Problem 2)
It was not clear from the problem whether you could forward out from between the split stages (E1/E2 and M1/M2), if that stage is not doing anytnig useful. For example, if the instruction is an ADD, then you can get to the result of the ALU in between the M1/M2 stages. However, this was not clear in the problem statement. As long as you showed that there was a forwarding path needed, and maybe said that a bubble was needed, then no points were deducted.
Forwarding paths are shown by the arrows below:
IMPORTANT: if you lost points for forwarding after the WB stage, that was an error on my part. Please see me if I deducted points (it should be 2 points). There were only about 5 or 6 of you, I think…
Thank you for your understanding,
Sayf
b) 4 points, ½ a point for each pair of instructions.
Instruction Sequence |
Total Number of Bubbles |
ADD $2, $3, $4 SUB $7, $2, $3 |
1 |
LW $5, 24($6) ADD $9, $8, $5 SUB $6, $9, $5 |
4= 3 from LW->Add + 1 from ADD->SUB |
LW $5, 12($13) LW $5, 16($8) |
0 They both go to same reg, no conflict |
LW $4, 32($3) LW $5, 32($4) LW $6, 32($5) |
6 = 3 from LW->LW + 3 from LW->LW |
ADD $7, $4, $2 LW $4, 0($7) |
1 |
SW $7, 0($12) XOR $2, $7, $4 |
0 |
This was a confusing part. All that was being tested was whether you understood forwarding and where it came from. And, whether you could generate this type of code for testing purposes, etc.
As far as grading, there was no requirement of efficiency, optimality, etc. You could write as many lines of code as you wanted (within reason). As long as your code exercised every forwarding case, you got the 3 points. The 3 cases were:
E2 -> E1
M1 -> E1
M2 -> E1
Or, you can view it as forwarding from the 2nd cycle after the instruction back, or after 3rd, or after the 4th.
A compact piece of code would have looked like:
ADD $3, $4, $5
ADD $0, $0, $0 //NOP
SUB $7, $3, $3 // 2nd cycle, E2 -> E1
SUB $8, $3, $3 // 3rd cycle, M1 -> E1
SUB $9, $3, $3 // 4th cycle, M2 -> E1
However, there were MANY correct answers.