Forums

C6711 DSK, DSPLIB, autocorrelation, double-word aligned?

Started by Joe May 30, 2005
Hey everybody

I am a newbie when it comes to C-programming and DSPs. I have been playing 
around with the autocorrelation-function that comes with TI's DSPLIB. I have 
made a small program to see how the autocorrelation-function works. The 
program compiles without errors but I do not get the right results. Here is 
the program:

#include "dspf_sp_autocor.h"

void main()
{

int nr=16;
int nx=16;

float r[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float x[16]={1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0};

 DSPF_sp_autocor (r,x,nx, nr);
while(1);
}

Is there somebody out there who can point me to a solution of the problem? 
The documentation talks about double-word alignment but I haven't been able 
to find out what that is?

The documentation for the function is on page 29 in this PDF:

http://users.cybercity.dk/~dsl159353/USERGUIDE.pdf

Thanks :o)



Joe wrote:
> > The documentation talks about double-word alignment but I haven't been able > to find out what that is?
Alignment in this case simply refers to where in memory the data is stored. If an array is to be, say, 128bit aligned (alignment is often specified in bits to remove ambiguity about the meaning of "word", "dword", etc), then the address of the start of the array must be divisible by 16. How you specify alignment depends on the compiler you are using. TI's compilers have a pragma, so for example: #pragma DATA_ALIGN(foo, 128) unsigned char foo[100]; would align foo on a 128 bit boundary. For memory allocated on the heap, MEM_alloc and friends allow you to specify the alignment as a parameter to the function. Cheers mark-r -- "Let's meet the panel. You couldn't ask for four finer comedians - so that answers your next question..." -- Humphrey Lyttleton