如何使用动态指令计数计算全局 CPI 并确定哪台计算机更快?

How to calculate global CPI with dynamic instruction counts and determine which computer is faster?

这道题我做对了吗?我的回答是 P2(0.667ms) 比 P1 (1.04ms) 快。全球CPI是多少?

1.6 [20] <§1.6> 考虑同一指令集架构的两种不同实现。 这些指令根据其CPI可分为四个classes(class A、B、C和D)。 P1 时钟速率为 2.5 GHz,CPI 为 1 (10%)、2 (20%)、3 (50%) 和 3 (20%)。 P2 时钟速率为 3 GHz,CPI 为 2 (10%)、2 (20%)、2 (50%) 和 2 (20%)。

给定一个动态指令数为 1.0E6 (1.0 * 10^6) 条指令的程序,分为 classes 如下:10% class A,20% class B,50% class C,和 20% class D,哪个实现更快?

a. What is the global CPI for each implementation? Which is faster: P1 or P2?

CPU Time = CPU clock cycle/clock rate
CPU Clock Cycles = Sum of CPI * instruction count
Sum of each row, (A, B, C, D multiplied by IC and CPI)

P1 Clock Cycles = 1.0 * 10^6 dynamic instruction count * 1 CPI * 10% class A
               +1.0 * 10^6 dynamic instruction count * 2 CPI * 20% class B
               +1.0 * 10^6 dynamic instruction count * 3 CPI * 50% class C
               +1.0 * 10^6 dynamic instruction count * 3 CPI * 20% class D

P1 Clock Cycles = (0.1 CPI * 106 instruction count) + (0.4 CPI * 106 instruction count) + (1.5 CPI * 106 instruction count) + (0.6 CPI * 106 instruction count) = 2.6 * 10^6 Clock Cycles

P2 Clock Cycles = 1.0 * 10^6 dynamic instruction count * 2 CPI * 10% class A
               +1.0 * 10^6 dynamic instruction count * 2 CPI * 20% class B
               +1.0 * 10^6 dynamic instruction count * 2 CPI * 50% class C
               +1.0 * 10^6 dynamic instruction count * 2 CPI * 20% class D

P2 Clock Cycles = (0.2 CPI * 10^6 instruction count) + (0.4 CPI * 10^6 instruction count) + (1.0 CPI * 10^6 instruction count) + (0.4 CPI * 10^6 instruction count) = 2 * 10^6 Clock Cycles

P1 CPU Time = (2.6 * 10^6 Clock Cycles) / 2.5 GHz = 1.04 (10^6/10^9) = 1.04 * 10^-3 = 1.04ms
P2 CPU Time = (2 * 10^6 Clock Cycles) / 3 GHz = 1.04 (10^6/10^9) = 0.667 * 10^-3 = 0.667ms

P2 is faster than P1.

答案是正确的,我最初在网上找到了一些不正确的解决方案,并开始关注自己的答案。此答案包括对每台计算机的全球 CPI 的说明以及更完整的单位:

P1 CPU Time = (2.6 * 106 Clock Cycles) / 2.5 GHz = 1.04 (106/109) = 1.04 * 10-3 = 1.04ms, Global CPI is 2.6 cycles per instruction

P2 CPU Time = (2 * 106 Clock Cycles) / 3 GHz = 0.667 (106/109) = 0.667 * 10-3 = 0.667ms, Global CPI is 2 cycles per instruction

P2 is faster than P1.