CS473 - HW3 - MIPS and Pipelining

Due Monday, February 17, 2003

MIPS Instruction Coding/Decoding

  1. (25 points)

    For each of the following MIPS instructions, assemble the instruction into appropriate MIPS machine code. For the instructions which are actually pseudo-instructions, first translate into an instruction or a sequence of instructions which will accomplish the result, and then assemble the resulting instruction sequence. Your final answer should be in the form of one or more eight-digit hexadecimal numbers.

    1. add $s0, $t8, $a1
    2. ori $v0, $s1, 0x1234
    3. beq $s3, $a2, 0x400 the intent here is that the offset be 40016 bytes from the instruction following the beq
    4. not $t6, $t7
    5. bge $a3, $s6, 0x800 the intent here is that the offset be 80016 bytes from the instruction following the bge
    6. abs $t1, $t2
  2. (15 points)

    For each of the following MIPS machine code instructions, disassemble the code back to MIPS assembly code. Use the register use conventions on Page A-23 to translate register numbers (so use register $at, not register $1).

    1. 00221820
    2. 304398c3
    3. 11271234
  3. (15 points) It turns out that the following instruction cannot be implemented in the MIPS pipeline as presented on Page 470: ori. Why not? Add a multiplexor to the data paths, and a signal to control it from the control unit, which will make it possible.
  4. (35 points) Consider the following sequence of MIPS instructions:

    
    lw  $1, 100($4)
    add $5, $6, $7
    or  $8, $9, $1
    sw  $8, 200($12)
    or  $0, $0, $0
    or  $0, $0, $0
    or  $0, $0, $0
    or  $0, $0, $0
    or  $0, $0, $0
    
    

    Using Figure 6.41 as a guide, show the contents of every control and data line in the CPU on every cycle of the execution of this code, starting with an empty pipeline and continuing until the pipeline is full of or instructions. Xeroxing the figure from page 523 and marking it up, or downloading the figure from the text website and marking it up, would be a really good idea. Assume initial register and memory contents as in Problem 6.10.


Last modified: Mon Feb 17 09:27:36 MST 2003