*************************************************************** * ale_fixpt_c54x.asm - Assembly program using C54x assembly * programming for ALE on CCS Simulator * *************************************************************** * Section allocation * .def start out_buffer .usect "out",500 ; reserve 500 locations for y err_buffer .usect "error",500 ; reserve 500 locations for error coeff .usect "coeff",16 ; reserve 16 locations for coefficients .sect "coeff_table" init_coeff .int 0,0,0,0,0,0,0,0 .int 0,0,0,0,0,0,0,0 .sect "indata" in_buffer .copy "in1_int.dat" ; copy in1_int.dat to memory labeled in_buffer .sect "adapt" two_mu .int 338 ; mu = 33(0.001); 338(0.01); 655(0.02) two_mu_err .int 125 .mmregs .text ; create code section * Copy data to vector x using indirect addressing mode start: SSBX FRCT ; on fractional mode SSBX SXM ; on sign extension mode RSBX OVM ; on overflow mode copy: STM #coeff,AR2 ; AR1 pointing to coeff RPT #15 ; repeat next instruction 16 times MVPD init_coeff,*AR2+ ; copy the init_coeff to coeff * Setup the pointers to point at the coeff and data samples STM #coeff, AR2 ; setup the pointer for coeff STM #in_buffer, AR3 ; setup the pointer for in_buffer STM #out_buffer, AR4 ; setup the pointer for out_buffer STM #err_buffer, AR1 ; setup the pointer for err_buffer STM #1, AR0 STM #499, AR6 STM #16, BK ; circular buffer for coeff at 16-taps LD #two_mu_err, DP LD @two_mu_err, T ; init T=two_mu_err loop: LD #0, B ; clear Acc B for filter output STM #14, BRC ; loop (16-2)=14 times RPTBD adapt_end-1 MPY *AR3, A ; A = 2*mu*err*input LMS *AR2, *AR3+ ; B = a0*x0+0 || A=e0+A (A = a0) ; RPTB starts here ST A, *AR2+0% ; updates coeff and || MPY *AR3,A ; A = x1*T(2*mu*err) in parallel LMS *AR2, *AR3+ ; B = filtered output || A=e+A(A =ai) adapt_end: STH A, *AR2+0% ; store final coeff STH B, *AR4 ; store final result LD *AR3, A SUB *AR4+,A ; obtain the error signal STL A, *AR1 ; store error signal LD @two_mu,T MPY *AR1+,A STH A, @two_mu_err LD @two_mu_err,T MAR *+AR3(#-15) ; reset the input vector back by 15 time instant BANZ loop,*AR6- complete: NOP