📄 fftspx_h.asm
字号:
* w = ptr_w + tw_offset; *
* *
* for (i = 0; i < n; i += 4) *
* { *
* co1 = w[j]; *
* si1 = w[j+1]; *
* co2 = w[j+2]; *
* si2 = w[j+3]; *
* co3 = w[j+4]; *
* si3 = w[j+5]; *
* *
* x_0 = x[0]; *
* x_1 = x[1]; *
* x_h2 = x[h2]; *
* x_h2p1 = x[h2+1]; *
* x_l1 = x[l1]; *
* x_l1p1 = x[l1+1]; *
* x_l2 = x[l2]; *
* x_l2p1 = x[l2+1]; *
* *
* xh0 = x_0 + x_l1; *
* xh1 = x_1 + x_l1p1; *
* xl0 = x_0 - x_l1; *
* xl1 = x_1 - x_l1p1; *
* *
* xh20 = x_h2 + x_l2; *
* xh21 = x_h2p1 + x_l2p1; *
* xl20 = x_h2 - x_l2; *
* xl21 = x_h2p1 - x_l2p1; *
* *
* ptr_x0 = x; *
* ptr_x0[0] = xh0 + xh20; *
* ptr_x0[1] = xh1 + xh21; *
* *
* ptr_x2 = ptr_x0; *
* x += 2; *
* j += 6; *
* predj = (j - fft_jmp); *
* if (!predj) x += fft_jmp; *
* if (!predj) j = 0; *
* *
* xt0 = xh0 - xh20; *
* yt0 = xh1 - xh21; *
* xt1 = xl0 + xl21; *
* yt2 = xl1 + xl20; *
* xt2 = xl0 - xl21; *
* yt1 = xl1 - xl20; *
* *
* ptr_x2[l1 ] = xt1 * co1 + yt1 * si1; *
* ptr_x2[l1+1] = yt1 * co1 - xt1 * si1; *
* ptr_x2[h2 ] = xt0 * co2 + yt0 * si2; *
* ptr_x2[h2+1] = yt0 * co2 - xt0 * si2; *
* ptr_x2[l2 ] = xt2 * co3 + yt2 * si3; *
* ptr_x2[l2+1] = yt2 * co3 - xt2 * si3; *
* } *
* tw_offset += fft_jmp; *
* stride = stride>>2; *
* }/* end while */ *
* *
* j = 0; *
* *
* ptr_x0 = ptr_x; *
* y0 = ptr_y; *
* l0 = _norm(n) - 17; /* get size of fft */ *
* *
* if (radix <= 4) for (i = 0; i < n; i += 4) *
* { *
* /* reversal computation */ *
* *
* j0 = (j ) & 0x3F; *
* j1 = (j >> 6) & 0x3F; *
* k0 = brev[j0]; *
* k1 = brev[j1]; *
* k = (k0 << 6) | k1; *
* k = k >> l0; *
* j++; /* multiple of 4 index */ *
* *
* x0 = ptr_x0[0]; x1 = ptr_x0[1]; *
* x2 = ptr_x0[2]; x3 = ptr_x0[3]; *
* x4 = ptr_x0[4]; x5 = ptr_x0[5]; *
* x6 = ptr_x0[6]; x7 = ptr_x0[7]; *
* ptr_x0 += 8; *
* *
* xh0_0 = x0 + x4; *
* xh1_0 = x1 + x5; *
* xh0_1 = x2 + x6; *
* xh1_1 = x3 + x7; *
* *
* if (radix == 2) { *
* xh0_0 = x0; *
* xh1_0 = x1; *
* xh0_1 = x2; *
* xh1_1 = x3; *
* } *
* *
* yt0 = xh0_0 + xh0_1; *
* yt1 = xh1_0 + xh1_1; *
* yt4 = xh0_0 - xh0_1; *
* yt5 = xh1_0 - xh1_1; *
* *
* xl0_0 = x0 - x4; *
* xl1_0 = x1 - x5; *
* xl0_1 = x2 - x6; *
* xl1_1 = x3 - x7; *
* *
* if (radix == 2) { *
* xl0_0 = x4; *
* xl1_0 = x5; *
* xl1_1 = x6; *
* xl0_1 = x7; *
* } *
* *
* yt2 = xl0_0 + xl1_1; *
* yt3 = xl1_0 - xl0_1; *
* yt6 = xl0_0 - xl1_1; *
* yt7 = xl1_0 + xl0_1; *
* *
* if (radix == 2) { *
* yt7 = xl1_0 - xl0_1; *
* yt3 = xl1_0 + xl0_1; *
* } *
* *
* y0[k] = yt0; y0[k+1] = yt1; *
* k += n>>1; *
* y0[k] = yt2; y0[k+1] = yt3; *
* k += n>>1; *
* y0[k] = yt4; y0[k+1] = yt5; *
* k += n>>1; *
* y0[k] = yt6; y0[k+1] = yt7; *
* } *
* } *
* CYCLES *
* cycles = 3.25 * ceil(log4(N)-1) * N + 3*N + 179 *
* e.g. N = 1024, cycles = 16563 *
* e.g. N = 512, cycles = 8371 *
* e.g. N = 256, cycles = 3443 *
* e.g. N = 128, cycles = 1811 *
* e.g. N = 64, cycles = 729 *
* *
* REFERENCES *
* [1] C. S. Burrus and T.W. Parks (1985) "DFT/FFT and Convolution Algos - *
* Theory and Implementation", J. Wiley. *
* [2] Implementation of Various Precision Fast Fourier Transforms on the *
* TMS320C6400 processor - David J. Hoyle, ESC 2000 *
* [3] Burrus - Paper on converting radix4 to radix2 digit reversal. *
* *
* CODESIZE *
* 1312 bytes *
* *
*==============================================================================*
* Copyright (C) 1997-2000 Texas Instruments Incorporated. *
* All Rights Reserved *
*==============================================================================*
.sect ".data:copyright_h"
_Copyright: .string "Copyright (C) 2000 Texas Instruments Incorporated."
.string "All Rights Reserved."
.global _fftSPxSP_asm
.sect ".text:hand"
_fftSPxSP_asm:
* ====================== SYMBOLIC REGISTER ASSIGNMENTS ======================= *
.asg B15, B_SP ;stack pointer
.asg A7, A_SP ;stack pointer copy
.asg A5, A_csr ;orginal CSR
.asg B5, B_csr ;orginal CSR
.asg A3, A_csr_no_gie ;CSR no interupts
.asg A4, A_n ;number of points to transform
.asg B4, B_ptr_x ;pointer to time domain data
.asg A6, A_ptr_w ;pointer to twiddle factor array
.asg B6, B_ptr_y ;pointer to output frequency domain
.asg A8, A_brev ;pointer to bit reverse table
.asg B8, B_radix ;smallest butterfly size
.asg A10, A_offset ;offset of fft in the output array
.asg B10, B_n_max ;largest fft used
.asg B14, B_stride ;size of butterfly
.asg A3, A_tw_offset ;offset into twiddle array
.asg A9, A_j ;index into twiddle table
.asg B7, B_x ;copy of pointer to transfomred data
.asg A7, A_fft_jmp ;correction factor in index
.asg A8, A_w0 ;current pointer to twiddle factors
.asg A2, A_i ;loop counter
.asg B2, B_while ;while loop condition for end
.asg B12, B_xp0 ;x[2*i]
.asg B13, B_xp1 ;x[2*i+1]
.asg B0, B_x_ ;copy of pointer to transformed data
.asg A12, A_xh2p0 ;x[N/2 +i*2 ]
.asg A13, A_xh2p1 ;x[N/2 +i*2+1]
.asg B8, B_xl1p0 ;x[N +i*2 ]
.asg B9, B_xl1p1 ;x[N +i*2+1]
.asg A10, A_xl2p0 ;x[3*N/2+i*2 ]
.asg A11, A_xl2p1 ;x[3*N/2+i*2+1]
.asg B9, B_xh0 ;intermediate butterfly calculation
.asg B8, B_xh1 ;intermediate butterfly calculation
.asg B2, B_xl0 ;intermediate butterfly calculation
.asg B1, B_xl1 ;intermediate butterfly calculation
.asg A0, A_xh20 ;intermediate butterfly calculation
.asg A12, A_xh21 ;intermediate butterfly calculation
.asg A3, A_xl20 ;intermediate butterfly calculation
.asg A5, A_xl21 ;intermediate butterfly calculation
.asg B9, B_y0 ;new x[2*i]
.asg B4, B_y1 ;new x[2*i+1]
.asg B6, B_ptr_x0 ;copy of pointer to data
.asg B5, B_ptr_x1 ;copy of pointer to data
.asg A4, A_ptr_x1 ;copy of pointer to data
.asg A15, A_si10 ;sin(2*PI*i/N)
.asg A14, A_co10 ;cos(2*PI*i/N)
.asg B11, B_si20 ;sin(4*PI*i/N)
.asg B10, B_co20 ;cos(4*PI*i/N)
.asg A11, A_si30 ;sin(6*PI*i/N)
.asg A10, A_co30 ;cos(6*PI*i/N)
.asg A7, A_fft_jmp ;copy of fft_jmp
.asg B3, B_fft_jmp ;copy of fft_jmp
.asg A3, A_prj_ ;predicate to test for new butterfly
.asg A1, A_prj ;copy of prj_
.asg B1, B_xt0 ;intermediate butterfly calculation
.asg B1, B_yt0 ;intermediate butterfly calculation
.asg A5, A_yt2 ;intermediate butterfly calculation
.asg A3, A_xt1 ;intermediate butterfly calculation
.asg B2, B_xt2 ;intermediate butterfly calculation
.asg B2, B_yt1 ;intermediate butterfly calculation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -