World Library  
Flag as Inappropriate
Email this Article

Cycles per instruction

Article Id: WHEBN0002592865
Reproduction Date:

Title: Cycles per instruction  
Author: World Heritage Encyclopedia
Language: English
Subject: Instructions per cycle, Reduced instruction set computing, CPI (disambiguation), Classic RISC pipeline, Clock signal
Publisher: World Heritage Encyclopedia

Cycles per instruction

In computer architecture, cycles per instruction (aka clock cycles per instruction, clocks per instruction, or CPI) is one aspect of a processor's performance: the average number of clock cycles per instruction for a program or program fragment.[1] It is the multiplicative inverse of instructions per cycle.


  • Definition 1
  • Explanation 2
  • Examples 3
    • Example 1 3.1
    • Example 2 3.2
  • See also 4
  • References 5


Cycles Per Instruction is defined by the following:

CPI = \frac{\Sigma (IIC)(CCI) }{IC}

Where IIC is the number of instructions for a given instruction type, CCI is the clock-cycles for a given instruction type, IC is the total instruction count. The summation sums over all instruction types for a given benchmarking process.


Let us assume a classic RISC pipeline, with the following 5 stages:

  1. Instruction fetch cycle (IF)
  2. Instruction decode/Register fetch cycle (ID)
  3. Execution/Effective address cycle (EX)
  4. Memory access (MEM)
  5. Write-back cycle (WB)

Each stage requires one clock cycle and an instruction passes through the stages sequentially. Without pipelining, a new instruction is fetched in stage 1 only after the previous instruction finishes at stage 5. Therefore without pipelining the number of cycles it takes to execute an instruction is 5. This is the definition of CPI.

With pipelining we can improve the CPI by exploiting instruction level parallelism. For example, what if an instruction is fetched every cycle? We could theoretically have 5 instructions in the 5 pipeline stages at once (one instruction per stage). In this case, a different instruction would complete stage 5 in every clock cycle, and therefore on average we have one clock cycle per instruction (CPI = 1).

With a single-issue processor, the best CPI attainable is 1. However with multiple-issue processors, we may achieve even better CPI values. For example a processor that issues two instructions per clock cycle (see Superscalar) can achieve a CPI of 0.5 when two instructions are completing every clock cycle.


Example 1

For the multi-cycle MIPS, there are 5 types of instructions:

  • Load (5 cycles)
  • Store (4 cycles)
  • R-type (4 cycles)
  • Branch (3 cycles)
  • Jump (3 cycles)

If a program has:

  • 50% load instructions
  • 15% R-type instructions
  • 25% store instructions
  • 8% branch instructions
  • 2% jump instructions

then, the CPI is:

\text{CPI} = \frac{5 \times 50 + 4 \times 15 + 4 \times 25 + 3 \times 8 + 3 \times 2}{100} = 4.05

Example 2

[2] A 400-MHz processor was used to execute a benchmark program with the following instruction mix and clock cycle count:

Instruction type Instruction count Clock cycle count
Integer arithmetic 45000 1
Data transfer 32000 2
Floating point 15000 2
Control transfer 8000 2

Determine the effective CPI, MIPS rate, and execution time for this program.

Total instruction count = 100000

\text{CPI} = \frac{45000 \times 1 + 32000 \times 2 + 15000 \times 2 + 8000 \times 2}{100000} = \frac{155000}{100000} = 1.55

\text{Effective processor performance} = \text{MIPS} = \frac{\text{clock frequency}}{\text{CPI} \times 1000000} = \frac{400 \times 1000000}{1.55 \times 1000000} = 258 \, \text{MIPS}


\text{Execution time}(T) = \text{CPI} \times \text{Instruction count} \times \text{clock time} = \frac{\text{CPI} \times \text{Instruction Count}}{\text{frequency}} = \frac{1.55 \times 100000}{400 \times 1000000} = \frac{1.55}{4000} = 0.387 \, \text{ms}

See also


  1. ^ Patterson, David A.; Hennessy, John L. Computer Organization and Design: The Hardware/Software Interface. 
  2. ^ Advanced Computer Architecture by Kai Hwang, Chapter 1, Exercise Problem 1.1
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.