1

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

1.6 [20] <§1.6> 考虑相同指令集架构的两种不同实现。指令可根据其 CPI 分为四类(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) 指令的程序,分为如下几类:10% 的 A 类、20% 的 B 类、50% 的 C 类和 20% 的 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.
4

1 回答 1

0

答案是正确的,我最初在网上找到了一些不正确的解决方案,并开始关注我自己的答案。这个答案包括澄清每台计算机的全球 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. 
于 2021-09-19T21:24:54.673 回答