Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 10/04/2021

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

Document Table of Contents

11.3.1. Creating an Object File From HLS Code

Use the fpga_crossgen command to create objects for your library from your HLS code. An object created from HLS code contains information required both for emulating the functions in the object and synthesizing the hardware for the object functions.

Restriction: Creating object files from HLS code is supported only on Linux operating systems.

The fpga_crossgen command creates one object file from one input source file. The object created can be used only libraries that target the same Intel high-level design tool.

Objects are assigned the same version number as the version number of your Intel® HLS Compiler installation. Libraries can contain only objects with the same version number, and can only be used with Intel high-level design tools with the same version number.

All functions in your HLS code that need to be exported to a library must be defined using the HLS_EXTERNAL macro. For example:
extern "C" HLS_EXTERNAL int my_hls_func(int x);
Remember: Ensure that the functions in your HLS source code are not declared with the HLS component keyword.
Create a library object with the following command:
fpga_crossgen <source_file> --target target_HLD_tool [-o <object_file_name>]
Where the command parameters are defined as follows:
  • target_HLD_tool
    The target Intel® high-level design tool for this library. This parameter can have one of the following values:
    • hls

      Target this object to be included in libraries for components developed with the Intel® HLS Compiler.

      Objects built for the Intel® HLS Compiler are created as operating system specific object files (.o on Linux). You cannot use objects created on one operating system with the Intel® HLS Compiler running on a different operating system.

    • aoc

      Target this object to be included in libraries for kernels developed with the Intel® FPGA SDK for OpenCL™ .

      Objects built for the Intel® FPGA SDK for OpenCL™ are not operating system specific. The objects are created as Intel® FPGA SDK for OpenCL™ object files (.aoco).

      You must have the Intel® FPGA SDK for OpenCL™ Pro Edition installed to use this option. The version of the SDK must be the same as your version of Intel® HLS Compiler.

If you do not specify an object file name with the -o option, the object file name defaults to be the same name as the source file name.

After you generated all objects that you want to include in your library, collect the objects in the library with the fpga_libtool command. For details, see Packaging Object Files Into a Library.