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

Registers $s0 and $s1 hold the values as shown in the table below. You will be a

ID: 2268110 • Letter: R

Question

Registers $s0 and $s1 hold the values as shown in the table below. You will be asked to consider execution of MIPS assembly language instruction(s) which will use these two registers and analyze the result. Note that there are two cases as part a and part b in the below table. 3) a. SO = 0x80000000, $s1 = 0xD0000000 b. Ss0 0x00000001, Ss1 0xFFFFFFFF For the contents of registers $s0 and $s1 as specified above, what is the value of StO following the execution of instruction below? Is the result in tO correct, or has there been overflow? Explain. a. add Sto, $s0, $s1 For the contents of registers $s0 and $s1 as specified above, what is the value of $tO following the execution of the assembly instruction below? Is the result in StO correct, or has there beern overflow? Explain. b. sub $t0, $s0, $s1 For the contents of registers $s0 and $s1 as specified above, what is the value of $to following the execution of the assembly code with two back-to-back instructions below? Is the result in tO correct, or has there been overflow? Explain c. add tO, $s0, $s1 add Sto, Sto, $s0

Explanation / Answer

a)

a)- 0x80000000+0xD0000000 = 150000000(hex)

which can be written as 0001 0101 0000 0000 0000 0000 0000 0000 0000(binary)

Which results in more than 32 bits, and hence it results in overflow.

b- 0x00000001 + 0xFFFFFFFF = 100000000(hex)

and can be written as 000100000000000000000000000000000000(twos compliment)

Here, Overflow again occurs in this problem, and $t0 holds the wrong result.

b)
a- 0x80000000 - 0xD0000000 = -50000000(hex)

which can be written as 1101 0000 0000 0000 0000 0000 0000 0000(twos compliment).

Here, no overflow occurs, and $t0 is the right answer

b- 0x00000001 - 0xFFFFFFFF = FFFFFFFE(hex)

11111111111111111111111111111110 (twos compliment)

In this problem also, no overflow occurs, and $t0 contains the right answer.

c)

a - t0 =(s0*2) + s1 <--- both operations occur in one C statement

(80000000*2) + D0000000 = 1d0000000(hex)

000111010000000000000000000000000000(twos compliment)

Here, overflow occurs

b -  t0 =(s0*2) + s1 <--- both operations occur in one C statement

00000002 + FFFFFFFF = 100000001(hex)

000100000000000000000000000000000001(twos compliment)

Here, overflow occurs