[理工] [計組]-Pipeline

看板Grad-ProbAsk作者 (GraffitiK)時間16年前 (2010/03/05 14:26), 編輯推噓4(408)
留言12則, 3人參與, 最新討論串2/2 (看更多)
請問兩題: 1.(93台大電機) Identify all of the data dependencies in the following code. Show which dependencies are data hazards and how they can be resolved via forwarding? (1) add $2, $5, $4 (2) add $4, $2, $5 (3) sw $5, 110($2) (4) add $3, $2, $4 書上的解答是: (1)(2)之間$2會產生data hazard (1)(3)之間$2會產生data hazard (2)(4)之間$4會產生data hazard (1)(4)之間$2會產生data hazard 我想問的是,(1)(4)之間不是可以前半週期寫入、後半週期讀取,這樣還算有data hazard嗎? 2.(98成大資工) Consider a pipelined processor. Given a "single" MIPS code to illustrate RAW, WAR and WAW hazards. Note that the MIPS code can only consist of no more than four R-type instructions. 我不太懂要怎麼寫... MIPS不是只會出現RAW嗎? 那要怎麼用MIPS指令說明WAR和 WAW hazards? 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.121.155.245

03/05 14:28, , 1F
hazard本來三個都有,只是RAW比較常出現
03/05 14:28, 1F

03/05 14:28, , 2F
(1)(4)之間應該是dependance而已。
03/05 14:28, 2F

03/05 14:30, , 3F
成大那題的意思是,以RAW code描述其他種類的hazard。
03/05 14:30, 3F

03/05 14:30, , 4F
白話一點就是叫你用你線在學的add、sub那種去寫。
03/05 14:30, 4F

03/05 14:30, , 5F
add $s1,$s2,$s add $s2,$s1,$t1 add $s2,$t2,$t3
03/05 14:30, 5F

03/05 14:31, , 6F
add $s1,$s2,$s3
03/05 14:31, 6F

03/05 14:37, , 7F
我猜你想打得應該是(2)(4)~
03/05 14:37, 7F

03/05 14:59, , 8F
所以(1)(4)的$2只有dependence無data hazard, 那第二題
03/05 14:59, 8F

03/05 15:00, , 9F
是指使用add sub這種指令去寫, 但是假設不是使用MIPS的
03/05 15:00, 9F

03/05 15:01, , 10F
5 stage pipeline是嗎? 因為MIPS的5個stage應該是不可能
03/05 15:01, 10F

03/05 15:01, , 11F
有WAR和WAW吧
03/05 15:01, 11F

03/05 15:07, , 12F
MIPS code to illustrate 寫法為stevenwin那種~自己改
03/05 15:07, 12F
文章代碼(AID): #1BaAGT49 (Grad-ProbAsk)
文章代碼(AID): #1BaAGT49 (Grad-ProbAsk)