Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 12/13/2021
Public

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

Document Table of Contents

11.3.2. Supported OpenCL* Language Constructs

If you are using the Intel® HLS Compiler to develop libraries to use with the Intel® FPGA SDK for OpenCL™ , you might need access to OpenCL* language constructs that are not typically available natively from C++ language elements. The Intel® HLS Compiler provides support for some OpenCL* language constructs through the ocl_types.h header file.

All basic signed and unsigned OpenCL* data types (double, float, long long, long, int, short, char and bool) are supported without needing the ocl_types.h header file.

Add OpenCL* language construct support by adding the following code to your component:`
#include "HLS/ocl_types.h"
The OpenCL* types header file adds support for the following OpenCL* language constructs:
Note: The size of the long data type is 64 bits in OpenCL* and for the Intel® HLS Compiler on Linux systems. For Intel® HLS Compiler on Windows systems, the size of long is 32 bits.

OpenCL* Address Space Qualifiers

The ocl_types.h header file adds macros to support defining pointer in different OpenCL* address spaces as follows:
OpenCL* Address Space Qualifier Intel® HLS Compiler Macro
__global OCL_ADDRSP_GLOBAL
__local OCL_ADDRSP_LOCAL
__constant OCL_ADDRSP_CONSTANT
__private OCL_ADDRSP_PRIVATE

Arbitrary Precision Integers

The ocl_types.h header file supports the OpenCL* intX_t and uintX_t data types up to 64 bits. However, these data types are in the ihc namespace to avoid conflicts with C-system header definitions.

That is, you can use ihc::int1_t through to ihc::int64_t and ihc::uint1_t through to ihc::uint64_t in your component.

Only use these data types to exchange data on your component interface (for example, parameters). Assign them to HLS ac_int<> data types in your component code.

Restriction: While you can use a using namespace ihc; declaration in your code, power-of-two arbitrary precision datatypes still require the ihc:: namespace prefix. For example, you must declare ihc::uint8_t whether it preceded by a using namespace ihc; declaration or not.