Review RTP Update Code - 2023.1 English

Vitis Tutorials: AI Engine Development

Document ID
XD100
Release Date
2023-09-20
Version
2023.1 English
  1. Open aie/graph.h. Examine the code to connect the trigger input port of the graph to the first input port of the dds kernel (i.e., the phase_increment parameter of the sine function).

    //connect asynchronous runtime parameter
    adf::connect<adf::parameter>(trigger, adf::async(dds.in[0]));
    

    Note: You need to use adf::async to indicate that the first port (phase_increment parameter) of the dds kernel will be updated asynchronously.

  2. Open aie/graph.cpp. Check the code that first updates the trigger input port of the graph has the value 10 in the ping buffer. Then run it for two iterations. Wait for the two iterations to complete, then update the trigger input port of the graph with the value 100 in the pong buffer. Run it for another two iterations and then end.

    gr.init();
    // asynchronous RTP trigger calls
    gr.update(gr.trigger,10);
    gr.run(2);
    gr.wait();
    gr.update(gr.trigger,100);
    gr.run(2);
    gr.end();
    

    Notice that using this code, the result is the same as that in the example given in step 1, but they are in different control modes. In synchronous RTP mode, the graph run is implicitly controlled by the RTP update, while in asynchronous RTP mode, the “_wait()_” function is used to explicitly wait the graph running to be completed. In asynchronous RTP mode, there is no guarantee when the RTP update will be effective while the graph is running.