Motorola DSP96002 User Manual page 643

32-bit digital signal processor
Table of Contents

Advertisement

org
x:0
scale
set
tantab
tanarg
set
dup
scale
set
dc
tanarg
set
endm
org
p:$100
;
;
Do argument reduction, input in d6 in degrees
;
move
fadd.x
d7,d6
fmpy.x
d5,d6,d6
floor
d6,d5
fsub.x
d5,d6
fmpy.x
d5,d6,d6
fadd.x
d7,d6
;
;
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
B-124
1.0
45.0*3.14159/180.0
tabsize
scale*@cos(tanarg)
@tan(tanarg)
tanarg/2.0
#-180.0,d7.s
#1.0/360.0,d5.s
#360.0,d5.s
#90.0,d7.s
d6.s,d3.s
#180.0,d7.s
ffge
fflt
ffge
#tantab,r0
#scale,d0.s
#45.0,d6.s
x:(r0)+,d4.s
fflt
fflt
ffge
fsub.x d2,d0
DSP96002 USER'S MANUAL
;get range min
;adjust to min, get range
;reduce range
;get int part
;get frac part, spread
;spread fraction part to range
;adjust to min
;make positive, get pi/2
;save new sign
;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
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents