********************************************************************* * exp4c54_1.asm - An assembly program for C5000 CCS simulator * Representing different Q formats in Section 4.6.1 * ********************************************************************* * Section allocation * .def x,y,init_q15, init_q1_14, init_q2_13 x .usect "vars",12; reserve 12 locations for x y .usect "vars",3 ; reserve 3 locations for y .sect "table" ;init_q15 .int 0.5*32768, 0.25*32768, 0.125*32768, 0.0625*32768 ;init_q1_14 .int 0.5*16384, 0.25*16384, 0.125*16384, 0.0625*16384 ;init_q2_13 .int 0.5*8192, 0.25*8192, 0.125*8192, 0.0625*8192 init_q15 .int 16384, 8192, 4096, 2048 init_q1_14 .int 8192, 4096, 2048, 1024 init_q2_13 .int 4096, 2048, 1024, 512 .text ; create code section .def start ; label of the beginning of code * Copy data to vector x using indirect addressing mode start: NOP copy: STM #x,AR1 ; AR0 pointing to x0 RPT #11 ; repeat next instruction 8 times MVPD init_q15,*AR1+ ; copy 8 data to x * mode setting .mmregs SSBX SXM ; sign extention SSBX FRCT ; Operate in fractional mode SSBX OVM ; overflow mode set * Add the first 4 data using direct addressing mode add_q15: ; Q15 format STM #x, AR2 RPTZ A, #3 ADD *AR2+,16,A STH A, *(y) add_q1_14: ; Q14 format STM #x+4, AR2 RPTZ A, #3 ADD *AR2+,16,A STH A, *(y+1) add_q2_13: ; Q13 format STM #x+8, AR2 RPTZ A, #3 ADD *AR2+,16,A STH A, *(y+2) end: NOP B end ; stop here