Using the Fixed-Point Data Type

The fixed-point data type provides some of the flexibility of the floating-point data type, but maintains the size and speed advantages of integer arithmetic. Refer to ni.com for more information about the fixed-point data type and working with this data type.

Note Not all FPGA Module VIs and functions support the fixed-point data type. Furthermore, some functions offer only limited fixed-point support. For example, the Sine Wave Generator Express VI supports fixed-point numbers for only the input terminals.
1378 Caution If you wire a fixed-point number to an integer terminal, you might lose fractional bits.

Fixed-Point Configuration Effects on FPGA Resources

When using fixed-point numbers in an FPGA VI, it is important to select the proper overflow and rounding modes for a particular function. The High Throughput Math functions and some Numeric functions have configuration dialog boxes you use to select these modes. If overflow or rounding can occur, these modes affect the amount of FPGA resources an FPGA VI needs. If overflow or rounding cannot occur, the operation does not require additional FPGA resources.

In many situations, you can avoid overflow by placing a checkmark in the Adapt to source checkbox in the configuration dialog box of the function. If you place a checkmark in this checkbox, LabVIEW attempts to adjust the width and range of the output data type such that neither overflow nor rounding occurs. However, this adjustment is not possible in all situations. For example, if a function involves division, rounding always occurs. Also, some functions do not have this checkbox.

Effects of Overflow Modes

In general, the overflow modes affect FPGA resource usage in the following ways:

  • Saturate—Requires FPGA resources to determine whether the input value is within the range of the output type and to choose whether to return the original or saturated value.
  • Wrap—Requires fewer FPGA resources than the Saturate mode.

Effects of Rounding Modes

In general, the rounding modes affect FPGA resource usage in the following ways:

  • Truncate—Removes bits and therefore does not require any FPGA resources. However, this mode produces the largest mean error for most data streams. This mode is the default for integer operations.
  • Round-Half-Up (Asymmetric)—Adds to the least significant bit of the output data type. This option requires an adder that is the width of the output data type.
  • Round-Half-Even—Requires the most FPGA resources and results in the longest combinatorial path of the three rounding modes. However, this mode returns the most statistically correct results for most data streams and is therefore the default rounding mode for the fixed-point data type.
Note The High Throughput Divide and High Throughput Reciprocal functions use a rounding mode that truncates the output value towards zero. This mode rounds the output value down to the nearest value that the output type can represent. If the value is positive, LabVIEW truncates the value. If the value is negative, LabVIEW deletes the least significant bits (LSBs) and adds the sign bit to the remaining LSBs, provided at least one of the deleted bits differs from 0. For example, if the output value x falls between successive values s and t such that s < x < t, LabVIEW sets x to equal s if x is positive. If x is negative, LabVIEW sets x to equal t. For these two functions, truncating towards zero uses the least amount of FPGA resources compared with the other rounding modes. You cannot specify a different rounding mode for these functions.