经典的5阶段管道中的分支摊位

时间:2016-10-08 21:21:50

标签: mips cpu-architecture pipelining

我很感激,如果有人能回答我关于锻炼的问题(不是做作业,为自己做的话):

draw a pipeline cycle timing diagram for the above code. Start with the first lw before the loop, run one loop iteration, and stop at the first store of the second iteration.

好吧,我省略了“上面的代码”,你可以在表格中看到它。 “S”代表失速。下表应该是正确的答案。

问题:为什么分支的第9周期会有停顿?它只是解码阶段。据我了解,它还不需要操作数值。

如果有人可以评论,我会很感激...

instruction    1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
--------------------------------------------------------------------------------
lw r3, 0(r2)   f | d | x | m | w |   |   |   |   |    |    |    |    |    |    |
sw r3, 0(r2)     | f | d | x | m | w |   |   |   |    |    |    |    |    |    |
sub r1, r3, r4   |   | f | d | x | m | w |   |   |    |    |    |    |    |    |
lw r3, 0(r1)     |   |   | f | d | x | m | w |   |    |    |    |    |    |    |
sw r1, 0(r3)     |   |   |   | f | d | s | x | m | w  |    |    |    |    |    |
subi r2, r2, 4   |   |   |   |   | f | s | d | x | m  | w  |    |    |    |    |
bnez r2, loop    |   |   |   |   |   |   | f | s | d  | x  | m  | w  |    |    |
lw r3, 0(r2)     |   |   |   |   |   |   |   |   | f  | d  | x  | m  | w  |    |
sw r3, 0(r2)     |   |   |   |   |   |   |   |   |    | f  | d  | x  | m  | w  |

1 个答案:

答案 0 :(得分:0)

维基百科说classic 5-stage pipeline supposes that branches are resolved in decode stage,如果他们没有分支预测或推测执行。