4. Using a shift operation, write MIPS code that multiplies the number in $t0 by 16.
ANS: # do a multiply by 16 with shift
li $t0, 16
sll $t0, $t0, 4
# result is 256 (16 * 16)
5. Using a shift operation, write the MIPS code that divides the number in $t0 by 8.
ANS: # do a divide by 8 with shift
li $t0, 256
srl $t0, $t0, 3
# result is 256 / 8 = 32
6. Using only ori and sll instructions, put the constant Ox3FF01 into $t0.
ANS:
Do this by putting Ox3FF0 into $t0, then shift value by 4, then ORI with Ox01. Ox01 comes right after the 3FF0.
li $t0, 0x3FF0
sll $t0, $t0, 4
ori $t0, $t0, 0x01