之前回的是錯的... 抱歉.
vvvvvvv read of M[-16($5)]
L1:lw $5,-16($5)
^^ ^^ read of $5
write of $5
vvvvvvv write of M[-16($5)]
L2:sw $5,-16($5)
^^ ^^ another read of $5
read of $5
L3:add $5,$5,$5
^^ ^^ ^^ one write and two reads of $5
$5 RAW from L1 to L2 and L3
$5 WAR from L1 and L2 to L3
$5 WAW from L1 to L3
WAR hazard from L1 to L2 是因memory M[-15($5)] 才發生的,
雖然 L1有對$5 寫入, L2的 read of $5 引用的是 L1 寫入的新值,
但L1 仍可能寫入一樣的值給 $5, 所以還是可能會有 hazard.
Data hazard 只是單純地分析 data dependancy,
未必會造成問題. 一般 pipelining processor
碰到 WAW/WAR hazards 並不會出錯, 所以並沒有特別處理.
superscalar 尤其是有 out-of-order issue, out-of-order execution的,
問題就比較大條了...
------------------------------------------------------------------------
以下是錯的
------------------------------------------------------------------------
作者: ksmrt0123 (ksmrt) 看板: Electronics
標題: Re: [問題] 計算機結構的問題
時間: Mon May 25 00:29:41 2009
※ 引述《gmotwm2001 (yabi)》之銘言:
: L1:lw $5,-16($5)
^^ read of $5
: L2:sw $5,-16($5)
^^ write of $5
: L3:add $5,$5,$5
^^ write of $5
: 答案:
: $5 RAW from L1 to L2 and L3
: $5 WAR from L1 and L2 to L3
: $5 WAW from L1 to L3
: 我不懂第二行 WAR 到底是只哪個地方的$5寫跟讀?
上面標出的那幾個.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.68.71.218
推 gmotwm2001:謝謝你:) 05/25 15:55
→ ksmrt0123:啊~~~ 講錯了... 待會更正 05/25 16:45
※ 編輯: ksmrt0123 來自: 219.68.71.218 (05/25 17:21)