Skip to content
Related Articles
Calculate Number of Cycles and Average Operand Fetch Rate of the Machine
• Difficulty Level : Medium
• Last Updated : 28 Dec, 2020

In this article, we will know how to calculate the average operand fetch rate of the machine when the machine uses different operand accessing modes.

Example-1 :
Consider a hypothetical machine that uses different operand accessing mode is given below. Assume the 3 clock cycles consumed for memory access, 2 clock cycles consumed for arithmetic computation, 0 clock cycle consumed when data is present in the register or Instruction itself, What is the average operand fetch rate of the machine?

Operand Accessing ModeFrequency%(Probability)
Immediate Accessing Mode25
Register Accessing Mode28
Direct Accessing Mode18
Memory Indirect Accessing Mode14
Indexed Accessing Mode15

Solution :
In Indexed Addressing mode, if nothing is specified then we assume “Base Address is given directly into the instruction and Index value is stored into the Index Register“. Now, If we look at the given operand accessing mode with their number of cycle required to execute according to the given question we can see that –

Immediate Accessing Mode needs no reference or 0 Cycles.
Register Accessing Mode needs a 0-reg reference or 0 Cycles.
Direct Accessing Mode needs a 1-memory reference or 3 Cycles.
Memory Indirect Accessing Mode needs a 2-memory reference.
OR
3*2 Cycles (1-memory reference has 3 cycles so 2-mem reference has 3*2 cycles).
Indexed Accessing Mode needs 1-reg reference and 1-mem reference and 1-arithmetic calculation.
OR
5 Cycles (1-memory reference has 3 cycles and 1-arithmetic calculation has 2 cycles).

Operand Accessing ModeFrequency%(Probability)No of Cycles
Immediate Accessing Mode25no reference (0 cycle)
Register Accessing Mode280-reg reference (0 cycle)
Direct Accessing Mode181-mem reference (3 Cycle)
Memory Indirect Accessing Mode142-mem reference (3*2 Cycle)
Indexed Accessing Mode151 -reg reference and 1-mem reference and 1-arithmetic calculation (0+3+2 Cycle)

We can get the total average number of cycles required to execute one instruction by taking the sum of products of frequency and number of cycles.
The total average number of Cycle required to execute one instruction

= (0.25\times0) + (0.28\times0) + (0.18\times3) + (0.14\times6) + (0.15\times5)
= 2.13 Cycles

Now it is known that the time taken to complete one cycle is

= 1/1GHz = 1 nanosecond

Average time required to execute one instructions

= 2.13 ∗ 1 = 2.13 nanosecond

So, 2.13 nanoseconds are required for = 1 instruction.

1 second is required for

= 1 / (2.13 * 10^(-9))
= 0.469483568 * 10^9 Instructions
= 469.483568 MIPS (Million Instructions Per Second).
In general we take operation fetch rate in MIPS.

Example-2 :
Consider a hypothetical machine that uses different operand accessing mode is given below. Calculate Cycle per Instructions or CPI.

Instruction TypeFrequencyCycles Consumed for Instruction
ALU Instruction45%4
Load Instruction35%3
Store instruction10%2
Branch instruction10%2

Solution :
In computer architecture, cycles per instruction are one aspect of a processor’s performance: the average number of clock cycles per instruction for a program or program fragment. It is the multiplicative inverse of instructions per cycle.
It is given that –
ALU Instruction consumes 4 cycles.
Load Instruction consumes 3 cycles.
Store Instruction consumes 2 cycles.
Branch Instruction consumes 2 cycles.

So, we can get CPI by taking the product of cycles and frequency.

CPI = 4*0.45 + 3*0.35 + 2*0.1 + 2*0.1
= 6.85 Cycles/Instruction

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up