Computer Hardware User's Guide

Floating-Point Conversion (IEEE Std. 754)
5-23
Data Formats and Floating-Point Operation
Example 5–6.TMS320C3x-to-IEEE Conversion (Fast Version) (Continued)
* CYCLES: 14 (WORST CASE) WORDS: 15
*
.global TOIEEE
*
TOIEEE 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
RETS
NEG POP R0 ; Place number in lower 32 bits
; of R0
ADDI *+AR1(2),R0 ; Add exponent bias (127)
LSH
±1,R0 ; Make space for the sign
ADDI *+AR1(3),R0 ; Add the negative sign
RETS