Motorola DSP96002 User Manual page 713

32-bit digital signal processor
Table of Contents

Advertisement

; Entry point:
;
; Inputs:
r0 contains the lowest address of a 4-word internal
;
;
r1 contains an integer number
;
; Outputs:
r0 contains the lowest address of a 4-word internal
;
;
; Alters:
D0.L,D1.L
;
; NOTE:
r1 contains an integer. (It does NOT point to an address.)
;
dp_scale move
move
add
jvc
move
move
move
move
rts
scle
move
rts
page
;
; MOTOROLA DSP96002 DPLIB - VERSION 1.0
;
; DP_SQRT - Find the square root of a double precision number.
;
; Entry point:
;
; Inputs:
r0 contains the lowest address of a 4-word internal
;
;
; Outputs:
r0 contains the lowest address of a 4-word internal
;
;
; Alters:
D0.L,D1.L,D2.L,D3.L,D4.L,D5.L,D6.L,D7.L
;
dp_sqrt
move
tst
jne
tst
jne
rts
_ok
move
tst
jne
move
sub
lsr
B-194
dp_scale:
c(r0)
extended precision number
extended precision number
r1,d0.l
x:(r0),d1.l
d0,d1
#$3fffffff,d0.l
scle
d0.l,x:(r0)
#$ffffffff,d0.l
d0.l,x:(r0+ms)
d0.l,x:(r0+ls)
d1.l,x:(r0)
dp_sqrt:
c(r0)
extended precision number
extended precision number
x:(r0+ms),d0.l
d0
x:(r0),d1.l
_ok
d1
_ok
x:(r0+sign),d0.l
d0
uflow
#bias,d2.l
d2,d1
#1,d0.l
d1
DSP96002 USER'S MANUAL
c(r0) * 2**r1
;put scale factor in data register
;get exponent
;scale the number
;scale if no overflow
;
if overflow,
;
set the result
;
to the maximum
;
number achievable
;save scaled exponent
sqrt(c(r0))
;get most significant
;check, get exponent
;not zero
;check ls
;not zero
;if already 0, return
;get sign
;check for negative
;return 0
;get bias
;unbias exponent
;square root of exponent
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents