I need help with the following Computer Architecture question: Consider two diff
ID: 3585520 • Letter: I
Question
I need help with the following Computer Architecture question:
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 90 MHz and M2 has a clock rate of 80 MHz. The average number of cycles for each instruction class and their frequencies (for a typical program) are as follows:
Instruction Class
Machine M1 – Cycles/Instruction Class
Machine M2 – Cycles/Instruction Class
Frequency
A
2
1
60%
B
3
2
30%
C
1
3
10%
a) Calculate the average CPI for each machine, M1 and M2.
b) Which machine has the better performance? Show your reasoning.
// SIMILAR PROBLEM BELOW:
Two compilers are used for a 1GHz machine. There are three classes of instructions: Class A, Class B, and Class C, which requires 2, 4 and 5 cycles (respectively). Both compilers are used to produce code.
Compiler 1 generates code with 1 million Class A instructions, 3 million Class B instructions, and 2 million Class C instructions.
Compiler 2 generates code with 5 million Class A instructions, 1 million Class B instructions, and 1 million Class C instructions.
Which sequence will be faster (higher performance)? Explain.
Solution:
CLOCK CYCLES compiler1:
CC1 = (1,000,000 * 2) + (3,000,000 * 4) + (2,000,000 * 5)
CC1 = 24,000,000 clock cycles
CLOCK CYCLES compiler2:
CC2 = (5,000,000 * 2) + (1,000,000 * 4) + (1,000,000 + 5)
CC2 = 19,000,000
Compiler 2 will clearly be faster. Compiler 1 requires 24e6 instructions while compiler 2 only requires 19e6 instructions to execute the same set of instructions.
Execution Time 1 = 24,000,000 / 1 GHz
= 24 x 10-3 seconds
Execution Time 2 = 19,000,000 / 1GHz
= 19 x 10-3 seconds
Compiler 2 utilizes class A, which has the highest CPI of the three classes, to the do bulk of the computational work. The result is an efficiency advantage versus compiler1.
Instruction Class
Machine M1 – Cycles/Instruction Class
Machine M2 – Cycles/Instruction Class
Frequency
A
2
1
60%
B
3
2
30%
C
1
3
10%
Explanation / Answer
Solution:
a)
Average CPI of M1= 0.6*2 + 0.3*3 + 0.1 * 1= 2.2
Average CPI of M2= 0.6*1 + 0.3*2 + 0.1 * = 1.5
b)
If we compare M1 and M2 using CPI then M2 is the better machine. In the problem, instruction count is not given for each machine so only CPI is left to measure if instruction count of both is the same Machine2 will still perform better than Machine 1.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)