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.

MATHLIB C674x speed

Other Parts Discussed in Thread: OMAP-L138, MATHLIB

Hi,

I am working on a real time data processing application using OMAP-L138, where I need to use some math functions in the MATLIB library. The timing is critical so where can I get how many clock cycles it takes to calculate each function?

Thanks,

Kivanc

  • Hi,

    The cycle information can be found in the test report on Mathlib download page. The cycles reported are CPU cycles. The actual cycles from hardware could be higher due to cache penalties. Please let me know if this answers your question.

    regards,

    Yimin

  • Mehmet Hedili said:

    The timing is critical so where can I get how many clock cycles it takes to calculate each function?

    I did this with my code, but I use a different device than you (I use C6678).

    Regardless, you can get accurate hardware clock-cycle timing yourself using the Timestamp module from SYS/BIOS.

    /* Put this inside a Thread in SYS/BIOS */
    
    UInt32 t1 = 0;
    UInt32 t2 = 0;
    
    t1 = Timestamp_get32();
    /* call MATHLIB functions here */
    t2 = Timestamp_get32();
    
    /* Now, get your device's clock frequency */
    Types_FreqHz timestampFreq;
    Timestamp_getFreq(&timestampFreq);
    
    /* Display results in console */
    System_printf("\nDSP Freq: %u\n", timestampFreq.lo);
    System_printf("\ndT: %u\n", (t2-t1)/(timestampFreq.lo/1000000) );
    //note that dT should be in microseconds...
    
    System_exit(0);

    Is this what you're after?  It seems very practical and accurate to me.

  • Thank you for your answers. The reason I asked this question is I need the values for single precision sin, cos, atan and sqrt functions for a given input. This has to be done real time so I need to know the input frequency limit. If all those functions take about 100 clock cycles and I call them 4 times, for a 456MHz device I can get a maximum frequency of about 1MHz. Is that right?  

  • Yes,  (456Mhz) / (400 total clock cycles) = 1.14 MHz frequency.

    Fortunately, with the timing solution I suggested it should be possible to verify this for yourself in a real-time system.