Run Hardware Emulation and Hardware Flow - 2023.1 English

Vitis Tutorials: AI Engine Development

Document ID
XD100
Release Date
2023-09-20
Version
2023.1 English

The pl_kernels directory contains a kernel that generates samples of random noise. The noise generator is implemented as a free-running programmable logic (PL) kernel, with samples consumed by the filter:

extern "C" void random_noise(hls::stream<std::complex<short> > & out) {
   #pragma HLS INTERFACE axis port=out
   #pragma HLS INTERFACE ap_ctrl_none port=return

The PL kernel has two #pragma specified for vitis HLS. #pragma HLS INTERFACE axis port=out indicates that port “out” will be implemented with an AXI4-Stream interface, while #pragma HLS INTERFACE ap_ctrl_none port=return indicates that the kernel has no block control signals (i.e., it is a free-running kernel). Free-running means that the kernel will keep running after the FPGA has been configured, the clock has been activated, and the reset is deactivated. The execution of a free-running kernel depends on the availability of input data, or readiness of a receiving buffer. It does not require explicit control in the host code when running aiesimulator, HW emulation, and HW flows.

PL kernels must be compiled into Xilinx object (.xo) files. Run the following make command to compile it:

make -C pl_kernels

The corresponding v++ -c command is:

v++ -c --platform xilinx_vck190_base_202310_1 -k random_noise random_noise.cpp -o random_noise.xo --verbose --save-temps

The Makefile rule targets introduced in Synchronous update of scalar RTP and Asynchronous update of scalar RTP still apply here. Details about tool options and host code in Synchronous update of scalar RTP are similar. However, you can also run the following make command to launch HW emulation:

make run_hw_emu

At the Linux prompt, run the following command:

./host.exe a.xclbin

To exit QEMU press Ctrl+A, and then press x.

For hw mode, run following make command to generate an SD card package:

make package TARGET=hw

In hardware, after booting Linux from the SD card, run the following commands at the Linux prompt:

mount /dev/mmcblk0p1 /mnt
cd /mnt
./host.exe a.xclbin

The host code is self-checking. It will check the output data against the golden data. If the output matches the golden data, after the run is complete, it will print the following:

TEST PASSED