Consider two different implementations of the same instruction set architecture. There are four classes of instructions, A, B, C, and D. The clock rate and CPI of each implementation are given in the following table.
| Clock Rate | CPI Class A | CPI Class B | CPI Class C | CPI Class D | ||
|---|---|---|---|---|---|---|
| (a) | P1 | 2.5 GHz | 1 | 2 | 3 | 3 |
| P2 | 3 GHz | 2 | 2 | 2 | 2 | |
| (b) | P1 | 2.5 GHz | 2 | 1.5 | 2 | 1 |
| P2 | 3 GHz | 1 | 2 | 1 | 1 |
(a) Given a program with 106 instructions divided into classes as follows: 10% class A, 20% class B, 50% class C, and 20% class D, which implementation is faster? (7%)
(b) What is the global CPI for each implementation? (5%)
題目的表有 (a)、(b) 兩組 CPI,兩組都算
global CPI \(=\sum f_i\,\text{CPI}_i\),時間 \(=\dfrac{IC\times\text{CPI}}{\text{clock}}\),\(IC=10^6\)
表 (a) P1:\(0.1\cdot1+0.2\cdot2+0.5\cdot3+0.2\cdot3=2.6\) P2:\(2\)
\(T_{P1}=\dfrac{10^6\cdot2.6}{2.5\times10^9}=1.04\) ms,\(T_{P2}=\dfrac{10^6\cdot2}{3\times10^9}\approx0.667\) ms
表 (b) P1:\(0.1\cdot2+0.2\cdot1.5+0.5\cdot2+0.2\cdot1=1.7\) P2:\(0.1\cdot1+0.2\cdot2+0.5\cdot1+0.2\cdot1=1.2\)
\(T_{P1}=\dfrac{1.7\times10^6}{2.5\times10^9}=0.68\) ms,\(T_{P2}=\dfrac{1.2\times10^6}{3\times10^9}=0.4\) ms
| CPI 表 | P1 global CPI | P2 global CPI | P1 時間 | P2 時間 | 較快 |
|---|---|---|---|---|---|
| (a) | 2.6 | 2.0 | 1.04 ms | 0.667 ms | P2(快 1.56 倍) |
| (b) | 1.7 | 1.2 | 0.68 ms | 0.4 ms | P2(快 1.7 倍) |