Block FIR Filtering
y[n] = h0 x[n] + h1 x[n-1] + ... + hN-1 x[n-(N-1)]
- h stored as linear array of N elements (in prog. mem.)
- x stored as circular array of N elements (in data mem.)
; Addresses: a4 h, a5 N samples of x, a6 input buffer, a7 output buffer; Modulo addressing prevents need to reinitialize regs each sample; Moving filter coefficients from program to data memory is not shownfirtask: ld #firDP,dp ; initialize data page pointer stm #frameSize-1,brc ; compute 256 outputs rptbd firloop-1 stm #N,bk ; FIR circular buffer size ld *ar6+,a ; load input value to accumulator b stl a,*ar4+% ; replace oldest sample with newest rptz a,#(N-1) ; zero accumulator a, do N taps mac *ar4+0%,*ar5+0%,a ; one tap, accumulate in a sth a,*ar7+ ; store y[n]firloop: ret