beautypg.com

Motorola DSP96002 User Manual

Page 637

background image

B-118

DSP96002 USER’S MANUAL

MOTOROLA

fsub.s d2,d3 ; 1 1

move d3.s,x:(r1)+ ;cz 1 1

--- ---

Totals: 10 10

B.1.49

Power Function X**Y

Power Function X**Y

X = Single Precision Float, Y = 5 Bit Integer

Program

ICycles

Words

;

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

;

andi #0,ccr ;clear ccr bits 1 1

move sr,d3.l ;get sr 1 1

or d0,d3 #1.0,d1.s ;set ccr bits 2 2

move d3.l,sr ;move power to CCR bits 1 1

fmpy.x d1,d4,d1 ifcs ;bit 0, carry 1 1

fmpy.x d4,d4,d4 ifal ;do multiply w/o ccr update 1 1

fmpy.x d1,d4,d1 ifvs ;bit 1, overflow 1 1

fmpy.x d4,d4,d4 ifal ;do multiply w/o ccr update 1 1

fmpy.x d1,d4,d1 ifeq ;bit 2, zero 1 1

fmpy.x d4,d4,d4 ifal ;do multiply w/o ccr update 1 1

fmpy.x d1,d4,d1 ifmi ;bit 3, negative 1 1

fmpy.x d4,d4,d4 ifal ;do multiply w/o ccr update 1 1

fmpy.s d1,d4,d1 ffinf ;bit 4, infinity 1 1

--- ---

Totals: 14 14

Power Function X**Y

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

Program

ICycles

Words

;

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

;

move #1.0,d1.s ;initialize power 2 2

do #32,pwr 2 3

lsr d0 ;get lsb 1 1

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