MIPS Logical Instructions
and $4, $5, $6 $4$5 (bit-wise AND) $6
andi $4, $5, 0x5f $4$5 (bit-wise AND) 5f16
or $4, $5, $6 $4$5 (bit-wise OR) $6
ori $4, $5, 0x5f $4$5 (bit-wise OR) 5f16
xor $4, $5, $6 $4$5 (bit-wise Exclusive-OR) $6
xori $4, $5, 0x5f $4$5 (bit-wise Exclusive-OR) 5f16
nor $4, $5, $6 $4$5 (bit-wise NOR) $6
not $4, $5 $4NOT $5 #inverts all the bits

1. If $5 contains 0xA5D and $6 contained 0x63C, what hexadecimal value would be in $4 after each of the following?

a) and $4, $5, $6

b) andi $4, $5, 0xBF

c) or $4, $5, $6

d) ori $4, $5, 0xBF

e) xor $4, $5, $6

f) xori $4, $5, 0xBF

g) nor $4, $5, $6

h) not $4, $5

MIPS Shift and Rotate Instructions
sll $4, $5, 3 $4shift left $5 by 3 positions. Shift in zeros (only least significant 5-bits of immediate value are used to shift)
sllv $4, $5, $6 Similar to sll, but least significant 5-bits of $6 determine the amount to shift.
srl $4, $5, 3 $4 shift right $5 by 3 positions. Shift in zeros
srlv $4, $5, $6 Similar to srl, but least significant 5-bits of $6 determine the amount to shift.
sra $4, $5, 3 $4shift right $5 by 3 positions. Sign-extend (shift in sign bit)
srav $4, $5, $6 Similar to sra, but least significant 5-bits of $6 determine the amount to shift.
rol $4, $5, 3 $4rotate left $5 by 3 positions
rol $4, $5, $6 Similar to above, but least significant 5-bits of $6 determine the amount to rotate.
ror $4, $5, 3 $4rotate right $5 by 3 positions
ror $4, $5, $6 Similar to above, but least significant 5-bits of $6 determine the amount to rotate.

2. If $5 contains 0xAF000A5D and $6 contained 0x6, what hexadecimal value would be in $4 after each of the following?

a) sll $4, $5, 3

b) sllv $4, $5, $6

c) srl $4, $5, 3

d) srlv $4, $5, $6

e) sra $4, $5, 3

f) srav $4, $5, $6

g) rol $4, $5, 3

h) rol $4, $5, $6

i) ror $4, $5, 3

j) ror $4, $5, $6