→ SiriusCloud:我想請問c大的推文 等號左邊怎會有兩個reg@@? 11/13 19:37
※ 引述《SiriusCloud (古月小楓)》之銘言:
: Given 4 instructions , how many unique comparions
: (between register source and destinations) are
: necessary to find all of the RAW,WAR,WAW data dependences,
: Answer for the case of 4 instructions , and then
: derive a general equations for N instructions .
: Assume that all instructions have one register
: destination and two register source.
: (answer)
: For four instructions , the number of unique comparions:
: (2(3) + 2(2) + 2(1)) + (2(3) + 2(2) + 2(1)) + (3 + 2 + 1 ) = 30
: ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
: ↑RAW ↑WAR ↑WAW
: n-1
: The general equation for N instructions = 5 * Σ i = (5*(n -1)*n) / 2
: i=1
: 想請問的是4道指令答案是怎麼推導的呢?
: 還有一般式如何推導出來?
RAW, WAR, WAW就是比較的次數(暴力法)
這部分C大在你原來的PO文已經回答了
一般式這樣導
( 2*3 + 2*2 + 2*1 ) + ( 2*3 + 2*2 + 2*1 ) + (3 + 2 + 1)
= 2(3+2+1) + 2(3+2+1) + 1(3+2+1)
= 5(3+2+1) //這邊n=4
導出
n-1
5( Σ i)
i=1
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.110.186