Saturation detection in floating point to integer conversions
First Claim
Patent Images
1. A method comprising:
- receiving a floating point number and an integer field size indicating a number of bit positions in an integer field;
comparing an exponent value of the floating point number to the integer field size to produce a set of relational outputs;
determining whether ones or zeros are present in particular bit positions of a mantissa of the floating point number to produce a set of boundary condition outputs; and
predicting whether the floating point number when converted to an integer value would saturate the integer field based on at least one of a sign of the floating point number, the set of relational outputs, and the set of boundary condition outputs.
1 Assignment
0 Petitions
Accused Products
Abstract
An improved method and apparatus for saturation detection in floating point to integer conversions is described. A floating point number is tested for saturation conditions based on an integer field size. From testing the saturation conditions on the floating point number, the present invention predicts whether a floating point number can be converted into an integer value having the given integer field size, or whether the integer field would be saturated. In one embodiment, the saturation conditions are tested on the floating point number in parallel with a floating point to integer conversion.
13 Citations
25 Claims
-
1. A method comprising:
-
receiving a floating point number and an integer field size indicating a number of bit positions in an integer field;
comparing an exponent value of the floating point number to the integer field size to produce a set of relational outputs;
determining whether ones or zeros are present in particular bit positions of a mantissa of the floating point number to produce a set of boundary condition outputs; and
predicting whether the floating point number when converted to an integer value would saturate the integer field based on at least one of a sign of the floating point number, the set of relational outputs, and the set of boundary condition outputs. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
-
-
15. A machine readable storage medium having stored thereon machine executable instructions, the execution of said machine executable instructions to implement a method comprising:
-
receiving a floating point number and an integer field size indicating a number of bit positions in an integer field;
comparing an exponent value of the floating point number to the integer field size to produce a set of relational outputs;
determining whether ones or zeros are present in particular bit positions of a mantissa of the floating point number to produce a set of boundary condition outputs; and
predicting whether the floating point number when converted to an integer value would saturate the integer field based on at least one of a sign of the floating point number, the set of relational outputs, and the set of boundary condition outputs. - View Dependent Claims (16, 17, 18, 19)
the set of relational outputs indicates whether a most significant one of the floating point number would be in a bit position more significant than a most significant bit position in the integer field, wherein the integer field would be saturated. -
18. The machine readable storage medium of claim 15 wherein the
the set of relational outputs indicates whether a most significant one of the floating point number would be in a most significant bit position of the integer field, wherein the integer field would be saturated if the integer value would be rounded up, or the floating point number is positive, or the floating point number is negative and less than all lower order bits of the integer value would be non-zero. -
19. The machine readable storage medium of claim 15 wherein the
the set of relational outputs indicates whether a most significant one of the floating point number would be in a second most significant bit position of the integer field, wherein the integer field would be saturated if the integer value would be rounded up, and the floating point number is positive, and all lower order bits of the integer value would be one.
-
-
20. An apparatus comprising:
-
an input port to receive a floating point number and an integer field size indicating a number of bit positions in an integer field;
a comparator to compare an exponent value of the floating point number to the integer field size to produce a set of relational outputs;
a plurality of logic elements to determine whether ones or zeros are present in particular bit positions of a mantissa of the floating point number to produce a set of boundary condition outputs; and
a combinational logic unit to predict whether the floating point number when converted to an integer value would saturate the integer field based on at least one of a sign of the floating point number, the set of relational outputs and the set of boundary condition outputs. - View Dependent Claims (21, 22, 23, 24, 25)
set of relational outputs indicates whether a most significant one of the floating point number would be in a bit position more significant than a most significant bit position in the integer field, wherein the integer field would be saturated. -
23. The apparatus of claim 20 wherein the
set of relational outputs indicates whether a most significant one of the floating point number would be in a most significant bit position of the integer field, wherein the integer field would be saturated if the integer value would be rounded up, or the floating point number is positive, or the floating point number is negative and less than all lower order bits of the integer value would be non-zero. -
24. The apparatus of claim 20 wherein the
set of relational outputs indicates whether a most significant one of the floating point number would be in a second most significant bit position of the integer field, wherein the integer field would be saturated if the integer value would be rounded up, and the floating point number is positive, and all lower order bits of the integer value would be one. -
25. The apparatus of claim 20 wherein the plurality of logic elements comprise:
-
a rounding detector to predict if the integer value would be rounded up;
a sign detector to detect a sign bit of the floating point number; and
a zeros/ones detector to predict if less than all lower order bits of the integer field would be non-zero.
-
-
Specification