Motorola DSP Developer's Kit | ![]() ![]() |
Y = mot###_fft X )
Description
This function performs the discrete Fourier transform (DFT) of input complex vector X
Input/Output
Input: Complex vector X (includes the real input data of vector Xr
, and the imaginary data input of vector Xi)
Output: Complex vector Y (includes the real output data of vector Yr
, and the imaginary output data of vector Yi
)
Algorithm
The algorithm is radix-2 DIT FFT.
Passnum = (int) (Log2(size) + 0.5); //calculated by mex function GroupPerPass= 1; ButterflyPerGroup = size / 2; Set coefficient table addressing mode as bit-reversed; Clear scaling bit; Set scaling down mode; Scalexp = 1; //scaling exponent for(i = 0; i < Passnum; i++) { pA = 0; /*address pointer of the first input of butterfly */ pB = pA + ButterflyPerGroup;/*address pointer of the second input of butterfly */ pC = 0; /*address pointer of coefficient lookup table C */ for (j = 0; j < GroupPerPass; j++) { for (k = 0; k < ButterflyPerGroup; k++) { Xr[pA] = Xr[pA] + Xr[pB]*Cr[pC] + Xi[pB]*Ci[pC]; Xi[pA] = Xi[pA] + Xi[pB]*Cr[pC] - Xr[pB]*Ci[pC]; Xr[pB] = 2*Xr[pA] - Xr[pA]; Xi[pB] = 2*Xi[pA] - Xi[pA]; pA ++; pB ++; } Clr scaling down mode; if has overflow { Set scaling down mode; Clr scaling bit; Scalexp++; } pA += ButterflyPerGroup; pB += ButterflyPerGroup; pC += size / 4; /* bit-reverse */ } ButterflyPerGroup >>= 1; GroupPerPass<<= 1; } Clear scaling bit; Set no scaling mode; Convert bit reverse order to normal order in-place;
Note Actual output data should be scaled up by 2^(Scalexp-1). This will be done by the MEX function. |
Memory & Register
Status Register
The assembly function fft-c.asm
does not explicitly set any status registers/bits during the function execution
Data Size Limit
The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
The value of input vector X must be between -1.0 and +1.0.
![]() | fft-r.asm | filter-r.asm | ![]() |