Motorola DSP96002 User Manual page 679

32-bit digital signal processor
Table of Contents

Advertisement

move
ori
ori
ori
jmp
;
; Begin Rounding the Result
;
;
; Check for Denormalized Numbers
;
_rnd
move
move
move
and
cmp
jne
tst
dec
;
; Remove Bits to Right of the Sticky Bit
;
_remst
move
and
;
; Check GRS Bits Equal Zero
;
move
move
and
tst
jeq
ori
ori
;
; Check Rounding Mode
;
jset
jset
;
; Round to nearest even
;
jclr
bclr
tst
jne
jset
jmp
_r1chk
jclr
;
; Round toward +infinity
;
jclr
jmp
B-160
d6.l,d1.h
;
#$10,ccr
; set infinity bit
#$09,ier
; set OVF and INX bits in IER
#$09,er
; set OVF and INX bits in ER
_done
; result is infinity
#eden,d7.l
; get denorm exponent
d6.l,d5.l
; get expr
#emsk,d4.l
; get exponent mask
d4,d5
; delete tags and sign
d7,d5
; compare exponents
_remst
; jump if not a denorm
d3
; test mantr.high
d6
ifpl.u
; decrement expr if no int bit
#smsk,d7.l
; get sticky mask
d7,d1
; remove bits right of sticky
d1.l,d5.l
; get register with GRS bits
#grsmsk,d7.l
; get GRS mask
d7,d5
; get GRS bits
d5
; check GRS bits = zero
_lmove
; jump if no rounding required
#$1,ier
; set inexact result bit
#$1,er
; set inexact result bit
#21,sr,_r1chk
; jump if rounding bit r0 = 1
#22,sr,_rminf
; jump if round toward -infinity
#10,d5.l,_lmove ; check guard bit
#10,d5.l
; delete G bit
d5
; check sticky and round bits
_addone
; jump if S or R bits = 1
#11,d1.l,_addone ; add one if LSB of result = 1
_lmove
; no rounding required
#22,sr,_lmove
; jump if round toward zero
#31,d6.l,_addone ; add one if positive
_lmove
; get result in d1
DSP96002 USER'S MANUAL
"
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents