Cycles Per Instruction (CPI) Calculator

Posted by Dinesh on

In computer architecture, cycles per instruction (CPI) is actually a ratio of two values. The numerator is the number of cpu cycles uses divided by the number of instructions executed. It tells the average number of CPU cycles required to retire an instruction, and therefore is an indicator of how much latency in the system affected the running application and it is the multiplicative inverse of instructions per cycle.

This calculator calculates the cycles per instruction using r-type instructions, load instructions, store instructions, branch instructions, jump instructions values.

Cycles Per Instruction (CPI) Calculation

Formula:

CPI = ((4xRI) + (5xLI) + (4xSI) + (3xBI) + (3xJI)) / 100

Where,

RI is R-type instructions

LI is load instructions

SI is store instructions

BI is branch instructions

JI is jump instructions

Example:
If a program has 50% R-type instructions, 10% load instructions, 20% store instructions, 8% branch instructions and 2% jump instructions then what is the CPI?

Solution:
CPI = (4x50 + 5x10 + 4x20 + 3x8 + 3x2)/100 = 3.6