The following code block shows example code of how to include an instance of the fft_ifft_dit_1ch graph in a super-graph and also how the constraints might be applied to kernels within the FFT graph. In this example, not all kernels within the fft_ifft_dit_1ch graph are subject to location constraints. It is sufficient for the mapper to find a solution in this case by constraining only the r2comb kernels.
#include <adf.h>
#include "fft_ifft_dit_1ch_graph.hpp"
using namespace adf;
namespace fft_example {
#define LOC_XBASE 0
#define LOC_YBASE 0
#define DATA_TYPE_FFT cint16
#define TWIDDLE_TYPE cint16
#define POINT_SIZE 128
#define FFT_NIFFT 1
#define SHIFT 3
#define CASC_LEN 1
#define DYN_PT_SIZE 0
#define WINDOW_VSIZE 128
#define API_IO 1
#define PARALLEL_POWER 1
class test_fft : public graph {
public:
static constexpr int kParFactor = 2 << PARALLEL_POWER;
xf::dsp::aie::port_array<input, kParFactor> in;
xf::dsp::aie::port_array<output, kParFactor> out;
xf::dsp::aie::fft::dit_1ch::fft_ifft_dit_1ch_graph<DATA_TYPE_FFT,
TWIDDLE_TYPE,
POINT_SIZE,
FFT_NIFFT,
SHIFT,
CASC_LEN,
DYN_PT_SIZE,
WINDOW_VSIZE,
API_IO,
PARALLEL_POWER>
fftGraph;
test_fft() {
// make connections
for (int i = 0; i < kParFactor; i++) {
connect<>(in[i], fftGraph.in[i]);
connect<>(fftGraph.out[i], out[i]);
}
// add location constraints
for (int lane = 0; lane < 2; lane++) {
location<kernel>(fftGraph.m_r2Comb[lane]) = tile(LOC_XBASE + lane * 2, LOC_YBASE + CASC_LEN + 1);
}
};
}; // end of class
};