Motorola DSP96002 User Manual page 645

32-bit digital signal processor
Table of Contents

Advertisement

;
Input angle in d6 in degrees, -180 < d6 < 180
;
fabs.x
d6
move
fcmp
d7,d6
fsub.x
d6,d7
ftfr.x
d6,d7
fneg.x
d3
;
;
First quadrant CORDIC trig computation
;
Input angle in d7 in degrees
;
Output d1=sine, d0=cosine
;
move
fclr
d1
fclr
d5
do
#tabsize,_cordic
fcmp
d5,d7
fneg.x
d4
fsub.x
d6,d5
fadd.x
d6,d5
fmpy.x
d1,d4,d2
fmpy
d0,d4,d2 fsub.x d2,d0
fadd.x
d2,d1
fscale.x #-1,d6
_cordic
fcopys.s
ftfr.s
d1,d0
fseedd
d1,d4
ftfr.s
d4,d1
fneg.s
d1
fmpy.s
d1,d4,d1
fmpy
d0,d4,d0
fmpy.s
d1,d2,d1
fmpy
d0,d4,d0
fmpy.s
d0,d3,d0
end
Argument Reduction
Quadrantizing
CORDIC Algorithm
Division/Error Check
B-126
d6.s,d3.s
#90.0,d7.s
#180.0,d7.s
ffge
fflt
ffge
#tantab,r0
#scale,d0.s
#45.0,d6.s
x:(r0)+,d4.s
fflt
fflt
ffge
d3,d0
d0.s,d1.s
ffinf
ffinf
fsub.s d1,d2
fsub.s d1,d3
DSP96002 USER'S MANUAL
;make positive, save sign
;get pi/2
;see if greater than 90
;reduce to less than 90
;transfer if no change
;flip if other quadrant
;point to tangent table
;y=0, x=scale
;z=0,alp=45
;angle < z? get tangent
;yes, rotate cw
;yes, subtract angle
;no, add angle for ccw
;y*tan
;x*tan, x'=x-y*tan
;y'=y+x*tan
;alp=alp/2
;fix sign of tangent
;exchange d0
;d0/d1
#2.0,d2.s
d2.s,d3.s
d2.s,d4.s
;tangent
Program
ICycles
Words
10
10
8
8
16
8N+9
10
10
----
-------
d1
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents