Thread: is there multiple clock cycles?

  1. #1
    Registered User
    Join Date
    Apr 2010

    is there multiple clock cycles?

    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)

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

  4. #4
    Registered User
    Join Date
    May 2009
    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

  5. #5
    Registered User
    Join Date
    Dec 2011
    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.

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR
    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.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cpu clock cycles
    By begginer in forum C Programming
    Replies: 13
    Last Post: 03-30-2011, 07:17 AM
  2. multiple for cycles
    By ERJuanca in forum C Programming
    Replies: 4
    Last Post: 06-17-2009, 04:02 PM
  3. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 06:15 PM
  4. Multiple Cycles through Multi-Dimensional Array
    By DonFord81 in forum C Programming
    Replies: 2
    Last Post: 11-13-2008, 06:27 PM
  5. How many CPU cycles (ARM) for add vs if..then
    By Pea in forum C Programming
    Replies: 11
    Last Post: 01-26-2005, 02:40 PM