Step 1 - Creating custom RTL kernels with the Vivado® Design Suite - 2022.2 English

Vitis Tutorials: AI Engine Development

Document ID
XD100
Release Date
2022-12-01
Version
2022.2 English

Package your RTL code as a Vivado IP and generate a Vitis RTL kernel.

  1. Open the polar_clip_rtl_kernel.tcl file.

  2. This Tcl script creates an IP following the Vivado IP Packaging flow as described in the Creating and Packaging Custom IP User Guide (UG1118).

    Note the following points:

    • The script creates a Vivado Design Suite project; this is required to create any IP because all source and constraint files need to be local to the IP.

    • Lines 40 and 41 are used to associate the correct clock pins to the interfaces. This is required for the Vitis compiler which links those interfaces to the platform clocking.

      ipx::associate_bus_interfaces -busif in_sample -clock ap_clk [ipx::current_core]
      ipx::associate_bus_interfaces -busif out_sample -clock ap_clk [ipx::current_core]
      
    • On lines 44 and 45 the FREQ_HZ bus parameter is removed. This parameter is used in IP integrator, and is to make sure the associated clock of the interface is used correctly. However, the Vitis compiler sets this during the compilation process, and having it set in the IP will cause the compiler to incorrectly link the clocks.

      ipx::remove_bus_parameter FREQ_HZ [ipx::get_bus_interfaces in_sample -of_objects [ipx::current_core]]
      ipx::remove_bus_parameter FREQ_HZ [ipx::get_bus_interfaces out_sample -of_objects [ipx::current_core]]
      
    • At the end of the script there is the package_xo command. This command analyzes the IP that was created to make sure proper AXI interfaces are used and other rule checks are followed. It then creates the XO file in the same location as the IP repository. A key function used in this command is the -output_kernel_xml. The kernel.xml file is key to the RTL kernel as it describes to the Vitis tool how the kernel should be controlled. You can find more information on RTL kernels and their requirements here.

      package_xo -kernel_name $kernelName \
          -ctrl_protocol ap_ctrl_none \
          -ip_directory [pwd]/ip_repo/$kernelName \
          -xo_path [pwd]/ip_repo/${kernelName}.xo \
          -force -output_kernel_xml [pwd]/ip_repo/kernel_${kernelName}_auto.xml
      
  3. To complete this step run the following command:

    vivado -source polar_clip_rtl_kernel.tcl -mode batch
    

    or

    make polar_clip.xo