Assume the following register and memory contents in an ARM computer. Registers
ID: 3742119 • Letter: A
Question
Assume the following register and memory contents in an ARM computer. Registers R1, R2, R3, R6, and R7 contain the values 1000, 2000, 1016, 20, and 30, respectively. The numbers 2, 4, 6, 8, 10 and 12 are stored in successive word locations starting at memory address 1000. The numbers 20, 40, 60, 80, 100 and 120 are stored in successive word locations starting at memory address 2000. What is the effect of executing each of the following two instruction blocks, starting each time with the given initial values? (a) LDR R8, [R1] LDR R9, [R1, #4] ADD R10, R8, R9 (b) STR R6, [R2, #4]! STR R7, [R2, #4]! LDR R8, [R2], #4 LDR R9, [R2], #4 SUB R10, R8, R9
Explanation / Answer
a) LDR R8,[R0]
R0= 1000
R8<--- [1000]
R8=1
(B) STR R6,[R1,#-4]
R6=20
20 -----> [R1,#-4]
------> [2000,#-4]
-------> [2000-4]
20 ------> [1996] 20 WILL BE STORED AT ADDRESS1996
(C)
LDMIA R2!,{R4,R5}
-----LOAD DATA STARTING FROM R2 LOCATION INTO R4 & R5
-----CONTENT OF R2=CONTENT OF 2016,THAT IS 17
-----SO 17 WILL BE LOADED TO R4 AND NEXT 18 WILL BE LOADED TO R5
LDR R9,[R0,#4]
--- WILL LOAD R9 WITH DATA AT[R0,#4]
---- R9<----[1000 +4]
----- R9=5
STR R7,[R1,#-4]
-----STORE DATA AT R7 INTO [R1,#-4]
------STORE 30 INTO [2000-4]
------STORE 30 INTO [1996]
-----CONTENT OF 1996=30
ADD R4,R4,R5
---- R4=R4+R5
-----R4=17+18
-----R4=35
ADD R10,R8,R9
-----R10=R8+R9
-----R10=5+1
-----R10=5
LDR R8,[R1],#4
----LOAD R8 INTO ADDRESS AT R1
----LOAD 1 AT [1000]
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.