大家好
想请教一个问题
forwarding的侦测码中有分为Ex hazard跟mem hazard
(分别是看执行指令与下一、下下一指令有没有hazard)
EX Hazard
if (EX/MEM.RegWrite and (EX/MEM.RegisterRd ≠ 0) and (EX/MEM.RegisterRd ==
ID/EX.RegisterRs)) ForwardA = 10
if (EX/MEM.RegWrite and (EX/MEM.RegisterRd ≠ 0) and (EX/MEM.RegisterRd ==
ID/EX.RegisterRt)) ForwardB = 10
MEM Hazard
if (MEM/WB.RegWrite and (MEM/WB.RegisterRd ≠ 0) and (MEM/WB.RegisterRd ==
ID/EX.RegisterRs)) and not(Ex Hazard)ForwardA = 01
if (MEM/WB.RegWrite and (MEM/WB.RegisterRd ≠ 0) and (MEM/WB.RegisterRd ==
ID/EX.RegisterRt)) and not(Ex Hazard) ForwardB = 01