Hello,
I have done a small program to find dot product of two arrays having 100 elements using DSPF_sp_dotprod. As per programmers guide at following link
page 4-55 each time the function execute it must take only 75 cycles,whereas in my program when optimization is off it takes about 2488 cycles at optimization level 3 it takes 135 cycles. Also when I reduce array length to half or double the results are almost 133 cycles at o3. No cycle count comes at rate given in manual.My program is given below. I set a breakpoint at dummy=0; and another at dummy++; and was watching profile clock cycles to measure cycles.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <limits.h>
#include ""dsplibc674x.h"
/* ======================================================================= */
/* Interface header files for the natural C and optimized C code */
/* ======================================================================= */
#define notaps 100
float aarr[notaps];
float barr[notaps];
float res;
volatile int dummy=0;
#pragma DATA_ALIGN(aarr, 8);
#pragma DATA_ALIGN(barr, 8);
int main()
{
float in;
int i;
for(i=0;i<notaps;i++)
{
aarr[i]=1.0;
barr[i]=100.0;
}
dummy=0;
res=DSPF_sp_dotprod(aarr,barr,notaps);
dummy++;
return (1);
}
Thanks in advance
With Regards
Shalini