Clock cycle vs operating cycle

Discussion in 'Embedded Systems and Microcontrollers' started by patheticz, Nov 17, 2009.

  1. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
    Is it true that the operating cycle and the clock cycle are two different things altogether?
    For example, in a DSP data sheet, an instruction MAC requires 1 cycle to execute. Does that mean the operation can be completed in 1 clock cycle?
    I read in a 8051 uP book which states that a cycle consist of 6 states, and each state consist of 2 clock cycles.
    Is it true?
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    They are usually different things. Quite often different instructions take different times as well. For example AMD CPUs used to run at slower clock frequencies that Intel ones but got more instructions done in every clock cycle.
    Some PIC microcontrollers do 1 instruction every 4 clock cycles but program jumps take twice as long.
    Because the BASIC stamp runs interpreted code, different instructions take very different times to execute.

    I wish the forum would tell me if someone had already answered the post while I was slowly typing.....
     
    Last edited: Nov 17, 2009
  3. studiot

    AAC Fanatic!

    Nov 9, 2007
    5,005
    513
    Look carefully at the size of the registers, the bus and the memory address space.

    Different devices have to load the address info in chunks defined by the width of the bus.
     
  4. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
    so how do i know how many clock cycles are there in an instruction cycle for a particular DSP chip?
    i am looking at the TMS320F28346
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    It is pretty common for the instruction set to have included in it the execution time for each instruction, and differences depending on things like branches taken, etc.
     
  6. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
  7. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Looks like it is going to be 1:1

    FEATURE TYPE(1) F2809 F2808 F2806 F2802 F2801 C2802 C2801
    Instruction cycle (at 100 MHz) – 10 ns 10 ns 10 ns 10 ns 10 ns 10 ns 10 ns
     
  8. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
    where can you get such informations?
    which page of which set of data sheet/manual?
     
  9. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
  10. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
    lets talk about the chip you are referring to then.
    say i clock the chip at 150MHz, which means one clock cycle will take 6.67ns.
    Wouldn't that mean the instruction cycle take only one clock cycle?

    Because i have seen from other sources that each instruction will take more than one clock cycle.
     
  11. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    It does look like most instructions take 1 clock cycle on this chip. Some of the instructions do take longer but the datasheet has the number of cycles for the instruction in the details starting page 175 of the datasheet you linked to.
     
  12. patheticz

    Thread Starter New Member

    Nov 3, 2009
    28
    0
    I am confused here...
    If that is the case, won't it contradict one earlier reply in the same thread?
    That reply mentioned about the instruction cycle being different from the clock/oscillator cycle...

    So which is correct, especially for a DSP chip?
     
  13. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    A lot of the previous answers were from before you stated what chip you would be using and the number of clock cycles per instruction on different chips varies a lot. Some chips use a lot of clock cycles per instruction, some use less than one. You happen to have picked one that is 1:1 (for most instructions).
    The previous answers were not wrong, they were just talking in general, not knowing what chip you would be using.
     
Loading...