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

📄 init-fft.asm

📁 TI DSP常用例程
💻 ASM
字号:
;
;  file: D:\FFT2X\INIT-FFT.ASM is the same for all 320C2X RADIX complex FFTs
;
;  Update: 10. July 90 / Manfred Christ / Texas Instruments - Freising
;
         .mmregs
         .def    divid,N
         .sect "vectors"
         B       INIT,*,AR0
         .sect   "init"
;
         .bss    NN,1             ; number of fft-points
         .bss    DATAADD,1        ; START ADDRESS OF DATA
         .bss    DATA2,1          ; DATA+2
         .bss    DATA4,1          ; DATA+4
         .bss    DATA6,1          ; DATA+6
         .bss    DATA8,1          ; DATA+8
         .bss    DATA16,1         ; DATA+16
TABINIT: .word   N,DATA,DATA+2,DATA+4,DATA+6,DATA+8,DATA+16

; stage 3 and 4 costants
SINES4   .set    TWID             ; start of sine in stage 4
         .word   5A82h            ; cos(45)=sin(45)
         .word   SINES4,SINES4+4
         .bss    cos45,1          ; sine/cosine in stage 3
         .bss    sin4,1           ; start of sine in stage    4
         .bss    cos4,1           ; start of cosine in stage  4

         .if N>16
         .def    STAGE5,SINES5
SINES5   .set    SINES4+11        ; start of sine in stage 5
         .word   DATA+32,SINES5,SINES5+8
         .bss    DATA32,1         ; DATA+32
         .bss    sin5,1           ; start of sine in stage    5
         .bss    cos5,1           ; start of cosine in stage  5
         .endif

         .if N>32
         .def    STAGE6,SINES6
SINES6   .set    SINES5+23        ; start of sine in stage 6
         .word   DATA+64,SINES6,SINES6+16
         .bss    DATA64,1         ; DATA+64
         .bss    sin6,1           ; start of sine in stage    6
         .bss    cos6,1           ; start of cosine in stage  6
         .endif

         .if N>64
         .def    STAGE7,SINES7
SINES7   .set    SINES6+47        ; start of sine in stage 7
         .word   DATA+128,SINES7,SINES7+32
         .bss    DATA128,1        ; DATA+128
         .bss    sin7,1           ; start of sine in stage    7
         .bss    cos7,1           ; start of cosine in stage  7
         .endif

         .if N>128
         .def    STAGE8,SINES8
SINES8   .set    SINES7+95        ; start of sine in stage 8
         .word   DATA+256,SINES8,SINES8+64
         .bss    DATA256,1        ; DATA+256
         .bss    sin8,1           ; start of sine in stage    8
         .bss    cos8,1           ; start of cosine in stage  8
         .endif
;
         .if N>256
         .def    STAGE9,SINES9
SINES9   .set    SINES8+191       ; start of sine in stage 9
         .word   DATA+512,SINES9,SINES9+128
         .bss    DATA512,1        ; DATA+512
         .bss    sin9,1           ; start of sine in stage    9
         .bss    cos9,1           ; start of cosine in stage  9
         .endif

         .if N>512
         .def    STAGE10,SINES10
SINES10  .set    SINES9+383       ; start of sine in stage 10
         .word   SINES10,SINES10+256  ; ALL 32 WORDS IN B2 ARE USED NOW!!
         .bss    sin10,1          ; start of sine in stage   10
         .bss    cos10,1          ; start of cosine in stage 10
         .endif

TABEND:  .set    $
;
;  Temp variables
;
         .bss    sine,1           ; sine value
         .bss    cosine,1         ; cosine value
         .bss    TEMP,2           ; used for temporary numbers
;
INIT:    LDP     #0              ; use only B2 and mmregs for direct addressing
         SPM     0               ; no shift from PREG to ALU
         ROVM                    ; disable overflowmode
         SSXM                    ; enable sign extension mode
;
; INIT Block B2
;
         LAR     AR0,#NN         ; arp is already pointing to ar0
         LACC    #TABINIT
         RPT     #TABEND-TABINIT
         TBLR    *+
;
; INIT TWIDDLE FACTORS
;
         LAR     AR0,#TWID       ; arp is already pointing to ar0
         LACC    #TWIDSTRT
         .if     N<256
         RPT     #TWIDLEN        ; for N= 16 .. 128
         TBLR    *+
         .else
         LAR     ar1,#TWIDLEN    ; for n = 256 .. 1024 ..
TWIDLOOP tblr    *+,ar1          ; transfer a word
         addk    1               ; accu =+1
         banz    TWIDLOOP,*-,ar0
         .endif
;
; EXECUTE THE FFT
;
         LAR     AR5,#TEMP       ; pointer to 2 temp register
         CALL    FFT,*,AR3       ; ARP=AR3 FOR MACRO COMBO
;
WAIT     B       WAIT            ; THE SIMULATOR STOPS HERE

⌨️ 快捷键说明

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