Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $v1 $v2 1 4 4 2 3 2 3 6 5 4 b. $s0 $s1 $s2 $s

ID: 3709363 • Letter: A

Question

a. $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $v1 $v2 1 4 4 2 3 2 3 6 5 4 b. $s0 $s1 $s2 $s3 $s4 $s5 $s6 $s7 $v1 $v2 1 4 3 3 2 2 3 8 5 4 3. Consider the memory location 0x10000000 has the value 00000014. $a3 holds the address 0x10000000 and $t1 holds the value 5. Consider the following MIPS code sequence with a 5-stage pipeline without data forwarding: addi $t1, $t1, 2 lw $t1, 0($a3) addi $t2, $t1, 5 addi $t1, $t1, 12 What are the contents of the registers $t1, $t2 and $a3 after the code sequence above is executed?

Explanation / Answer

Solution:

$t1 = 5

$a3 at memory location whcih stores 00000014 in hexadecimal for which decimal equivalent is 00000020 in decimal.

So for given instructions :

a) addi $t1, $t1, 2

The instruction immediately add the 2 with contents of $t1 and store thee result back to $t1.

So $t1 = $t1 + 2

$t1 = 5 + 2 = 7

So upto know $t1 contains 7.

b) lw $t1,0($a3)

it loads the contents of 0 + $a3 to regiter $t1.

We have data 20 in $a3.

So after adding 0+20 = 20 i.e. store in $t1.

So upto know $t1 contains 20

c) addi $t2, $t1, 5

it add the contents of $t1 with 5 and store the result to register $t2.

$t2 = $t1 + 5

$t2 = 20 + 5 = 25

So upto know

$t1 contains 20

$t2 contains 25

d) addi $t1, $t1, 12

It add the contents of $t1 with 12 and store them back to $t1.

So

$t1 = $t1 + 12

$t1 = 20 + 12 = 32

So $t1 contains 32.

So the final contents are :

$t1 = 32

$t2 = 25

$a3 = 20

All the data are in decimal.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote