6. Run Hardware Emulation - 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_cbc/krnl_cbc_test_hw_emu.xclbin is generated, you can run hardware emulation to verify the kernel in the platform environment for debug or details profiling purpose. You also use different option to compare the different behaviors between ap_ctrl_hs and ap_ctrl_chain modes.

First, use the following command to enable hw_emu mode. 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.

source setup_emu.sh -s  -p PLATFORM_NAME

Then, use the following command to run the program with words-per-groups as 64 and group number as 4 in ap_ctrl_chain mode:

./host_krnl_cbc_test -w 64 -g 4

In the generated wdb waveform database, you can select the AXI-Stream slave ports of krnl_cbc to reflect the work status of the kernel. You can also add emu_wrapper.emu_i.krnl_aes_1.inst.krnl_aes_axi_ctrl_slave_inst.status[3:0] signals to the waveform window to get the status of the AES engines in krnl_aes.

The waveform snapshot is as follows. You can see that the four AES engines are working in parallel to process the four consecutive input data groups.

krnl_cbc waveform

As a contrast, if you use the following command to run the emulation, ap_ctrl_hs execution model will be emulated.

./host_krnl_cbc_test -w 64 -g 4 -s

The following figure shows the waveform. You can see that each time the kernel only processes one input data groups, and there are three processing engines in idle status all the time.

krnl_cbc waveform

The next figure shows the control signals behavior in AXI control slave for ap_ctrl_chain mode, which is similar to the waveform in the previous standalone simulation step.

ap_ctrl_chain waveform

The ~/krnl_cbc/xrt.ini file is used to control the XRT emulation options, as shown below. In line 3, the user_pre_sim_script=/home/workspace/bottom_up_rtl_kernel/krnl_cbc/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 [Emulation]
  2 debug_mode=batch
  3 user_pre_sim_script=/home/workspace/bottom_up_rtl_kernel/krnl_cbc/xsim.tcl
  4
  5 [Debug]
  6 timeline_trace=true
  7 device_trace=coarse