This step demonstrates how software emulation can run the PS application on an x86 process instead of an Arm process for an AI Engine design. Software emulation is an abstract model and does not use any of the PetaLinux drivers such as Zynq OpenCL (ZOCL), interrupt controller, or Device Tree Binary (DTB). Hence, the overhead of creating an
sd_card.img, and booting PetaLinux on a full QEMU machine is too heavyweight for software emulation and can be avoided.
There are no changes required in the AI Engine graph compilation for x86sim target, V++ compile, and link steps. For the remaining stages such as, host compilation, package, and launch emulation, follow these steps:
a. Remove the host compilation outputs (
.o) and executable (
host.exe) generated during Run PS application on Arm Process (QEMU) step.
cd .. make clean_for_x86
Note: XRT needs to be installed on the host and the
$XILINX_XRT variable should be set by sourcing the
b. Unset the
CXX variable that points to the
aarch64-linux-gnu-g++ compiler. Run the following command to set
g++ for the x86 process.
setenv CXX g++
c. Use the tutorial’s
Makefile.sw_x86 that configures the correct GCC_FLAGS, GCC_LIB, and GCC_INCLUDE options and
package commands that corresponds to running the PS application on an x86 process.
cp -rf Makefile.sw_x86 Makefile
d. Compile the host application by running the following command.
cd ./sw g++ -Wall -c -std=c++17 -D__PS_ENABLE_AIE__ -Wno-int-to-pointer-cast -I$XILINX_XRT/include -I./ -I../aie -I$XILINX_VITIS/aietools/include -o host.o host.cpp g++ *.o -lxrt_coreutil -L$XILINX_VITIS/aietools/lib/lnx64.o -L$XILINX_XRT/lib -o ./host_ps_on_x86
To compile the host code, it is required to use the
c++17 package. Ensure your
g++ compiler has the necessary packages installed.
e. Package the design. In addition to packaging, the
emconfigutil command is used to generate the device, board, and device tree details (
emconfig.json) which are required by XRT before loading the
emconfigutil --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202310_1/xilinx_vck190_base_202310_1.xpfm --nd 1
cd ./sw v++ -p -t sw_emu \ --package.defer_aie_run \ --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202310_1/xilinx_vck190_base_202310_1.xpfm \ --package.out_dir ./package.sw_emu \ ../tutorial.xsa ../libadf.a
f. To run the emulation use the following command:
cd ./sw setenv XCL_EMULATION_MODE sw_emu ./host_ps_on_x86 a.xclbin
Observe the difference in launching the emulation process. Unlike in the QEMU emulator, the
launch_sw_emu.shscript is not used. Instead, the outputs of the host compilation and package steps are used to launch the emulation.
Also notice that the start up time required to boot up Linux in the QEMU process is longer, and the emulation process is slower than running the PS application on x86.