Importing HLS Kernels - 2024.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2024-05-30
Version
2024.1 English

To import the HLS kernel as a block into Vitis Model Composer, you need to select it from the HLS/User-Defined Functions library.

Figure 1. HLS Kernel

Double-click the block symbol to display the parameters of the HLS kernel block as shown in the following figure.

Figure 2. HLS Kernel Parameters

The block mask parameters need to be updated to import the HLS kernel as a block. The following table provides details on the parameters and descriptions for each parameter.

Table 1. Parameters
Parameter Name Parameter Type Criticality Description
Kernel header file String Mandatory The name of the HLS kernel header file that contains the function declaration. The string could be just the file name, a relative path to the file, or an absolute path of the file. Use the Browse button to select the file.

If environment variables are used to specify the header file path, then an appropriate error is returned.

Kernel function String Mandatory The name of the kernel function in C/C++ for which the HLS kernel block is to be created.
Kernel source file String Optional The name of the source file that contains the kernel function implementation (definition). The string could be just the file name, a relative path to the file or the absolute path of the file.

The kernel source file is optional if the header file contains both the declaration as well as the definition of the function.

If environment variables are used to specify the source file path, an appropriate error is returned.

Kernel search paths Vector of Strings Optional If the kernel header file or the kernel source file are not found using in the current folder, then the paths provided in Kernel search paths are used to locate the files.

This parameter allows use of environment variables while specifying paths for the kernel header file and the kernel source file. The environment variable can be used in either ${ENV} or $ENV format.

Preprocessor options   Optional Optional preprocessor arguments for downstream compilation with specific preprocessor options.

The following two preprocessor option formats will be accepted (multiple can be selected): -Dname and -Dname=definition. That is, the optional argument must begin with the -D string and if the option definition value is not provided, it is assumed to be 1.

After successful import, the Configuration tab displays automatically. You can quickly review the HLS Kernel definition and specify the directionality of the ports from the drop-down as shown in following figure.

Figure 3. Kernel Definition and Ports

When you click the Build button after specifying the directionality of the ports, a new window opens as shown in the following figure. Do not forget to set the Signal size appropriately for stream signal types or else you might run into a memory overflow. For example, if at every invocation, the kernel produces 16 samples, set Signal Size to 16.

Figure 4. Kernel Definition and Ports (Post-Build)