beautypg.com

Motorola DSP96002 User Manual

Page 634

background image

MOTOROLA

DSP96002 USER’S MANUAL

B-115

B.1.46

Evaluation of LOG(x)

Floating-point evaluation of log

2

(x) can be performed by representing x as s*(2**e) where s is the signifi-

cand and e is the unbiased exponent. Then, log

2

(s*(2**e)) = log

2

(s) + e. After extracting the significand s,

log

2

(s) can be evaluated with a polynomial. By adding the unbiased exponent, log

2

(x) results. Various

execution speeds and accuracies may be determined by using different order polynomials.

page 132,60,1,1

org x:0

polyc

dc 0.6681523e-02 ;**8

dc -0.6736254e-01 ;**7

dc 0.2584541e+00 ;**6

dc -0.3676691e+00 ;**5

dc -0.4461204e+00 ;**4

dc 0.2740512e+01 ;**3

dc -0.5236615e+01 ;**2

dc 0.6184454e+01 ;**1

dc -0.3072334e+01 ;**0

org p:$100

;

; calculate d2=log2(d0)

;

Program

ICycles

Words

getexp d0,d7 #polyc,r0 2 2

fgetman d0,d0 1 1

fclr d2 x:(r0)+,d1.s 1 1

do #9,_log2sig 2 3

fmpy.x d2,d0,d2 1 1

fadd.x d1,d2 x:(r0)+,d1.s 1 1

_log2sig

float.x d7 1 1

fadd.s d7,d2 1 1

--- ---

Totals: 10 27