📄 fir_filt.asm
字号:
;
; fir_filt.asm - Generic FIR filter
;
; prototype: unsigned int fir_filt(int *, unsigned int, int *,
; unsigned int, int *, int *, unsigned int);
;
; Entry: arg0: AR0 - filter input sample buffer pointer
; arg1: T0 - number of samples in input buffer
; arg2: AR1 - FIR coefficients array pointer
; arg3: T1 - FIR filter order
; arg4: AR2 - output sample buffer pointer
; arg5: AR3 - delayline buffer pointer
; arg6: AR4 - delayline buffer index
;
; Return: T0 = Delayline buffer index
;
.def _fir_filt
.sect "fir_code"
_fir_filt
pshm ST1_55 ; Save ST1 and ST2
pshm ST2_55
or #0x340,mmap(ST1_55) ; Set FRCT,SXMD,SATD
mov mmap(AR1),BSA01 ; AR1=base address for coeff
mov mmap(T1),BK03 ; Set coefficient array size
mov mmap(AR3),BSA23 ; AR3=base address for delayline
or #0xA,mmap(ST2_55) ; AR1 & AR3 as circular pointers
mov #0,AR1 ; Start from zero offset
mov AR4,AR3 ; Start with offset=index
sub #1,T0 ; T0=M-1
mov T0,BRC0 ; Init outer loop for M times
sub #3,T1,T0 ; T0=N-3
mov T0,CSR ; Init inner loop L-2 times
|| rptblocal sample_loop-1 ; Start the outer loop
mov *AR0+,*AR3 ; Put the sample to delayline
mpym *AR3+,*AR1+,AC0 ; Do the 1st iteration
|| rpt CSR ; Start the inner loop
macm *AR3+,*AR1+,AC0
macmr *AR3,*AR1+,AC0 ; Do the last iteration
mov hi(AC0),*AR2+ ; Save Q15 filtered value
sample_loop
popm ST2_55 ; Restore ST1 and ST2
popm ST1_55
mov AR3,T0 ; Return delayline index
|| ret
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -