Running emulation under the QEMU environment for embedded processors is
compute-intensive and requires additional setup and configuration. You must
cross-compile the embedded application using arm-gcc
,
create an SD card image, and boot Linux under the QEMU environment before running the
application. The PS on x86 feature lets you simulate your embedded system design on an
x86 processor with much less effort. This feature requires you to compile the PS
application using an x86 version of gcc
or g++
compiler, and to build your .xclbin file to run on an emulation platform for software emulation
created by emconfigutil
.
--package.defer_aie_run
option as shown in the config file
examples below. The process for building and running software emulation using PS on x86 is as follows:
- Compile the PS application using the standard
gcc
compiler rather than the Arm cross-compiler. This is described in Compiling and Linking for x86. - Compile and link the device binary (.xclbin) using standard
v++
commands as described in Building the Device Binary. -
For the PS on x86 flow the
v++ --package
command tells the tool what processor to use for emulation (--package.emu_ps
).For AMD Versal™ platforms it is also needed to convert the
.xsa
produced by thev++ --link
command into an.xclbin
file. This step is not required for AMD Zynq™ UltraScale+™ MPSoC based platforms. - Use the emconfigutil Utility to
create an emconfig.json file for software
emulation.
emconfigutil --platform xilinx_zcu102_base_202220_1
- Set the
XCL_EMULATION_MODE
environment variable tosw_emu
for software emulation mode.Important: The emulation targets will not run if theXCL_EMULATION_MODE
environment variable is not properly set. - Run the application. For example:
./host.exe kernel.xclbin
The following are example emconfigutil
and
v++ --package
commands. Use the emconfigutil
to create the virtual platform needed for
emulation, and the v++ --package
comand to create the
system for emulation.
emconfigutil --platform $PLATFORM_REPO_PATHS/xilinx_vck190_base_202310_1/xilinx_vck190_base_202310_1.xpfm --nd 1
followed by,
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.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 commands:
setenv XCL_EMULATION_MODE sw_emu
./host_ps_on_x86 a.xclbin
The following table describes the differences in building the PS application and device binary (.xclbin) for running software emulation under QEMU and for running PS on x86.
Process | Running SW_EMU under QEMU | SW_EMU with PS on X86 |
---|---|---|
Host compilation |
Requires cross-compilation using
|
Requires x86
|
Package |
Requires SD card image creation to run under QEMU, specifies the emulation processor to be QEMU:
|
For PS on x86 simulation the
|
Running Simulation |
Requires use of
|
Set emulation mode environment variable and launch application directly:
|
You can compile the same PS code using arm-gcc
in x86 gcc
. However, any ARM-only
data types or libraries that are linked in your PS code will not work when compiled for
x86. Refer to ps_on_x86 on GitHub for an example of
running software emulation using this feature.