Use the following narrative to answer questions 17- 20: There are two machines M
ID: 3907629 • Letter: U
Question
Use the following narrative to answer questions 17- 20:
There are 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
3
20
SW
4
20
2
10
Branch
3
10
2
20
Other I-type
1
20
2
10
R-type
1
30
1
30
J- type
1
10
1
10
What are the average CPIs for this program on the machines M1 and M2 in that order?
d. Cannot determine
a. 2.2 and 2.4
b. 2.2 and 1.8
c. 2.6 and 3.1
On the machine M1, if the program (ML1) takes 3000 ns to execute, how many machine language instructions are there in ML1? ( note that 1 ns = 10-9 sec, and 1 GHz = 109 Hz)
a.Cannot determine
b. 3000
c. 2.2 * 3000
d. 3000/2.2
If ML2 has 1000 more machine instructions than ML1. Which machine is faster for this program?
a. M1 is faster
b. M2 is faster
c. Both are same
d. Cannot determine
Which machine, M1 or M2, will spend more time on executing memory reference instructions, and by how much (in nano seconds)? [hint: based on the above table M1 spends (13/22) of the total time on sw and lw]
a. M1 will spend nearly 450 ns more than M2
b. M2 will spend nearly 450 ns more than M1
c. Both will spend same amount of time
d. Cannot determine
Instruction Class
Machine M1 – ML1
Machine M2 – ML2
Cycles/Instr Class
Frequency (%)
Cycles/Instr Class
Frequency (%)
LW
5
10
3
20
SW
4
20
2
10
Branch
3
10
2
20
Other I-type
1
20
2
10
R-type
1
30
1
30
J- type
1
10
1
10
Explanation / Answer
------------------------------------------------------------------------------------
17. b)
average cpi for M1 = 0.5 + 0.8 + 0.3 + 0.2 + 0.3 + 0.1 = 2.2
average cpi for M2 = 0.6 + 0.2 + 0.4 + 0.2 + 0.3 + 0.1 = 1.8
18. 3000 ns
Number of clocks in 3000 ns = 3000 * 10 ^-9 / (2.2 * 10^-9) = 3000/2.2
Number of instructions = (3000/2.2) * 2.2 = 3000
ans- a)
19. If M2 has 1000 instructions more then
Number of instructions = 4000
Number of clocks = 4000 * 1.8
Time = 4000 * 1.8 / 2.4 ns = 3000 ns
c) Same
20 Assuming the program instructions as
for M1 = 3000 instructions
for M2 = 4000 instructions
For M1 as per the table 10% lw and 20% are sw
so 300 lw instructions , 600 lw instructions
Time lw = (300 * 5)/2.2 = 681.8 ns
Time sw = (600 * 4)/2.2 = 1090.9 ns
Total time = 1772.7
For M2 as per the table 20% lw and 10% are sw
so 800 lw instructions , 400 lw instructions
Time lw = (800 * 3)/2.4 = 1000 ns
Time sw = (400 * 2)/2.4 = 333.3 ns
Total time = 1333.3
M1 is spending more by (1772.7 -1333.3 = 439.4
answer should be a)