Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
46
Добавлен:
27.04.2015
Размер:
4.26 Mб
Скачать

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:

-2-[N-1] ≤ SI ≤ [2[N-1]-1]

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 ≤ [2N-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

 

 

 

After Execution

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

$0

 

$0020

 

$0000

 

$0

 

$0060

 

$0000

 

 

 

 

 

 

 

 

 

 

 

 

 

A2

A1

 

A0

A2

A1

A0

 

 

 

 

 

 

 

 

 

 

 

 

 

X0

 

$0040

 

 

 

X0

 

$0040

 

 

 

 

 

 

 

 

 

 

 

 

MOVE

#64,X0

 

; Load integer value 64

($40) into X0

 

MOVE

#32,A

 

; Load integer value 32

($20) into A Accumulator

 

 

 

 

; (correctly sign extends into A2 and zeros A0)

 

ADD

X0,A

 

; Perform Integer Word Addition

 

 

 

MOVE

A1,X:RESULT

; Save Result (without saturating) to Memory

 

AA0045

Figure 3-9. Word-Sized Integer Addition Example

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

DSP56800 Family Manual

 

Соседние файлы в папке DSP568xx