⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfft_br2c.asm

📁 2407TI库函数
💻 ASM
字号:
;========================================================================
;
; File Name     : cfft_br2c.asm
; 
; Originator    : Digital Control Systems Group 
;                 Texas Instruments 
; 
; Description   : This file contains source code, to bit reverse the N-point real sequence
;                 stored in alternate memory locations.
;
; Date          : 30/3/2001
;======================================================================
; 
; 
; Routine Name  : Generic Function      
; Routine Type  : C Callable
; 
; Usage :
; void FFTC_brev2(int *src, int *dst, ushort n)
; This function bit reverses the N-point real sequence stored in alternate memory locations 
; to carry out N-point complex FFT computation. If src=dst, then in-place bit reversal is performed.
; The destination array should be aligned to 2N words. 
;=====================================================================
; INPUT ARRAY
;         |Xr(0)|
;         |Xi(0)|
;         |Xr(1)|
;         |Xi(1)|
;            :
;            :
;=====================================================================
; Function Local Frame
;======================================================================
;   |_______|
;   |_______|<- Stack Pointer                           (FP+2) <---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)
;======================================================================

__FFTC_brev2_frs    .set    00001h  ; Local frame size for this routine 
                .def _FFTC_brev2
 
_FFTC_brev2:  
            POPD    *+              ; Store the Return Address in stack
            SAR     AR0,*+          ; Store the Caller's Frame Pointer
            SAR     AR7,*+
            SAR     AR1,*                 
            LAR     AR5,*
            LAR     AR0,#__FFTC_brev2_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
            
cbrev1LP1:  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
            SACH    *,AR3           ; ARP=AR3, AR3=src, *dst=*src
           
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    cbrev1LP1,*-,AR3 ; ARP=AR3, AR3->src+2, AR7=AR7-1
             
            MAR     *,AR1
            SBRK    #(__FFTC_brev2_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    *+              ; ARP=AR3, AR3=src+1, ACCL=*src
            MAR     *+,AR4          ; ARP=AR4, AR4=dst, AR3=src+2
            SACL    *BR0+,0,AR7     ; ARP=AR7, AR7=size-1, AR4=br(dst+size)
            BANZ    offbrevLP,*-,AR3 ; ARP=AR3, AR3->src+2, AR7=AR7-1                
            
            MAR     *,AR1
            SBRK    #(__FFTC_brev2_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 + -