Given,
Frequency =40 MHz
Clock time = $\frac{1}{40*10^{6}} sec$
Instruction type |
Instruction count |
cycle/instructions |
% of instruction type |
Integer arithmetic |
45000 |
1 |
45% |
Data transfer |
32000 |
2 |
32% |
Floating point |
15000 |
2 |
15% |
Control Transfer |
8000 |
2 |
8% |
Total |
100000 |
|
100% |
$\text{CPI}= \displaystyle \sum_i (\text{Fraction of instruction type } i \times \text{Cycles needed by instruction type }i)$
$\implies \text{CPI}= 0.45*1 +(0.32+0.08+0.15)*2 = 1.55$
$\text{Execution time} = \text{CPI} * \text{total number of instructions} * \text{Clock time}$
$\qquad =1.55*10^{5}*\frac{1}{40*10^{6}}$ sec
$\qquad =3.875 \;ms$
$\text{MIPS} = \frac{\text{Clock Frequency}}{\text{CPI}*10^{6}}$
$\qquad =\frac{40*10^{6}}{1.55*10^{6}}$
$\qquad =25.8$
So correct answer is option (B).
Reference :- https://en.wikipedia.org/wiki/Cycles_per_instruction#:~:text=For%20example%2C%20with%20two%20executions,1%2F2%20%3C%2001).
The question was copied from wikipedia itself.