Signed Integer; Unsigned Integer; Addition And Subtraction; Figure 3-9 Word-Sized Integer Addition Example - Motorola DSP56800 Manual

16-bit digital signal processor
Table of Contents

Advertisement

Data Arithmetic Logic Unit
3.3.2.3

Signed Integer

This format is used when data is being processed as integers. Using this format, the N-bit operand is
represented using the N.0 format (N integer bits). Signed integer numbers lie in the following range:
≤ SI ≤ [2
-[N-1]
-2
For words and long-word signed integers the most negative word that can be represented is -32768
($8000), and the most negative long word is -2147483648 ($80000000). The most positive word is 32767
($7FFF), and the most positive long word is 2147483647 ($7FFFFFFF).
3.3.2.4

Unsigned Integer

Unsigned integer numbers may be thought of as positive only. The unsigned numbers have nearly twice
the magnitude of a signed number of the same length. Unsigned integer numbers lie in the following range:
0 ≤ UI ≤ [2
N
-1]
Examples of unsigned integer numbers are 25, 125, and 1999. The binary word is interpreted as having a
binary point immediately to the right of the LSB. The most positive, 16-bit, unsigned integer is 65536
($FFFF). The smallest unsigned number is zero ($0000).
3.3.3

Addition and Subtraction

For fractional and integer arithmetic, the operations are performed identically for addition, subtraction, or
comparing two values. This means that any add, subtract, or compare instruction can be used for both
fractional and integer values.
To perform fractional or integer arithmetic operations with word-sized data, the data is loaded into the
MSP (A1 or B1) of the accumulator as shown in Figure 3-9.
Before Execution
$0
$0020
A2
A1
X0
$0040
MOVE
#64,X0
MOVE
#32,A
ADD
X0,A
MOVE
A1,X:RESULT
Fractional word-sized arithmetic would be performed in a similar manner. For arithmetic operations where
the destination is a 16-bit register or memory location, the fractional or integer operation is correctly
calculated and stored in its 16-bit destination.
3-18
[N-1]
-1]
$0000
A0
; Load integer value 64 ($40) into X0
; Load integer value 32 ($20) into A Accumulator
; (correctly sign extends into A2 and zeros A0)
; Perform Integer Word Addition
; Save Result (without saturating) to Memory
Figure 3-9. Word-Sized Integer Addition Example
DSP56800 Family Manual
After Execution
$0
$0060
A2
A1
X0
$0040
$0000
A0
AA0045

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents