Importing Templatized Functions - 2024.1 English

Vitis Model Composer User Guide (UG1483)

Document ID
Release Date
2024.1 English

HLS kernel block supports importing a templatized function as a block into Vitis Model Composer. Consider the HLS kernel with function template as depicted in the following code.

template <typename T, int C>
void my_add_temp(hls::stream<T> & in1, hls::stream<T> & in2, hls::stream<T> & out)
   T a, b, c;
   a =;
   b =;
   c = a + b * C;

After configuring the port directionalities and clicking Build as explained in the previous section, the following dialog box opens for setting the template values.

Figure 1. Block Parameters Dialog Box

You can enter the template values in the Function Template Parameters section, click Apply then click OK. This generates the HLS Kernel block with all the ports in the interface.