Ieee-to-tms320c3x floating-point format conversion – Texas Instruments TMS320C3x User Manual

Page 122

Advertising
background image

Floating-Point Conversion (IEEE Std. 754)

5-17

Data Formats and Floating-Point Operation

5.4.1.1

IEEE-to-TMS320C3x Floating-Point Format Conversion

Example 5–4 shows the fast conversion from IEEE to ’C3x floating-point format.
It properly handles the general case when 0 <

e < 255, and also handles 0s (that

is,

e = 0 and f = 0). The other special cases (denormalized, infinity, and NaN)

are not treated and, if present, will give erroneous results.

The fast version of the IEEE-to ’C3x conversion routine was originally developed
by Keith Henry of Apollo Computer, Inc. The other routines were based on this
initial input.

Example 5–4. IEEE-to-TMS320C3x Conversion (Fast Version)

*

TITLE IEEE TO TMS320C3x CONVERSION (FAST VERSION)

*
*
*

SUBROUTINE FMIEEE

*
*

FUNCTION: CONVERSION BETWEEN THE IEEE FORMAT AND THE

*

TMS320C3x FLOATING-POINT FORMAT. THE NUMBER TO

*

BE CONVERTED IS IN THE LOWER 32 BITS OF R0.

*

THE RESULT IS STORED IN THE UPPER 32 BITS OF R0.

*

UPON ENTERING THE ROUTINE, AR1 POINTS TO THE

*

FOLLOWING TABLE:

*

*

(0) 0xFF800000 <

– –

AR1

*

(1) 0xFF000000

*

(2) 0x7F000000

*

(3) 0x80000000

*

(4) 0x81000000

*

*

ARGUMENT

ASSIGNMENTS:

*

ARGUMENT

|

FUNCTION

*

–––––––––––+–––––––––––––––––––––––––––––––––––––

*

R0

|

NUMBER TO BE CONVERTED

*

AR1

|

POINTER TO TABLE WITH CONSTANTS

*

*

REGISTERS USED AS INPUT: R0, AR1

*

REGISTERS MODIFIED: R0, R1

*

REGISTER CONTAINING RESULT: R0

*

Advertising