/************************************************************************************ * ditr2fft_fixpt_intr.c - Fix-point complex radix-2 decimation-in-time FFT algorithm * using C5000 intrinsics for CCS * ************************************************************************************/ #include "def_complex_fixpt.h" /* floating-point complex.h header file */ void ditr2fft_fixpt_intr(complex *X, unsigned int EXP, complex *W, unsigned int SCALE) { lcomplex ltemp; /* temporary storage of complex variable */ complex temp; complex U; /* twiddle factor W^k */ unsigned int i,j; unsigned int id; /* index for lower point in butterfly */ unsigned int N=1<>1; /* number of butterflies in sub-DFT */ U.re = 32767; U.im = 0; for (j=0; j>16); temp.re = _sadd(temp.re, 1)>>scale; /* Rounding & scale */ ltemp.im = _lsmpy(X[id].im, U.re); temp.im = (_smac(ltemp.im, X[id].re, U.im)>>16); temp.im = _sadd(temp.im, 1)>>scale; /* Rounding & scale */ X[id].re = _ssub(X[i].re>>scale, temp.re); X[id].im = _ssub(X[i].im>>scale, temp.im); X[i].re = _sadd(X[i].re>>scale, temp.re); X[i].im = _sadd(X[i].im>>scale, temp.im); } /* Recursive compute W^k as U*W^(k-1) */ ltemp.re = _lsmpy(U.re, W[L-1].re); ltemp.re = _smas(ltemp.re, U.im, W[L-1].im); ltemp.im = _lsmpy(U.re, W[L-1].im); ltemp.im = _smac(ltemp.im, U.im, W[L-1].re); U.re = ltemp.re>>16; U.im = ltemp.im>>16; } } }