Graph Source Code - 2024.2 English - XD100

Vitis Tutorials: AI Engine Development (XD100)

Document ID
XD100
Release Date
2024-12-06
Version
2024.2 English

The graph source code is composed of a top level graph class declaration and definition, and the main function. The new graph is used to encapsulate the actual graph and facilitate testing. After the graph header file is included, the new class dut_graph is defined.

class dut_graph : public graph {
public:
    input_plio  din[N_IO];
    output_plio dout[N_IO];
    fft1k_128_graph fft_graph;
    dut_graph(void)
    {
        std::string plio_i;
        std::string plio_o;
        std::string file_i;
        std::string file_o;
        for(int i=0; i<N_IO; i++){
            plio_i = "PLIO_i[" + std::to_string(i) + "]";
            plio_o = "PLIO_o[" + std::to_string(i) + "]";
            file_i = "verif_i_128/din" + std::to_string(i) + ".txt";
            file_o = "verif_o_128/dout" + std::to_string(i) + ".txt";
            din[i] = input_plio::create(plio_i, plio_64_bits, file_i);
            dout[i] = output_plio::create(plio_o, plio_64_bits, file_o);
            connect(din[i].out[0], fft_graph.din[i]);
            connect(fft_graph.dout[i], dout[i].in[0]);
        }
    }
};

The new class instantiates the fft1k_128_graph and connects each of its ports to the PLIOs that are also created though a for loop. In this case, the PLIOs are connected to files for simulation purposes. The second part of the graph source code is the main function

int main(void)
{
    fft1k_128_dut.init();
    fft1k_128_dut.run(3);
    fft1k_128_dut.end();

    return 0;
}

Inside the main there are basic APIs that control the graph runtime execution. As easly understandable looking at the code, the API purpose is to initialize the graph, make it run for three times, and terminate the execution.

Now that the design of the AIE-ML FFT implementation is complete, the next step is to build it.