Hello I am having trouble with the following problems in my
Hello, I am having trouble with the following problems in my MIPS class, can you help?
Start with the registers $t1 = 0 times 12345678 $t2 = 0 times 91abcdef $t3 = 0x000051 of $t4 = 0 times 0000bcd Show the contents of $t5 or Io and hi after each statement is executed. a. sra $t5, $t2, 5 b. sll $t5, $t1, 7 c. srl $t5, $t2, 4 d. sra $t5, $t1, 2Solution
Answer
a.
$t2 = 0x91abcdef = (10010001101010111100110111101111)2
Shift right 5 steps and store it in $t5, preserve the sign bit
so,
$t5 = (10000100100011010101111001101111)2 = 0x848D5E6F
b.
$t1 = 0x12345678 = (10010001101000101011001111000)2
Shift left 7 steps and store it in $5
so,
$t5 = (11010001010110011110000000000)2 = 0x1A2B3C00
c.
$t2 = 0x91abcdef = (10010001101010111100110111101111)2
Shift right 5 steps and store it in $t5
so,
$t5 = (00000100100011010101111001101111)2 = 0x48D5E6F
d.
$t1 = 0x12345678 = (10010001101000101011001111000)2
Shift right 2 steps and store it in $5 and preserve the sign bit
so,
$t5 = (10100100011010001010110011110)2 = 0x148D159E
