dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 162

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Data Arithmetic Logic Unit
5.3.2
Addition, subtraction, and comparison operations are performed identically for both fractional and integer
data values. The data ALU does not distinguish between the data types for these operations.
To perform integer arithmetic operations with word-sized data, the MOVE.W instruction loads the data
into the FF1 portion of the accumulator as shown in Figure 5-9. FF2 contains sign extension and FF0 is
cleared. Note that the decimal (or binary) point lines up correctly for integer data in the two accumulators.
Fractional word arithmetic is performed in a similar manner. The MOVE.W instruction loads the data into
the FF1 portion of the accumulator as shown in Figure 5-10. FF2 contains sign extension and FF0 is
cleared. Again, the decimal (or binary) point lines up correctly for fractional data in the two accumulators.
5-16
Integer Addition of 2 Words: 32 + 64 = 96
Fractional Addition: 0.5 + 0.25 = 0.75
MOVE.W
MOVE.W
ADD
MOVE.W
MOVE.W
MOVE.W
ADD
MOVE.W
Before Execution
Before Execution
A
B
A
B
Addition and Subtraction
A2
B2
A2
B2
$0
$0
$0
$0
#32,A
#64,B
B,A
A1,X:RESULT
#0.5,A
#0.25,B
B,A
A,X:RESULT
$0020
$0040
$4000
$2000
A1
B1
A1
B1
Figure 5-10. Fractional Word Addition
DSP56800E Core Reference Manual
Figure 5-9. Integer Word Addition
; Load integer value “32” ($20) into A Accumulator
; (Sign extends A2 and clears A0)
; Load integer value “64” ($40) into B Accumulator
; (Sign extends B2 and clears B0)
; Perform Integer Word Addition
; (32 + 64 = $20 + $40 = $60 = 96)
; Save Result (without saturating) to Memory
; Load fraction value “0.5” ($4000) into A
; (Sign extends A2 and clears A0)
; Load fraction value “0.25” ($2000) into B
; (Sign extends B2 and clears B0)
; Perform Fractional Word Addition
; (0.5 + 0.25 = $4000 + $2000 = $6000 = 0.75)
; Save Result (limiting enabled) to Memory
$0000
$0000
$0000
$0000
A0
B0
A0
B0
After Execution
After Execution
A
A
$0
A2
$0
A2
$0060
$6000
A1
A1
Freescale Semiconductor
$0000
$0000
A0
A0

Related parts for dsp56800e