Developer Guide

FPGA Optimization Guide for Intel® oneAPI Toolkits

ID 767853
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Algorithmic C Data Types

The following table summarizes the algorithmic C (AC) data types:

Algorithmic C Data Types Supported by the Intel® oneAPI DPC++/C++ Compiler
Data Type Header File Variable Declaration Description
ac_int <sycl/ext/intel/ac_types/ac_int.hpp>
  • Template-based declaration:

    ac_int<N, true> var_name; //Signed N-bit integer

    ac_int<N, false> var_name; //Unsigned N-bit integer

  • Predefined types up to 63 bits:

    ac_intN::intN var_name; //Signed N-bit integer

    ac_intN::uintN var_name; //Unsigned N-bit integer

Arbitrary-precision integer support
ac_fixed <sycl/ext/intel/ac_types/ac_fixed.hpp>

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

Arbitrary-precision fixed-point number support. For math functions supported by this data type, refer to Math Functions Provided by the ac_fixed_math.hpp Header File.
ac_complex <sycl/ext/intel/ac_types/ac_complex.hpp> Declare according to the data type of your complex number. Complex number support
ap_float <sycl/ext/intel/ac_types/ap_float.hpp> ihc::ap_float<exponent_width, mantissa_width[,rounding_mode]> Arbitrary-precision floating-point number support. For math functions supported by this data type, refer to Math Functions Provided by ap_float_math.hpp Header File

Compilation Flags

Compilation Flags for Data Types
Data Type SYCL Command Flags Description
AC type
  • Linux: -qactypes
  • Windows: /Qactypes
Use these flags to include ac_types header files on the include path and link against AC type libraries required for the host device execution support.
ap_float type
  • Linux: -fp-model=precise -no-fma
  • Windows: /fp:precise /Qfma-
Use these flags to ensure that floating-point operations are accurate.
-DFPGA_EMULATOR Compiles programs with ap_float data type for emulation.

Explicit Conversion Functions

The following table lists the functions to convert to C signed and unsigned integer types int, long and Slong for the ac_int and ac_fixed data types:

AC Data Type Supported Conversion Functions
ac_int to_int(), to_uint(), to_long(), to_ulong(), to_int64(), to_uint64(), to_double()
ac_fixed to_int(), to_uint(), to_long(), to_ulong(), to_int64(), to_uint64(), to_double(), to_float() , to_ac_int()

Math Functions Provided by the ac_fixed_math.hpp Header File

The ac_fixed_math.hpp header file adds support for the following non-standard math functions for the arbitrary precision fixed-point (ac_fixed) data type:

  • sqrt_fixed
  • reciprocal_fixed
  • reciprocal_sqrt_fixed
  • sin_fixed
  • cos_fixed
  • sincos_fixed
  • sinpi_fixed
  • cospi_fixed
  • sincospi_fixed
  • log_fixed
  • exp_fixed

Math Functions Provided by ap_float_math.hpp Header File

The ap_float_math.hpp header file adds support for the following arbitrary precision fixed-point (ap_float) data type functions:

Math Functions Provided by ap_float_math.hpp Header File
Function Type Math Functions Comment
Exponential and logarithmic functions
  • ln
  • log2, log10
  • ex, 2x, 10x
Supported only for ap_float data types with exponent width less than or equal to 15 bits and mantissa width less than or equal to 63 bits.
  • ln(1+x)
  • ex−1
Supported only for ap_float data types with exponent width less than or equal to 11 bits and mantissa width less than or equal to 52 bits.
Advanced functions
  • reciprocal
  • reciprocal_sqrt
  • sqrt
  • cube root
  • hypot (hypotenuse)
Power functions
  • pow
  • powr
  • pown
Trigonometric functions
  • sin, cos, sincos
  • sinpi, cospi
  • asin, asinpi
  • acos, acospit
  • atan, atanpi, atan2