作者bigrat2 (MrEric)
看板Grad-ProbAsk
標題[理工] [計組] pipeline hazard 成大
時間Mon Jan 25 14:13:53 2010
consider a pipelined processor that executes the MIPS code shown in figure
1 using the logic of hazard detection and data forwarding unit shown in
figure 2. if the MIPS code cannot be excuted correctly,then how do we revise
the logic shown in Figure 2 such that the code can be correctly executed?
add $1 ,$1 ,$2
add $1 ,$1 ,$3
add $1 ,$1 ,$4
if (MEM/WB.RegWrite
and (MEM/WB.RegisterRD =! 0)
and (MEM/WB.RegisterRD =ID/EX.RegisterRS)
then
Forward A=01
if (MEM/WB.RegWrite
and (MEM/WB.RegisterRD =! 0)
and (MEM/WB.RegisterRD =ID/EX.RegisterRt)
then
Forward B=01
我買的兩本書上分別有此題但是答案不一樣想請教個位高手
哪個答案是正確的呢?另外可以請問一下答案一的 (EX/MEM.Register!=ID/EX.Register
RS為甚麼要這樣寫嘛?謝謝大家 :)
答案1.
if (MEM/WB.RegWrite
and (MEM/WB.RegisterRD =! 0)
and (EX/MEM.RegisterRD =! ID/EX.Register RS)
and (MEM/WB.RegisterRD =ID/EX.RegisterRS)
then Forward A=01
if (MEM/WB.RegWrite
and (MEM/WB.RegisterRD =! 0)
and (EX/MEM.RegisterRD =! ID/EX.Register Rt)
and (MEM/WB.RegisterRD =ID/EX.RegisterRt)
then Forward B=01
答案2.
if (EX/MEM.RegWrite
and (EX/MEM.RegisterRD!= 0)and
(EX/MEM.RegsiterRD= ID/Ex.Register RS))
then Forward A =01
if (EX/MEM.RegWrite
and (EX/MEM.RegisterRD!= 0)and
(EX/MEM.RegsiterRD= ID/Ex.Register Rt))
then Forward B =01
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.46.138.104
推 sean456:我認為是答案一 01/25 15:06
→ sean456:而且答案二跟題目還不是一樣= = 01/25 15:07
→ sean456:看錯了 01/25 15:21
推 sean456:不過張凡是答案一 01/25 15:23
推 keithkeith20:高民是答案一 01/25 15:36
※ 編輯: bigrat2 來自: 114.46.138.104 (01/25 15:39)
→ bigrat2:是的答案一是高明的解答 :) 01/25 15:40
→ bigrat2:不過對於答案一的步驟我有點疑問 麻煩請個位高手指教謝謝 01/25 15:54