The Vitis kernel flow provides support for compiled kernel objects (.xo) for control by the Xilinx Run Time (XRT) and integration with a host application. This flow has very specific interface requirements that Vitis HLS must meet. This flow implements the following interfaces by default:
- Scalar inputs: AXI4-Lite interface
(
s_axilite) - Pointers to an Array: AXI4 memory
mapped interface (
m_axi) to access the memory, and thes_axiliteinterface to receive the offset into the memory address space. - Arguments specified as
hls::stream: AXI4-Stream interface (axis) - Function Return:
ap_returnport added to thes_axiliteinterface - Block Protocol:
ap_ctrl_chainspecified on thes_axiliteinterface.
The s_axilite interface is special in
the Vitis kernel flow. It handles the input of scalar
arguments from the software function into the kernel as well as any function return value;
but it also specifies offsets for m_axi interfaces and
handles the block control protocol.
The sum_io function in the following
code provides an example of interface synthesis.
#include "sum_io.h"
dout_t sum_io(din_t in1, din_t in2, dio_t *sum) {
dout_t temp;
*sum = in1 + in2 + *sum;
temp = in1 + in2;
return temp;
}
The sum_io function includes:
- Two pass-by-value inputs:
in1andin2. - A pointer:
sumthat is both read from and written to. - A function
returnassigned the value oftemp.
With the default interface synthesis settings used by Vitis HLS for the Vivado IP flow, the design is synthesized into an RTL block with the ports and interfaces shown in the following figure.
In the default Vitis kernel flow the tool creates three types of interface ports on the RTL design to handle the flow of both data and control.
- Clock, Reset, and Interrupt ports:
ap_clkandap_rst_nandinterruptare added to the kernel. -
AXI4-Lite interface:
s_axi_controlinterface to handle data values for scalar argumentsin1andin2, and to handle the functionreturnvalue. The interface is expanded to show the various ports associated with it. -
AXI4 memory mapped interface:
m_axi_gmeminterface to handle thesumargument. - Block-Level interface protocol: The default
ap_ctrl_chainprotocol is associated with thes_axi_controlinterface.