****************************************************************** *iir_fxpt_asm.asm - Assembly program for C5000 CCS simulator used * in Section 7.7.6.1 * * function: IIR Bandpass filtering ****************************************************************** * Section allocation * .def start out_buffer .usect "out",300 ; reserve 300 location for y coeff .usect "coeff",12,1 ; reserve 12(4coeff/section*3sections) location for coefficients .sect "coeff_table" init_coeff .int -30677, 19644,-32768,0 ; -Den[2],-Den[1],Num[2],Num[1](section1) .int -31829, 16158,32767,-9027 ; (section 2) .int -31866, 23707,32767,-30370 ; (section 3) .sect "indata" in_buffer .copy "in1_int.dat" ; copy in1_int.dat to memory label in_buffer .sect "delay" delay_line .int 0,0,0,0,0,0,0,0,0 ; setup 9 locations for delay line over 3 sections .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,AR4 ; AR1 pointing to coeff RPT #11 ; repeat next instruction 12 times MVPD init_coeff,*AR4+ ; copy the init_coeff to coeff * Setup the pointers to point to the coeff and data sample STM #in_buffer, AR1 ; setup the pointer for in_buffer STM #out_buffer, AR2 ; setup the pointer for out_buffer loop: STM #299, BRC RPTB iir_end-1 iirloop: STM #coeff, AR4 ; setup the pointer for coeff MPY *AR1+,#17,A STM #delay_line+2, AR3 ; setup the pointer for delay line STM #2, AR6 ; number of sections-1 feedback: MAC *AR4+,*AR3-,A MAC *AR4+,*AR3-,A STH A, *AR3 MAR *+AR3(#2) feedforward: MPY *AR4+,*AR3-,A MAC *AR4+,*AR3,A DELAY *AR3- MAC *AR3,#32767,A DELAY *AR3 MAR *+AR3(#5) BANZ feedback,*AR6- STH A,3,*AR2+ ; write result to memory location y iir_end: NOP