The execution mode of a Vitis kernel or
Vivado IP is defined by the block-level control
protocol and the structure of sub-functions within the HLS design. For control-driven TLP the
ap_ctrl_chain and ap_ctrl_hs protocols support both
sequential or pipelined execution. For data-driven TLP ap_ctrl_none is the
required control protocol.
The ap_ctrl_chain control protocol is the default for the
Vitis kernel flow as explained in Interfaces for Vitis Kernel Flow. The ap_ctrl_hs block-level
control protocol is the default for the Vivado IP flow as
described in Interfaces for Vivado IP Flow. However, you should use
ap_ctrl_chain when chaining HLS designs together to better support
pipelined execution.
ap_return for the return value.
s_axilite) all the ports in the control protocol are bundled
into the s_axilite interface. This is a common practice
for software-controllable kernels or IP when an application or software driver is used to
configure and control when the block starts and stops operation. This is a requirement of
XRT and the Vitis kernel flow.ap_ctrl_chain
The following figure shows the behavior of the block-level handshake
signals created by the ap_ctrl_chain control protocol for
a sequential execution. In the following figure, the first transaction of the HLS design
completes, and the second transaction starts immediately because ap_continue is High when ap_done is High.
However, the design halts at the end of the second transaction until ap_continue is asserted High.
- The block waits for
ap_startto go High before it begins operation. - Output
ap_idlegoes Low immediately to indicate the design is no longer idle. - The
ap_startsignal must remain High untilap_readygoes High. Onceap_readygoes High:- If
ap_startremains High the design will start the next transaction. - If
ap_startis taken Low, the design will complete the current transaction and halt operation.
- If
- Data can be read on the input ports.
- Data can be written to the output ports.Note: The input and output ports can also specify a port-level I/O protocol that is independent of the control protocol. For details, see Port-Level Protocols for Vivado IP Flow.
- Output
ap_donegoes High when the block completes operation.Note: If there is anap_returnport, the data on this port is valid whenap_doneis High. Therefore, theap_donesignal also indicates when the data on outputap_returnis valid. - The
ap_ctrl_chaincontrol protocol provides an active-Highap_continuesignal that indicates when the downstream block that consumes the output data is ready for new data inputs. This allows the downstream block to provide back-pressure to prevent the flow of data.- If the
ap_continuesignal is High whenap_doneis High, the design continues operating. - If the downstream block is not able to consume new data inputs,
the
ap_continuesignal is Low. If theap_continuesignal is Low whenap_doneis High, the design stops operating, theap_donesignal remains High waiting forap_continueto go High.
- If the
- When the design is ready to accept new inputs, the
ap_readysignal is pulsed High for one clock cycle. Theap_readyport of a downstream block can directly drive theap_continueport. Following is additional information about theap_readysignal:- The
ap_readysignal is inactive until the design starts operation. - In non-pipelined designs, the
ap_readysignal is asserted at the same time asap_done. - In pipelined designs, the
ap_readysignal might go High at any cycle afterap_startis sampled High. This depends on how the design is pipelined. - If
ap_startremains high afterap_readygoes high, the next transaction starts immediately. - When
ap_startgoes low right afterap_readygoes high, the design keeps executing untilap_doneis high and then stops operation, unlessap_startgoes high again in the meantime, which starts a new transaction.
- The
- The
ap_idlesignal indicates when the design is idle and not operating. Following is additional information about theap_idlesignal:- If the
ap_startsignal is Low whenap_readyis High, the design stops operation, and theap_idlesignal goes High one cycle afterap_done. - If the
ap_startsignal is High whenap_readyis High, the design continues to operate, and theap_idlesignal remains Low.
- If the
ap_ctrl_hs
The ap_ctrl_hs control protocol has the
same signals as ap_ctrl_chain, but sets the ap_continue signal to 1 so it remains high. This control
protocol supports sequential and pipelined execution modes, but does not offer back-pressure
from downstream design modules to control the flow of data.
ap_ctrl_none
ap_ctrl_none also has the same signals
as ap_ctrl_chain, but the handshake signal ports (ap_start, ap_idle, ap_ready, and ap_done) are set
high and optimized away.
An ap_ctrl_none region, or one or more hls::tasks, can be
instantiated in one of two ways:
- Either with only
ap_ctrl_noneregions all the way to the top, including the top (i.e. no sequential FSM or non-ap_ctrl_nonedataflow anywhere above, even due to a coding mistake), - Or in a dataflow region where:
- its input streams are produced by one or more non-
ap_ctrl_noneprocesses or regions that are called before it - its output streams are consumed by one or more non-
ap_ctrl_noneprocesses or regions that are called after it
- its input streams are produced by one or more non-
The former enables the elimination of the
ap_start/ap_ready/ap_done/ap_continue
handshakes all the way to the top. The latter enables the generation of the
ap_start/ap_ready handshake for the dataflow region
above by the predecessor processes or regions, and of the
ap_done/ap_continue handshake by the successor processes
or regions.
ap_ctrl_none control protocol in your design, you must
meet at least one of the conditions for C/RTL co-simulation as described in Co-simulation Requirements for Interface Synthesis to verify the RTL
design. If at least one of these conditions is not met, C/RTL co-simulation halts with the
following
message:@E [SIM-345] Cosim only supports the following 'ap_ctrl_none' designs: (1)
combinational designs; (2) pipelined design with task interval of 1; (3) designs with
array streaming or hls_stream ports.
@E [SIM-4] *** C/RTL co-simulation finished: FAIL ***