📄 rfft_brc.asm
字号:
;========================================================================
;
; File Name : rfft_brc.asm
;
; Originator : Digital Control Systems Group
; Texas Instruments
;
; Description : This file contains source code to suffle the 2N-point real sequence
; as N-point complex sequence in bit reversed order
;
; Date : 13/4/2001
;======================================================================
;
; Routine Type : C Callable
;
; Usage :
; void rfft_brc(int *src, int *dst, ushort n)
; This function shuffles 2N-point in-order array and stores it as N-point complex
; array in bit-reversed order. This is helpful for Real FFT computation on the 2N-point
; real sequence using N-point complex FFT module
;=====================================================================
; SOURCE ARRAY
; | X(0) |
; | X(1) |
; | X(2) |
; | X(3) |
; :
; :
; | X(2N-1) |
;=====================================================================
; Function Local Frame
;======================================================================
; |_______|
; |_______|<- Stack Pointer (FP+1) <---AR1
; |_______|<- Reg to Reg Tfr (FP) <---AR5
; |_______|<- Context Save AR7 (FP-1)
; |_______|<- Old FP (AR0) (FP-2)
; |_______|<- Return Address of the Caller (FP-3)
; |_______|<- src (FP-4)
; |_______|<- dst (FP-5)
; |_______|<- n (FP-6)
;======================================================================
__FFTR_brev_frs .set 00001h ; Local frame size for this routine
.def _FFTR_brev
_FFTR_brev:
POPD *+ ; Store the Return Address in stack
SAR AR0,*+ ; Store the Caller's Frame Pointer
SAR AR7,*+
SAR AR1,*
LAR AR5,*
LAR AR0,#__FFTR_brev_frs
LAR AR0,*0+,AR2 ; Create Local frame
LAR AR2,#0FFFCh ; ARP=AR2, AR2=-4
MAR *0+ ; ARP=AR2, AR2->src
LAR AR0,* ; ARP=AR2, AR2->src, AR0=src
LAR AR3,*- ; ARP=AR2, AR2->dst, AR3=src
LAR AR4,*-,AR4 ; ARP=AR4, AR4=dst, AR2->n
CMPR 0 ; Check src==dst
BCND OFFBREV,NTC ; If not equal, jump to off place bit rev
MAR *,AR2 ; ARP=AR2, AR2->size
LAR AR7,*,AR7 ; ARP=AR7, AR7=size
MAR *-,AR3 ; ARP=AR3, AR3=src, AR7=size-1
brevLP1: LACC *,16,AR4 ; ARP=AR4, AR4=dst, ACCH=*src
ADDS *,AR5 ; ARP=AR5, AR5=FP, ACCL=*dst
SAR AR4,* ; ARP=AR5, AR5=FP, (FP)=dst
LAR AR0,*,AR3 ; ARP=AR3, AR3=src, AR0=dst
CMPR 1 ; check src<dst
BCND noswap,NTC ; if src<dst, do not swap *src & *dst
SACL *+,AR4 ; ARP=AR4, AR4=dst, *src=*dst, AR3=src+1
SACH *+,AR3 ; ARP=AR3, AR3=src, *dst=*src, AR4=dst+1
LACC *,16,AR4 ; ARP=AR4, AR4=dst+1, ACCH=*(src+1)
ADDS *,AR3 ; ARP=AR3, AR3=src+1, ACCL=*(dst+1)
SACL *-,AR4 ; ARP=AR4, AR4=dst+1, AR3=src, *(src+1)=*(dst+1)
SACH *-,AR3 ; ARP=AR3, AR3=src, AR4=dst, *(dst+1)=*(src+1)
noswap: MAR *+,AR2 ; ARP=AR2, AR2->size, AR3=src+1
LAR AR0,*,AR3 ; ARP=AR3, AR3=src+1, AR0=size, AR2->size
MAR *+,AR4 ; ARP=AR4, AR4=dst, AR3=src+2
MAR *BR0+,AR7 ; ARP=AR7, AR7=size-1, dst=br(dst+size)
BANZ brevLP1,*-,AR3 ; ARP=AR3, AR3->src+2, AR7=AR7-1
MAR *,AR1
SBRK #(__FFTR_brev_frs+1) ; Clear the local frame
LAR AR7,*-
LAR AR0,*- ; Retrive Caller's frame pointer
PSHD * ; Push the return address to TOS
RET
OFFBREV: MAR *,AR2 ; ARP=AR2, AR2->size
LAR AR0,* ; ARP=AR2, AR2->size, AR0=size
LAR AR7,*,AR7 ; ARP=AR7, AR7=size
MAR *-,AR3 ; ARP=AR3, AR3=src, AR7=size-1
offbrevLP LACC *+,16 ; ARP=AR3, AR3=src+1, ACCH=*src
ADDS *+,AR4 ; ARP=AR4, AR4=dst, AR3=src+2, ACCL=*(src+1)
SACH *+ ; ARP=AR4, AR4=dst+1, *dst=*src
SACL *- ; ARP=AR4, AR4=dst, *(dst+1)=*(src+1)
MAR *BR0+,AR7 ; ARP=AR7, AR7=size-1, AR4=br(dst+size)
BANZ offbrevLP,*-,AR3 ; ARP=AR3, AR3->src+2, AR7=AR7-1
MAR *,AR1
SBRK #(__FFTR_brev_frs+1) ; Clear the local frame
LAR AR7,*-
LAR AR0,*- ; Retrive Caller's frame pointer
PSHD * ; Push the return address to TOS
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -