Section quiz of 3/6/03
cmd 1: LW $t0, 0($s0)
cmd 2: LW $t1, 4($s0)
cmd 3: ADD $t2, $t0, $t1
cmd 4: SW $t2, 8($s0)
cmd 5: SUB $t3, $t5, $t6
cmd 6: OR $t2, $t2, $t3
cmd 7: SW $t2, 12($s0)
Using the MIPs pipelined implementation detail, at each cycle,
the status of each command in the pipeline.
If forwarding is needed, indicate where the value is being
forwarded from.
What is the CPI for this set of instructions?
Cycle 1:
Fetch cmd 1
Cycle 2:
Fetch cmd 2
Decode cmd 1
Cycle 3:
Fetch cmd 3
Decode cmd 2
Calc addr cmd 1
Cycle 4:
Fetch cmd 4
Decode cmd 3
Calc addr cmd 2
Mem access cmd 1
Cycle 5: ($t1 value is not yet available for cmd 3 - no way to forward)
Stall
Stall
Bubble
Mem access cmd 2
WB cmd 1
Cycle 6: ($t2 value is forwarded to ALU from MEM/WB reg)
Fetch cmd 5
Decode cmd 4
Calc cmd 3
Bubble
WB cmd 2
Cycle 7:
Fetch cmd 6
Decode cmd 5
Calc addr cmd 4
Do nothing - cmd 3
Bubble
Cycle 8: ($t2 Value stored by cmd 4 forwarded from MEM/WB reg)
Fetch cmd 7
Decode cmd 6
Calc cmd 5
Mem access cmd 4
WB cmd 3
Cycle 9: ($t3 Value is forwarded to ALU from EX/MEM reg)
Decode cmd 7
Calc cmd 6
Do nothing - cmd 5
Do nothing - cmd 4
Cycle 10:
Calc addr - cmd 7
Do nothing - cmd 6
WB cmd 5
Cycle 11: ($t2 value is forwarded from MEM/WB reg)
Mem access cmd 7
WB cmd 6
Cycle 12:
Do nothing - cmd 7
CPI = 12 / 7