Motorola DSP96002 User Manual

Page 638

Advertising
background image

MOTOROLA

DSP96002 USER’S MANUAL

B-119

fmpy.x d4,d4,d4 ;scale power 1 1

pwr --- ---

Totals: 7 100

Power Function X**Y

X = Single Precision Float, Y = 32 Bit Unsigned Integer

Program

ICycles

Words

;

; d1.s = d4.s**d0.l

;

bfind d0,d0 #32,d2.l ;how many bits 2 2

move d0.h,d3.l 1 1

sub d3,d2 #1.0,d1.s ;initialize power 2 2

do d2.l,pwr 2 3

lsr d0 ;get lsb 1 1

fmpy.x d1,d4,d1 ifcs ;multiply if bit set 1 1

fmpy.x d4,d4,d4 ;scale power 1 1

pwr --- ---

Totals: 10 3N+8

where N is the bit position of the most significant "one" bit in Y

plus 1.

Power Function X**Y

X = Single Precision Float, Y = Single Precision Float

Program

ICycles

Words

logc

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

expc

dc -0.5770606e-03 ;**8

Advertising