Putting it All Together - 2023.1 English

Vitis Tutorials: Hardware Acceleration (XD099)

Document ID
XD099
Release Date
2023-08-02
Version
2023.1 English

The following section summarizes all the steps to control the Vivado tool implementation with the v++ command, optimize design with the Vivado tools, and reuse implemented DCP to generate the platform file. You might use it as a quick reference for commands.

  1. Set up the core development kit and working directory.

     #setup Xilinx Vitis tools. XILINX_VITIS and XILINX_VIVADO will be set in this step.
     source <VITIS_install_path>/settings64.sh
     #setup Xilinx runtime. XILINX_XRT will be set in this step.
     source <XRT_install_path>/setup.sh
    
  2. Generate the platform file (xclbin) with v++ commands.

    v++ -t hw --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 --config design.cfg -c -k apply_watermark -o apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xo ../src/krnl_watermarking.cl
    v++ -t hw -s --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 --config design.cfg -R2 -l -o apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xclbin apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xo
    
  3. Optimize the design with the Vivado tool, and rewrite the routed DCP.

    vivado -mode batch -source opt.tcl
    
  4. Reuse the routed DCP to generate the device binary file (.xclbin).

    v++ -t hw --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 --config design.cfg -l -o apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xclbin apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xo --reuse_impl ./_x/link/vivado/routed.dcp
    
  5. This tutorial has provided host code to make it complete to run through various flows. The following commands are references to build the host and run the application.

    #Generate the host executable.
    g++ -I$XILINX_XRT/include/ -I$XILINX_VIVADO/include/ -Wall -O0 -g -std=c++11 -L$XILINX_XRT/lib/ -lOpenCL -lpthread -lrt -lstdc++ -o 'host' '../src/host.cpp'
    #Please set correct XCL_EMULATION_MODE manually if running sw_emu and hw_emu modes
    ./host apply_watermark.hw.xilinx_u250_gen3x16_xdma_4_1_202210_1.xclbin ../src/inputImage.bmp ../src/golden.bmp