beautypg.com

Texas Instruments TMS320C64X User Manual

Page 133

background image

DSP_fft

4-105

C64x+ DSPLIB Reference

x0r = x[2*(i + 0) + 0]; x0i = x[2*(i + 0) + 1];

x1r = x[2*(i + 1) + 0]; x1i = x[2*(i + 1) + 1];

x2r = x[2*(i + 2) + 0]; x2i = x[2*(i + 2) + 1];

x3r = x[2*(i + 3) + 0]; x3i = x[2*(i + 3) + 1];

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/* Calculate the final FFT result from this butterfly. */

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

y0r = (x0r + x2r) + (x1r + x3r);

y0i = (x0i + x2i) + (x1i + x3i);

y1r = (x0r − x2r) + (x1i − x3i);

y1i = (x0i − x2i) − (x1r − x3r);

y2r = (x0r + x2r) − (x1r + x3r);

y2i = (x0i + x2i) − (x1i + x3i);

y3r = (x0r − x2r) − (x1i − x3i);

y3i = (x0i − x2i) + (x1r − x3r);

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/* Digit reverse our address to convert the digit−reversed input */

/* into a linearized output order. This actually results in a */

/* digit−reversed store pattern since we’re loading linearly, but */

/* the end result is that the FFT bins are in linear order. */

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

DIG_REV(i, m, j); /* Note: Result is assigned to ’j’ by the macro. */

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

/* Store out the final FFT results. */

/* −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− */

y[2*(j + 0) + 0] = y0r; y[2*(j + 0) + 1] = y0i;

y[2*(j + s) + 0] = y1r; y[2*(j + s) + 1] = y1i;

y[2*(j + 2*s) + 0] = y2r; y[2*(j + 2*s) + 1] = y2i;

y[2*(j + 3*s) + 0] = y3r; y[2*(j + 3*s) + 1] = y3i;

}

}