Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 – Computer C1 has an overall CPI of 2.0 and can be run at a clock rate of 2 GH

ID: 3850591 • Letter: 1

Question

1 – Computer C1 has an overall CPI of 2.0 and can be run at a clock rate of 2 GHz. Computer C2 has a CPI of 2.5 and can be run at a clock rate of 3 Ghz. A particular program when compiled for Computer C1 has exactly one million instructions. How many instructions would the program need to have when compiled for Computer C2, in order for the two computers to have exactly the same execution time for this program?

2 – The CPU design team is choosing between two implementations of the same instruction set each with three classes of instructions. Parameters for the two possibilities are given in the following table.

CPU-1

CPU-2

Clock Rate

2GHz

3GHz

CPI for ALU Inst.

1

2

CPI for Memory Inst.

4

2

CPI for Control Inst.

2

2

a)Consider a program with 60% ALU instructions, 30% memory instructions, and 10% control instructions. What is the average CPI for CPU-1? What is the average CPI for CPU-2? Which is faster in terms of overall execution time?

b)Consider a program with 70% ALU instructions, 20% memory instructions and 10% control instructions. What is the average CPI for CPU-1? What is the average CPI for CPU-2? Which is faster in terms of overall execution time?

CPU-1

CPU-2

Clock Rate

2GHz

3GHz

CPI for ALU Inst.

1

2

CPI for Memory Inst.

4

2

CPI for Control Inst.

2

2

Explanation / Answer

Ans1- In general, Clock_Cycles = Instruction_Count * Cycles_per_Instruction

and CPU_Time = Instruction_Count * CPI * Clock_Cycle_Time

=(Instruction_Count * CPI) / Clock_Rate

for C1, (keeping clock rate in GHz)

CPU_TimeA= (Instruction_CountA * CPIA )/ Clock_RateA

   =(1*106*2)/2

for C1, (keeping clock rate in GHz)

CPU_TimeB= (Instruction_CountB * CPIB )/ Clock_RateB

Now, it is given that

CPU_TimeA= CPU_TimeB

Thus,

(1*106*2)/2=(Instruction_CountB * CPIB )/ Clock_RateB

(1*106*2)/2=(Instruction_CountB * 2.5)/ 3

(1*106*2*3)/(2*2.5)=(Instruction_CountB )

1.2*106=(Instruction_CountB )

Ans-2(a)

Average CPI(CPU-2)= 0.6*2+0.3*2+0.1*2=2

Since Instruction count is the same,

CPU_Time(CPU-1) = Instruction_Count * CPI (CPU-1)/ Clock_Cycle_Time(CPU-1)

CPU_Time(CPU-2) = Instruction_Count * CPI (CPU-2)/ Clock_Cycle_Time(CPU-2)

CPU_Time(CPU-1)= CPI (CPU-1)/ Clock_Cycle_Time(CPU-1)

CPU_Time(CPU-2) =CPI (CPU-2)/ Clock_Cycle_Time(CPU-2)

CPU_Time(CPU-1)=2*106 /2

CPU_Time(CPU-2) =2*106/3

                                =1.5

Hence, CPU 1 is faster.

(b)

Average CPI(CPU-1)=0.7*1+0.2*4+0.1*2=1.7

Average CPI(CPU-2)= 0.7*2+0.2*2+0.1*2=2

Since Instruction count is the same,

CPU_Time(CPU-1) = Instruction_Count * CPI (CPU-1)/ Clock_Cycle_Time(CPU-1)

CPU_Time(CPU-2) = Instruction_Count * CPI (CPU-2)/ Clock_Cycle_Time(CPU-2)

CPU_Time(CPU-1)= CPI (CPU-1)/ Clock_Cycle_Time(CPU-1)

CPU_Time(CPU-2) =CPI (CPU-2)/ Clock_Cycle_Time(CPU-2)

CPU_Time(CPU-1)=1.7*106 /2

CPU_Time(CPU-2) =2*106/3

                                =1.275

Hence, CPU 1 is faster.