2012-09-13 36 views
1

假设的指令的时间,如果M5是五级流水线执行尝试计算执行五级流水线处理器

我知道五级流水线有以下步骤:

IF -- instruction fetch (and PC update) 
    ID -- instruction decode (and get operands from registers) 
    EX -- ALU operation (can be effective address calculation) 
    MA -- memory access 
    WB -- write back (results written to register(s)) 

如果假设有100个MIPS具有以下 指令混合指令:

Loads 23%, Stores 12%, Conditional Branches 12%, Jumps 
8% and R-type instructions 45%. 

The CPU clock frequency is 1.2 GHz 

我试图计算时间来执行100条指令。我明白了如何使用这个公式来计算一个非管道时

ExTime = Instruction count * CPI * Clock period in seconds 

我的频率转换成使用1/f = 8.33 * 10^-10 seconds 期间,但我不能确定的方式来计算的执行时间这条管道,而且我需要了解管道实施的周期?

请帮我,因为我不能在网上找到一个体面的例子。 感谢

编辑

我想我已经找到了答案!

我发现了一些信息

INSTRUCTION LATENCY = 5 time units THEREFORE 
INSTRUCTION THROUGHPUT = 5 * (1/5) = 1 instruction per time unit 
So in this case it would be: 
ExTime in seconds = Number of instructions * clock cycle period in seconds 
+0

我不明白为什么我应该得到一个-1?谨慎解释? –

+0

您还需要考虑到管道刷新树枝上和跳跃。 – markgz

+0

那么你会如何去计算它呢? –

回答

0

忽略上分支采取刷新时间/跳转:

通过在给定的指令组合的指令所花费的循环的平均无=

( 0.23)* 5 +(0.12)* 4 +(0.12)* 4 +(0.08)* 4 +(0.45)* 4 = 4.23个时钟周期

(Load需要5个周期,Store:4,R:跳转/分支:4)

现在,

没有通过1个指令在平均= 4.23

=>没有由100指示在平均= 423

时钟频率花费的循环的= 1.2GHz的

花费的循环的

=>时间取1个循环= 8.33 * 10^-10

采取423个周期=>时间= 3.5236 * 10^-7 =答