In the typical AI Engine development flow, the steps will be as follows.
- Running the x86 simulator for verifying the functional correctness of the AI Engine kernels and graph
- Software emulation of the system for verifying the functional correctness of the complete system
- AI Engine simulator for verifying that the AI Engine kernel and graph meets performance needs of the application
- Hardware emulation of the entire system
- Testing and debugging on hardware
Generally, software emulation is the first step to building and testing the system in a functional process through the custom host code you create rather than the simulator test host code.
Software emulation for a system with the AI Engine can be useful in:
- Checking initial system behavior with a limited known data set
- Functional integration and debugging of PS, PL, and ADF graph using GDB
- Testing the system with external traffic generator using Python, or C++
- Running system with C-based models for RTL kernels
- Applying AI Engine simulation
options through the
x86.optionsfile in Work/options
- When writing host code to execute in software emulation, make
sure all buffer objects (
xrtBO) are synced with
- To run free running PL kernels more than once, you can run it inside a while (1) loop.
To build the project for software emulation confirm that the target
option of the
v++ link and
v++ package command-s are
Running Software Emulation with x86 Model for the PS Arm Processor
v++ -p command packages the
design. In addition to package, the emconfigutil command should be used to generate
the device, board and device tree details (emconfig.json).
emconfigutil --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm --nd 1
cd ./sw v++ -p -t sw_emu \ --package.defer_aie_run \ --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202220_1/xilinx_vck190_base_202220_1.xpfm \ --package.sd_dir $PLATFORM_REPO_PATHS/sw/versal/xrt \ --package.out_dir ./package.sw_emu \ --package.ps_on_x86 \ --package.sd_file ./emconfig.json \ ../tutorial.xsa ../libadf.a
To run the software emulation use the following command
setenv XCL_EMULATION_MODE sw_emu ./host_ps_on_x86 a.xclbin
Running Software Emulation with QEMU Model for the PS ARM Processor
v++ package command
generates the launch_sw_emu.sh script as part
of the process for packaging the system. This script launches the QEMU emulation
environment for the AI Engine application for
test and debug purposes. Software emulation runs separate x86 processes for the PL
kernels and AI Engine kernels, and runs QEMU
for the PS host application.
Use the following command to run software emulation:
When launching software emulation, you can specify options for the
x86simulator simulator that runs the graph
application. The options can be specified from the launch_sw_emu.sh script using the
-x86-sim-options as described in Reusing x86 Simulator Options.
When the emulation is fully booted and the Linux prompt is up, make sure to set the following environment variables in the QEMU environment.
export XILINX_XRT=/usr export LD_LIBRARY_PATH=/mnt/sd*1:/tmp:$LD_LIBRARY_PATH export XCL_EMULATION_MODE=sw_emu
This ensures that the host application works. Now the application can be executed on the Linux prompt.