Interruptible Loops
7-5
Interrupts
7.3
Interruptible Loops
Even if code employs single assignment, it may not be interruptible in a loop.
Because the delay slots of all branch operations are protected from interrupts
in hardware, all interrupts remain pending as long as the CPU has a pending
branch. Since the branch instruction on the ’C6000 has 5 delay slots, loops
smaller than 6 cycles always have a pending branch. For this reason, all loops
smaller than 6 cycles are uninterruptible.
There are two options for making a loop with an iteration interval less than 6
interruptible.
1) Simply slow down the loop and force an iteration interval of 6 cycles. This
is not always desirable since there will be a performance degradation.
2) Unroll the loop until an iteration interval of 6 or greater is achieved. This
ensures at least the same performance level and in some cases can im-
prove performance (see section 6.9,
Loop Unrolling and section 7.4.4,
Getting the Most Performance Out of Interruptible Code). The disadvan-
tage is that code size increases.
The next section describes how to automatically generate these different op-
tions with the ’C6000 code generation tools.