Hardware Emulation - 2022.2 English

Vitis Tutorials: AI Engine Development

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

Next, rrun the Hardware Emulation targeting the custom platform as follows:

  1. Link AI Engine & PL kernels with platform:

    make xsa TARGET=hw_emu
    

    or

    v++ -l --platform $PLATFORM_REPO_PATHS/vck190_custom.xpfm s2mm.xo mm2s.xo libadf.a -t hw_emu --save-temps -g --config system.cfg -o tutorial.xsad
    
  2. Compile the A72 Host Application:

    make host
    

    or

    cd ./sw
    aarch64-xilinx-linux-g++ -Wall -c -std=c++14 -Wno-int-to-pointer-cast --sysroot=$SDKTARGETSYSROOT -I$SDKTARGETSYSROOT/usr/include/xrt -I$SDKTARGETSYSROOT/usr/include -I./ -I../aie -I$XILINX_VITIS/aietools/include -I$XILINX_VITIS/include -o aie_control_xrt.o ../Work/ps/c_rts/aie_control_xrt.cpp
    
    aarch64-xilinx-linux-g++ -Wall -c -std=c++14 -Wno-int-to-pointer-cast --sysroot=$SDKTARGETSYSROOT -I$SDKTARGETSYSROOT/usr/include/xrt -I$SDKTARGETSYSROOT/usr/include -I./ -I../aie -I$XILINX_VITIS/aietools/include -I$XILINX_VITIS/include -o main.o .cpp
    
    aarch64-xilinx-linux-g++ main.o aie_control_xrt.o -ladf_api_xrt -lxrt_coreutil -L$SDKTARGETSYSROOT/usr/lib --sysroot=$SDKTARGETSYSROOT -L$XILINX_VITIS/aietools/lib/aarch64.o -o host.exe
    cd ..
    
  3. Package the Design

    make package TARGET=hw_emu
    

    or

    cd ./sw
    v++ --package -t hw_emu \
       -f $PLATFORM_REPO_PATHS/vck190_custom.xpfm \
       --package.rootfs=$ROOTFS \
       --package.image_format=ext4 \
       --package.boot_mode=sd \
       --package.kernel_image=$IMAGE \
       --package.defer_aie_run \
       --package.sd_file host.exe ../tutorial.xsa ../libadf.a
    cd ..
    
  4. Run Hardware Emulation

    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
    
  5. 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..."
    
  6. Run the design using the following command:

    ./host.exe a.xclbin
    
  7. You should see an output displaying TEST PASSED. When this is shown, run the keyboard command: Ctrl+A x to end the QEMU instance.

  8. You can view the profiling and trace results of hardware emulation in Vitis™ Analyzer by running the following command:

vitis_analyzer sw/sim/behav_waveform/xlsxdefault.aierun_summary
  1. You can easily compare the results of the custom platform with the one generated using base platform. For example:

  • Select File > Open Summary to open the summary file generated for the base platform target.

  • Once the summary file opens, click Trace to open the VCD data which gives information about kernels, tiles and nets within the AI Engine.

  • Click the Compare option as shown in the following figure.

hw_emu_trace_compare

  • From the drop down, you can select the trace output of other summary file as highlighted below.

hw_emu_trace_compare2