edited by
475 views
3 votes
3 votes

Consider the following Assembly code fragment

ldr r0, adr_var1 
    @ load the memory address of var1 via 
    label adr_var1 into r0 
ldr r1, adr_var2 
    @ load the memory address of var2 via 
    label adr_var2 into r1 
ldr r2, [r0] 
    @ load the value at memory address 
    found in r0 to register r2 
str r2, [r1] 
    @ store the value found in r2 
    to the memory address found in r1


The total number of memory accesses (excluding register accesses) during the execution stage when the above sequence of instructions is executed is ________

edited by

1 Answer

Best answer
5 votes
5 votes
First two accesses are direct memory access and the last two are register indirect accesses. So, all of them will have one main memory access. Total number of memory access $ = 4.$
selected by
Answer:

Related questions