peddamat
5/20/2013 - 5:34 PM

FIR_Filter_excerpt.s

;..............................................................................    
; Perform Block FIR filtering

         DO   w3, blockLoop             ; loop until all input samples have been processed
         MOV  [w1++],[w10]              ; store new sample into delay line

; clear a, prefetch tap and sample pair, update ptrs
         CLR   a, [w8]+=2, w5, [w10]+=2, w6

         REPEAT w4                              ; perform macs (except for last two)
         MAC  w5*w6, a, [w8]+=2, w5, [w10]+=2, w6

         MAC  w5*w6, a, [w8]+=2, w5, [w10], w6  ; perform second-to-last MAC
         MAC  w5*w6, a                          ; perform last MAC


    ; round and store result in AccA to output buffer
blockLoop:
         SAC.R  a,[w2++]            ; this is the last instruction in the loop controlled
                                    ; by W3                        

         MOV  w10,[w0+oDelayPtr]    ; update delay line pointer
                                    ; note: that the delay line pointer can have multiple 
                                    ; wraps depending on the number of input samples
;---------------------------------------------------------------------------------