Loop Carry Paths
6-81
Optimizing Assembly Code via Linear Assembly
Although the minimum iteration interval is the greater of the resource limits and
data dependency constraints, an interval of 10 seems slow. Figure 6–16
shows how to improve the performance.
6.7.4.1
Drawing a New Dependency Graph
Figure 6–16 shows a new graph with a loop carry path of 4 (2 +1 + 1). because
the MPY p2 instruction can read yi+1 while it is still in a register, you can reduce
the loop carry path by six cycles. LDH yi is no longer in the graph. Instead, you
can issue LDH y[0] once outside the loop. In every iteration after that, the y+1
values written by the SHR instruction are valid y inputs to the MPY instruction.
Figure 6–16. Dependency Graph of IIR Filter (With Smaller Loop Carry)
LDH
ADD
SUB
cntr
Loop
1
B
1
SHR
yi+1
mem
1
STH
s1
s0
MPY
xi
5
p0
2
LDH
MPY
xi+1
5
p1
2
ADD
p2
MPY
A side
B side
1
1
2
1
Note:
The shaded numbers show the loop carry path: 2 + 1 + 1 = 4.