176k views
5 votes
Consider two different implementations of the same instruction set architecture. The instructions can be divided into four classes according to their CPI (class 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 implementation is faster? a. What is the global CPI for each implementation? b. Find the clock cycles required in both cases.

User Sonni
by
4.4k points

1 Answer

6 votes

Answer:

Processor P_2 is faster than P_1.

Part A:

For Processor P_1:

CPI=2.6

For Processor P_2:

CPI=2

Part B:

For Processor P_1:

CPU CLOCK CYClE=
2.6*10^(6)

For Processor P_2:

CPU CLOCK CYClE=
2*10^(6)

Step-by-step explanation:

We will find the instructions executed of each class:

For Class A=1*10^{6} *10%=1*10^{5}

For Class B=1*10^{6} *20%=2*10^{5}

For Class C=1*10^{6} *50%=5*10^{5}

For Class D=1*10^{6} *20%=2*10^{5}

CPU CLOCK CYClE=
\sum_(n=1)^(i)*CPI_i*C_i

Where:

C_i is the instructions of each class (Calculated above)

For Processor P_1:

CPU CLOCK CYClE=
(1*1*10^(5))+ (2*2*10^(5))+ (3*5*10^(5))+ (3*2*10^(5))

CPU CLOCK CYClE=
2.6*10^(6)

For Processor P_2:

CPU CLOCK CYClE=
(2*1*10^(5))+ (2*2*10^(5))+ (2*5*10^(5))+ (2*2*10^(5))

CPU CLOCK CYClE=
2*10^(6)

Now:

CPU TIME=CPU CLOCK CYClE/CYCLE RATE

For Processor P_1:

CPU TIME=
(2.6*10^(6) )/(2.5*GHz) =1.04ms

For Processor P_2:

CPU TIME=
(2*10^(6) )/(3*GHz) =666.67ms

Processor P_2 is faster than P_1.

Part A:

CPI=CPU CLOCK CYClE/Number of instructions

For Processor P_1:

CPI=
(2.6*10^(6))/(1*10^(6))=2.6

For Processor P_2:

CPI=
(2*10^(6))/(1*10^(6))=2

Part B:

For Processor P_1:

CPU CLOCK CYClE=
(1*1*10^(5))+ (2*2*10^(5))+ (3*5*10^(5))+ (3*2*10^(5))

CPU CLOCK CYClE=
2.6*10^(6)

For Processor P_2:

CPU CLOCK CYClE=
(2*1*10^(5))+ (2*2*10^(5))+ (2*5*10^(5))+ (2*2*10^(5))

CPU CLOCK CYClE=
2*10^(6)

User Hanky
by
4.7k points