[理工] [計組] pipeline hazard 成大
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
推
01/25 15:06, , 1F
01/25 15:06, 1F
→
01/25 15:07, , 2F
01/25 15:07, 2F
→
01/25 15:21, , 3F
01/25 15:21, 3F
推
01/25 15:23, , 4F
01/25 15:23, 4F
推
01/25 15:36, , 5F
01/25 15:36, 5F
※ 編輯: bigrat2 來自: 114.46.138.104 (01/25 15:39)
→
01/25 15:40, , 6F
01/25 15:40, 6F
→
01/25 15:54, , 7F
01/25 15:54, 7F