• Not Answered

Timing issues

Hello~

    I use 6678EVM to run a program ,counted use the internal register TSCL, the result is 141984243.Then I use the clock() function to count the same program ,it returns 1102514,how can the two results be so different,which one should I take?? I choose "CPU Execute Cycles" for clock. Thank you~  

4 Replies

  • Hobo Q,

    TSCL is single-function counter that will give you the number of clock cycles that occured since the TSC was started after reset. It will not be gated by execution cycles or affected by wait states or CPU stalls.

    You will have to explain more about where you accessed "the clock() function" to get any better explanation. Name the library, tool version, document reference name and document reference page/line, or whatever information will explain exactly what you have used.

    Regards and welcome to the TI E2E Forums,
    RandyP

  • In reply to RandyP:

    Thank you for your reply.I use clock() function and TSCL like 

    TSCL=0;

    a=TSCL;

    t_start=clock();

    ...

    FUNC();

    ...

    t_stop=clock();

    b=TSCL;

    cycle=b-a;

    t=t_stop-t_start;

    And the FUNC() is my program. The CCS version is 5.1.  Thank you ~

  • In reply to RandyP:

    RandyP

    Hobo Q,

    TSCL is single-function counter that will give you the number of clock cycles that occured since the TSC was started after reset. It will not be gated by execution cycles or affected by wait states or CPU stalls.

    You will have to explain more about where you accessed "the clock() function" to get any better explanation. Name the library, tool version, document reference name and document reference page/line, or whatever information will explain exactly what you have used.

    Regards and welcome to the TI E2E Forums,
    RandyP

    Thank you for your reply.I use clock() function and TSCL like 

    TSCL=0;

    a=TSCL;

    t_start=clock();

    ...

    FUNC();

    ...

    t_stop=clock();

    b=TSCL;

    cycle=b-a;

    t=t_stop-t_start;

    And the FUNC() is my program. The CCS version is 5.1.  Thank you ~

  • In reply to hobo Q:

    Hobo Q,

    hobo Q
    Then I use the clock() function to count the same program ,it returns 1102514,how can the two results be so different,which one should I take?? I choose "CPU Execute Cycles" for clock.

    I do not know where the clock() function comes from or what its return value is. Where did you choose "CPU Execute Cycles" for clock()?

    This clock() function is probably not returning the same value as TSCL. Please search through the API documents you have and the help files available to find out what value it returns. Without your help telling where you got it, I am not sure what we can say about it. Which header file declares it?

    1. Try putting the TSCL reads between the clock() calls and see how your cycle count varies.

    2. Keep in mind that the TSCL is only a 32-bit portion of the TSCH/TSCL pair and it will overflow/wrap-around after about 4 seconds at a 1GHz clock rate.

    Regards,
    RandyP