Calculate Number of Cycles and Average Operand Fetch Rate of the Machine
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.
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?
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.
|Operand Accessing Mode||Frequency%(Probability)|
|Immediate Accessing Mode||25|
|Register Accessing Mode||28|
|Direct Accessing Mode||18|
|Memory Indirect Accessing Mode||14|
|Indexed Accessing Mode||15|
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.
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.
5 Cycles (1-memory reference has 3 cycles and 1-arithmetic calculation has 2 cycles).
Operand Accessing Mode Frequency%(Probability) No of Cycles Immediate Accessing Mode 25 no reference (0 cycle) Register Accessing Mode 28 0-reg reference (0 cycle) Direct Accessing Mode 18 1-mem reference (3 Cycle) Memory Indirect Accessing Mode 14 2-mem reference (3*2 Cycle) Indexed Accessing Mode 15 1 -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.
Consider a hypothetical machine that uses different operand accessing mode is given below. Calculate Cycle per Instructions or CPI.
Instruction Type Frequency Cycles Consumed for Instruction ALU Instruction 45% 4 Load Instruction 35% 3 Store instruction 10% 2 Branch instruction 10% 2
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 = 3.25 Cycles/Instruction