Case 3: Conditional Sequential Sub-Graphs - 2023.2 English

Vitis Tutorials: AI Engine (XD100)

Document ID
Release Date
2023.2 English

In this example, the template parameter of the graph is used to select or deselect the instantiation of a sub-graph:

template<int ID>
struct MyGraph: public graph
    input_plio _plioI;
    output_plio _plioO;

    constexpr static bool hasSub0() {return ID & 0x1;}
    constexpr static bool hasSub1() {returcn ID & 0x2;}

    typename std::conditional<hasSub0(), Sub0, int >::type _sub0;
    typename std::conditional<hasSub1(), Sub1, int >::type _sub1;


If ID has bit 0 set, Sub0 is instantiated. If it has bit 1 set, then Sub1 is instantiated.

Type make CASE=3 aie aieviz to visualize the resulting graph of this testcase.