which sequence will be faster 1according to mips 2according
which sequence will be faster
1.according to mips
2.according to execution time
Solution
Compilers are being tested for 4GHz ie 4000MHz
MIPS = Millions of instructions per second
= Number of instructions / Execution time * 106
=IC / IC * CPI * clock cycle time * 106
= IC * clock rate / IC * CPI * 106
= clock rate / CPI * 106
For first sequence,
CPI = (5*1 + 1*2 + 1*3) * 106 / (5+1+1) * 106 = 10 / 7
Execution time = (5+1+1) * 106 * (10 / 7) * 1/(4000 * 106) = 0.0025 seconds
MIPS = 4000 * 106 / (10/7) * 106 = 4000*7 / 10 = 2800
For second sequence,
CPI = (10*1 + 1*2 + 1*3) * 106 / (10+1+1) * 106 = 15 / 12
Execution time = (10+1+1) * 106 * (15 / 12) * 1/(4000 * 106) = 15 / 4000 = 0.00375 seconds
MIPS = 4000 * 106 / (15/12) * 106 = 4000*12 / 15 = 3200
So according to MIPS second sequence is faster and according to execution time first sequence is faster.
