In: Electrical Engineering
Consider two different implementations of the same instruction set architecture.
The instructions can be divided into four classes according to their CPI (classes A, B, C, and D).
P1 with a clock rate of 2.5 GHz and CPIs of 1, 2, 3, and 3, and P2 with a clock rate of 3 GHz and CPIs of 2, 2, 2, and 2.
Given a program with a dynamic instruction count of 1.0E6 instructions divided into classes as follows:
10% class A, 20% class B, 50% class C, and 20% class D,
which is faster: P1 or P2?
a. What is the global CPI for each implementation?
b. Find the clock cycles required in both cases.
Total instructions - 106
No. of class A instructions = 10/100* 106 = 105
No. of class B instructions = 20/100* 106 = 2*105
No. of class C instructions = 50/100* 106 = 5*105
No. of class D instructions = 20/100* 106 = 2* 105
For P1:
CPIs are: 1, 2, 3, 3
Thus total CPIs = 1* 105 + 2* 2 *105 + 3* 5 *105 + 3* 2*105 ( sum of CPI of that class * no. of instructions of a particular class ) = 26 * 105
THus CPU time = 26 * 105/ clock rate = 26 * 105 / 2.5 * 109 = 10.4*10-4 sec
For P2:
CPIs are: 2, 2, 2, 2
Total CPIs = 2 * 105 + 2* 2 *105 + 2* 5 *105 + 2* 2*105 ( sum of CPI of that class * no. of instructions of a particular class ) = 20 * 105
THus CPU time = 20 * 105/ clock rate = 20 * 105 / 3 * 109 = 6.67*10-4 sec
Thus P2 is faster.
a. Global CPI = (CPU-Time x Clock Rate)/ total instructions
CPI (P1) = 10.4 × 10−4 × 2.5 × 109/106 = 2.6
CPI (P2) = 6.66 × 10−4 × 3 × 109/106 = 2.0
b. CLock cycles required in P1= 1* 105 + 2* 2 *105 + 3* 5 *105 + 3* 2*105 ( sum of CPI of that class * no. of instructions of a particular class ) = 26 * 105
CLock cycles required in P2= 2 * 105 + 2* 2 *105 + 2* 5 *105 + 2* 2*105 ( sum of CPI of that class * no. of instructions of a particular class ) = 20 * 105