This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OMAP-L138: Regarding Timing Calculation of C codes or Functions using CCS 9.3.0

Part Number: OMAP-L138
Other Parts Discussed in Thread: OMAPL138

I am using OMAPl138 DSP evaluation board(LCDKOMAP138). As Timing is Processing time is the critical issue for my code, I am unable to check how to find the Processing time for Each C code or Functions in CCS. Please, help me to resolve this issue.

  •  And  Adding to the question as in the TMS320C67x DSP Library Programmer's Reference Guide (Rev. C) Documentation, for Each code as it was mentioned the number of clock cycles required for each function. How can I verify whether my timing/ Clock cycles I am able to meet or not? Please, find this below image for Reference from the document(spru657).

  • Hi Manikanta,

    There is a free running 64-bit counter, which you can use for counting cycles.

    You can refer to sprufe8 (rev b) document for CPU and Instruction set for C674x DSP.

    Note that to start counting you need to initialize TSCL to 0. You can initialize TSCL to 0, and then do the following:

    1. Initialize TSCL = 0

    2. Read TSC (lo) and TSC (hi) values (Start values)

    3. Call the function of interest for benchmark

    4. Read TSC (lo) and TSC (hi) values (End values)

    5. Compute the difference between End and Start to get the cycles. That should provide you the cycle information for the function under 3.

    Snippet

  • Thanks Aravind, your answer helped me lot to resolve the issue.

  • Glad to hear that it resolved your issue.

  •  I am using OMAPL138 with Evaluation board(LCDK OMAPl138) with emulator XDS560v2 System Trace Emulator (STM).

    I did the Timing Calculation for FIR filter both in C and ASM as follows.

    //FIR filter in ASM

    __asm(" MVC B0,TSCL");
    #if 1
    __asm(" MVC TSCL,B0\n"
    " MVC TSCH,B1");

    #endif

    DSPF_sp_fir_gen_asm(x,h,r,nh,nr); // FIR filter ASM code from TI DSP library.
    //x->Input
    //h->Filter Coefficeients
    //r->Output Array
    //nh->No.of Coeeficients
    //nr->No.of Output Values


    __asm(" MVC TSCL,B0\n"
    " MVC TSCH,B1");

    Reading from the TSCL registers before and after Function calling, I am noting down the Register values and checking the Instruction cycles. But I am not able to meet timing as what TI mentioned in the  Document TMS320C67x DSP Library Programmer’s Reference Guide(SPRU657C) for FIR filter 

    with the above Calculation I am getting around 2,55,008 Cycles and Observing the cycles from TI library code on board 81,19,767. Filter Specification are as follows.

    nh=46;nr=10000; as per formula.

    Please, let me know if something wrong in my calculation or assumption or any other ways to check. As timing is very crucial in my case and I am new to TI DSP.

    Thanks in advance.

  • Hi Manikanta,

    The placement of code and data, enabling cache plays significant role in the cycles. 

    By the way, You do not need to initialize TSCH. Please don't update TSCH out of power cycle. You can write TSCL=0 to start counting.

    1. Keep the Program and Data in the internal memory, if you have placed them in external memory
    2. Make sure you have Cache enabled.
    3. Verify the cycles info for the values that is shown in the data sheet of DSPLIB. with NH=10, NR=100, you should be getting cycles around 780 cycles. If not, you can single step the code and identify the instructions that is impacting this, to get the cycles formula for your settings.
    4. Once you figure out the cycles formula, for the code/data placement and cache settings for your case, you can verify it for other inputs like you provided.

    Thanks

  • Hi Manikanta,

    I assume above suggestions worked. Closing the thread for now.