交大101年計組第二題http://www.lib.nctu.edu.tw/attach/download/id-1369/
第二小題: branch decide 在ID stage的情況,然後bne不管怎樣都猜跳
所以會flush後面一個指令
因為ID stage 不支援forwarding,所以遇到data hazard要stall兩個
然後張凡的這題解答 stall cycle:4,7,8,13(他這題後來更正是13)
然後這是我的看法:
V代表該clock有stall
V V V V V
lw t0 s1 s2 IF ID EX ME WB
add s0 t0 t1 IF ID ID EX ME WB
lw s1 0(t0) IF IF ID EX ME WB
bne s0 s1 10 IF ID ID ID EX ME WB (不能forwarding,所以ID要等到WB)
add s2 s0 s1 IF IF IF ID ....(這個FLUSH)
add s3 s1 s0 IF ID EX ME WB
bne s3 s3 10 IF ID ID ID EX ME WB
add s3 s2 s3 (FKUSH)
這樣不是12,13都有STALL了!?
請板上高手解答一下T_T
謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.66.184