Targeting Hardware Emulation - Targeting Hardware Emulation - 2024.2 English - XD098

Vitis Tutorials: Getting Started (XD098)

Document_ID
XD098
Release_Date
2025-02-19
Version
2024.2 English

To build for hardware emulation, enter the following commands to setup the target build directory:

cd <Path to the cloned repo>/Getting_Started/Vitis/example/u250
mkdir hw_emu
cp xrt.ini hw_emu

Then, after changing into the target build directory, enter the following commands to build the host application and device binary:

g++ -g -std=c++17 -Wall -O0 ../../src/host.cpp -o ./app.exe -I$XILINX_XRT/include/ -L$XILINX_XRT/lib -lxrt_coreutil -pthread
emconfigutil --platform xilinx_u250_gen3x16_xdma_4_1_202210_1
v++ -c --mode hls --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 --config ./u250_hls.cfg --work_dir hw_emu
v++ -l -t hw_emu --platform xilinx_u250_gen3x16_xdma_4_1_202210_1 --config ../src/u250.cfg ./hw_emu/vadd.xo -o ./hw_emu/vadd.xclbin

Building for hardware emulation takes more time than for software emulation, but still much less than when targeting the hardware accelerator card. Notice that the v++ -c --mode hls command replaces the v++ -c -k vadd command from the software emulation flow. After the build process completes, you can run hardware emulation using the following commands:

export XCL_EMULATION_MODE=hw_emu
./app.exe

When the run completes, you should see the TEST PASSED message indicating that the run completed successfully. You can list the contents of the u250/hw_emu folder to see the files that were created during this build and run process. Refer to Targeting Software Emulation for a brief explanation of the different files.