Motorola DSP96002 User Manual
Page 639
B-120
DSP96002 USER’S MANUAL
MOTOROLA
dc 0.2093549e-02 ;**7
dc -.02777411e-02 ;**6
dc 0.3357901e-02 ;**5
dc 0.8940958e-02 ;**4
dc 0.5558203e-01 ;**3
dc 0.2402348e+00 ;**2
dc 0.6931450e+00 ;**1
dc 0.1000000e+01 ;**0
;
; d2.s = d4.s**d0.s = exp2(d0 * log2(d4))
;
; calculate d2=log2(d4)
;
getexp d4,d7 #logc,r0 ;get exponent 2 2
fgetman d4,d4 ;get mantissa 1 1
fclr d2 x:(r0)+,d1.s ;clr sum, get coef 1 1
do #9,_log ;do log2(man) 2 3
fmpy.x d2,d4,d2 ;sum*x 1 1
fadd.x d1,d2 x:(r0)+,d1.s ;sum*x+coef, coef 1 1
_log
float.x d7 ;float exponent 1 1
fadd.s d7,d2 ;add log2(man) 1 1
;
fmpy.x d2,d0,d0 ;y*log2(x) 1 1
;
; calculate d2=exp2(d0)
;
floor d0,d7 #expc,r0 ;get lowest int 2 2
fsub.x d7,d0 ;get fraction part 1 1
fclr d2 x:(r0)+,d1.s 1 1
int d7 ;get lowest int 1 1
do #9,_exp 2 3
fmpy.x d2,d0,d2 d7.l,d7.h ;sum*x, move scale 1 1
fadd.x d1,d2 x:(r0)+,d1.s ;+coef, get next coef 1 1
_exp
fscale.s d7,d2 ;exp2(y*log2(x)) 1 1
--- ---
Totals: 21 55