beautypg.com

Motorola DSP96002 User Manual

Page 711

background image

B-192

DSP96002 USER’S MANUAL

MOTOROLA

dp_move move x:(r1),d0.l ;move exponent

move d0.l,x:(r0)

move x:(r1+sign),d0.l ;move sign

move d0.l,x:(r0+sign)

move x:(r1+ms),d0.l ;move ms

move d0.l,x:(r0+ms)

move x:(r1+ls),d0.l ;move ls

move d0.l,x:(r0+ls)

rts

;

; MOTOROLA DSP96002 DPLIB - VERSION 1.0
;
; DP_MPY - Multiply two double precision numbers.

;

; Entry point: dp_mpy: c(r0)

c(r1) * c(r2)

;

; c d

; * a b

; d b

; c b

; d a

; c a

; x y

;

; Inputs: r0 contains the lowest address of a 4-word internal

; extended precision number

; r1 contains the lowest address of a 4-word internal

; extended precision number

;

; Outputs: r0 contains the lowest address of a 4-word internal

; extended precision number

;

; Alters: D0.L,D1.L,D2.L,D3.L,D4.L,D5.L,D6.L,D7.L,D0.M

;

dp_mpy clr d4 x:(r1+ms),d2.l ;get c

move x:(r2+ms),d3.l ;get a

mpyu d2,d3,d0 x:(r2+ls),d5.l ;c*a, get b

mpyu d5,d2,d2 d0.m,d1.l ;c*b, move high

move d2.m,d2.l

add d2,d0 x:(r1+ls),d2.l ;add to low, get d

addc d4,d1 x:(r2),d5.l ;get exponent

mpyu d2,d3,d2 x:(r2+sign),d7.l ;d*a

move d2.m,d2.l

add d2,d0 x:(r1),d6.l ;add to low

addc d4,d1 #bias,d4.l ;get bias

jeq uflow ;if *0, set 0 result

inc d5 ifmi ;if normed

jmi _nonorm

lsl d0 ;if not normed

rol d1 ;if not normed

_nonorm add d5,d6 d1.l,x:(r0+ms) ;do exponents

sub d4,d6 d0.l,x:(r0+ls) ;1 bias

move x:(r1+sign),d1.l