标题: [转帖]FIR滤波器的TI54X系列DSP的实现 [打印本页]
作者: dfadfe 时间: 2005-12-12 15:22 标题: [转帖]FIR滤波器的TI54X系列DSP的实现
代码部分:
************************************************************
* This function can be called in the c programs and in the *
* assmbly programs. *
************************************************************
* filename: fir_filter *
* author:skycanny *
* date:2004,11,03 *
* argument1:the program coffcients pointer *
* argument2:the data coffcients pointer *
* argument3:the input pointer *
* argument4:the output pointer *
*
************************************************************
*c syntax: *
* fir_filter(arg1,arg2,arg3,arg4) *
************************************************************
************************************************************
*assembly syntax: *
* frame -3 |return address| *
* st arg2,*sp(0) | arg2 |<--sp *
* st arg3,*sp(1) | arg3 | *
* st arg4,*sp(2) | arg4 | *
* calld _fir_filter *
* ld arg1,0,a *
* frame 3 *
作者: dfadfe 时间: 2005-12-12 15:22
************************************************************
_fir_filter:
.title "fir_filter.asm"
.mmregs
.include "main.inc"
.global _fir_filter
.text
off_p .set 0
off_m .set 0
frame_size .set off_p+11
;return address
arg_coff_dad .set frame_size+1 ; arguments 2
arg_in_address .set frame_size+2 ; arguments 3
arg_out_address .set frame_size+3 ; arguments 4
.asg AR2,COFFBUF_P
.asg AR3,INBUF_P
.asg AR4,OUTBUF_P
NOP
NOP
NOP
PSHM ST0
PSHM ST1
PSHM BK
PSHM AL
PSHM AH
PSHM BL
PSHM BH
PSHM AR0
PSHM AR2
PSHM AR3
PSHM AR4
SSBX FRCT
MVDK *SP(arg_coff_dad),COFFBUF_P
RPT #K_FIR_SIZE2
READA *COFFBUF_P+
SSBX OVM
STM #1,AR0
MVDK *SP(arg_out_address),OUTBUF_P
RPTZ A,#K_IN_SIZE-1
STL A,*OUTBUF_P+
NOP
MVDK *SP(arg_in_address),INBUF_P
MVDK *SP(arg_out_address),OUTBUF_P
LDM OUTBUF_P,B
ADD #K_FIR_SIZE2,B
STLM B,OUTBUF_P
MVDK *SP(arg_coff_dad),COFFBUF_P
STM #K_FIR_SIZE2,BK
STM #K_IN_SIZE-K_FIR_SIZE2-1,BRC
RPTBD fir_filter_loop-1
NOP
NOP
LD #0,A
RPT #K_FIR_SIZE2
MAC *COFFBUF_P+,*INBUF_P+,A
;计算前向通道
;将计算结果保存至预留区中
STH A,*OUTBUF_P+
;系数归位
MVDK *SP(arg_coff_dad),COFFBUF_P
;将输入的地址指向下一次的开始位置
LDM INBUF_P,B
ADD #-K_FIR_SIZE2,B
STLM B,INBUF_P
fir_filter_loop:
NOP
POPM AR4
POPM AR3
POPM AR2
POPM AR0
POPM BH
POPM BL
POPM AH
POPM AL
POPM BK
POPM ST1
POPM ST0
NOP
RET
*************************************
.end
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) |
Powered by Discuz! 7.0.0 |