The update_rtp() method is available for each FIR graph class and reduces the runtime coefficient update to a single call.
The following example demonstrates using the update_rtp() method in a FIR filter graph class.
The test_graph class contains a member firGraph — a parameterized fir_sr_asym_graph FIR filter graph — and an array of coefficient RTP ports sized by the getTotalRtpPorts() method.
The main function initializes the graph, calls update_rtp to update the RTP ports with coefficient values from the std::vector taps, runs the filter for a specified number of iterations, then ends graph execution.
// This is a header file, e.g. "test.hpp" that is included in the corresponding cpp file. class test_graph : public adf::graph { public: xf::dsp::aie::fir::tdm::fir_tdm_graph< cint16, //TT_DATA int16, //TT_COEFF 4, //TP_FIR_LEN 10, //TP_SHIFT 0, //TP_RND 128, //TP_INPUT_WINDOW_VSIZE 32, //TP_TDM_CHANNELS 1, //TP_NUM_OUTPUTS 0, //TP_DUAL_IP // 0, //TP_API 1, //TP_SSR 0, //TP_SAT 1, //TP_CASC_LEN cint32 //TT_OUT_DATA > firGraph; static constexpr int rtpPortNumber = firGraph::getTotalRtpPorts(); port_array<input, rtpPortNumber> coeff;
#include "test.hpp" xf::dsp::aie::testcase::test_graph filter; int main(void) { filter.init(); std::vector<int16> taps = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63}; filter.firGraph.update_rtp(filter, taps, filter.coeff); filter.run(4); filter.end(); return 0; }
The update_rtp method abstracts the RTP port update sequence. It performs the following steps:
- Read the total number of RTP ports using
getTotalRtpPorts(). Refer to Reloadable Coefficients - Number of Ports. - For each port, read the port size using
getRtpPortSize(int port). Refer to Reloadable Coefficients - Array Size. - For each port, extract the corresponding taps using the
extractTaps()method. Refer to Reloadable Coefficients - Array Contents. - For each port, update the RTP port with the new taps using the graph’s
update()method. Refer to UG1079 Run-Time Parameter Update/Read Mechanisms.