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/u200
mkdir hw_emu
cp xrt.ini hw_emu
cd 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_u200_gen3x16_xdma_2_202110_1
v++ -c -t hw_emu --platform xilinx_u200_gen3x16_xdma_2_202110_1 --config ../../src/u200.cfg -k vadd -I../../src ../../src/vadd.cpp -o ./vadd.xo
v++ -l -t hw_emu --platform xilinx_u200_gen3x16_xdma_2_202110_1 --config ../../src/u200.cfg ./vadd.xo -o ./vadd.xclbin
Refer to Targeting Software Emulation for a brief explanation of these different commands. The only difference with the previous step is the v++ target (-t) option which is changed from sw_emu to hw_emu. All other options remain the same.
Building for hardware emulation takes more time than for software emulation, but still much less than when targeting the hardware accelerator card. 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 u200/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.