Design Flow Using RTL Programmable Logic - 2022.1 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
Release Date
2022.1 English

RTL blocks are not supported inside the ADF graph. Communication between the RTL blocks and the ADF graph requires that you use PLIO interfacing. In the following example, interpolator and classify are AI Engine kernels. The interpolator AI Engine kernel streams data to a PL RTL block, which, in turn, streams data back to the AI Engine classify kernel.

class clipped : public graph {  
    kernel interpolator;
    kernel classify;
    input_plio in;
    output_plio out;
    output_plio clip_in;
    input_plio clip_out; 

    clipped() {
      in  = input_plio::create("DataIn1", plio_32_bits,"data/input.txt");
      out = output_plio::create("DataOut1", plio_32_bits,"data/output.txt");
      clip_out = input_plio::create("polar_clip_in",plio_32_bits,"data/input1.txt");
      clip_in  = output_plio::create("polar_clip_out", plio_32_bits,"data/output1.txt"); 

      interpolator = kernel::create(fir_27t_sym_hb_2i);
      classify     = kernel::create(classifier);

      connect< window<INTERPOLATOR27_INPUT_BLOCK_SIZE, INTERPOLATOR27_INPUT_MARGIN> >(in.out[0],[0]);
      connect< window<POLAR_CLIP_INPUT_BLOCK_SIZE>, stream >(interpolator.out[0],[0]);
      connect< stream >(clip_out.out[0],[0]);
      connect< window<CLASSIFIER_OUTPUT_BLOCK_SIZE> >(classify.out[0],[0]);

      std::vector<std::string> myheaders;

      adf::headers(interpolator) = myheaders;
      adf::headers(classify) = myheaders;

      source(interpolator) = "kernels/interpolators/";
      source(classify)    = "kernels/classifiers/";

      runtime<ratio>(interpolator) = 0.8;
      runtime<ratio>(classify) = 0.8;

clip_in and clip_out are ports to and from the polar_clip PL RTL kernel which is connected to the AI Engine kernels in the graph. For example, the clip_in port is the output of the interpolator AI Engine kernel that is connected to the input of the polar_clip RTL kernel. The clip_out port is the input of the classify AI Engine kernel and the output of the polar_clip RTL kernel.

RTL Blocks and AI Engine

The following example shows application code.

#include "graph.h"

clipped clipgraph;

#ifdef __AIESIM__
int main(int argc, char ** argv) {
    return 0;

To make the AI Engine simulator work, you must create input test bench files related to the RTL kernel. data/output_interp.txt is the test bench input to the RTL kernel. The AI Engine simulator generates the output file from the interpolator AI Engine kernel. The data/input_classify.txt file contains data from the polar_clip kernel which is input to the AI Engine classify kernel. Note that PLIO can have an optional attribute, PL clock frequency, which is 100 for the polar_clip.

RTL Blocks in Hardware Emulation and Hardware Flows

RTL kernels are fully supported in hardware emulation and hardware flows. You need to add the RTL kernel as an nk option and link the interfaces with the sc option, as shown in the following code. If necessary, adjust any clock frequency using freqHz. The following is an example of a Vitis configuration file.


For more information on RTL kernels and the Vitis flow see Integrating the Application Using the Vitis Tools Flow. SystemC kernels can also be used in an emulation-only form. For this flow see Working with SystemC Models in the Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393).