![background image](http://html.mh-extra.com/html/motorola/freescale-semiconductor-dsp56000/freescale-semiconductor-dsp56000_user-manual_246570060.webp)
A - 60
DSP56000/DSP56001 USER’S MANUAL
MOTOROLA
Explanation of Example: Prior to execution, the 56-bit A accumulator contains the 56-
bit, sign-extended fractional dividend D (D=$00.0E66D7:F2832C=0.112513535894635
approx.) and the 24-bit X0 register contains the 24-bit, signed fractional divisor S
(S=$123456=0.142222166061401). Since |D|<|S|, the execution of the previous divide
routine stores the correct 24-bit signed quotient in the 24-bit X1 register (A/
X0=0.79111111164093=$654321=X1). The partial remainder is restored by reversing
the last DIV operation and adding back the absolute value of the signed divisor in X0 to
the partial remainder in A1. This produces the correct LS 24 bits of the 48-bit signed
remained in the 24-bit B1 register. Note that the remainder is really a 48-bit value which
has 24 bits of precision. Thus, the correct 48-bit remainder is $000000:000100 which
equals 0.0000000000018190 approximately.
Note that the divide routine used in the previous example assumes that the sign-
extended 56-bit signed fractional dividend is stored in the A accumulator and that the 24-
bit signed fractional divisor is stored in the X0 register. This routine produces a full 24-bit
signed quotient and a 48-bit signed remainder.
This routine may be greatly simplified for the case in which only positive, fractional oper-
ands are used to produce a 24-bit positive quotient and a 48-bit positive remainder, as
shown in the following example:
1-Quadrant division, 24-bit unsigned quotient, 48-bit unsigned remainder
AND #$FE,CCR
;clear carry bit C (quotient sign bit)
REP #$18
;form a 24-bit quotient and remainder
DIV X0,A
;form quotient in A0, remainder in A1
ADD X0,A
;restore remainder in A1
Note that this routine assumes that the 56-bit positive, fractional, sign-extended dividend
is stored in the A accumulator and that the 24-bit positive, fractional divisor is stored in
Before Execution
After Execution
A
A
$00:0E66D7:F2832C
X0
X0
$123456
$123456
$FF:EDCCAA:654321
X1
X1
$000000
$654321
B
B
$00:000000:000000
$00:000100:654321
DIV
Divide Interation
DIV
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..