Texas Instruments TMS320C3x 사용자 설명서

다운로드
페이지 757
Floating-Point to Integer Conversion (FIX Instruction)
5-41
Data Formats and Floating-Point Operation
5.9
Floating-Point to Integer Conversion (FIX Instruction)
Using the FIX instruction, you can convert an extended-precision floating-
point number to a single-precision integer in a single cycle. The floating-point
to integer conversion of the value 
x is referred to here as fix(x). The conversion
does not overflow if 
a, the number to be converted, is in the range:
– 2
31
 
 
α
 
 2
31
 – 1
First, you must be certain that
α
(
exp) 
30
If these bounds are not met, an overflow occurs. If an overflow occurs in the
positive direction, the output is the most positive integer. If an overflow occurs
in the negative direction, the output is the most negative integer. If 
α
(
exp) is
within the valid range, then 
α
(
man), with implied bit included, is sign-extended
and right-shifted (rs) by the amount
rs = 31 – 
α
(
exp)
This right shift (rs) shifts out those bits corresponding to the fractional part of
the mantissa. For example:
If 0 
 
×
 < 1, then fix(
x) = 0
If –1 
 
×
 < 0, then fix(
x) = –1
Figure 5–20 shows the flowchart for the floating-point-to-integer conversion.