BENCHMARK PROGRAMS
B - 18 BENCHMARK PROGRAMS
MOTOROLA
page 132,60,1,1
;newlms2n.asm
; New Implementation of the delayed LMS on the DSP56000 Revision C
;Memory map:
; Initial X H
; x(n) x(n-1) x(n-2) x(n-3) x(n-4) hx h0 h1 h2 h3
;] ] ]
;r0 r5 r4
;hx is an unused value to make the calculations faster.
;opt cc
ntaps equ 4
input equ $FFC0
output equ $FFC1
org x:$0
state ds 5
org y:$0
coef ds 5
;
org p:$40
move #state,r0 ;start of X
move #2,n0
move #ntaps,m0 ;mod 5
move #coef +1,r4 ;coefficients
move #ntaps,m4 ;mod 5
move #coef,r5 ;coefficients
move m4,m5 ;mod 5
_smploop ; Prog Icyc
movep y:input,a ;get input sample word
move a,x:(r0) ;save input sample 1 1
;error signal is in y1
;FIR sum in a=a+h(k) old*x(n-k)
;h(k)new in b=h(k)old + error*x(n-k-1)
cir a x:(r0)+,x0 ;x0=x(n) 1 1
move x:(r0)+,x1 y:(r4)+,y0 ;x1=x(n-1),y0=h(0) 1 1
do #taps/2,_lms ; 2 3
mac x0,y0,a y0,b b,y:(r5)+ ;a=h(0)*x(n),b=h(0) 1 1
macr x1,y1,b x:(r0)+,x0 y:(r4)+,y0 ;b=h(0)+e*x(n-1)=h(0)new 1 1
;x0=x(n-2) y0=h(1)
mac x1,y0,a y0,b b,y:(r5)+ ;a=a+h(1)*x(n-1) b=h(1) 1 1
macr x0,y1,b x:(r0)+,x1 y:(r4)+,y0 ;b=h(1)+e*x(n-2) 1 1
; ;x1=x(n-3) y0=H(2)
_lms
move b,y:(r5)+ ;save last new c( ) 1 1
move (r0) -n0 ;pointer update 1 1
;(Get d(n), subtract fir output (reg a), multiply by “u”, put
;the result in y1. This section is application dependent.)
movep ay:output ;outputfir if desired
Figure B-5 Real Input FFT Based on Glenn Bergland Algorithm (Sheet 7 of 8)