Can you check whether what i did is correct or not. Table 1 shows the content inside computer memory addresses. The code listed in Table 2 is designed to sum the numbers stored in 10 locations beginning with x3100, leaving the result in R1. The initial value of R1 is 0, R2 is x3100 and R4 is 10. Your task is to trace the content of R1, R2, and R4. Table 3 is given as a guide on how to write the contents of the registers. Draw the table in your answer booklet. Table 3 PC R1 R2 R4 x3000 0 x3100 10 x3001 0 x3100 0 x3002 0 x3100 10 x3003 0 x3100 10 x3004 0 x3100 10 x3005 0 x3101 10 x3006 x3107 x3101 10 x3007 x3107 x3101 9 x3008 x3107 x3101 9 x3009 x3107 x3101 9 [3000] 0101001001100000 - AND R1 R1 #10 [3001] 0101100100100000 - AND R4 R4 #0 [3002] 0001100100101010 - ADD R4 R4 #10 [3003] 1110010011111100 - LEA R2 x3100 [3004] 0110011010000000 - LOOP LDR R3 R2 #0 [3005] 0001010010100001 - ADD R2 R2 #1 [3006] 0001001001000011 - ADD R1 R1 R3 [3007] 0001100100111111 - ADD R4 R4 #-1 [3008] 0000001111111011 - BRP LOOP [3009] 1111000000100101 - TRAP x25
Can you check whether what i did is correct or not.
Table 1 shows the content inside computer memory addresses. The code listed in Table 2 is designed to sum the numbers stored in 10 locations beginning with x3100, leaving the result in R1. The initial value of R1 is 0, R2 is x3100 and R4 is 10.
Your task is to trace the content of R1, R2, and R4. Table 3 is given as a guide on how to write the contents of the registers. Draw the table in your answer booklet.
Table 3
PC |
R1 |
R2 |
R4 |
x3000 |
0 |
x3100 |
10 |
x3001 |
0 |
x3100 |
0 |
x3002 |
0 |
x3100 |
10 |
x3003 |
0 |
x3100 |
10 |
x3004 |
0 |
x3100 |
10 |
x3005 |
0 |
x3101 |
10 |
x3006 |
x3107 |
x3101 |
10 |
x3007 |
x3107 |
x3101 |
9 |
x3008 |
x3107 |
x3101 |
9 |
x3009 |
x3107 |
x3101 |
9 |
[3000] 0101001001100000 - AND R1 R1 #10
[3001] 0101100100100000 - AND R4 R4 #0
[3002] 0001100100101010 - ADD R4 R4 #10
[3003] 1110010011111100 - LEA R2 x3100
[3004] 0110011010000000 - LOOP LDR R3 R2 #0
[3005] 0001010010100001 - ADD R2 R2 #1
[3006] 0001001001000011 - ADD R1 R1 R3
[3007] 0001100100111111 - ADD R4 R4 #-1
[3008] 0000001111111011 - BRP LOOP
[3009] 1111000000100101 - TRAP x25
Step by step
Solved in 3 steps with 2 images