For CPI I'm given the following equation. Why does it say CPU clock cycles, doesn't the entire system operate on the same clock cycle, as dictated by the clock?
CPI=(CPU clock cycles)/(Instruction count)
For CPI I'm given the following equation. Why does it say CPU clock cycles, doesn't the entire system operate on the same clock cycle, as dictated by the clock?
CPI=(CPU clock cycles)/(Instruction count)
In other words, it is possible for an instruction to take more than one clock cycle to complete, e.g., processing an instruction may take multiple steps, with each step happening based on a clock cycle.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Well that really depends on your machine doesn't it.
ARM (and other RISC processors) typically do one instruction per tick.
x87 (and other CISC processors) have a much wider range.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I suggest looking up machine cycle time if you still do not understand the question.
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
Not only do different instructions take different amounts of cycles, the average cycle number is often incorrect. It disregards un-cached data, branch misprediction, unaligned access, types of operands and the latency to access the devices, pipelining, and a multitude of other factors that could influence the speed of the instruction.
Additionally, some other operations use microcode which could be very complicated, especially for FPU operations, which will complicate matters further.
You might want to look here for clarification and demonstration.
The motherboard generates a clock signal that the CPU multiplies up (via PLL) to generate its own clock. The CPU clock is much faster than all the other clocks in the system. Modern CPUs can even change their clock rate as they are operating. Thus, the term is qualified CPU clock cycles, because computers haven't operated on a single shared clock for decades.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}