ls_ztor.h

来自「realview22.rar」· C头文件 代码 · 共 106 行

H
106
字号
;
; $Copyright: 
; ----------------------------------------------------------------
; This confidential and proprietary software may be used only as
; authorised by a licensing agreement from ARM Limited
;   (C) COPYRIGHT 2000,2002 ARM Limited
;       ALL RIGHTS RESERVED
; The entire notice above must be reproduced on all authorised
; copies and copies may only be made to the extent permitted
; by a licensing agreement from ARM Limited.
; ----------------------------------------------------------------
; File:     ls_ztor.h,v
; Revision: 1.7
; ----------------------------------------------------------------
; $
;
; Optimised ARM assembler multi-radix FFT
; Please read the readme.txt before this file
;
; This file contains complex FFT -> real FFT conversion code

; register allocation

cptr    RN 0    ; pointer to twiddle coefficients
dptr    RN 1    ; pointer to FFT data working buffer
dinc    RN 2    ; (N/2)<<datalog, the size of the data in bytes
cinc    RN 3    ; bytes between twiddle values in the coefficient buffer
dout    RN 4    ; address to write the output (normally the same as dptr)


inL     RN 1    ; left (position k) in input buffer
inR     RN 2    ; right (position N/2-k) in input buffer
outL    RN 10   ; left (position k) in output buffer
outR    RN 11   ; right (position N/2-k) in output buffer

; data registers
x0r     RN 4
x0i     RN 5
x1r     RN 6
x1i     RN 7
x2r     RN 8
x2i     RN 9


t0      RN 12   ; these MUST be in correct order (t0<t1) for STM's
t1      RN 14

        MACRO
        LS_ZTOR
        SETSHIFT postldshift, norm
        SETSHIFT postmulshift, qshift
        ; prepare right hand pointers
        SUB     t0, dinc, #1<<$datalog  ; point to one before the end
        ADD     inR, inL, t0
        MOV     outL, dout
        ADD     outR, outL, t0
        ; do special case for first two elements
        LOADDATA inL, #1<<$datalog, x0r, x0i
        SHIFTDATA x0r
        ADD     x1r, x0r, x0i $postldshift
        SUB     x1i, x0r, x0i $postldshift
        STORE   outL, #1<<$datalog, x1r, x1i
        ADD     cptr, cptr, cinc
        ; add one to the shift since u,v calculation needs halving
        SETSHIFT postldshift, norm+1
10      ; loop over main entries to give y[k] and y[N/2-k]
        LOADDATA inL, #1<<$datalog, x0r, x0i    ; load out[k]
        LOADDATA inR, #-1<<$datalog, x1r, x1i   ; load out[N/2-k]
        SHIFTDATA x0r, x0i                      ; shift down input x0
        ; x2 = u[k] = sum of x[2*j]  *w^(2*j*k)
        ; y1 = v[k] = sum of x[2*j+1]*w^(2*j*k)
        SETREG  y1, x1i, x1r
        ADD     x2r, x0r, x1r $postldshift      ; x0r + x1r
        SUB     x2i, x0i, x1i $postldshift      ; x0i - x1i
        ADD     $y1r, x0i, x1i $postldshift     ; x0i + x1i
        RSB     $y1i, x0r, x1r $postldshift     ; -(x0r - x1r)
        ; now rotate y1 by w^k and put result in x0 so
        ; x0 = sum of x[2*j+1]*w^((2*j+1)*k)
        IF (architecture>=5):LAND:(qshift<16)
          LDR       t0, [cptr], cinc
          TWIDDLE_E x0r, x0i, t0, t1, $y1r, $y1i
        ELSE
          LOADCOEF  cptr, cinc, x0r, x0i
          TWIDDLE   $y1r, $y1i, x0r, x0i, t0, t1
        ENDIF
        ; now store x2+x0 and conj(x2-x0) in positions k and N/2-k
        ADD     x1r, x2r, x0r $postmulshift
        ADD     x1i, x2i, x0i $postmulshift
        STORE   outL, #1<<$datalog, x1r, x1i
        SUB     x1r, x2r, x0r $postmulshift
        RSB     x1i, x2i, x0i $postmulshift
        STORE   outR, #-1<<$datalog, x1r, x1i
        CMP     inL, inR
        BLT     %BT10
        ; now do final y[N/4] term
        LOADDATA inL,  #1<<$datalog, x0r, x0i
        SETSHIFT postldshift, norm
        SHIFTDATA x0r, x0i
        IF "$direction"="F"
          RSB   x0i, x0i, #0    ; conjuagate if w^(N/4)=-i
        ENDIF
        STORE    outL, #1<<$datalog, x0r, x0i
        MEND

        END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?