***************************************************************** *fir_fxpt_asm.asm - An assembly program for C5000 CCS simulator * ***************************************************************** * Section allocation * .def start out_buffer .usect "out",300 ; reserve 300 location for y coeff .usect "coeff",96,1 ; reserve 96 location for coefficients .sect "coeff_table" init_coeff .int 317, 26, -125, -132, 35, 149, 38, -144, -141 .int 36, 131, 28, -97, -76, 6, 7, -17, 48 .int 90, -65, -252, -105, 302, 364, -176, -636, -229 .int 646, 722, -316, -1102, -375, 1034, 1111, -463, -1572 .int -517, 1396, 1458, -589, -1955, -627, 1658, 1693, -667 .int -2170, -681, 1765, 1765, -681, -2170, -667, 1693, 1658 .int -627, -1955, -589, 1458, 1396, -517, -1572, -463, 1111 .int 1034, -375, -1102, -316, 722, 646, -229, -636, -176 .int 364, 302, -105, -252, -65, 90, 48, -17, 7 .int 6, -76, -97, 28, 131, 36, -141, -144, 38 .int 149, 35, -132, -125, 26, 317 .sect "indata" in_buffer .copy "in1_int.dat" ; copy in1_int.dat to memory label in_buffer .mmregs .text ; create code section * Copy data to vector x using indirect addressing mode start: STM #0, SWWSR SSBX FRCT ; On fractional mode SSBX SXM ; On sign extension mode RSBX OVM ; On overflow mode copy: STM #coeff,AR1 ; AR1 pointing to coeff RPT #95 ; repeat next instruction 96 times MVPD init_coeff,*AR1+ ; copy the init_coeff to coeff * Setup the pointers to point to the coeff and data sample... STM #coeff, AR2 ; setup the pointer for coeff STM #in_buffer, AR3 ; setup the pointer for in_buffer STM #out_buffer, AR4 STM #1, AR0 loop: STM #299, BRC STM #96, BK RPTB fir_end-1 firloop: NOP MPY *AR2+, *AR3+, A ; first multiply on 1st tap RPT #94 ; subsequent multiply for 95 other taps MAC *AR2+0%, *AR3+, A MAR *+AR3(#-95) STH A, *AR4+ ; write result to memory location y fir_end: NOP