Suppose a program has 3000 instructions with the following instruction types: -
ID: 3531467 • Letter: S
Question
Suppose a program has 3000 instructions with the following instruction types:
- R type (70%)
- lw (10%)
- sw (10%)
- beq (8%)
- j (2%)
If we run this program on a 5-stage multi-cycle CPU, and the number of cycles to finish each type of instruction is given as following:
- R type - 4 cycles
- lw - 5 cycles
- sw - 4 cycles
- beq - 3 cycles
- j - 2 cycles
What is the CPI (Clock Cycle per Instruction) for running the program on this CPU ? Suppose the CPU is clocked at 1 MHZ (i.e., 10^6 clock cycles per second). How much time is needed to finish the program?
Explanation / Answer
CPI = 0.7*4 + 0.1*5 + 0.1*4 +0.08*3+ 0.02*2
= 2.8+0.5+0.4+0.24+0.04
= 3.78
now total time needed = CPI* no. of insturctions * time for each clockcycle
= 3.78*3000 * (10)^-6
= 11.54 ms
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.