Intel® High Level Synthesis Compiler Pro Edition: Reference Manual
A newer version of this document is available. Customers should click here to go to the newest version.
8. Arbitrary Precision Math Support
Some of these header files are based on the Algorithmic C (AC) data types that Mentor Graphics* provides under the Apache license. For more information about the Algorithmic C data types, refer to Mentor Graphics Algorithmic C (AC) Datatypes, which is available as a part of your Intel® HLS Compiler installation: <quartus_installdir>/hls/include/ref/ac_datatypes_ref.pdf.
The Intel® HLS Compiler also supports arbitrary-precision IEEE 754 compliant floating point data types that is not based on the AC data types.
Data Type | Intel Header File | Description |
---|---|---|
ac_int | HLS/ac_int.h | Arbitrary-width integer support
To learn more, review the following tutorials:
|
ac_fixed | HLS/ac_fixed.h | Arbitrary-precision fixed-point number support To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/ac_datatypes/ac_fixed_constructor |
HLS/ac_fixed_math.h | Support for some nonstandard math functions for arbitrary-precision fixed-point data types To learn more, review the tutorial: <quartus_installdir>/hls/examples/tutorials/ac_datatypes/ac_fixed_math_library |
|
ac_complex | HLS/ac_complex.h | Complex number support |
hls_float | HLS/hls_float.h | Arbitrary-precision floating-point number support |
HLS/hls_float_math.h | Support for commonly used exponential, logarithmic, power, and trigonometric functions.
To learn more, review the following tutorials:
|
- ac_fixed data type
Include the HLS/ac_fixed_math.h header file
- hls_float data type
Include the HLS/hls_float_math.h header file
Advantages of Arbitrary Precision Data Types
The arbitrary precision data types have the following advantages over using standard C/C++ data types in your components:
- You can achieve narrower data paths and processing elements for various operations in the circuit.
- The data types ensure that all operations are carried out in a size guaranteed not to lose any data. However, you can still lose data if you store data into a location where the data type is too narrow.
Limitations of AC Data Types
The AC data types have the following limitations:
- Multipliers are limited to generating 512-bit results.
- Dividers for ac_int data types are limited to a maximum of 128 bit unsigned or 127 bit signed.
- Dividers for ac_fixed data types are limited to a maximum of 64 bits (unsigned or signed).
- The FPGA-optimized header files provided by the Intel® HLS Compiler are not compatible with GCC or MSVC. When you use the Intel® HLS Compiler header files, you cannot use GCC or MSVC to compile your testbench. Both your component and testbench must be compiled with the Intel® HLS Compiler.
To compile AC data types with GCC or MSVC, use the reference AC data types headers also provided with he Intel® HLS Compiler. For details, see AC Data Types and Native Compilers.
Limitations of the Intel® HLS Compiler Arbitrary Precision Floating Point Data Type
- Casting an hls_float datatype to an unsigned integer generates signed integer cast. Ensure that the hls_float value is cast into a signed integer that is large enough to contain the hls_float value being casted (for example, by using an ac_int datatype).
- Floating point optimization into constants performed for float and double data types is not done for the hls_float data type.
-
A limited set of math functions is supported. For details, see Operators and Return Types Supported by the hls_float Data Type.
- The hls_float header files provided by the Intel® HLS Compiler are not compatible with GCC or Microsoft Visual Studio. When you use the Intel® HLS Compiler header files, you cannot use GCC or Microsoft Visual Studio to compile your testbench. Both your component and testbench must be compiled with the Intel® HLS Compiler. For details, refer to Compiler Interoperability.
- The high-level design reports do not show bit widths for the hls_float data type.
-
Constant initialization works only with the round-towards-zero (RZERO) rounding mode.