DSPRelated.com
Forums

Questions about the use of the DSPlib FFT functions on TMS320C6711

Started by dukke3d January 26, 2006
Hello I'm trying to simulate an FFT and an iFFT (with code composer
studio)using functions in DSPlib, in particular i'm using
DSPF_sp_fftSPxSP function. I have made to work with success the
following code:

#define CHIP_6711C
#include <stdio.h>
#include <stdlib.h>
#include <csl.h>
#include <csl_timer.h>
#include <math.h>

#include "twiddleSPxSP4096.h"
#include "brev_table.h"

#define PI (3.141592654)
#define NN (4096)

float x[2 * NN];
float y[2 * NN];

void main(void)
{
int i;
int k;
int j;
short F1 = 10, F2 = 40;
/*
====================================================================
*/
/* Generate input
data */
/*
====================================================================
*/
for(i=0; i<NN; i++)
{
/* real part */
x[2 * i] = (sin(2 * PI * F1 * i / NN) + sin(2 * PI * F2 * i / NN));
/* img part */
x[2 * i + 1] = 0;
}

DSPF_sp_fftSPxSP (NN, x ,w , y , brev ,4 ,0 ,NN);

DSPF_sp_ifftSPxSP (NN, y ,w , x , brev ,4,0 ,NN);
}

In "TMS320C67x DSP Library Programmer's Reference Guide"(spra657b)I
have read that "the c code of the functions is the equivalent of the
assembly code without restrictions" and that "the assembly code is
hand optimized and restrictions may apply".
What does it means?
If I call the functions as you can see in the program above,am I
using the hand optimized assembler routines or not?
In other words, simply calling the Dsplib functions with the c
language am I using the optimized code?



Short answer is - yes. You can call ASM from C and get all the so-called
hand-optimizations.

Restrcitions are probably related to array alignment in memory. The hand
coded ASM assumes particluar alignment so the LDDW instructions can be used.

- Andrew E. dukke3d wrote:

>Hello I'm trying to simulate an FFT and an iFFT (with code composer
>studio)using functions in DSPlib, in particular i'm using
>DSPF_sp_fftSPxSP function. I have made to work with success the
>following code:
>
>#define CHIP_6711C
>#include <stdio.h>
>#include <stdlib.h>
>#include <csl.h>
>#include <csl_timer.h>
>#include <math.h>
>
>#include "twiddleSPxSP4096.h"
>#include "brev_table.h"
>
>#define PI (3.141592654)
>#define NN (4096)
>
>float x[2 * NN];
>float y[2 * NN];
>
>void main(void)
>{
> int i;
> int k;
> int j;
> short F1 = 10, F2 = 40;
> /*
>====================================================================
>*/
> /* Generate input
>data */
> /*
>====================================================================
>*/
> for(i=0; i<NN; i++)
> {
> /* real part */
> x[2 * i] = (sin(2 * PI * F1 * i / NN) + sin(2 * PI * F2 * i / NN));
> /* img part */
> x[2 * i + 1] = 0;
> }
>
>DSPF_sp_fftSPxSP (NN, x ,w , y , brev ,4 ,0 ,NN);
>
>DSPF_sp_ifftSPxSP (NN, y ,w , x , brev ,4,0 ,NN);
>}
>
>In "TMS320C67x DSP Library Programmer's Reference Guide"(spra657b)I
>have read that "the c code of the functions is the equivalent of the
>assembly code without restrictions" and that "the assembly code is
>hand optimized and restrictions may apply".
>What does it means?
>If I call the functions as you can see in the program above,am I
>using the hand optimized assembler routines or not?
>In other words, simply calling the Dsplib functions with the c
>language am I using the optimized code?