📄 cfft.asm
字号:
*
*
*2.4 kbps MELP Proposed Federal Standard speech coder
*
*TMS320C5x assembly code
*
*version 1.0
*
*Copyright (c) 1998, Texas Instruments, Inc.
*
*Texas Instruments has intellectual property rights on the MELP
*algorithm. The Texas Instruments contact for licensing issues for
*commercial and non-government use is William Gordon, Director,
*Government Contracts, Texas Instruments Incorporated, Semiconductor
*Group (phone 972 480 7442).
*
*
*************************************************************************
*
* The following code was hand optimized for the Texas Instuments
* TMS320C5x DSP by DSPCon, Inc. For information, please contact DSPCon
* at:
*
* DSPCon, Inc.
* 380 Foothill Road
* Bridgewater, New Jersey 08807
* (908) 722-5656
* info@dspcon.com
* www.dspcon.com
*
*************************************************************************
.file "cfft.asm"
.title "512 point DIT Radix-2, Complex FFT"
.width 120
******************************************************************************
* *
* 512 - POINT COMPLEX, RADIX-2 DIF FFT WITH THE TMS320C5x / LOOPED CODE *
* --------------------------------------------------------------------- *
* *
* THE PROGRAM IS BASED ON THE BOOK 'DIGITAL SIGNAL PROCESSING APPLICATIONS' *
* FROM TEXAS INSTRUMENTS P. 69. IT IS OPTIMIZED FOR THE TMS320C5x INCLUDING *
* BIT REVERSAL ADDRESSING MODE. *
* *
* WRITTEN BY: MANFRED CHRIST REVISION: 2.00 21. Mar. 94 *
* *
* COPYRIGHT TEXAS INSTRUMENTS INC. 1990/1994 *
* *
******************************************************************************
* *
* USED REGISTER: INDX,AR0..AR5,ACCU,PREG,TREG0,PMST,BRCR *
* 2 Stacklevel, Block B0 *
* *
* PROGRAM MEMORY: 219 WORDS ('FFTLEN') WITHOUT INITIALIZATION *
* *
* COEFFICIENTS : 16 BITS (Q15 Format) SCALING : 1/2^9 = 1/512 *
* *
* CYCLES : 36016 CYLCES => 1800.8 us 1260.6 us 900.4 us *
* T-CYCLE => 50 ns 35 ns 25 ns *
* *
* MEMORY USAGE: FFT PROGRAM [ 00600H - 006daH ] *
* INPUT DATA [ 01000H - 013ffH ] *
* DATA WORKSPACE [ 00800H - 00bffH ] *
* TWIDDLES [ 00100H - 003edH ] *
* *
* INPUT DATA AT ADDRESS 1000h-13ffh: *
* ---------------------------------- *
* THE DATA ARE STORED IN 'input' IN THE SEQUENCE: X(0),X(1),...,X(511) *
* Y(0),Y(1),...,Y(511) *
* *
* OUTPUT DATA AT ADDRESS 0800h-0bffh: *
* ----------------------------------- *
* THE DATA ARE STORED IN SECIION 'fftdata' IN THE SEQUENCE: *
* X(0),Y(0),X(1),Y(1),... ... ,X(511),Y(511) *
******************************************************************************
* *
* THIS PROGRAM INCLUDES FOLLOWING FILES: *
* -------------------------------------- *
* 'TWIDDLES.Q15' contains all twiddle factors in Q15 format (sine,cosine) *
* 'C5CXRAD2.ASM' consists of all macros for all FFTs *
* 'INIT-FFT.ASM' for initialisation *
******************************************************************************
.mmregs
.def _fft_data ; output data buffer
.def _cfft
N .set 512 ; NUMBER OF POINTS FOR FFT
;
; Aligned data workspace
;
_fft_data .usect "fftdata",N*2 ; working data array
DATA .set _fft_data ; data buffer
;
; Twiddle factor table; referenced in place
;
.sect "twiddles"
TWID .set $
.label TWIDSTRT
.include twidfull.q15 ; table of twiddle factors for the FFT
.label TWIDEND
TWIDLEN .set TWIDEND-TWIDSTRT
;
; Initialized variables; copied onto B2 at execution
;
.sect "ffttab"
TABB .set $
.label TABSTRT
DATAADD .set 60h ; START ADDRESS OF DATA
.word DATA
; .def STAGE1
DATA2 .set 61h ; DATA+2
sin1 .set 62h ; start of sine in stage 1
cos1 .set 63h ; start of cosine in stage 1
.word DATA+2,SIN1,COS1
; .def STAGE2
DATA4 .set 64h ; DATA+4
sin2 .set 65h ; start of sine in stage 2
cos2 .set 66h ; start of cosine in stage 2
.word DATA+4,SIN2,COS2
; .def STAGE3
DATA8 .set 67h ; DATA+8
sin3 .set 68h ; start of sine in stage 3
cos3 .set 69h ; start of cosine in stage 3
.word DATA+8,SIN3,COS3
; .def STAGE4
DATA16 .set 6Ah ; DATA+16
sin4 .set 6Bh ; start of sine in stage 4
cos4 .set 6Ch ; start of cosine in stage 4
.word DATA+16,SIN4,COS4
; .def STAGE5
DATA32 .set 6Dh ; DATA+32
sin5 .set 6Eh ; start of sine in stage 5
cos5 .set 6Fh ; start of cosine in stage 5
.word DATA+32,SIN5,COS5
; .def STAGE6
DATA64 .set 70h ; DATA+64
sin6 .set 71h ; start of sine in stage 6
cos6 .set 72h ; start of cosine in stage 6
.word DATA+64,SIN6,COS6
; .def STAGE7
DATA128 .set 73h ; DATA+128
sin7 .set 74h ; start of sine in stage 7
cos7 .set 75h ; start of cosine in stage 7
.word DATA+128,SIN7,COS7
; .def STAGE8
DATA256 .set 76h ; DATA+256
sin8 .set 77h ; start of sine in stage 8
cos8 .set 78h ; start of cosine in stage 8
.word DATA+256,SIN8,COS8
; .def STAGE9
DATA512 .set 79h ; DATA+512
sin9 .set 7Ah ; start of sine in stage 9
cos9 .set 7Bh ; start of cosine in stage 9
.word DATA+512,SIN9,COS9
.label TABEND
TABLEN .set TABEND - TABSTRT
;
; Uninitialized temporary variables
;
saveFP .set 7Ch
saveSP .set 7Dh
saveIDX .set 7Eh
do_btfly .macro num
CALLD butterfly ; delayed call follows
LACL #:num:-1 ; make it DP-independend
SAMM BRCR ; execute num times BUTTFLYI
.endm
stdmacro .macro stage,num,loops,add
LAR AR0,#num*2 ; index register = num * 2
LAR AR1,DATAADD ; ar1 -> DATA
LAR AR2,DATA:add: ; ar2 -> DATA+16
LAR AR5,#:loops: ; ar5 is loopcounter -> repeat loop+1 times
loop?: LAR AR3,cos:stage: ; start of cosine in this stage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -