User`s manual

Data Operations
Using the barrel shifter
MOTOROLA Optimizing DSP56300/DSP56600 Applications 2-9
will normalize A, so that in the DSP56300 it’s leading one or zero
will be shifted to Bit 46 in the accumulator. If |A| > 1 (meaning that
it spilled to the extension A2), then CLB returns a positive number
(between 1 and 8). If |A| < 1, CLB returns a zero or a negative
number (between –47 and 0). The two cases in Figure 2-1 exemplify
the normalization operation for the DSP56300. The NORMF at the
56600 core operates similarly, with adjustments to the different
accumulator length.
The NORMF instruction can be used to keep data dynamically
bounded (maximizing calculation accuracy), implement floating
point routines, normalizing data blocks, and more. For example,
consider the following routine for efficiently normalizing a data
block. The first pass finds the normalization factor (using MAXM
and CLB) and the second pass performed the normalization itself.
;NORMALIZING A DATA BLOCK
;=========================
;X:base - base address of un-normalized data.
;Y:base - base address of normalized data.
;N: data block size
;cycle count
move #base,r0 ; 1
move #base,r1 ; 1
clr b x:(r0)+,a ; 1 + 2 pointer interlock
rep #N ; 5
maxm a,b x:(r0)+,a ; 1 x N
move r1,r0 ; 1
clb b,a ; 1
Figure 2-1 The Fast Normalization Operation for the DSP56300:
0234755
0234755
A
B
0c 020000 100000
00 000005 000000
0234755
A 00 601000 008000
CLB
NORMF
0234755
0234755
A
B
00 00c000 003000
ff fffff9 000000
0234755
A 00 600000 180000
A,B
B1,A
AA0831