Visible to Intel only — GUID: ogx1496341469900
Ixiasoft
Visible to Intel only — GUID: ogx1496341469900
Ixiasoft
8.2. Declaring ac_fixed Data Types
- Include the ac_fixed.h header file in your component in the following manner:
#ifdef __INTELFPGA_COMPILER__ #include "HLS/ac_fixed.h" #else #include "ref/ac_fixed.h" #endif
- After you include the header file, declare your ac_fixed variables as follows:
- ac_fixed<N, I, true, Q, O> var_name; //Signed fixed-point number
- ac_fixed<N, I, false, Q, O> var_name; //Unsigned fixed-point number
Where the template attributes are defined as follows:- N
- The total length of the fixed-point number in bits.
- I
-
The number of bits used to represent the integer value of the fixed-point number.
The difference of N−I determines how many bits represent the fractional part of the fixed-point number.
- Q
-
The quantization mode that determines how to handle values where the generated precision (number of decimal places) exceeds the number of bits available in the variable to represent the fractional part of the number.
For a list of quantization modes and their descriptions, see "2.1. Quantization and Overflow" in Mentor Graphics Algorithmic C (AC) Datatypes, which is available in the following file: <quartus_installdir>/hls/include/ref/ac_datatypes_ref.pdf.
- O
-
The overflow mode that determines how to handle values where the generated value has more bits than the number of bits available in the variable.
For a list of overflow modes and their descriptions, , see "2.1. Quantization and Overflow" in Mentor Graphics Algorithmic C (AC) Datatypes, which is available in the following file: <quartus_installdir>/hls/include/ref/ac_datatypes_ref.pdf.
For a list of supported operators and their return types, see "Chapter 2: Arbitrary-Length Bit-Accurate Integer and Fixed-Point Datatypes" in Mentor Graphics Algorithmic C (AC) Datatypes, which is available in the following file: <quartus_installdir>/hls/include/ref/ac_datatypes_ref.pdf.
Additional math functions are supported by the HLS/ac_fixed_math.h header file. For details, see Math Functions Provided by the ac_fixed_math.h Header File.