Section 3 Program Control; Hardware Loops - Motorola DSP56600 Manual

Application optimization for digital signal processors
Table of Contents

Advertisement

Section 3
PROGRAM CONTROL
3.1

HARDWARE LOOPS

Hardware looping is one of the strongest features of the
DSP56300/DSP56600 core families. Loop counter management and
end-of-loop testing is done by hardware in parallel to instruction
execution, thus saving execution time of otherwise needed control
software. This enables the user to muster more performance in
critical loops, and also makes program writing more close to
high-level languages. Consider the following C code example:
for (i = 0; i < 100; i++){
}
A straight forward assembly implementation of the main loop of the
code may look like this:
move
clr
move
_LOOP_TOP
add
sub
tst
jne
Using hardware looping, this code looks like:
move
clr
do
add
_LOOP_END
There is more to hardware loops than easy programming. The loop
control hardware is optimized for maximum pipeline efficiency.
There is no stall between loop iterations; all comparisons and loop
counter arithmetic are done in parallel to instruction execution. It is
important to know that after the loop is initialized (execution of the
DO instruction), the instructions in the loop are fetched and
executed in sequence. From the pipeline's point of view, there is no
difference between the code in the last example and the "ADD"
instruction written 100 times in sequence.
MOTOROLA
Optimizing DSP56300/DSP56600 Applications
a = a + data[i];
#MEMORY_AREA,r0
a
#100,b
x:(r0)+,x0
x0,a
x:(r0)+,x0
#1,b
b
_LOOP_TOP
#MEMORY_AREA,r0
a
x:(r0)+,x0
#100,_LOOP_END
x0,a
x:(r0)+,x0
This section
discusses
important program
control features
and new additions.
3-1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dsp56300

Table of Contents