Cycles Per Instruction
Encyclopedia
|
| Tutorials | Encyclopedia | Dictionary | Directory |
|
![]()
Cycles Per Instruction
In computer architecture, Cycles per instruction (clock cycles per instruction or clocks per instruction or CPI) is a term used to describe one aspect of a processor's performance: the number of clock cycles that happen when an instruction is being executed. It is the multiplicative inverse of Instructions Per Cycle.
ExplanationLet us assume a Classic RISC pipeline, with the following 5 stages:
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 stage pipeline 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 processors) can achieve a CPI of 0.5 when two instructions are completing every clock cycle. CalculationsMulti-cycle ExampleFor the multi-cycle MIPS, there are 5 types of instructions:
If a program has
Then, the CPI is: CPI = (4 x 50 + 5 x 15 + 4 x 25 + 3 x 8 + 3 x 2) / 100 = 4.05 Example40-MHz processor was used to execute a benchmark program with the following instruction mix and clock cycle count:
Determine the effective CPI, MIPS rate, and execution time for this program. total instruction count = 100000 CPI = (45000*1 + 32000*2 + 15000*2 + 8000*2)/100000 = 1550000/100000 = 1.55 MIPS = clock frequency/(CPI*1000000) = (40*1000000)/(1.55*1000000) = 25.8 Execution time (T) = CPI*Instruction count*clock time = CPI*Instruction count/frequency = 1.55*100000/40000000 = 1.55/400 = 3.87 ms Ans. See also
Source: Wikipedia | The above article is available under the GNU FDL. | Edit this article
|
|
top
©2008-2009 TutorGig.com. All Rights Reserved. Privacy Statement