Motorola DSP56600 Manual page 89

Application optimization for digital signal processors
Table of Contents

Advertisement

Compact Opcode Use
Cycle Count of an Instruction
7-4
Optimizing DSP56300/DSP56600 Applications
Example:
frequent_code
rare_error
...
By choosing the inverse of the condition, the code can be optimized
and some cycles can be saved:
rare_error
frequent_code
Another example is the implementation of a CASE structure or an
FSM (Finite State Machine) in code:
switch (a) {
}
The straight forward implementation would be:
_default
_case_0
_case_4
_case_9
_end_case
tst
a
blt
rare_error
...
tst
a
bge
frequent_code
...
...
case 0:
a +=2; break;
case 4:
a = b; break;
case 9:
a <<= a; break;
default:
a += x0;
tst
a
beq
_case_0
cmp
#4,a
beq
_case_4
cmp
#9,a
beq
_case_9
add
x0,a
bra
_end_case
add
#2,a
bra
_end_case
tfr
b,a
bra
_end_case
asl
a
MOTOROLA

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dsp56300

Table of Contents