25. A certain microprocessor requires either 2, 4, 8, 12, or 16 machine cycles to perform various operations. Seventeen and one-half (17.5) percent of its instructions require 2 machine cycles, 12.5% require 4 machine cycles, 35% require 8 machine cycles, 20% require 12 machine cycles, and 15% require 16 machine cycles.
a) What is the average number of machine cycles per instruction for this microprocessor?
b) What is the clock rate (machine cycles per second) required for this microprocessor to be a “1 MIPS” processor?
c) Suppose this system requires an extra 16 machine cycles to retrieve an operand from memory. It has to go to memory 30% of the time. What is the average number of machine cycles per instruction for this microprocessor, including its memory fetch instructions?
a)
The calculation is as follows:
To calculate the average number of machine cycles per instruction, we need to multiply the percentage of instructions by the corresponding number of machine cycles and sum them up.
Average = (0.175 * 2) + (0.125 * 4) + (0.35 * 8) + (0.2 * 12) + (0.15 * 16)
= 0.35 + 0.5 + 2.8 + 2.4 + 2.4
= 8.5
Hence, the average number of machine cycles per instruction for this microprocessor is 8.5.
b)
To determine the clock rate required for the microprocessor to be a "1 MIPS" (Million Instructions Per Second) processor, we need to divide 1 MIPS by the average number of machine cycles per instruction:
Clock Rate = 1 MIPS / Average Machine Cycles per Instruction
= 1,000,000 instructions / 8.5 machine cycles
= 117,647 cycles per second (Hz)
Hence, the clock rate required for this microprocessor to be a "1 MIPS" processor is 117,647 Hz or 117.647 kHz.
c)
Considering the extra 16 machine cycles required for memory fetch instructions and a 30% probability of going to memory, we need to modify the average calculation:
Average = (0.175 * 2) + (0.125 * 4) + (0.35 * 8) + (0.2 * 12) + (0.15 * 16) + (0.3 * 16)
= 0.35 + 0.5 + 2.8 + 2.4 + 2.4 + 4.8
= 13.3
Hence, the average number of machine cycles per instruction, including memory fetch instructions, for this microprocessor is 13.3.