CS 61C (Fall 2007)

Quiz 12

Three questions, submit as "quiz12".  Due 2:45pm before lecture 9/26/2007.


1.

Recall that unsigned shifts throw away the bits that are pushed off the edge. Consider the problem of "wrapping" or rotating those unsigned bits around so that they appear at the other end. If you rotated an unsigned number by 32 in either direction, you'd get the same number back.

Give a sequence of one or more MIPS instructions which implement an unsigned wrap of $s0 to the right by 8 bits. You may use $t0 as a temporary register if you like.
   Example:

   Before: $s0: 0001 0010 0011 0100 0101 0110 0111 1000
   After : $s0: 0111 1000 0001 0010 0011 0100 0101 0110 
                ^^^^^^^^^
                wrapped around from low bits

2.

List the abbreviated names of the 5 MIPS instruction formats on your green card.  Very briefly explain what kinds of instructions each is used for.

3.

What's the largest immediate value that the addi instruction can add to a register?   Why?