Professional Documents
Culture Documents
15 上午 9:20
Prob. 1. Assume that multiply instructions takes 12 cycles and account for 15% of the
instructions in a typical program, and the other 85% of the instructions require an
average of 4 cycles for each instruction. What percentage of time does the CPU spend
doing multiplication?
ANS:
12 * 0.15 / ( ( 12 * 0.15 ) + ( 4 * 0.85 ) )= 1.8 / 5.2 = 35%.
Prob. 2. A computer uses a 2-GHz processor with a claim 500-MIPS rating to execute a given
program mix. Assume a one-cycle delay for each memory access.
Prob. 3. Consider two different implementations, M1 and M2, of the same instruction set.
There are three classes of instructions (A, B, and C) in the instruction set. M1 has a
clock rate of 80 MHz and M2 has a clock rate of 100 MHz. The average number of
cycles for each instruction class and their frequencies (for a typical program) are as
follows:
(a) Calculate the average CPI for each machine, M1, and M2.
ANS:
M1 = ( 0.6 * 1 ) + ( 0.3 * 2 ) + ( 0.1 * 4 ) = 1.6.
M2 = ( 0.6 * 2 ) + ( 0.3 * 3 ) + ( 0.1 * 4 ) = 2.5.
(b) Calculate the average MIPS ratings for each machine, M1 and M2.
ANS:
M1 = 80 / 1.6 = 50.
M2 = 100 / 2.5 = 40.
(c) Which machine has a smaller MIPS rating? Which individual instruction class CPI do
you need to change, and by how much, to have this machine have the same or better
performance as the machine with the higher MIPS rating (you can only change the CPI
for one of the instruction classes on the slower machine)?
M2 has a smaller MIPS rating.
ANS:
Change the CPI of instruction class A for M2 to 1.
CPI = ( 0.6 * 1 ) + ( 0.3 * 3 ) + ( 0.1 * 4 ) = 1.9,
Average MIPS rating = 100 / 1.9 = 52.6 .
Prob. 4. Assume a program requires the execution of 50 × 106 FP instructions, 110 × 106 INT
instructions, 80 × 106 L/S instructions, and 16 × 106 branch instructions. The CPI for each type
of instruction is 1, 1, 4, and 2, respectively. Assume that the processor has a 2 GHz clock rate.
(a) By how much must we improve the CPI of FP instructions if we want the program to
run two times
faster?
ANS:
(50*1+110*1+80*4+16*2)*(10^6)/(X+110*1+80*4+16*2) *(10^6)=2,
512/(462+X)=2,
2X=512-924,
X(CPI of FP)<0,
因此不可能.
(b) By how much must we improve the CPI of L/S instructions if we want the program to
run two
times faster?
ANS:
(50*1+110*1+80*4+16*2)*(10^6)/(50*1+110*1+X+16*2) *(10^6)=2,
512/(192+X)=2,
2X=512-384,
2X=128,
X(CPI of L/S)=64,
64/80=0.8.
(c) By how much is the execution time of the program improved if the CPI of INT and FP
instructions is reduced by 40% and the CPI of L/S and Branch is reduced by 30%?
ANS:
50*0.6+110*0.6+80*2.8+16*1.4,
=30+66+224+22.4,
=342.4,
(512-342.4)/512=33%.