5.Run Hardware Emulation - 2022.2 English

Vitis Tutorials: AI Engine Development

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

After packaging, everything is set to run emulation. Since you ran aiesimulator with profiling enabled, you can bring that to hardware emulation. You can pass the aiesim_options.txt to the launch_hw_emu.sh which will enable the profiling options used in aiesimulator to be applied to hardware emulation. To do this, you will just add the -aie-sim-options ../aiesimulator_output/aiesim_options.txt.

  1. To run emulation use the following command:

    make run_emu TARGET=hw_emu
    

    Or

    cd ./sw
    ./launch_hw_emu.sh -aie-sim-options ../aiesimulator_output/aiesim_options.txt -add-env AIE_COMPILER_WORKDIR=../Work
    

When launched, use the Linux prompt presented to run the design. Note that the emulation process is slow, so do not touch the keyboard of your terminal or you might stop the emulation of the Versal booth (as it happens in the real HW board)

  1. Execute the following command when the emulated Linux prompt finally appears:

    cd /run/media/*1
    export XILINX_XRT=/usr
    dmesg -n 4 && echo "Hide DRM messages..."
    

This will set up the design to run emulation and remove any unnecessary DRM messaging.

  1. Run the design using the following command:

    ./host.exe a.xclbin
    

Note: The design is running with dumping VCD, which will extend emulation time. It may look like it is hung, but it is not.

  1. You should see an output displaying TEST PASSED. When this is shown, run the keyboard command: Ctrl+A x to end the QEMU instance.

  2. To view the profiling results and trace in Vitis™ Analyzer run the command:

    vitis_analyzer sw/sim/behav_waveform/xsim/default.aierun_summary
    

    hw_emu analyzer

As you can tell from opening up this run summary, that it is the same layout as the one from aiesimulator.

  1. Click Trace. This will open up the VCD data (as defined in the aiesim_options.txt). This gives detailed information about kernels, tiles, and nets within the AI Engine during execution. Here you can see stalls in regards to each kernel and can help you identify where they are originating.

    hw_emu trace

  2. Click Profile. This will bring up the same view as shown for the profiling of the aiesimulator, but now it will have information gathered from running hardware emulation.

  3. Click Total Function Time you will see this:

    hw_emu profile

    As you can tell the values here differ from the one used in aiesimulator.

The final two views: Graph and Array are same to what you saw in the aiesimulator run summary.

  1. Open the aiesimulator run summary by going to File > Open Summary and navigating to the aiesimulator_output directory and clicking on default.aierun_summary.

Explore the two reports and take notice of any differences and similarities. These will help you debug and optimize your design.

  1. Close out of the Vitis Analyzer and build for hardware.