Loop Carry Paths
6-84
6.7.7
Using the Assembly Optimizer for the IIR Filter
Example 6–45 shows the linear assembly code to perform the IIR filter. Once
again, you can use this code as input to the assembly optimizer to create a soft-
ware-pipelined loop instead of scheduling this by hand.
Example 6–45. Linear Assembly for IIR Filter
.global _iir
_iir:
.cproc x, y, c1, c2, c3
.reg
xi, xi1, yi1
.reg
p0, p1, p2, s0, s1, cntr
MVK
100,cntr
; cntr = 100
LDH
.D2
*y++,yi1
; yi+1
LOOP:
.trip 100
LDH
.D1
*x++,xi
; xi
MPY
.M1
c1,xi,p0
; c1 * xi
LDH
.D1
*x,xi1
; xi+1
MPY
.M1X c2,xi1,p1
; c2 * xi+1
ADD
.L1
p0,p1,s0
; c1 * xi + c2 * xi+1
MPY
.M2X c3,yi1,p2
; c3 * yi
ADD
.L2X s0,p2,s1
; c1 * xi + c2 * xi+1 + c3 * yi
SHR
.S2
s1,15,yi1
; yi+1
STH
.D2
yi1,*y++
; store yi+1
[cntr] SUB
.L1
cntr,1,cntr
; decrement loop counter
[cntr] B
.S1
LOOP
; branch to loop
.endproc