(MIPS Assembly Language):
Assume the following piece of MIPS code:
label1:
.text 0x4000fc lui $t0, 1022 ori $t0, $t0, 2048 srl $t1, $t0, 18 sw $t0, 101($t1) slti $t2, $t1, 5 beq $t2, $0, label3
label2:...
...
label3:...
a) The code modifies a word in memory at the following address
(circle one):
(i) 1022
(ii) 101
(iii) 5
(iv) 10220000
(v) Other (provide your own answer): _________________
b) The following value is stored in memory (circle one):
(i) 0x17
(ii) 0
(iii) 1023
(iv) 67043320
(v) Other (provide your own answer): ___________________
c) After the branch instruction is executed, the program will continue at (circle one):
(i)label1 (ii) label2 (iii) label3 (iv) The program does not continue
d) Show the sequence of addresses issued by the CPU to execute the code (the first five instructions only):
Address |
R/W |
Data Bus |
Comments(optical) |
lui $t0, 1022
$t0 = 0000 0000 0000 0000 0000 0011 1111 1110
ori $t0, $t0, 2048
$t0 = 0000 0000 0000 0000 0000 1011 1111 1110 (2048 + 1022 =
3070)
srl $t1, $t0, 18
$t1 = 0000 0000 0000 0000 0000 0000 0000 0000
sw $t0, 101($t1)
Mem[$t1 + 101] = $t0
a) The code modifies a word in memory at address = 101
b) value is stored in memory = 3070
c) As $t1=0 and ($t1 < 5) $t2=1
After the branch instruction is executed, the program will continue
at label2
(d)the sequence of addresses issued by the CPU to execute the
code
0x4000fc
0x400100
0x400104
0x400108
0x40010c
Get Answers For Free
Most questions answered within 1 hours.