Table 7.4 (continued )
j À k;
k ) 1;
}
j k;
if(i < j)
{
temp X [j];
X [j] X [i];
X [i] temp;
}
}
}
Based on the floating-point C function, the fixed-point conversion is done by employ-
ing the C intrinsic functions. The implementation of the decimation-in-time FFT butter-
fly computation using the C55x intrinsics is listed below:
ltemp.re _lsmpy(X [id].re, U.re);
temp.re (_smas(ltemp.re, X [id].im, U.im) ) 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);
In the program, X []is the complex sample buffer and U is the complex twiddle factor.
The scale is done by right-shifting 1-bit instead of multiply by 0.5.
Go through the following steps for Experiment 7A:
1. Verify the floating-point C programs test_fft.c, fft_float.c, fbit_rev.c,
and fcomplex.h using a PC or C55x simulator. The output should be all zeros
except X(k) and X(NÀk). These squared values are equal to 1.0. The floating-point
program will be used as reference for the code development using the fixed-point
C and assembly language. The floating-point program uses the floating-point data
file input7_f.dat, while the fixed-point data file input7_i.dat will be used for
the rest of experiments.
2. Create the project exp7a using CCS. Add the command file exp7.cmd, the
functions epx7a.c, fft_a.c, and ibit_rev.c, and the header file
icomplex.h from the software package into the project.
340
FAST FOURIER TRANSFORM AND ITS APPLICATIONS