CSE 141 Homework # 4

Due June 5.

Please see class homepage concerning late assignments and academic dishonesty policies.

  1. Figure 6.24 on page 391 of the text shows a pipelined MIPS implementation. It has four tall skinny boxes, labelled IF/ID, ID/EX, EX/MEM and MEM/WB, representing the pipeline registers that separate the 5 pipeline stages. For each of the four pipeline registers, tell how many bits the register hold, and what those bits represent.

    Example (and the correct answer for the first pipeline register) - the IF/ID pipeline register has:
    32 bits for the incremented PC
    32 bits for the instruction
    64 bits total.

    For the remaining three pipeline registers, be sure to include the control signals (shown in red in the figure).

  2. Consider this MIPS code sequence:
          sll  $2, $2, 2      # multiply $2 by 4 
          sub  $5, $5, $5     # initialize Sum = 0
    loop: lw   $8, 1000($2)   # load A(i)
          add  $5, $5, $8     # add it to Sum
          addi $2, $2, -4     # decrement i	
          bne  $2, $0, loop   # are we done?
          sw   $5, 500($0)    # if so, store Sum