HOME

TheInfoList



OR:

In computer architecture, cycles per instruction (aka clock cycles per instruction, clocks per instruction, or CPI) is one aspect of a
processor Processor may refer to: Computing Hardware * Processor (computing) **Central processing unit (CPU), the hardware within a computer that executes a program *** Microprocessor, a central processing unit contained on a single integrated circuit (I ...
'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 In computer architecture, instructions per cycle (IPC), commonly called instructions per clock is one aspect of a processor's performance: the average number of instructions executed for each clock cycle. It is the multiplicative inverse of ...
.


Definition

The average of Cycles Per Instruction in a given process is defined by the following: CPI = \frac Where IC_i is the number of instructions for a given instruction type i, CC_i is the clock-cycles for that instruction type and IC=\Sigma_i(IC_i) is the total instruction count. The summation sums over all instruction types for a given benchmarking process.


Explanation

Let us assume a classic RISC pipeline, with the following five stages: # Instruction fetch cycle (IF). # Instruction decode/Register fetch cycle (ID). # Execution/Effective address cycle (EX). # Memory access (MEM). # Write-back cycle (WB). Each stage requires one clock cycle and an instruction passes through the stages sequentially. Without pipelining, in a
multi-cycle processor A multi-cycle processor is a processor that carries out one instruction over multiple clock cycles In electronics and especially Synchronous logic, synchronous digital circuits, a clock signal (historically also known as ''logic beat'') oscillate ...
, a new instruction is fetched in stage 1 only after the previous instruction finishes at stage 5, therefore the number of clock cycles it takes to execute an instruction is five (CPI = 5 > 1). In this case, the processor is said to be ''subscalar''. With pipelining, a new instruction is fetched every clock cycle by exploiting instruction-level parallelism, therefore, since one could theoretically have five instructions in the five pipeline stages at once (one instruction per stage), a different instruction would complete stage 5 in every clock cycle and on average the number of clock cycles it takes to execute an instruction is 1 (CPI = 1). In this case, the processor is said to be ''scalar''. With a single- execution-unit processor, the best CPI attainable is 1. However, with a multiple-execution-unit processor, one may achieve even better CPI values (CPI < 1). In this case, the processor is said to be '' superscalar''. To get better CPI values without pipelining, the number of execution units must be greater than the number of stages. For example, with six executions units, six new instructions are fetched in stage 1 only after the six previous instructions finish at stage 5, therefore on average the number of clock cycles it takes to execute an instruction is 5/6 (CPI = 5/6 < 1). To get better CPI values with pipelining, there must be at least two execution units. For example, with two executions units, two new instructions are fetched every clock cycle by exploiting instruction-level parallelism, therefore two different instructions would complete stage 5 in every clock cycle and on average the number of clock cycles it takes to execute an instruction is 1/2 (CPI = 1/2 < 01).


Examples


Example 1

For the multi-cycle MIPS, there are five types of instructions: * Load (5 cycles) * Store (4 cycles) *
R-type is a horizontally scrolling shooter arcade video game developed and released by Irem in 1987 and the first game in the ''R-Type'' series. The player controls a star ship, the R-9 "Arrowhead", in its efforts to destroy the Bydo, a powerful ...
(4 cycles) * Branch (3 cycles) *
Jump Jumping is a form of locomotion or movement in which an organism or non-living (e.g., robotic) mechanical system propels itself through the air along a ballistic trajectory. Jump or Jumping also may refer to: Places * Jump, Kentucky or Jump S ...
(3 cycles) If a program has: * 50% load instructions * 25% store instructions * 15% R-type instructions * 8% branch instructions * 2% jump instructions then, the CPI is: \text = \frac = 4.4


Example 2

Advanced Computer Architecture by Kai Hwang, Chapter 1, Exercise Problem 1.1 A 400 MHz processor was used to execute a benchmark program with the following instruction mix and clock cycle count: Determine the effective CPI, MIPS (Millions of instructions per second) rate, and execution time for this program. \text = \frac = \frac = 1.55 400\,\text = 400 ,000 ,000\,\text since: \text \propto 1/\text and \text \propto \text \text = \text = \frac \times = \frac= \frac = 258 \, \text Therefore: \text(T) = \text \times \text \times \text = \frac = \frac = \frac = 0.0003875 \, \text = 0.3875 \, \text


See also

* Cycle per second ( Hz) *
Instructions per cycle In computer architecture, instructions per cycle (IPC), commonly called instructions per clock is one aspect of a processor's performance: the average number of instructions executed for each clock cycle. It is the multiplicative inverse of ...
(IPC) *
Instructions per second Instructions per second (IPS) is a measure of a computer's processor speed. For complex instruction set computers (CISCs), different instructions take different amounts of time, so the value measured depends on the instruction mix; even for co ...
(IPS) * Megahertz myth * MIPS * The benchmark article provides a useful introduction to computer performance measurement for those readers interested in the topic.


References

{{DEFAULTSORT:Cycles Per Instruction Instruction processing Clock signal Rates Computer performance