dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 163

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
When a word-sized integer is added to a long-sized integer, the word value must first be converted to a
long value, as shown in Figure 5-11.
When a word-sized fraction is added to a long-sized fraction as shown in Figure 5-12, no conversion is
necessary because their binary points are the same.
If limiting is desired before the long value is written to memory, it is necessary to use the
instruction immediately before the MOVE.L.
Freescale Semiconductor
Integer Addition of a Long and a Word: 32 (long) + 64 (word) = 96 (long)
Fractional Addition of a Long and a Word: 0.5 (long) + 0.25 (word) = 0.75 (long)
MOVE.L
MOVE.W
ASR16
ADD
MOVE.L
MOVE.L
MOVE.W
ADD
MOVE.L
Before Execution
Before Execution
A
B
A
B
A2
B2
A2
B2
$0
$0
$0
$0
#32,A
#64,B
B
B,A
A10,X:RESULT
X:(R0),A
#0.25,B
B,A
A10,X:RESULT
Figure 5-12. Adding a Word Fractional to a Long-Word Fractional
Figure 5-11. Adding a Word Integer to a Long-Word Integer
$0000
$0040
$4000
$2000
A1
B1
A1
B1
; Load integer long “32” ($20) into A Accumulator
; (Sign extends A2 and A1)
; Load integer word “64” ($40) into B Accumulator
; (Sign extends B2 and clears B0)
; Convert word value in B Accumulator to a long
; Perform Integer Word Addition
; (32 + 64 = $20 + $40 = $60 = 96)
; Save Result (limiting disabled) to Memory
; Load fraction long “0.5” ($4000:0000) into A
; (Sign extends A2)
; Load fraction word “0.25” ($2000) into B
; (Sign extends B2 and clears B0)
; (Note: Same format as a fractional long)
; Perform Fractional Long Addition
; (0.5 + 0.25 = $0:6000:0000 = 0.75)
; Save Result (limiting disabled) to Memory
$0020
$0000
$0000
$0000
Data Arithmetic Logic Unit
A0
B0
A0
B0
After Execution
After Execution
A
B
A
B
$0
A2
$0
B2
$0
A2
$0
B2
Fractional and Integer Arithmetic
$0000
$0000
$6000
$2000
A1
B1
A1
B1
$0060
$0040
$0000
0000
A0
B0
A0
B0
SAT A,A
5-17

Related parts for dsp56800e