之前回的是错的... 抱歉.
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
1F:推 gmotwm2001:谢谢你:) 05/25 15:55
2F:→ ksmrt0123:啊~~~ 讲错了... 待会更正 05/25 16:45
※ 编辑: ksmrt0123 来自: 219.68.71.218 (05/25 17:21)