Forums

problems with TI's digit reversal, radix 4 FFT, C6713 DSK

Started by ece_student December 11, 2003
Hello All,

I'm writing a radix 4 FFT program for the c6713 DSK that calls TI's
function, cfftr4_dif. I believe that the FFT itself works; however,
I'm having trouble with the TI digit reversal functions,
digitrev_index and bitrev. I have greatly simplified my code, posted
below, to just test these functions. I notice that after the program
has run, x has most of its original values (integers) rearranged for a
radix 2 fft, but also has some very small and seemingly random
floating point numbers as well.

My first question is, do you see any obvious errors in the test code
below?

Another question is where can I find the most recent versions (source
code preferably, either assembly or C) of TI's routines,
digitrev_index and bitrev? The version of digitrev_index that I'm
using is written in C, but it has a copyright date of 1998. The
version of bitrev that I'm using came in the support files with Code
Composer Studio version 2.20.05.

Thanks for your help,
Joe


========================BEGIN SOURCE===============================
#define N 16		          	//number of FFT points
#define RADIX 4				    	//radix IS 4  

typedef struct Complex_tag {float re,im;}Complex;
Complex x[N]; 				    	//N complex data values
short iData[N];				    	//index for bitrev X
#pragma DATA_ALIGN(x,sizeof(Complex))	        //align x on boundary

void main() {
  int i=0;
  for( i=0 ; i<N ; i++) {
      x[i].re = (float)i;
      x[i].im = 0.0;
  }
  digitrev_index(iData, N, RADIX);	//produces index for bitrev() X 
  bitrev(x, iData, N);			      
}

=======================END SOURCE===================================
Check the size requirements for the data arrays associated with the FFT and
related functions - some of them require a few extra words at the end, but
this fact is not made obvious in the dsplib documentation.

Suggest you just try Complex x[N+4] and short iData[N+4] as a first cut -
maybe it will help.

Don Tunstall

"ece_student" <dietj0e@netscape.net> wrote in message
news:4216baed.0312110851.34b8313d@posting.google.com...
> Hello All, > > I'm writing a radix 4 FFT program for the c6713 DSK that calls TI's > function, cfftr4_dif. I believe that the FFT itself works; however, > I'm having trouble with the TI digit reversal functions, > digitrev_index and bitrev. I have greatly simplified my code, posted > below, to just test these functions. I notice that after the program > has run, x has most of its original values (integers) rearranged for a > radix 2 fft, but also has some very small and seemingly random > floating point numbers as well. > > My first question is, do you see any obvious errors in the test code > below? > > Another question is where can I find the most recent versions (source > code preferably, either assembly or C) of TI's routines, > digitrev_index and bitrev? The version of digitrev_index that I'm > using is written in C, but it has a copyright date of 1998. The > version of bitrev that I'm using came in the support files with Code > Composer Studio version 2.20.05. > > Thanks for your help, > Joe > > > ========================BEGIN SOURCE=============================== > #define N 16 //number of FFT points > #define RADIX 4 //radix IS 4 > > typedef struct Complex_tag {float re,im;}Complex; > Complex x[N]; //N complex data values > short iData[N]; //index for bitrev X > #pragma DATA_ALIGN(x,sizeof(Complex)) //align x on boundary > > void main() { > int i=0; > for( i=0 ; i<N ; i++) { > x[i].re = (float)i; > x[i].im = 0.0; > } > digitrev_index(iData, N, RADIX); //produces index for bitrev() X > bitrev(x, iData, N); > } > > =======================END SOURCE===================================