; TMS320C54x assembly language code ; FIR filter with symmetric filter coefficients ; An even number of filter coefficients is assumed ; Addresses: a6 input buffer, a7 output buffer ; a4 array with x[n-4], x[n-3], x[n-2], x[n-1] for N = 8 ; a5 array with x[n-5], x[n-6], x[n-7], x[n-8] for N = 8 ; Modulo addressing prevents need to reinitialize regs each sample ; Example taken from the C54x Applications Guide, pages 4-7 and 4-8. firtask: ld #firDP,dp ; initialize data page pointer stm #frameSize-1,brc ; compute 256 outputs rptbd firloop-1 stm #N/2,bk ; FIR circular buffer size ld *ar6+,b ; load input value to accumulator b mvdd *ar4,*a5+0% ; move old x[n-N/2] to new x[n-N/2-1] stl b,*ar4% ; replace oldest sample with newest add *a4+0%,*a5+0%,a ; a = x[n] + x[n-N/2-1] rptz b,#(N/2-1) ; zero accumulator b, do N/2-1 taps firs *ar4+0%,*ar5+0%,coeffs ; b += a * h[i], do next a mar *+a4(2)% ; to load the next newest sample mar *ar5+% ; position for x[n-N/2] sample sth b,*ar7+ firloop: ret