Technical information
18 Porting and Optimizing DSP56800 Applications to DSP56800E
The most important new features of the DSP56800E used in writing RXDEMOD from scratch were the
increased number of registers and the increased number of register combinations for different instructions
(which are allowed by the more flexible instruction set).
A first specific difference between the optimized ported version and the written from scratch version is that
the latter chooses other variables (DPHASE instead of CDP) to stay in registers and preloads two more
constants in registers to be available in the inner loop (mod_tbl_offset and #$0040-1). This arrangement
makes better use of the registers.
Another difference is that the written from scratch version uses the new DSP56800E AGU instruction
ZXTA.B, which takes 1 cycle, instead of BFCLR, which takes 2 cycles. See Code Example 25.
Code Example 25. Using DSP56800E AGU Instruction
bfclr #$FF00,a ; 2 cycles, 2 words
...
move.w a1,r1 ; 1 cycle, 1 word
; DSP56800E optimized code: 3 cycles / 3 words
move.w a1,r1 ; 1 cycle, 1 word
...
zxta.b r1 ; 1 cycle, 1 word
; DSP56800E written from scratch code: 2 cycles / 2 words
The register combinations used for MPY and MACR in Code Example 26 are not valid on the DSP56800
but are valid on the DSP56800E.
Code Example 26. New Register Combinations Allowed on DSP56800E
mpy b1,y0,b ; 1 cycle, 1 word
macr -a1,y1,b ; 1 cycle, 1 word
To perform these instructions, the original DSP56800 code first exchanges values between Y0 and Y1 to
obtain a valid register combination. This extra step adds 3 more instructions, each taking 1 cycle to
execute, as presented in Code Example 27.
Code Example 27. Additional Code Needed by Less Flexible DSP56800 Instruction Set
move.w y0,n ; 1 cycle, 1 word
move.w y1,y0 ; 1 cycle, 1 word
move.w n,y1 ; 1 cycle, 1 word
mpy b1,y1,b ; 1 cycle, 1 word
macr -a1,y0,b ; 1 cycle, 1 word
The limited number of accumulators forces the original DSP56800 code to frequently move results from
accumulators to other registers to make room for the results of the next operations.
Table 7. Results Obtained for RXDEMOD
RXDEMOD
Speed Size
Minimum
(Cycles)
Maximum
(Cycles)
Average
(Cycles)
Gain
Over Initial
(%)
Value
(Words)
Gain
Over Initial
(%)
Initial 745 745 745 N/A 68 N/A
Optimized 621 621 621 16.64 65 4.41
Written from scratch 522 522 522 29.93 71 –4.41
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...