Loop Carry Paths
6-82
6.7.4.2
New ’C6x Instructions (Inner Loop)
Example 6–43 shows the new linear assembly from the graph in Figure 6–16,
where LDH yi was removed. The one variable y that is read and written is yi
for the MPY p2 instruction and yi+1 for the SHR and STH instructions.
Example 6–43. Linear Assembly for IIR Inner Loop With Reduced Loop Carry Path
LDH
*xptr++,xi
; xi+1
MPY
c1,xi,p0
; c1 * xi
LDH
*xptr,xi+1
; xi+1
MPY
c2,xi+1,p1
; c2 * xi+1
ADD
p0,p1,s0
; c1 * xi + c2 * xi+1
MPY
c3,y,p2
; c3 * yi
ADD
s0,p2,s1
; c1 * xi + c2 * xi+1 + c3 * yi
SHR
s1,15,y
; yi+1
STH
y,*yptr++
; store yi+1
[cntr]SUB
cntr,1,cntr
; decrement loop counter
[cntr]B
LOOP
; branch to loop
6.7.5
Linear Assembly Resource Allocation
Example 6–44 shows the same linear assembly instructions as those in
Example 6–43 with the functional units and registers assigned.
Example 6–44. Linear Assembly for IIR Inner Loop (With Allocated Resources)
LDH
.D1
*A4++,A2
; xi+1
MPY
.M1
A6,A2,A5
; c1 * xi
LDH
.D1
*A4,A3
; xi+1
MPY
.M1X
B6,A3,A7
; c2 * xi+1
ADD
.L1
A5,A7,A9
; c1 * xi + c2 * xi+1
MPY
.M2X
A8,B2,B3
; c3 * yi
ADD
.L2X
B3,A9,B5
; c1 * xi + c2 * xi+1 + c3 * yi
SHR
.S2
B5,15,B2
; yi+1
STH
.D2
B2,*B4++
; store yi+1
[A1] SUB
.L1
A1,1,A1
; decrement loop counter
[A1] B
.S1
LOOP
; branch to loop