Data Operations
The Max instruction
MOTOROLA
Optimizing DSP56300/DSP56600 Applications
2-7
2.3
THE MAX INSTRUCTION
MAX is a new instruction in the DSP56300 and DSP56600
instruction set that can used to enhance performance in critical data
operation loops. For example,
max a,b
compares the two accumulators, and places the bigger value in the
destination accumulator (accumulator B). The MAXM instruction
does the same thing, only it transfers the bigger absolute value to
the destination .
Like other data operations, this instruction is effectively executed in
one clock cycle. Previously such functionality was achieved in two
cycles, for example:
cmp
a,b
tlt
a,b
Note:
This example differs from the MAX functionality only in the
status update.
The MAXM instruction can be used to find the largest number in an
array of values, in N + 10 clock cycles:
cycles
move
#DATA_POINTER,r0
1
clr
b
x:(r0)+,a
1+3 interlock
rep
#n
5
maxm
a,b
x:(r0)+,a
N
The initialization of R0 takes 4 cycles due to an address register
interlock. The three cycle stall could be used for other useful
instructions (see
Section
Note:
The MAX and MAXM instructions can only be used with
fixed operands (A as first source, B as destination). There is
no opcode for MAX B,A.