Assume the following register contents t0 0xAAAAAAAA t1 0x

Assume the following register contents:
$t0 = 0xAAAAAAAA, $t1 = 0x56781234
a) For the register values shown above, what is the value of $t2 for the following sequence of instructions?   (3 points)
sll $t2, $t0, 6
or $t2, $t2, $t1

b) For the register values shown above, what is the value of $t2 for the following sequence of instructions? (3 points)
sll $t2, $t0, 8
andi $t2, $t2, -1

c) For the register values shown above, what is the value of $t2 for the following sequence of instructions? (3 points)
srl $t2, $t0, 3
andi $t2, $t2, 0xFEFE

Solution

a. SLL $t2, $t0, 6; This is a Shift Left Logical instruction,
                   $t2 = $t0 << 6; will shift the value of $t0 by 6 bits.
                   Therefore, now $t2 = 1010 1010 1010 1010 1010 1010 1000 0000 = 0xAAAAAA80
OR $t2, $t2, $t1; This is a Bitwise OR instruction,
                    $t2 = $t2 | $t1; will perform an OR operation for $t2, and $t1, and stores the result in $t2.
                    Therefore, now $t2 = $t2 | $t1
                    1010 1010 1010 1010 1010 1010 1000 0000
                    0101 0110 0111 1000 0001 0010 0011 0100
                    1111 1110 1111 1010 1011 1010 1011 0100 = 0xFEFABAB4.
                   
b. SLL $t2, $t0, 8; This is Shift Left Logical instruction,
                   $t2 = $t0 << 8; will shift the value of $t0 by 8 bits.
                   Therefore, now $t2 = 1010 1010 1010 1010 1010 1010 0000 0000 = 0xAAAAAA00
ANDI $t2, $t2, -1; This is a Bitwise AND Immediate instruction. Note -1 decimal is 0xFFFFFFFF hexadecimal.
                   $t2 = $t1 & 0xFFFFFFFF; will perform an ANDI operation for $t2, and 0xFFFFFFFF, and stores the result in $t2.
                   Therefore, now $t2 = $t2 & 0xFFFFFFFF
                   1010 1010 1010 1010 1010 1010 0000 0000
                   1111 1111 1111 1111 1111 1111 1111 1111
                   1010 1010 1010 1010 1010 1010 0000 0000 = 0xAAAAAA00.
                  
c. SRL $t2, $t0, 3; This is a Shift Right Logical instruction,
                   $t2 = $t0 >> 3; will shift the value of $t0 by 3 bits.
                   Therefore, now $t2 = 0001 0101 0101 0101 0101 0101 0101 0101 = 0x15555555
   ANDI $t2, $t2, 0xFEFE; This is a Bitwise AND Immediate instruction.
                   $t2 = $t1 & 0xFEFE; will perform an ANDI operation for $t2, and 0xFEFE, and stores the result in $t2.
                   Therefore, now $t2 = $t2 & 0xFEFE
                   0001 0101 0101 0101 0101 0101 0101 0101
                   0000 0000 0000 0000 1111 1110 1111 1110
                   0000 0000 0000 0000 0101 0100 0101 0100 = 0x00005454.

Assume the following register contents: $t0 = 0xAAAAAAAA, $t1 = 0x56781234 a) For the register values shown above, what is the value of $t2 for the following se

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site