Motorola DSP96002 User Manual page 564

32-bit digital signal processor
Table of Contents

Advertisement

indspc
rindspc
move
move
move
fsub.s
fmpy.s
floor
int
fsub.s
nop
move
move
move
fsub.s
fmpy.s
fadd.s
B.1.25
Argument Reduction
Argument reduction (AR) is the problem of having a desired floating point number range and an argument
that is outside of the range. The argument is placed inside of the desired range by adding or subtracting
multiples of the desired number range. Of course, adding and subtracting multiples of a number is inher-
ently slow and requires infinite precision. Some simple methods can be used with some assumptions on
the precision of the data and relative argument sizes.
The following program performs AR when the desired range is arbitrary and the input value is arbitrary. This
may be used to reduce an angle to the range of -pi to pi.
The following variables are defined:
rmin = range minimum value, -pi in this example
rmax = range maximum value, pi in this example
range = rmax-rmin, 2 * pi in this example
o_range = 1.0/range
Assume the input is in d0.
MOTOROLA
equ
5.0
equ
1.0/indspc
#table,n0
;point to start of table
#firstindex,d6.s ;value of first index
#rindspc,d7.s
;reciprocal of index spacing
d6,d0
;adjust input relative to index
d7,d0,d0
;reduce range and create index
d0,d1
;get index
d1
d1.s,d2.s ;convert index to int,copy int part
d2,d0
d1.l,r0 ;x-X(i), get ptr to table
;clear address ALU pipe
(r0)+n0
;point to Y(i)
x:(r0)+,d4.s
;get Y(i)
x:(r0),d5.s
;get Y(i+1)
d4,d5
;Y(i+1)-Y(i)
d0,d5,d5
; * (x-X(i))
d5,d4
;+Y(i)
DSP96002 USER'S MANUAL
;index spacing
;reciprocal of index spacing
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
---
---
Totals:
12
12
B-45

Advertisement

Table of Contents
loading

Table of Contents