Visible to Intel only — GUID: khc1506020779207
Ixiasoft
Visible to Intel only — GUID: khc1506020779207
Ixiasoft
2.3. Compiler Interoperability
GCC/MSVC | i++ | |
---|---|---|
Testbench | X | X |
Component (emulation) | X | X |
Component (RTL) | X |
To see what versions of GCC and Microsoft Visual Studio the Intel® HLS Compiler supports, see " Intel® High Level Synthesis Compiler Prerequisites" in Intel® High Level Synthesis Compiler Getting Started Guide.
To use a native compiler (GCC or Microsoft Visual Studio) to compile your Intel® HLS Compiler code, you must run your native compiler from a terminal session where you initialized the environment for the Intel® HLS Compiler. The initialization script chooses the correct native compiler for you system.
GCC
- Initialize your environment with the Intel® HLS Compiler initialization script:
<quartus_installdir>/hls/init_hls.sh
- Add the path to the Intel® HLS Compiler header files to the g++ command include path with the -l command option.
The header files are in the quartus_installdir/hls/include directory.
- Add the path to the HLS emulation library to the linker search path with the -L command option.
The emulation library is in the quartus_installdir/hls/host/linux64/lib directory.
- Add the hls_emul library to the linker command (that is, specify -lhls_emul as a command option).
- Ensure that you specify the -std=c++17 option of the g++ command.
- If you want to generate debug symbols, specify the -g option of the g++ command.
- If you are using HLS tasks in a system of tasks (ihc::launch and ihc:collect), specify the -pthread option of the g++ command.
- If you are using arbitrary precision datatypes, include the reference version in your source code instead of the FPGA-optimized version provided with the Intel® HLS Compiler. You can use the __INTELFPGA_COMPILER__ macro to control which variant is included. For example, if you are using arbitrary precision integers, you can use the following macro code
#ifdef __INTELFPGA_COMPILER__ #include "HLS/ac_int.h" #else #include "ref/ac_int.h" #endif
g++ myFile.cpp -g -I"$(HLS_INSTALL_DIR)/include"
-L"$(HLS_INSTALL_DIR)/host/linux64/lib" -lhls_emul
-pthread -std=c++17
Microsoft Visual C++
The following instructions were tested with Microsoft Visual Studio 2017 Professional.
To compile your Intel® HLS Compiler code with Microsoft Visual C++:
- Initialize your environment with the Intel® HLS Compiler initialization script:
<quartus_installdir>/hls/init_hls.bat
- Add the Intel® HLS Compiler header files to the compiler command include path with the /l command option.
The header files are in the quartus_installdir\hls\include directory.
- Add the /Zi option to generate debug symbols when compiling.
- Add the /wd4068 option to suppress warnings because MSVC does not recognize the Intel® HLS Compiler pragmas.
- Add the HLS emulation library to the linker search path with the /libpath command option.
The emulation library is in the quartus_installdir\hls\host\windows64\lib directory.
- Add the hls_emul library to the linker command.
- If you are using arbitrary precision datatypes, include the reference version instead of the FPGA-optimized version provided with the Intel® HLS Compiler. You can use the __INTELFPGA_COMPILER__ macro to control which version is included:
#ifdef __INTELFPGA_COMPILER__ #include "HLS/ac_int.h" #else #include "ref/ac_int.h" #endif
cl myFile.cpp /I "%HLS_INSTALL_DIR%\include" /nologo /EHsc /wd4068 /MD
/std:c++17 /Zi
/link "/libpath:%HLS_INSTALL_DIR%\host\windows64\lib"
hls_emul.lib