1
\$\begingroup\$

We have two different computers with the same instruction set. There are three classes of instructions (A, B, and C) in the instruction set. Computer M1 has a clock rate of 80 MHz and Computer M2 has a clock rate of 100 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

Class    M1 Cycles/Instrctn Class   M2 Cycles/Instrctn Class   Frequency
A               1                               2                   60%
B               2                               3                   30%
C               4                               4                   10%

Calculate the average CPI for each machine, M1 and M2.

My initial hunch would be to just do something like M1: .6*1+.3*2+.1*4 = 1.6/3=.53 average for M1 but that makes no sense.

\$\endgroup\$
1

2 Answers 2

2
\$\begingroup\$

You had it correct right up to the point where you divided. Since you've already multiplied the values by the weights, no further math needs to be performed and the final result is 1.6.

\$\endgroup\$
2
  • \$\begingroup\$ But how do I account for the different clockrates in MHz? M1 is 80, M2 is 100 MHz \$\endgroup\$
    – Carlo
    Commented Sep 24, 2014 at 14:09
  • 1
    \$\begingroup\$ The clock rate is irrelevant. The question is about CPI, not MIPS. \$\endgroup\$ Commented Sep 24, 2014 at 14:15
1
\$\begingroup\$

You can calulate Average Cycles Per Instruction as follows:

Average Cycles Per Instruction For computer M1: = (1*60 + 2*30 + 4*10)/100 = 1.6 cycles/instruction

Average Cycles Per Instruction For computer M2: = (2*60 + 3*30 + 4*10)/100 = 2.5 cycles/instruction

\$\endgroup\$
2
  • \$\begingroup\$ Wouldn't M1 be /80 because it has 80 MHz? \$\endgroup\$
    – Carlo
    Commented Sep 24, 2014 at 14:02
  • \$\begingroup\$ when you calculate average time per instruction then Clock frequency comes in picture. CPI does not depend on clock speed \$\endgroup\$
    – GOKU
    Commented Sep 25, 2014 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.