AnsweredAssumed Answered

How do I benchmark or count system cycles of a segemnt of code on the ADSP-CM40x?

Question asked by vinodbableshwar on Sep 23, 2013

You can use the Systick Timer available with the cortex M4 core to benchmark a section of the code as below:



long long sys_count=0,dd=0,final=0;

long long count1=0,count2=0;


void main()



//code to be benchmarked




void start_cnt()


*pREG_SCS0_STRVR=0xFFFFFF;  //Initial 24-bit count(decrements from here)

*pREG_SCS0_STCVR=0;         //Current value of countdown

*pREG_SCS0_STCSR=7;         //interrupt and timer enable



void stop_cnt()



final=(sys_count*0xffffff)+dd;   //holds the final cycle count



  void SysTick_Handler ()


sys_count++;    //keep track of number of timer overflows