Motorola DSP96002 User Manual page 704

32-bit digital signal processor
Table of Contents

Advertisement

abig
sub
cmp
jmi
cmp
jge
sub
clr
lsr
;
; Add the two mantissas together
;
addmant
move
move
cmp
jmi
jeq
;
; Calculate the result assuming that c(r1) > 0 and c(r0) < 0
;
aneg
cmp
jne
cmp
jeq
decid
jcc
r0fromr1 move
sub
subc
move
;
; Normalize the result
;
subnorm
jeq
bfind
lsl
lsl
move
sub
move
lsr
or
sub
jmp
msis0
tst
jeq
bfind
lsl
add
sub
jmp
signseq
add
addc
addnorm
jcc
ror
ror
MOTOROLA
d5,d6
d6,d7
#31,d7.l
aequala
d6,d7
#32,d7.l
dshiftx
d7,d6
d2.l,d3.l ;yes, shift ms to ls
d2.l
d6.l,d0.h ;# of shifts to be performed
d0.h,d3
x:(r0+sign),d6.l
x:(r1+sign),d7.l
d7,d6
apos
signseq
d2,d0
decid
d3,d1
#0,d7.l
dp_clr
r1fromr0
d7.l,x:(r0+sign)
d1,d3
d0,d2
d3.l,d1.l ;calculate c(r0)_ms
d2.l,d0.l
msis0
d0,d0
d0.h,d0
d1.l,d2.l ;shift c(r0)_ms
d0.h,d1
#32,d7.l
d0.h,d3.l
d3,d7
d7.l,d0.h
d0.h,d2
d2,d0
d3,d4
leave
d1.l
#32,d3.l
dp_clr
d1,d0
d1.l,d0.l ;find out how many zeros in ls
d0.h,d0
d0.h,d2.l ;get bits to go from ls to ms
d2,d3
d3,d4
#0,d1.l
leave
d3,d1
d2,d0
leave
d0.l
d1.l
DSP96002 USER'S MANUAL
;c(r0) exponent is greater
;is |r0(exp)-r1(exp)| > 63?
;yes, then c(r0) + c(r1) = c(r0)
;is |r0(exp)-r1(exp)| > 31?
;no, shift both c(r1) words
;align the mantissas
;get c(r0) sign
;get c(r1) sign
;are the signs the same?
;c(r0) > 0 and c(r1) < 0
;c(r0) and X have the same sign
;compare mantissas
;if ms's are equal, test ls's
;compare ls of mantissas
;clear reg_a if same magnitude
;if c(r0) > c(r1), c(r0) - c(r1)
;make sign positive
;subtract c(r0) from c(r1)
;put result in c(r0) register
;test ms word
;find out how many zeros in ms
;shift c(r0)_ls
;copy # of shifts
;# of opposite dir. shifts
;move # of shifts to .h reg.
;get bits to go from ls to ms
;shift in bits from ls to ms
;decrement the exponent
;make sure the exp is valid
;test if ls is zero
;zero reg_a if yes
;include shifts from ms
;decrement the exponent
;make sure the exp is valid
;add lower words
;add upper words
;test for carry
;normalize the sum
;shift ms and ls
B-185

Advertisement

Table of Contents
loading

Table of Contents