Question

(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022...

(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):

  1. (i) 1022

  2. (ii) 101

  3. (iii) 5

  4. (iv) 10220000

  5. (v) Other (provide your own answer): _________________

b) The following value is stored in memory (circle one):

  1. (i) 0x17

  2. (ii) 0

  3. (iii) 1023

  4. (iv) 67043320

  5. (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)

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions