Motorola DSP96002 User Manual page 565

32-bit digital signal processor
Table of Contents

Advertisement

rmin
equ -3.14159
range
equ 2 * 3.14159
o_range equ 1.0/range
move
move
move
fadd.s
fmpy.s
floor
fsub.s
fmpy.s
fadd.s
The output is in d0. Note that the constant initialization is not included in the benchmark because it does
not need to be executed every time argument reduction is desired and is therefore application dependent.
If the desired range begins at zero (i.e. the desired range is zero to two pi), then the first and last fadd in-
structions can be deleted for a four cycle argument reduction.
This is one possible method for AR and it is efficient. This method will not work when the argument divided
by the result range has no fractional part (in the current precision). This is obvious since it is the fractional
part that contains the information relating to how far the scaled argument is in the reduced range. The in-
teger part tells how many times the range has wrapped around. Typically, a good programmer will keep
the argument to a few multiples of the desired range. In most practical applications, the argument may ex-
ceed the desired range by several integral values. In this case, the presented algorithms work very well.
After the final reduced argument has been obtained, any increments should be made from the reduced ar-
gument to prevent eventual overflow and maintain maximum precision.
B.1.26
Non-IEEE floating-point Division
The following code segments perform the division of d0/d5. The resulting quotient is in d0. These code
segments are used for a fast division without the need to conform to the error checking or error bounds of
the IEEE standard.
The code uses a "convergent division" algorithm. The initial seed obtained from the FSEEDD instruction
has 8 bits of accuracy. Two iterations of the convergent division algorithm provide approximately 32 bits
of accuracy. For more information on the convergent division algorithm, consult "Computer Arithmetic,
Principles, Architecture, and Design" by Kai Hwang, 1979, John Wiley and Sons, New York.
Non-IEEE Division Algorithm
B-46
#range,d7.s
#rmin,d2.s
#o_range,d3.s ;load reciprocal of range
d2,d0
d0,d3,d0
d0,d1
d1,d0
d7,d0d0
d2,d0
DSP96002 USER'S MANUAL
;load desired range
;load range min
;adjust to rmin
;scale the input
;get integer part
;get fractional part
;spread out fraction to range 1
;adjust to rmin
Program ICycles
Words
1
1
1
1
1
1
1
1
1
1
1
---
---
Totals:
6
6
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents