📄 cfft_br1c.asm
字号:
;========================================================================
;
; File Name : cfft_br1c.asm
;
; Originator : Digital Control Systems Group
; Texas Instruments
;
; Description : This file contains source code to bit reverse the N-point real-data sequence
; stored in contiguous memory locations
;
; Date : 30/3/2001
;======================================================================
;
; Routine Type : C Callable
;
; Usage :
; void FFTC_brev1(int *src, int *dst, ushort size)
; This function bit reverses the N-point real sequence stored in contiguous memory locations
; to perform N-point Complex FFT computation. If src=dst, then it performs in-place bit reversal.
; The destination array must be aligned to 2N words
;====================================================================
; INPUT ARRAY
; |Xr(0)|
; |Xr(1)|
; |Xr(2)|
; |Xr(3)|
; :
; :
;======================================================================
; Function Local Frame
;======================================================================
; |_______|
; |_______|<- Stack Pointer (FP+2) <---AR1
; |_______|<- Temp (FP+1)
; |_______|<- Reg to Reg Tfr (FP)
; |_______|<- 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)
;======================================================================
__FFTC_brev1_frs .set 00002h ; Local frame size for this routine
.def _FFTC_brev
.global _FFTC_brev
_FFTC_brev:
POPD *+ ; Store the Return Address in stack
SAR AR0,*+ ; Store the Caller's Frame Pointer
SAR AR7,*+
SAR AR1,*
LAR AR5,*
LAR AR0,#__FFTC_brev1_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->size
CMPR 0 ; Check src==dst
BCND OFFBREV,NTC ; If not equal, jump to off place bit rev
MAR *,AR2 ; ARP=AR2, AR2->size
LACL *+,AR5 ; ARP=AR5, AR5=FP, AR2->dst, ACCL=size
SFR ; ARP=AR5, AR5=FP, ACCL=size/2
SACL * ; ARP=AR5, (FP)=size/2
LAR AR7,*+,AR7 ; ARP=AR7, AR7=size/2, AR5->temp
MAR *-,AR3 ; ARP=AR3, AR3=src, AR7=(size/2)-1
brev1LP1: LACC *,16,AR4 ; ARP=AR4, AR4=dst, ACCH=*src
ADDS *,AR5 ; ARP=AR5, AR5->temp, ACCL=*dst
SAR AR4,* ; ARP=AR5, AR5->temp, temp=dst
LAR AR0,*-,AR3 ; ARP=AR3, AR3=src, AR5=FP, AR0=dst
CMPR 1 ; check AR3<AR0
BCND noswap,NTC ; if src<dst, do not swap *src & *dst
SACL *,AR4 ; ARP=AR4, AR4=dst, *src=*dst
SACH *,AR3 ; ARP=AR3, AR3=src, *dst=*src
noswap: MAR *+,AR5 ; ARP=AR5, AR5=FP, (FP)=size/2, AR3=src+1
LAR AR0,*+,AR3 ; ARP=AR3, AR3=src+1, AR0=size/2, AR5->temp
MAR *+,AR4 ; ARP=AR4, AR4=dst, AR3=src+2
MAR *BR0+,AR7 ; ARP=AR7, AR7=(size/2)-1, dst=br(dst+size/2)
BANZ brev1LP1,*-,AR3 ; ARP=AR3, AR3->src+2, AR7=AR7-1
MAR *,AR2 ; ARP=AR2, AR2->dst
LAR AR3,*,AR5 ; ARP=AR5, AR5->temp, AR3=dst=src
SBRK #1 ; ARP=AR5, AR5=FP, (FP)=size/2
LACC *+,1,AR2 ; ARP=AR2, AR2->dst, AR5->temp, ACCL=size
ADDS *,AR5 ; ARP=AR5, AR5->temp, ACCL=dst+size
SACL * ; ARP=AR5, AR5->temp, temp=dst+size
LAR AR4,*- ; ARP=AR5, AR5=FP, AR4=dst+size
LAR AR0,* ; ARP=AR5, AR5=FP, (FP)=size/2, AR0=size/2
LAR AR7,*,AR7 ; ARP=AR7, AR7=size/2
MAR *-,AR3 ; ARP=AR3, AR3=src, AR7=(size/2)-1
ADRK #1 ; ARP=AR3, AR3=src+1
brev1LP2: LACL *+ ; ARP=AR3, AR3=src+2, ACCL=*(src+1)
MAR *+,AR4 ; ARP=AR4, AR4=dst+size, AR3=src+3
SACL *BR0+,0,AR7 ; ARP=AR7, AR7=(size/2)-1, AR4=br(dst+size+size/2)
BANZ brev1LP2,*-,AR3 ; ARP=AR3, AR3=src+3, AR7=AR7-1
MAR *,AR1
SBRK #(__FFTC_brev1_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 LACL *+,AR4 ; ARP=AR4, AR4=dst, AR3=src+1, ACCL=*src
SACL *BR0+,0,AR7 ; ARP=AR7, AR7=size-1, AR4=br(dst+size)
BANZ offbrevLP,*-,AR3 ; ARP=AR3, AR3->src+1, AR7=AR7-1
MAR *,AR1
SBRK #(__FFTC_brev1_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 + -