dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 186

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
Data Arithmetic Logic Unit
Figure 5-27 graphically demonstrates the advantages of saturation arithmetic. In this example, the A
accumulator contains the following 36-bit value to be read to a 16-bit destination:
If this accumulator is read with a
register contains the following value after the move instruction, assuming signed fractional arithmetic:
This result is clearly in error because the value –1.0 in the X0 register greatly differs from the value of +1.0
in the source accumulator. In this case, overflow has occurred. To minimize the error due to overflow, it is
preferable to write the maximum (“limited”) value that the destination can assume. In this example, the
limited value would be:
This value is clearly closer than –1.0 is to the original value, +1.0, and thus introduces less error.
Example 5-29 is a simple illustration of positive saturation.
5-40
35
3
0 . . . 0 1 0 0 . . . . . . . . . . 0 0 0 0 . . . . . . . . . . . 0 0
Limiting automatically occurs when the 36-bit operands A, B, C, or D are read with a MOVE.W instruction. Note that
the contents of the original accumulator are NOT changed.
0 15
0000 1.000 0000 0000 0000 0000 0000 0000 0000 (in binary)
(+1.0 in fractional decimal, $0 8000 0000 in hexadecimal)
1.000 0000 0000 0000 (–1.0 fractional decimal, $8000 in hexadecimal)
0.111 1111 1111 1111 (+ 0.999969 fractional decimal, $7FFF in hexadecimal)
15
1 0 0 . . . . . . . . . . 0 0
MOVE.W
INC.W
MOVE.W
INC.W
MOVE.W
INC.W
MOVE.W
INC.W
MOVE.W
INC.W
MOVE.W
INC.W
MOVE.W
MOVE.W
Without Limiting—
Example 5-29. Demonstrating the Data Limiter—Positive Saturation
#$7FFC,A
A
A,X:(R0)+
A
A,X:(R0)+
A
A,X:(R0)+
A
A,X:(R0)+
A
A,X:(R0)+
A
A,X:(R0)+
A1,X:(R0)+
0 15
0
MOVE.W A1,X0
X0 = –1.0
Figure 5-27. Example of Saturation Arithmetic
MOVE.W A1,X0
DSP56800E Core Reference Manual
IERRORI = 2.0
; Initialize A = $0:7FFC:0000
; A = $0:7FFD:0000
; Write $7FFD to memory (limiter enabled)
; A = $0:7FFE:0000
; Write $7FFE to memory (limiter enabled)
; A = $0:7FFF:0000
; Write $7FFF to memory (limiter enabled)
; A = $0:8000:0000 <=== Overflows 16 bits!
; Write $7FFF to memory (limiter saturates)
; A = $0:8001:0000
; Write $7FFF to memory (limiter saturates)
; A = $0:8002:0000
; Write $7FFF to memory (limiter saturates)
; Write $8002 to memory (limiter disabled)
0
0
A = +1.0
instruction, which disables limiting, the 16-bit X0
35
0 . . . 0 1 0 0 . . . . . . . . . . 0 0 0 0 . . . . . . . . . . . 0 0
3
0 15
15
0 1 1 . . . . . . . . . . 1 1
With Limiting—
MOVE.W A,X0
0 15
0
X0 = +0.999969
Freescale Semiconductor
IERRORI = .000031
0
0
A = +1.0

Related parts for dsp56800e