Examples

To demonstrate Waveflow, we have developed a set of examples that build progressively more advanced features. Each one is a complete, end-to-end design — a Python golden model, a simulation, a generated Vitis HLS kernel and testbench, and verification — and each introduces a few new concepts on top of the examples before it; its learning objectives state only that increment. We will add many more over time.

The navigation lists them in reading order, in four groups.

The flow

The core path, in order: each one is the next rung of the Flow Overview.

  1. Basic vector arithmetic – schemas and fields, vectorized NumPy goldens, bit-exact against Vitis: data before any interface.
  2. Free-running polynomial – one free-running kernel on streams: the command-response protocol, the HLS body, the harness, the system flow, calibrated timed phases.
  3. Block equalizer – several modules: stages at different rates, a StreamBroadcast, internal links, each stage in its own harness and then the composite.
  4. The polynomial on a bus – the same kernel behind memory-mapped queues on a crossbar, a two-thread software host on interrupts, timing composed.
  5. Free-running memory copy – a kernel that masters memory through MemRStream / MemWStream, whose timing ships pre-fit.
  6. Composite kernel interleaver – on-chip random access with a stream of blocks, and fitting a custom stage’s own timing model.
  7. Block FIR with state – state across firings (add_state), fixed point, two kernel bodies for one specification.
  8. A memory reached three ways – a memory outside the kernel, as hand-written Verilog, shared by two tasks.
  9. A memory-mapped FIR – a register bank, a config ordered against its data by an id, and the choice of adaptor topology.
  10. Two kernels on a bus – a kernel as a bus master: a credit stream across the crossbar, a shared memory, four bus masters.
  11. One FFT shared by every channel – a kernel shared by several clients and fed back to itself: an arbiter, a tag beside it, credits on the loop, results routed back by channel.

Measuring and exploring

  1. Vector multiply resource modeling – a parameter sweep and a resource model fitted from it.
  2. What a crossbar costs – vendor IP measured into a platform’s record store: a census, not a design.
  3. MU-MIMO whitening with CG – under construction: whitening matrices computed on demand for a multi-user MIMO scheduler, where the accelerator’s delay is the scheduling delay. Its first design, a bit-exact fixed-point CG detector, is The 2024 CG detector.
  4. Emitter detection and AoA – under construction: C channels watched for emitters, each searching or tracking, with every channel’s jobs dispatched at once onto shared hardware, so the detection delay depends on queueing and contention.

Libraries and domains

  1. Waveflow’s FFT, at full rate – a full-rate streaming FFT from free-running modules.
  2. Wrapping vendor IP: the Vitis FFT – a vendor block as a module, calibrated as a black box.
  3. RF loopback – the RF data converter boundary.
  4. Playing a stored waveform – a waveform played out of memory at the converter’s rate.
  5. Capturing without losing anything – a capture into two memory regions, with every loss reported.
  6. Measuring a delay with an address – the two buffers closed through one converter, a delay read as an address difference.
  7. Micro-scheduler on a CPU – software on a calibrated processor beside hardware.
  8. A systolic matrix multiply, measured – a composite kernel in its own harness, measured at RTL against its bounds, and the stage that binds found from a trace.
  9. Toy vector programs – three kernels of a few instructions each for the programmable vector unit, checked by the assembler and bit-exact with a NumPy golden.
  10. CG as a vector program – an algorithm as three programs for a programmable unit, ordered so the unit fuses it, against a dedicated kernel.
  11. A matched filter as a vector program – a streaming kernel on the same unit, broadcast and conjugate operands, measured against its input floor.

Legacy

Legacy examples – the host-activated flow (ap_start, a sequential testbench, csim and cosim): Register mapped simple function, Streaming polynomial and Histogram with shared memory.


Table of contents

  • Basic vector arithmetic - The front door for vectorization, and the smallest demonstration of the claim the rest of the framework rests on: one element-wise multiply-accumulate, computed over NumPy arrays with no per-element Python loop, in integer, float and fixed point — and asserted equal to the Vitis kernel bit for bit in all three. A data and schema example, so it comes before any module-to-module interface exists.
  • Free-running polynomial - The first kernel example, and the shape most accelerators take: a free-running kernel that answers commands on streams. A polynomial evaluator reads a command (its id, a sample count, four coefficients) and its samples on one AXI4-Stream, writes the results on a second -- headed by which command and how many -- and a status on a third, the last command seen; a burst that ends early is fatal: the kernel reports it and stops. The page set walks the whole flow in order -- the protocol, the golden, the kernel and its hand-written HLS body, the system flow (csynth, the RTL run under XSI, the comparison with pysim), and declared timed phases calibrated in the kernel's own generated harness. The same kernel on a bus, behind AXI-MM with a software host, is its own example, The polynomial on a bus.
  • Block equalizer - The second kernel example: a stream-only pipeline of three free-running modules. One input stream carries, per command, the channel estimates and the received symbols; the framework's StreamBroadcast gives a copy to each of two stages -- gain computes the MMSE equalizer g = conj(h)/(|h|^2+N) once a row (a division), apply multiplies every symbol by its row's g -- and gain passes g to apply on an internal stream. Each stage keeps consuming its own copy (the broadcast's rule), errors are fatal (a zero noise, a burst that ends early), and the arithmetic is float32 in a fixed operation order, bit-exact with signed zeros. Each stage is verified alone in its own harness, then the composite, in pysim and at RTL -- one hand-written body serving a stage in both places.
  • The polynomial on a bus - One kernel put on a bus: the free-running polynomial of the stream example -- the same class, the same csynth'd RTL -- placed behind memory-mapped queues on an AXI-MM crossbar and driven by a software host. The kernel's class declares its views (mm_views: a queue in front of its input, a queue behind each output) and build_mm_device builds them; the system is HwSystem(sim, dut) with the device and the crossbar as the DUT; the host is a two-thread SwHost -- a writer and a reader that sizes each result from its header -- that never polls, waiting on the queues' interrupts, with a C++ twin that runs the same scenario at RTL and must leave identical traces. The device also runs in its own harness, the host on a direct link with no crossbar. The composition check: pysim's cycles, composed from the kernel's calibrated record and the queue and crossbar models with nothing fitted, land within 2% of the RTL (Vitis/Vivado 2025.1).
  • Free-running memory copy - The first kernel that masters memory: a composite of free-running hls::tasks copying words between memory regions, which Vitis cannot co-simulate. So it is stated as an HwSystem, and the system flow generates a top and a harness from it and drives the real RTL cycle by cycle through XSI. It also reuses the MemRStream / MemWStream adaptors, whose timing models ship pre-fit, so the loosely-timed pysim reproduces the RTL with no calibration of its own.
  • Composite kernel interleaver - A gather accelerator — Y[i] = X[P[i]], reordering one vector under an index vector. It builds on the data mover by adding the two things copying never needs: a real compute stage, and on-chip random access, holding X in block RAM so the index-driven reads are single-cycle. Same free-running composite flow, and this is where fitting a custom component's own timing model is taken up rather than inherited.
  • Block FIR with state - The first design in the tree whose firings are not independent. A block FIR has to carry two things from one firing to the next, with different lifetimes — the coefficients, loaded once, and the tail of the previous block — so both are storage the module itself owns and declares with add_state. In fixed point, as a four-module composite, RTL-gated and resource-modelled: the advanced counterpart to the vector multiply.
  • A memory reached three ways - One true-dual-port memory that lives OUTSIDE the Vitis kernel, as hand-written Verilog joined by a generated wrapper, reached by three transactions over two free-running tasks: WRITE a payload in, COMPUTE over the words in place, READ them back. Command-driven, over DataList messages that generate the C++ headers the kernel compiles against; every transaction answers, because a write has no return path and a refused read is indistinguishable from a quiet stream. WRITE and COMPUTE share one port on one task, so what it costs to read a word you are about to write is a measurement in one waveform rather than an argument.
  • A memory-mapped FIR - A kernel the host configures over the bus. A free-running FIR whose taps are a register bank and whose samples and results are queues, all behind an AXI slave port that a host program writes and reads through AMD's crossbar. The kernel stays stream-only; a memory-mapped adaptor in the RTL top turns bus transactions into its messages. Because a config and the samples travel on different streams, the order between them is carried in the messages: each packet's in-band header names the config it needs by its id, the kernel waits for that config, and a response FIFO echoes which config each packet was filtered with. Bit-exact against an exact-integer golden in pysim and at RTL, in two adaptor topologies.
  • Two kernels on a bus - Two free-running kernels that talk over a shared bus, with no polling anywhere: a host sends commands and sleeps on interrupts; a generator kernel draws pseudo-random numbers and streams them to a Markov-chain kernel through a credit stream routed over the crossbar; the chain writes its states to shared memory and answers the host. The kernels are deliberately simple so that the example is about the links -- why a kernel writing another kernel's queue must hold credit, how the credit comes back without stalling the bus, and how the same kernels run joined directly. Bit-exact in pysim and at RTL with four bus masters on one crossbar, and pysim's timing within 3% of the RTL.
  • A channel sounder in a ray-traced street - The worked example for the RF environment: a street canyon traced with NVIDIA Sionna RT into a committed channel file, then sounded through the converter Waveflow already models. In channel mode a Zadoff-Chu sequence goes out of an Rfdc DAC, through RtChannel, back into the ADC, and a circular deconvolution recovers every ray-traced tap within 30 dB of the strongest, at its own lag, within 0.5 dB. In source mode RtSignalSource feeds the RF loopback's pass-through, and its rendered bundle is replayed through that design's RTL word for word.
  • One FFT shared by every channel - The shared-kernel example: a three-channel overlap-save filter bank on ONE SsrFft, used forward and then inverse for every block of every channel. A StreamArbiter merges the channels' new blocks with the feedback frames (priority to the feedback); the arbiter's index sets the FFT's direction per frame; a tag beside the FFT says whose each frame is; each channel's filter is loaded once into a slot; per-channel credits bound the loop so the stage after the FFT never blocks; StreamDemuxes route each answer, status and credit back to its channel. Bit-exact end to end against the FFT's own model and within 0.5% of np.convolve; each stage alone and the bank in pysim and at RTL, the recordings equal; without the credit it deadlocks and the run still returns.
  • Vector multiply resource modeling - Measuring and modelling what a design costs. A free-running vector multiplier swept across its two parameters, with the measurements handed to a VitisResourceModel that predicts LUT, FF, DSP and BRAM anywhere in the space. The arithmetic is trivial on purpose — the subject is how little you have to say to get a trustworthy model: describe what the design contains, and the library picks the features, prices the device geometry and fits whatever is left.
  • What a crossbar costs - A measurement census rather than a design: AMD's axi_crossbar in every small shape (1x2 to 4x4), both connectivity modes (SAMD crossbar, SASD shared bus) and two data widths, each synthesized, placed and routed out of context at 250 MHz and run under XSI between host and memory BFMs. The area, the timing-closure margin and the latency of every configuration are filed into a platform's module record store -- the same records a resource model fits from -- and the tables on this page are rendered back out of that store.
  • MU-MIMO whitening with CG - Under construction. A multi-user MIMO uplink keeps every user's channel in memory and a store of whitening (MMSE) matrices, one per set of users scheduled together. A set without a matrix waits for an accelerator to compute it, so the accelerator's delay becomes scheduling delay. The matrix is G = P Hᴴ with P = (I + HᴴH)⁻¹, a K × K inverse found by conjugate gradient. The problem is meant for exploring agentic design-space exploration with Waveflow.
  • Emitter detection and AoA - A multi-antenna receiver watches C channels for emitters that come and go: a capture stores each channel's blocks and flags energy crossings, shared search and check units decide arrivals and departures, and the delay depends on queueing. The study: a three-sector ray-traced site (C = 12), one ring of slots against one pool of buffers, scored per block in pysim over a 516-design space and checked at RTL. At equal memory the pool keeps its block error at 1.5% where the ring reaches 10%; the ring needs twice the memory to qualify. An earlier study at C = 8 (one sector, the ring only) is kept at the end.
  • Waveflow's FFT, at full rate - Waveflow's own SSR FFT (SsrFft): one RadixWord stream in and out -- four complex samples a beat -- a new frame every L/R cycles -- the rate the architecture is built for and 7.5 to 10 times AMD's Vitis L1 core as shipped -- bit-exact with that core. Built as free-running Waveflow modules: one hls::task per commutator, stage and buffer, the top generated from the module graph, the XSI testbench from the testbench graph. Measured at RTL on the RFSoC 4x2 from L = 16 to 4096: the interval, a latency that does not depend on arrival, the pysim against the RTL, and what the throughput costs in resources.
  • Wrapping vendor IP: the Vitis FFT - Wrapping vendor IP, worked end to end: AMD's Vitis L1 SSR FFT as a Waveflow module -- four AXI-Stream lanes in, four out, the vendor's xf::dsp::fft::fft<> as the hardware body and a bit-exact Python model as the simulation, bit-exact at RTL on the RFSoC 4x2. Also a worked calibration of a black box (a phase-dependent latency, its mean and its spread on the platform) and a cautionary tale: the module passed every functional test while running at a tenth of the rate AMD states, and how that was found. For an FFT in a design, use the SSR FFT example.
  • RF loopback - The worked example for designs that talk to an RF data converter. A source plays sample blocks into an ADC, the samples cross into the fabric as AXI-Stream words, a trivial pass-through relays them, and a DAC turns them back into sample blocks at a sink — a loopback that is byte-identical end to end, two blocks later. Deliberately without DSP: the point is the converter boundary itself, and the loss counters that are the only evidence a sample grid was actually met.
  • Playing a stored waveform - The worked example for RfShotTx: one transmitter, two command streams, and the same RTL answering both. A driver pushes in-band frames — a header then samples, TLAST at the end — the design loads them into a BRAM behind a lock, and a real Rfdc plays them out at the converter's grid. The finite stream plays three passes and goes quiet; the infinite one is preempted mid-play and switches waveform. Every verdict the protocol has is exercised across the two, and the playout is byte-identical between pysim and RTL.
  • Capturing without losing anything - The worked example for RfShotRx: a real ADC plays a ramp into a memory split into two regions, the capture fills one while the reader drains the other, and every window goes out as a frame with a header that says what was lost. The scenario IS the gate — a ramp makes a dropped block a visible step in the numbers rather than something a counter has to be believed about.
  • Measuring a delay with an address - The worked example for the RfShotTx / RfShotRx pair with absolute indexing on: one converter carrying both directions, a path with a bulk delay between them, and both buffers indexing absolutely. The channel delay is then a difference of memory addresses — read off a window header and one sample value, with no timestamps and no correlator. Covers why the reading aliases at one buffer, why an address cannot tell a path delay from an epoch offset, and why the two loads are spaced more than a pass apart.
  • Micro-scheduler on a CPU - Software on a calibrated processor, beside hardware: a micro-scheduler runs on the A53 platform model, keeps a ready list with the very algorithm the platform was calibrated on, and dispatches seeded Poisson jobs to SimpFun accelerators over AXI-Lite with interrupt completion. The report prices every scheduler operation -- latency, queueing, energy, footprint, confidence -- and the scheduler's trace is replayed on gem5 to check the model.
  • A systolic matrix multiply, measured - The systolic engine (SystolicEngine) and the engine behind memory (SystolicEngineMem), each in its own harness: a driver and sinks, or a driver, a sink and one memory, generated from the module. Each workload runs in pysim and at RTL from the same scenario files, every output checked against the bit-exact model; the RTL's timing is read at the ports, with no waveform, and the resources from csynth's XML. What it shows: the engine at its input bound -- 171 cycles per 8×8×32 product with 64-bit words, 94 with 128-bit, 81 an output batched -- how the binding stage was found, and the wrapper bound by its read port, 3,033 cycles for 32×32×64.
  • Legacy examples - The host-activated examples, kept for the designs and courses that use them: a control-driven kernel the host launches with ap_start, verified by a sequential C++ testbench in Vitis C-simulation and C/RTL co-simulation -- the Legacy flows of the guide. New designs use the system flow and the free-running examples before this group.
  • Toy vector programs - Three toy kernels for the programmable vector unit (VecUnit), each a few instructions and each introducing one idea: double (Y = X + X) is a whole job in one chained pass; cmul (Z = conj(X)·Y) chains three slots with the conjugate form and strip-mines a long matrix in chunks of VLMAX; gain (r = y − a·x, a = Re(xᴴy)/|x|² per column) uses reductions, the scalar file, the divide and a scalar-times-vector update. Each passes the assembler and is bit-exact with a NumPy golden on the interpreter and in pysim. The guide's pages excerpt them.
  • CG as a vector program - Conjugate gradient on A X = B (multi-RHS, complex fixed point) as a program for the programmable vector unit (VecUnit): the CG knowledge moves out of the hardware into a program builder, the unit stays application-free, and the solve is bit-exact with waveflow.linalg.cg's model in the interpreter, in pysim and at RTL. A harness plays the systolic array (S = A·P on each P the unit emits). What it shows: grouping the column groups' work kind by kind makes long fused runs, and the program runs a steady 8×32 solve of three iterations in 3,447 cycles against the dedicated CgVectorUnit's 3,581 (Vitis 2025.1), at about four times its LUTs.
  • A matched filter as a vector program - A multi-antenna matched filter, Y[i, j] = conj(X[i]) · R[i, j], as a program for the programmable vector unit (VecUnit): antennas on lanes, samples as elements strip-mined in chunks of VLMAX, the reference broadcast from member 0 and conjugated in the multiply. The same RTL template as CG at another build configuration (VLMAX 64, few groups), bit-exact with a NumPy golden at RTL. What it shows: how close a streaming program comes to its input floor -- a frame every 1,464 cycles against 1,152 input words (1.27x, Vitis 2025.1), the execute task binding just above the loader at VLMAX 64 -- and how to count the instructions a chunk so issue stays small.