Motorola DSP96002 User Manual page 709

32-bit digital signal processor
Table of Contents

Advertisement

dec
_startdiv
move
;
;
unsigned fractional divide: d7:d6 / d5:d4 = d3:d2
;
do
cmp
jhi
jlo
cmp
jhs
_small
andi
jmp
_big
sub
subc
ori
_q
rol
rol
lsl
rol
_divloop move
move
move
move
eor
move
jmp
;
; MOTOROLA DSP96002 DPLIB - VERSION 1.0
;
; DP_INT - Truncate a double precision number to an integer.
;
; 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:
D2.L,D3.L,D4.L,D7.L,D0.H
;
dp_int
move
move
sub
jmi
cmp
jpl
cmp
jpl
clr
asr
B-190
d1
d1.l,x:(r0)
#64,_divloop
d5,d7
_big
_small
d4,d6
_big
#$fe,ccr
_q
d4,d6
d5,d7
#$01,ccr
d2
d3
d6
d7
d3.l,x:(r0+ms)
d2.l,x:(r0+ls)
x:(r0+sign),d0.l
x:(r1+sign),d1.l
d1,d0
d0.l,x:(r0+sign)
echeck
dp_int:
c(r0)
extended precision number
extended precision number
x:(r0),d4.l
#bias,d7.l
d7,d4
#64,d2.l
dp_clr
d2,d4
#32,d2.l
aequala
d2,d4
#$80000000,d3.l
rndls
d1.l
d4.l,d0.h
d0,d3
x:(r0+ms),d0.l
DSP96002 USER'S MANUAL
;and adjust exponent
;save new exponent
;compare ms word
;dividend > divisor
;dividend < divisor
;compare ls word
;dividend >= divisor
;set 0 q bit
;adjust remainder
;set 1 q bit
;move in q bit
;adjust remainder
;save ms
;save ls
;get sign
;get sign
;new sign
;save sign
;check for errors
truncate to integer
;get exponent
;get bias
;calculate how far to shift
;if a fraction, zero the number
;is A > 2**63
;yes, out of range
;is A > 2**31
;yes, last valid digit is in ls
;no, put # shifts in .h register
;zero ls, create trunc. mask
c(r0)
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents