a. [3 points] Derive a simple formula for the execution time of a program on a c
ID: 3904513 • Letter: A
Question
a. [3 points] Derive a simple formula for the execution time of a program on a computer based on the properties of the program, compiler and the CPU.
Consider two machines M1 and M2 with different ISAs and with the clock rates 2.2 GHz and 2.4 GHz respectively. There are six classes of instructions (see the table below) in both ISAs. A program is compiled into both machines and gave two sets of machine language instruction sets (say ML1 and ML2). In both machine language programs, ML1 and ML2, the average number of cycles for the instructions of each instruction class and their frequencies are given below:
Instruction Class
Machine M1 – ML1
Machine M2 – ML2
Cycles/Instr Class
Frequency (%)
Cycles/Instr Class
Frequency (%)
LW
5
10
4
20
SW
4
20
4
10
Branch
3
10
3
20
Other I-type
1
20
2
10
R-type
1
30
1
30
J- type
1
10
1
10
b. [3 points] Calculate the average CPI for each machine, M1, and M2.
c. [3 points] Calculate the average MIPS ratings for both machines. Which machine is faster (based on MIPS)?
Note that, 1 GHz = 10 9 Hz, and 1 million is 10 6
d. [3 points] If the above program takes 250 ns ( 1 ns = 10 -9 sec)to execute on the machine M1, how many instructions are there in the program?
e. [3 points] Assume ML2 has 30 less machine instructions than ML1. Which machine is faster for this program [calculate how much time will it take to execute the same program on machine M2]?
BONUS-2 [3 points]: Which machine, M1 or M2, will spent more time on executing memory reference instructions? By how much (in nano seconds)?
Instruction Class
Machine M1 – ML1
Machine M2 – ML2
Cycles/Instr Class
Frequency (%)
Cycles/Instr Class
Frequency (%)
LW
5
10
4
20
SW
4
20
4
10
Branch
3
10
3
20
Other I-type
1
20
2
10
R-type
1
30
1
30
J- type
1
10
1
10
Explanation / Answer
a) Execution time = (Number of instructuons * CPI)/CPU Clock
b) Average CPI for M1 = 0.10 * 5 + 0.20 * 4 + 0.1 * 3 + 0.2 * 1 + 0.3 * 1 + 0.1 * 1
= 0.5 + 0.8 + 0.3 + 0.2 + 0.3 + 0.1 = 2.2
Average CPI for M2 = 0.20 * 4 + 0.10 * 4 + 0.2 * 3 + 0.1 * 2 + 0.3 * 1 + 0.1 * 1
= 0.8 + 0.4 + 0.6 + 0.2 + 0.3 + 0.1 = 2.4
c) Number of clocks in 250ns = 250 * 10^-9 * 2.2 * 10^9 = 550
Number of instruction = 550/2.2 = 250
d) Number of instructions = 220
Number of clocks = 220 * 2.4 = 528
Execution time = 528/2.4 * 10^9 = 220 ns
M2 is faster
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.