Motorola DSP56305 Manuel d'utilisateur Page 89

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 112
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 88
7-4 Optimizing DSP56300/DSP56600 Applications MOTOROLA
Compact Opcode Use
Cycle Count of an Instruction
Example:
tst a
blt rare_error
frequent_code
...
rare_error
...
By choosing the inverse of the condition, the code can be optimized
and some cycles can be saved:
tst a
/jointfilesconvert/341464/bge frequent_code
rare_error
...
frequent_code
...
Another example is the implementation of a CASE structure or an
FSM (Finite State Machine) in code:
switch (a) {
case 0: a +=2; break;
case 4: a = b; break;
case 9: a <<= a; break;
default: a += x0;
}
The straight forward implementation would be:
tst a
beq _case_0
cmp #4,a
beq _case_4
cmp #9,a
beq _case_9
_default
add x0,a
bra _end_case
_case_0
add #2,a
bra _end_case
_case_4
tfr b,a
bra _end_case
_case_9
asl a
_end_case
Vue de la page 88
1 2 ... 84 85 86 87 88 89 90 91 92 93 94 ... 111 112

Commentaires sur ces manuels

Pas de commentaire