看板 Grad-ProbAsk 關於我們 聯絡資訊
想請問兩題張凡上冊p.465和p.466的練習 1. http://imgur.com/5Dm99Mg http://imgur.com/V0efkYz 看不太懂題目的意思 是在描述EX/MEM hazard嗎? 那EX to 1st ande 2nd又是什麼意思呢? 2. lw $1, 40($6) add $6, $2, $2 sw $6, 50($1) Add nop instructions to this code to eliminate hazards if there is ALU-ALU forwarding only (no forwarding from the MEM to the EX stage) ? 我的想法是在使用full forwarding時本來就只有用ALU-ALU forwarding不是嗎? 但答案是 lw $1, 40($6) nop add $6, $2, $2 sw $6, 50($1) 請問是為什麼呢? 想了很久不知道是不是哪邊有理解錯誤的地方 謝謝各位 ~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.37.231.12 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1446288872.A.873.html ※ 編輯: tata0715 (114.37.231.12), 10/31/2015 18:55:14
tedchang102: 指令2跟指令1有Raw,指令2 3跟指令1有Raw 10/31 20:40
tedchang102: Lw在mem還沒寫回所以sw拿不到最新資料定址 要暫停 10/31 20:42
tata0715: 喔喔原來如此 那再請問這樣nop改放在第三行也可以嗎?因 10/31 21:37
tata0715: 為指令1.2是WAR,會有要解決dependency的問題嗎? 10/31 21:38
goldflower: 因為是full forwarding 我想可以 10/31 22:19
jerry031181: 2 只能放在第二行 放第三行還是會有mem級hazard 11/01 07:50
jerry031181: Mem to 1st 是load-used ;EXE to 1st 2nd 分別是 11/01 08:02
jerry031181: EXE級和MEM級 所以除了MEM級以外stall2 cycle都可解 11/01 08:03
jerry031181: 所以(1)CPI=1+(0.1+0.1+0.25)*2+0.05*1=1.95 11/01 08:06
jerry031181: Both的看成to1st就可以了 http://imgur.com/AbzjB7t 11/01 08:09
jerry031181: (2)的話因為只有load use要stall 1cycle所以是1.25 11/01 08:12
jerry031181: 2. 1.3有raw(Mem 級)2.3有(EXE)級 所以你插再2.3間 11/01 08:15
jerry031181: 會讓2.3產生(MEM級)可是他只提供EXE forward 不可用 11/01 08:16
tedchang102: 若放在第三行,由於沒有men/wb的forwarding 就變成ad 11/01 08:26
tedchang102: d和sw有hazard了 11/01 08:26
goldflower: 阿靠腰…以為2也是full forwarding… 11/01 08:55
tata0715: 我了解了~~感謝各位!! 11/01 14:04