6. Run Hardware Emulation (Optional) - 2023.1 English

Vitis Tutorials: Hardware Acceleration (XD099)

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

When the XCLBIN file for hardware emulation (~/krnl_aes/krnl_aes_test_hw_emu.xclbin) is generated, you can run hardware emulation to verify the kernel in the platform environment for debug or details profiling purposes. Refer to the following commands.

source setup_emu.sh -s on -p PLATFORM_NAME
./host_krnl_aes_test -w 32

The first command calls the script to generate the emulation configuration file, and set the necessary environment variables. The PLATFORM_NAME is the Alveo platform you are using, which can be xilinx_u200_xdma_201830_2 (default), xilinx_u250_xdma_201830_2, xilinx_u280_xdma_201920_3, or xilinx_u50_gen3x16_xdma_201920_3.

The second command runs the host program in hw_emu mode. The optional command line parameter -w 32 sets the number of 128-bit words to process. The default word number in the program source code is 1048576 (1 million), which is too big for hardware emulation, so you can set it to a smaller value to shorten the emulation run time.

The ~/krnl_aes/xrt.ini file is used to control the XRT emulation options, as shown below. In line 2, exclusive_cu_context=true is necessary if the low-level kernel.write_register() function is used. In line 6, user_pre_sim_script=/home/workspace/bottom_up_rtl_kernel/krnl_aes/xsim.tcl sets the absolute path to the pre-simulation Tcl script used by XSIM to indicate the tool to dump the waveform for all the signals.

NOTE: Make sure to modify the path to match your real path.

  1 [Runtime]
  2 exclusive_cu_context=true
  3
  4 [Emulation]
  5 debug_mode=batch
  6 user_pre_sim_script=/home/workspace/bottom_up_rtl_kernel/krnl_aes/xsim.tcl
  7
  8 [Debug]
 9 opencl_trace=true
 10 device_trace=fine

After the hardware emulation run finishes, you can open the generated xilinx_xxx-0-krnl_aes_test_hw_emu.wdb file in Vivado to analyze the waveform. The following figure shows the waveform for the behavior of eight AXI stream ports of krnl_aes.

krnl_aes waveform

The next figure shows the control signals behavior in AXI control slave for ap_ctrl_hs mode.

ap_ctrl_hs waveform