Texas Instruments TMS320C3x 사용자 설명서

다운로드
페이지 757
Floating-Point Conversion (IEEE Std. 754)
5-25
Data Formats and Floating-Point Operation
Example 5–7.TMS320C3x-to-IEEE Conversion (Complete Version) (Continued)
*
TOIEEE1
LDF
R0,R0
;
Determine the sign of the number
LDFZ
*+AR1(4),R0
;
If 0, load appropriate number
BND
NEG
;
Branch to NEG if negative (delayed)
ABSF
R0
;
Take the absolute value
;
of the number
LSH
1,R0
;
Eliminate the sign bit in R0
PUSHF
R0
POP
R0
;
Place number in lower 32 bits of R0
ADDI
*+AR1(2),R0
;
Add exponent bias (127)
LSH
±
1,R0
;
Add the positive sign
CONT
TSTB
*+AR1(5),R0
RETSNZ
;
If e > 0, return
TSTB
*+AR1(7),R0
RETSZ
;
If e = 0 & f = 0, return
PUSH
R0
POPF
R0
LSH
±
1,R0
;
Shift f right by one bit
PUSHF
R0
POP
R0
ADDI
*+AR1(6),R0
;
Add 1 to the MSB of f
RETS
NEG
POP
R0
;
Place number in lower 32 bits of R0
BRD
CONT
ADDI
*+ARI(2),R0
;
Add exponent bias (127)
LSH
±
1,R0
;
Make space for the sign
ADDI
*+AR1(3),R0
;
Add the negative sign
RETS