Importing HLS Kernels - 2022.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2022-05-26
Version
2022.1 English

To import the HLS kernel as a block into 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 in order 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. You can specify both the declaration and the definition of the function in the header file and leave this field empty.

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 Function tab GUI 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 on the build button after specifying the directionality of the ports, a new window opens as shown in the following figure. Don't forget to set the Signal size appropriately for stream signal types or else you may 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)