14
Software Examples
14 – 13
.INIT
inplaceimag: <inputimag.dat>;
.INIT
groups: N_div_2;
.INIT
bflys_per_group: 2;
.INIT
node_space: 2;
.INIT
blk_exponent: 0;
.INIT
padding: 0,0,0,0;
{Zeros after inplaceimag}
.GLOBAL
twid_real, twid_imag;
.GLOBAL
inplacereal, inplaceimag;
.GLOBAL
inputreal, inputimag;
.GLOBAL
groups, bflys_per_group, node_space, blk_exponent;
.EXTERNAL
scramble, fft_strt;
CALL scramble;
{subroutine calls}
CALL fft_strt;
TRAP;
{halt program}
.ENDMOD;
Listing 14.5 Main Module, Radix-2 DIT FFT
14.7.2
DIT FFT Subroutine
The radix-2 DIT FFT routine is shown in Listing 14.6. The constants N and
log2N are the number of points and the number of stages in the FFT,
respectively. To change the number of points in the FFT, you modify these
constants.
The first and last stages of the FFT are performed outside of the loop that
executes all the other stages. Treating the first and last stages individually
allows them to be executed faster. In the first stage, there is only one
butterfly per group, so the butterfly loop is unnecessary, and the twiddle
factors are all either 1 or 0, so no multiplications are necessary. In the last
stage, there is only one group, so the group loop is unnecessary, as are the