14
Software Examples
14 – 19
14.7.4
Block Floating-Point Scaling Subroutine
The bfp_adj routine checks the FFT output data for bit growth and scales
the entire set of data if necessary. This check prevents data overflow for
each stage in the FFT. The routine, shown in Listing 14.8, uses the
exponent detection capability of the shifter.
.MODULE
dit_radix_2_bfp_adjust;
{
Calling Parameters
Radix-2 DIT FFT stage results in inplacereal and inplaceimag
Return Parameters
inplacereal
and inplaceimag adjusted for bit growth
Altered Registers
I0,I1,AX0,AY0,AR,MX0,MY0,MR,CNTR
Altered Memory
inplacereal, inplaceimag, blk_exponent
}
.CONST
Ntimes2 = 2048;
.EXTERNAL
inplacereal, blk_exponent;
{Begin declaration section}
.ENTRY
bfp_adj;
bfp_adj:
AY0=CNTR;
{Check for last stage}
AR=AY0-1
IF EQ RTS;
{If last stage, return}
AY0=-2;
AX0=SB;
AR=AX0-AY0;
{Check for SB=-2}
IF EQ RTS;
{IF SB=-2, no bit growth, return}
I0=^inplacereal;
{I0=read pointer}
I1=^inplacereal;
{I1=write pointer}
AY0=-1;
MY0=H#4000;
{Set MY0 to shift 1 bit right}