In the typical AI Engine development flow, the steps will be as follows.
- X86 simulator
- Software emulation of the system
- AI Engine simulator
- Hardware emulation of the system
- Test and debug 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.options
file in Work/options
- When writing host code to execute in software emulation, make
sure all buffer objects (
xrtBO
) are synced withxrtBOSync
API call. - 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 aiecompiler
is -target=x86sim
. The v++
link and
v++
package command-s are set to -target=sw_emu
. The 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:
./launch_sw_emu.sh
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.