dsp56800 Freescale Semiconductor, Inc, dsp56800 Datasheet - Page 67

no-image

dsp56800

Manufacturer Part Number
dsp56800
Description
16-bit Digital Signal Controllers
Manufacturer
Freescale Semiconductor, Inc
Datasheet
OVER:
;
3.3.8
The DSP56800 instruction set contains several instructions which simplify extended- and multi-precision
mathematical operations. By using these instructions, 64-bit and 96-bit calculations can be performed, and
calculations involving different-sized operands are greatly simplified.
3.3.8.1
Two instructions, ADC and SBC, assist in performing multi-precision addition (Example 3-12) and
subtraction (Example 3-13), such as 64-bit or 96-bit operations.
3.3.8.2
Two instructions are provided to assist with multi-precision multiplication. When these instructions are
used, the multiplier accepts one signed and one unsigned two’s-complement operand. The instructions are:
Freescale Semiconductor
X:$1:X:$0:Y1:Y0 + A2:A1:A0:B1:B0 = A2:A1:A0:B1:B0
(B2 must contain only sign extension before addition begins;
that is, bits 35–31 are all 1s or 0s)
A2:A1:A0:B1:B0 - X:$1:X:$0:Y1:Y0 = A2:A1:A0:B1:B0
(B2 must contain only sign extension before addition begins;
that is, bits 35–31 are all 1s or 0s)
MOVE
ANDC
MOVE
MPYSU X0,Y0,A
TSTW
BGE
MOVE
MOVE
ADD
(ASR
MPYSU — multiplication with one signed and one unsigned operand
MOVE
MOVE
ADD
MOVE
MOVE
ADC
MOVE
MOVE
SUB
MOVE
MOVE
SBC
Multi-Precision Operations
Multi-Precision Addition and Subtraction
Multi-Precision Multiplication
X:FIRST,X0
#$7FFF,X0
X:SECOND,Y0
X:FIRST
OVER
#$0,B
Y0,B1
B,A
A)
X:$21,B
X:$20,B0
Y,B
X:$0,Y0
X:$1,Y1
Y,A
X:$21,B
X:$20,B0
Y,B
X:$0,Y0
X:$1,Y1
Y,A
Example 3-11. Multiplying Two Unsigned Fractional Values
; Get first operand from memory
; Force first operand to be positive
; Get second operand from memory
; Perform final addition if MSB of first operand was a one
; If first operand is less that one, jump to OVER
; Move Y0 to B without sign extension
; Optionally convert to integer result
; Correct sign extension
; First 32-bit addition
; Get second 32-bit operand from memory
; Second 32-bit addition
; Correct sign extension
; First 32-bit subtraction
; Get second 32-bit operand from memory
; Second 32-bit subtraction
Example 3-13. 64-Bit Subtraction
Example 3-12. 64-Bit Addition
Data Arithmetic Logic Unit
Fractional and Integer Data ALU Arithmetic
3-23

Related parts for dsp56800