这应该是一个简单的问题。
假设我们有一个 CPI 为 1.5 的 3.0 GHz 处理器,它每秒执行多少条指令?从逻辑上思考,这将是每秒的周期数乘以每个周期的指令数......这是......
3×10 9周期/秒 × 1.5 条指令/周期 = 4.5×10 9指令/秒
说得通。好的,这是我书中的一个问题,我查找解决方案只是为了确保我理解并正确理解。那么解决方案说它是:
3×10 9 /1.5 = 2×10 9指令/秒
这个答案来自时钟速率/CPI 部分,但我真的无法理解...如果你像这样子输入时钟速率/CPI:(时钟周期/秒)/(指令/时钟周期),它基本上是与原始方程相反,因为您将周期除以指令而不是乘以指令...并且这些单位甚至不会抵消,最终得到周期2 /指令×秒的单位。我必须在这里遗漏一些完全明显的东西/搞砸基础数学,但我的豌豆大脑不明白。
这里有一些相对基础的数学:
Instructions
IPS = ------------
Second
Run Code Online (Sandbox Code Playgroud)
您可以将某个值乘以 1 而不改变结果,并且由于 X / X = 1,我们可以执行以下操作:
Instructions Instructions Clock Cycles
IPS = ------------ x 1 = ------------ x ------------
Seconds Seconds Clock Cycles
Run Code Online (Sandbox Code Playgroud)
然后您可以按如下方式重新排列分数:
Instructions Clock Cycles
IPS = ------------ x ------------
Clock Cycles Seconds
Run Code Online (Sandbox Code Playgroud)
这将为您提供所提供公式的中间部分。
然后,给出:
Clock Cycles Clock Cycles
CPI = ------------ and Clock Rate = ------------
Instructions Seconds
Run Code Online (Sandbox Code Playgroud)
由于 1 / (A/B) = B/A:
1 Instructions
--- = ------------
CPI Clock Cycles
Run Code Online (Sandbox Code Playgroud)
所以:
1 Clock Rate
IPS = --- x Clock Rate = ----------
CPI CPI
Run Code Online (Sandbox Code Playgroud)