Loop Carry Paths
6-77
Optimizing Assembly Code via Linear Assembly
6.7
Loop Carry Paths
Loop carry paths occur when one iteration of a loop writes a value that must
be read by a future iteration. A loop carry path can affect the performance of
a software-pipelined loop that executes multiple iterations in parallel. Some-
times loop carry paths (instead of resources) determine the minimum iteration
interval.
IIR filter code contains a loop carry path; output samples are used as input to
the computation of the next output sample.
6.7.1
IIR Filter C Code
Example 6–41 shows C code for a simple IIR filter. In this example, y[i] is an
input to the calculation of y[i+1]. Before y[i] can be read for the next iteration,
y[i+1] must be computed from the previous iteration.
Example 6–41. IIR Filter C Code
void iir(short x[],short y[],short c1, short c2, short c3)
{
int i;
for (i=0; i<100; i++) {
y[i+1] = (c1*x[i] + c2*x[i+1] + c3*y[i]) >> 15;
}
}