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.
For Machine M1:
Clocks per Instruction = (60/100)* 1 + (30/100)*2 + (10/100)*4
= 1.6
For Machine M2:
Clocks per Instruction = (60/100)*2 + (30/100)*3 + (10/100)*4
= 2.5
(b) Calculate the average MIPS ratings for each machine, M1 and M2.
For Machine M1:
Average MIPS rating = Clock Rate/(CPI * 106)
= (80 * 106) / (1.6*106)
= 50.0
For Machine M2:
Average MIPS rating = Clock Rate/(CPI * 106)
= (100 * 106) / (2.5*106)
= 40.0
(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)?
Machine M2 has a smaller MIPS rating. If we change the CPI of instruction class A for Machine
M2 to 1, we can have a better MIPS rating than M1 as follows:
Clocks per Instruction = (60/100)*1 + (30/100)*3 + (10/100)*4 = 1.9
Average MIPS rating = Clock Rate/(CPI * 106) = (100 * 106) / (1.9*106) = 52.6
, 2. Suppose you have a machine which executes a program consisting of 50% floating point
multiply, 20% floating point divide, and the remaining 30% are from other instructions.
(a) Management wants the machine to run 4 times faster. You can make the divide run at most 3
times faster and the multiply run at most 8 times faster. Can you meet management’s goal by
making only one improvement, and which one?
Amdahl’s Law states:
Execution time after improvement =
(Execution time affected by improvement)/(Amount of Improvement) +
Execution time unaffected
Assuming initially that the floating point multiply, floating point divide and the other instructions
had
the same CPI,
Execution time after Improvement with Divide = (20)/3 + (50 + 30) = 86.67
Execution time after Improvement with Multiply = (50)/8 + (20 + 30) = 66.67
The management’s goal can be met by making the improvement with Multiply alone
3. Suppose that we can improve the floating point instruction performance of machine by a
factor of 15 (the same floating point instructions run 15 times faster on this new machine). What
percent of the instructions must be floating point to achieve a Speedup of at least 4?
We will use Amdahl’s Law again for this question.
Let x be percentage of floating point instructions. Since the speedup is 4, if the original program
executed in 100 cycles, the new program runs in 100/4 = 25 cycles.
(100)/4 = (x)/15 + (100 – x)
Solving for x, we get:
x = 80.36
The percent of floating point instructions need to be 80.36.
4. Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600MHz.
Computer B has a CPI of 2.5 and can be run at a clock rate of 750 Mhz. We have a particular
program we wish to run. When compiled for computer A, this program has exactly 100,000
instructions. How many instructions would the program need to have when compiled for
Computer B, in order for the two computers to have exactly the same execution time for this
program
(CPUTime)A = (Instruction count)A * (CPI)A * (Clock cycle Time)A
= (100,000)*(1.3)/(600*106) ns
(CPUTime)B = (Instruction count)B * (CPI)B * (Clock cycle Time)B
= (I)B*(2.5)/(750*106) ns
Since (CPUTime)A = (CPUTime)B,
we have to solve for (I)B and get 65000