The recommended approach for creating C++ PL kernels is using the Vitis HLS tool. The techniques of programming,
simulating, and synthesizing the PL kernel objects are described in the
Vitis HLS User Guide (UG1399). The synthesized kernel object
(.xo) can be exported from the HLS tool and used in the
v++ --link command as described in Linking the Kernels. However, it is better to use the optimized C++ code with any required HLS pragmas to
define the PL kernel and compile it using the Vitis
v++ --compile), as described below.
v++options that need to be used. The following is an example command line to compile the
v++ -t sw_emu --platform xilinx_u200_gen3x16_xdma_2_202110_1 -c -k vadd \ -I'./src' -o'vadd.sw_emu.xo' ./src/vadd.cpp
The various arguments used are described below. Note that some of the arguments are required.
-t <arg>: Specifies the build target, as discussed in Build Targets. Software emulation (
sw_emu) is used as an example. Optional. The default is hw.
--platform <arg>: Specifies the accelerator platform for the build. This is required because runtime features, and the target platform are linked as part of the FPGA binary. To compile a kernel for an embedded processor application, specify an embedded processor platform:
-c: Compile the kernel. Required. The kernel must be compiled (
-c) and linked (
-l) in two separate steps.
-k <arg>: Name of the kernel associated with the source files.
-o'<output>.xo': Specify the shared object file output by the compiler. Optional.
<source_file>: Specify source files for the kernel. Multiple source files can be specified. Required.
The above list is a sample of the extensive options available. Refer to v++ Command for details of the various command line options. Refer to Output Directories of the v++ Command to get an understanding of the location of various output files.
After the compilation step is complete, any reports generated during this process are collected into the <kernel_name>.compile_summary. This collection of reports can be viewed by opening the compile_summary in Vitis analyzer, and includes a Summary report, Kernel Estimate for timing and resource estimates, Kernel Guidance offering any suggestions for compilation, and the HLS Synthesis log from Vitis HLS. Refer to Using the Vitis Analyzer for additional information.