Wrapping vendor IP: the Vitis FFT

Looking for an FFT to use? See Waveflow’s FFT, at full rate. It computes these same bits with the same ports at a new frame every L/R cycles – 7.5 to 10 times this module’s rate. This example is about something else: putting a vendor block inside Waveflow, and what measuring it at RTL taught us, including a 10x shortfall that passed every functional test.

Every earlier example writes its own kernel. This one does not: the arithmetic is AMD’s Vitis L1 SSR FFT (xf::dsp::fft::fft<>), and the example is about using a vendor block as an ordinary Waveflow module, with the same guarantees as a block you wrote yourself. The module is VitisFft; The Vitis FFT in the guide describes it. This example is the end-to-end run, and what measuring it at RTL taught us.

Learning objectives

What this adds to Waveflow’s FFT, at full rate, in the order the pages teach it:

  • Use a vendor HLS library block as a FreeRunMod: its C++ body is the vendor call (kernel_task()), its simulation is a bit-exact Python model of the vendor’s arithmetic, so the two are twins rather than approximations.
  • Drive an R-wide port group: an SSR FFT with R = 4 takes four samples per cycle on four AXI-Stream lanes, sample n on lane n % R.
  • Measure a block’s timing at RTL rather than trusting a datasheet, a C-synthesis report (which reads undef for this block) or the block’s nominal rate.
  • Calibrate an LT model for a block whose latency depends on something the model cannot see, state its error rather than hide it, and keep the calibration on the platform where every design can reuse it.
  • Check a vendor block against the vendor’s own stated performance. This one passed bits, csynth, XSI and its own calibration while running at a tenth of AMD’s stated rate; the gap was explained instead of compared (how it was found).

The design

StreamDriver x 4  ->  VitisFft (L, R = 4)  ->  StreamSink x 4

The testbench is a graph (VitisFftTB, in waveflow/vitis_l1/testbench.py): the same object runs the pysim and, cut at the FFT by VitisFftSystem (waveflow/vitis_l1/rtl.py), is the system whose derived top and harness drive the RTL. Both read their stimulus from the same burst bundles and are checked against the same golden.

   
input ap_fixed<16, 2> complex, packed into 32-bit words (real in the low half)
output ap_fixed<W, I> complex, W = 16 + log2 L + 1 (21 at L=16): derived from the model
gated length L = 16; calibrated L = 16 .. 4096
target RFSoC 4x2, xczu48dr-ffvg1517-2-e at 250 MHz

There is no hand-written C++ in the example. The body is the framework’s waveflow/build/vitis_fft_task.h, the vendor headers stay in the Vitis install, the ap_ctrl_none top comes from composite_top_spec on the module, and the harness from the testbench graph. include/, gen/, xsi/ and work/ are build output: delete them and the build writes them back. Where each file comes from is Including it in your design.

Running it

python -m examples.vitis_fft.vitis_fft                       # pysim: bit-exact + frame timing
python -m examples.vitis_fft.vitis_fft_build                 # generate, then csynth (needs Vitis)
pytest tests/examples/test_vitis_fft_xsi.py -m xsi           # the RTL gates (needs Vivado)
python -m waveflow.calib.fixtures.vitis_fft --work <dir>     # recalibrate the platform
python -m examples.vitis_fft.vitis_fft_figures               # redraw this example's figures

The pages

  • The testbench – the graph, the two scenarios, how the RTL is timed, the gates.
  • Timing – what the RTL measured, why the core runs at a tenth of its rate and its latency depends on arrival phase, the calibrated model and its error, and what XSI costs against it.
  • Resources – what the core costs per length, and how resource records reach the platform.

Table of contents

  • FFT testbench - VitisFftTB, the testbench graph that both the pysim and the XSI harness are built from: four stream drivers, the FFT, four sinks. The two scenarios -- frames back to back, and isolated frames whose gaps sweep arrival phase -- the per-burst gaps that make the second possible in both backends, how the RTL is timed at its ports from the BFMs themselves with no waveform, how every run checks every frame's bits, and the gates.
  • FFT timing results - What the RTL measured on the RFSoC 4x2, L = 16 to 4096: the vendor core as VitisFft connects it (fft<>) runs at a tenth of its architecture's rate -- and how that was found -- its per-sample cost steps from 7.5 to 10 cycles per L/R across an implementation change, and an isolated frame's latency depends on its arrival phase against a free-running commutator. How the timing model is calibrated on the platform -- an exact interval, a mean processing delay, the spread as its stated error, a lookup per length -- how well the pysim tracks the RTL, what an XSI run costs against it, and how to extend the calibration for a design-space exploration.
  • FFT resource results - What the vendor FFT costs in DSP, BRAM, LUT and FF on the RFSoC 4x2, L = 16 to 4096, read from the csynth reports the calibration builds produce and filed onto the platform's module store. DSP is exactly 12 per stage boundary; BRAM appears at L = 256; LUT and FF grow roughly linearly in the stage count. How the records are keyed and stored, and how they would grow into a resource model.