作者TNC (code)
看板Grad-ProbAsk
標題Re: [理工] [計組]90成大電機算CPI
時間Tue Nov 15 19:43:55 2011
第一個算式
perfect CPI = 2
加上 load指令有一半會發生load-use data hazards
所以要多stall 1個cycle
第二個算式
load指令有一半會遇到hazards所以這些指令需要3個cycle
加上其他的指令(1-0.2*0.5)=0.9需要2cycle
個人認為第一個算法比較容易理解
題目中的"half of the time"當然就是指load有一半會發生hazard囉!
※ 引述《Croast (夢奇奇)》之銘言:
: 題目如下:
: Suppose that 20% of the instruction are loads,
: and half of the time the instruction following a load instruction depends on
: the result of the load, If this hazard creates a single-cycle delay
: CPI without stall是2
: 其中CPI with stall=2 + 20%*50%*1 = 2.1
: 不過我在另一個地方看到的算式
: CPI with stall=0.2*0.5*3 + 0.9*2 = 2.1
: 想請教一下這兩種算法該怎麼分別去解釋?
: 以及題目中的"half of the time"是指所有load指令有一半會發生危障嗎?
: 還是另有所指呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.77.45.92
※ 編輯: TNC 來自: 203.77.45.92 (11/15 19:46)
推 Croast:所以第二種方式是有點類似加權的概念 11/16 10:53
→ TNC:其實是一樣的耶!第一種是perfect CPI加上額外的overhead 11/16 13:37
→ TNC:第二種如你說的類似加權平均 11/16 13:38