**Answer:**

A ) CPI : M1 = 2.4 , M2 = 2.65

B ) MIPS : M1 = 1083, M2 = 1056

C ) The machine that has a better performance based on MIPS is M1 and this is by 27 million number of instructions per sec

**Explanation:**

**A) The CPI for each machine **

CPI = ( Total number of execution cycles ) / ( instruction counter executed )

**For Machine 1 ( M1 ) **

we have to make some assumptions : number of instructions = 10

number of times A was executed = 4 , Number of times B was executed = 2.5 , number of times C was executed = 2.5, Number of times D was executed = 1. and this was based on the frequency given above

hence CPI for M1 =[ ( 1 * 4 ) + ( 3 * 2.5 ) + ( 3 * 2.5 ) + ( 5 * 1 ) ] / 10

CPI for M1 = 2.4

**For Machine 2 ( M2 )**

we have to make some assumptions : number of instructions = 10

number of times A was executed = 4 , Number of times B was executed = 2. number of times C was executed = 1.5, Number of times D was executed = 2.5 times. and this was based on the frequency given above

Hence CPI for M1 = [ ( 2 * 4 ) + ( 2 * 2 ) + ( 3 * 1.5 ) + ( 4 * 2.5 ) ] / 10

CPI for M2 = 2.65

**B ) Calculate the native MIPS ratings for M1 and M2**

MIPS = ( instruction counts ) / ( Execution time * 10^6 )

**For M1 **

Assumptions : number of instructions executed = 10

each clock cycle = 0.3846 * 10^-9. frequency = 2.6 Ghz

first we calculate the total execution time which is equal to :

= [ ( 1 * 4 ) + ( 3 * 2.5 ) + ( 3 * 2.5 ) + ( 5 * 1 ) ] * 0.3846 * 10 ^-9

= 9.2304 * 10 ^-9 secs

therefore the MIPS for M1

= 10 / ( 9.2304 * 10^-9 ) * 10^6 **= 1083**

**For M2 **

Assumptions : number of instructions executed = 10

each clock cycle = 0.3846 * 10^-9. frequency = 2.8 Ghz

first we calculate the total execution time which is equal to :

= [ (2*4) + (2*2) + (3 * 1.5 ) + ( 4 * 2.5 ) ] * 0.3846 * 10^-9 = 9.4631 * 10^-9 secs

therefor the MIPS for M2

= 10 / ( 9.4631*10^-9) * 10^6 = **1056**

C ) The machine that has a better performance based on MIPS is M1 and this is by 27 million number of instructions per sec