PS Application and HW Emulation Flows - 2022.2 English

Vitis Tutorials: AI Engine Development

Document ID
Release Date
2022.2 English

The difference in the PS application from Window Based AI Engine Kernels is that the input buffers and output buffers for different data types should be modified accordingly. Take a look at the code in sw/host.cpp. Note how float and complex type (for cint16) is used in the code.

// output memory
xrtBufferHandle out_bo3 = xrtBOAlloc(dhdl, mem_size, 0, /*BANK=*/0);
xrtBufferHandle out_bo4 = xrtBOAlloc(dhdl, mem_size, 0, /*BANK=*/0);
float *host_out3 = (float*)xrtBOMap(out_bo3);
std::complex<short> *host_out4 = (std::complex<short>*)xrtBOMap(out_bo4);

// input memory
xrtBufferHandle in_bo3 = xrtBOAlloc(dhdl, mem_size, 0, /*BANK=*/0);
xrtBufferHandle in_bo4 = xrtBOAlloc(dhdl, mem_size, 0, /*BANK=*/0);
float *host_in3 = (float*)xrtBOMap(in_bo3);
std::complex<short> *host_in4 = (std::complex<short>*)xrtBOMap(in_bo4);

Correspondingly, the pre-processing and post-processing of this data has been changed.

Run HW emulation with the following make command (it builds the HW system and host application).

make run_hw_emu

Hint: If the keyboard is accidentally hit and stops the system booting automatically, type boot at the Versal> prompt to resume the system booting.

After Linux has booted, run the following commands at the Linux prompt (this is only for HW cosim).

mount /dev/mmcblk0p1 /mnt
cd /mnt
export XILINX_XRT=/usr
export XCL_EMULATION_MODE=hw_emu
./host.exe a.xclbin

To exit QEMU press Ctrl+A, x

To run in hardware, first build the system and application using the following make command.

make package TARGET=hw

After Linux has booted, run the following commands at the Linux prompt.

mount /dev/mmcblk0p1 /mnt
cd /mnt
export XILINX_XRT=/usr
./host.exe a.xclbin

The host code is self-checking. It will check the correctness of output data. If the output data is correct, after the run has completed, it will print: