************************************************************** * exp4c55_2.asm - An assembly program for C55x CCS simulator * Coefficient quantization in Section 4.6.2 * ************************************************************** * Section allocation * .def coeff_q15,yq15,init_q15 coeff_q15 .usect "vars",40 ; reserve 40 locations for coeff yq15 .usect "vars",2 ; reserve 2 locations for y .sect "table" init_q15 .int -141,-429,-541,-211,322,354,-215,-551 .int 21,736,332,-841,-871,755,1651,-304 .int -2880,-1106,6139,13157,13157,6139,-1106,-2880 .int -304,1651,755,-871,-841,332,736,21 .int -551,-215,354,322,-211,-541,-429,-141 .text ; create code section .def start ; label of the beginning of code * copy data to vector x using indirect addressing mode start BCLR C54CM ; set C55x native mode BCLR AR1LC ; set AR1 in linear mode BCLR AR2LC ; set AR2 in linear mode BSET SXMD BSET FRCT ; operate in fractional mode BSET SATD copy AMOV #coeff_q15, XAR1 ; AR1 pointing to x0 AMOV #init_q15,XAR2 ; XAR2 pointing to table of data RPT #39 ; repeat next instruction 40 times MOV *AR2+,*AR1+ ; copy 40 data to coeff_q15 * Add the mult-add 40 data using direct addressing mode mult_add_q15 AMOV #coeff_q15, XAR2 AMOV #yq15, XAR1 MOV #0,AC0 MOV #0x7FFF<<16,AC1 RPT #39 MACM *AR2+,AC1,AC0 MOV AC0,dbl(*AR1) end: NOP B end ; stop here