The MIPS R4000 had an eight-stage pipeline as shown here in abbreviated form:
This organization can be pipelined without structural hazards, as shown in this pipeline timing diagram:
Cycle -> Instruction 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0: add $1, $2, $3 IF IS RF EX DF DS TC WB 1: add $4, $5, $6 IF IS RF EX DF DS TC WB 2: add $7, $8, $9 IF IS RF EX DF DS TC WB 3: add $10,$11,$12 IF IS RF EX DF DS TC WB 4: add $13,$14,$15 IF IS RF EX DF DS TC WB 5: add $16,$17,$18 IF IS RF EX DF DS TC WB 6: add $19,$20,$21 IF IS RF EX DF DS TC WB 7: add $22,$23,$24 IF IS RF EX DF DS TC WB 8: add $25,$26,$27 IF IS RF EX DF DS TC WB
For each data hazard that can happen between R-type instructions with this MIPS R4000 organization:
Draw a version of the abbreviated datapath with all of the R-type instruction forwarding paths.
Consider this sequence of instructions, implementing y = |x|+1:
if (x<=0) x = -x; y = x + 1;
If x is in register $1 and y in register $2, this could correspond to the following assembly code:
bgtz $1, endif sub $1, $0, $1 endif: addi $2, $1, #1
Assume the branch target can only be resolved at the end of the EX stage, and the processor always predicts not taken (no delayed branch, branch target buffer, or other branch prediction).
Assume we have a multiply operation that takes five cycles in the execute stage.
Submit on paper or electronically (by pushing to your assn4 directory in your git repository) by the beginning of class on the due date. You do not need to submit the readme.txt for this assignment, even if you submit electronically.