The final step is to package the RTL IP into a Xilinx object (XO) file, so the kernel can be used in the Vitis core development kit. This is done using the
package_xo
Tcl command in the Vivado Design Suite.
After packaging the IP, the package_xo
command is run from within the Vivado tool. The
package_xo
command uses the component.xml file from the IP to create the necessary
kernel.xml if possible. The Vivado tool runs design rule checks as a pre-processor
for package_xo
to determine that everything is
available and either processes the IP to create the XO file, or returns errors
indicating any issues that might exist.
The following example packages an RTL kernel IP named test_sincos
, found in the specified IP directory, into an
object file named test.xo, creating the required
kernel.xml file, and using the ap_ctrl_chain
protocol:
package_xo -xo_path ./test.xo -kernel_name test_sincos \
-ctrl_protocol ap_ctrl_chain -ip_directory ./ip/
The output of the package_xo
command
is the test.xo file, that can be added as a source
file to the v++ --link
command as discussed in Building and Running the Application, or added to an application project as
discussed in Using the Vitis IDE.
In some cases, you might find it necessary to provide a kernel.xml file for your IP, as specified in the
requirements described in RTL Kernel XML File. You can
use the -kernel_xml
option to specify the file for the
package_xo
command. In this case, the package_xo
command uses the kernel.xml as specified. The following example shows this command.
package_xo -xo_path ./test.xo -kernel_name test_sincos \
-kernel_xml ./src/kernel.xml -ip_directory ./ip/
To use the RTL kernel during software emulation, you must provide a C-model for the kernel. The C-model must have a function prototype that compiles in hardware to the same interface used in your RTL kernel. However, the C-model does not need to be synthesizeable by the HLS tool.
You can use the package_xo
-kernel_files
option to add a C-model to the packaged RTL kernel:
package_xo -xo_path ./test.xo -kernel_name test_sincos -kernel_xml ./src/kernel.xml \
-ip_directory ./ip/ -kernel_files ./imports/sincos_cmodel.cpp
The package_xo
command packages the
C-model files into cpu_sources inside the XO. The
following C-model file suffixes are automatically recognized:
- .cl = OpenCL
- .c, .cpp, .cxx = C/C++