Guide

Welcome to Waveflow. This folder will have guides to use the Waveflow functionality as we develop it.

How this guide is organized

Waveflow models concurrent systems, and the guide starts with what is built and the flow that takes one from an idea to verified, measured hardware. What is built comes first, on four concept pages: Waveflow Architecture (the three levels of simulation and the layer around the DUT), Kernels, Devices and the DUT and Command-response, with every term in the Glossary. Then the Flow Overview walks the flow a page per step, on one running example: designing the DUT – its kernels, what each talks to and its messages, the stream patterns they talk by – then simulating it in Python beside anything else the question needs, simulating it at RTL, verifying it, calibrating its timing and resources, and exploring the design space. Each step is done module by module: any module can be the DUT of its own harness.

The sections after it are the reference those pages link into, from the outside in: Modules, Interfaces, Data schemas and Vectorization, the Simulation engine, and how a module becomes hardware – Module Code Generation (what a tool writes for you), Custom Hooks (what no generator can guess) and the Build System. Then the libraries (Stream Blocks, memory, RF, DSP), timing and resources, and, last, the Legacy flows.

Most readers – people and agents alike – arrive at a page from a search or a link, not from the top. So every page says where it sits and links across, rather than restating a neighbour.

One correction worth making early, because the natural assumption is wrong. Code generation covers both backends, and they are the same dispatch: kind_of_endpoint produces one vocabulary – axis_in, axis_out, maxi_read, maxi_write, mm_slave, axilite_slave, bram – and two tables consume it, the boundary-port emitter for HLS and BFM_DUALS for the XSI testbench. So the C++ model that drives a port from outside the kernel is as automatic as the port itself, and a module’s harness needs no testbench code at all.

The table of contents below is in reading order, and every entry’s summary is read from that section’s own front matter — so the list is generated rather than maintained here, and cannot fall out of step with what it lists.


Table of contents

  • Installation - Two paths, and which you want depends on whether you are using Waveflow or changing it: a pip install from GitHub into a virtual environment for building designs with it as a library, or a clone plus an editable install with the development tools for modifying it and running the bundled examples and tests. Python 3.10 or newer either way. Both give you the full Python simulation flow with no other tools installed; synthesis and RTL-level simulation additionally need AMD Vitis and Vivado connected via WAVEFLOW_VITIS_PATH. The AI-assistant integrations are optional and covered separately.
  • Waveflow Architecture - What Waveflow builds and simulates, before how -- where the guide starts. Waveflow designs hardware (the DUT) and simulates it in its environment, to answer three questions -- accuracy, timing, cost -- and explore their trade-off. Three levels: the golden (untimed, bit-exact pure functions, for accuracy and design-space search), pysim (a Simulation of SimObjs, one of them the DUT, with timing), and RTL simulation (an HwSystem: the DUT as Verilog, its testbench as C++ twins); two descriptions, not three: run_iter calls the golden, and each kernel's HLS body is the second, checked against it. The DUT is the same tree at both simulated levels -- kernels (FreeRunMods on streams only), adaptors (streams to memory, a bus), devices (kernels plus adaptors: an HLS top and RTL in one sub-top), memories and the interconnect -- described on the Kernels and Devices pages; only the layer around it changes. The terms are on the Glossary page. Then the Flow Overview: how it is built, step by step.
  • Data Schemas - The type system, and the one description both sides are generated from. A DataSchema class states its fields and their bitwidths once — at the arbitrary precisions Vitis HLS supports — and from it Waveflow derives the Python representation (NumPy-backed wherever it can be) and the C++ header together: a matching struct plus templated serializers for arrays, HLS streams and AXI4-Streams. That is what makes the Python model and the HLS implementation incapable of disagreeing about layout. Split into Python (building schemas, the source of truth) and HLS (the synthesizable C++ they generate).
  • Vectorization - How the functional simulation manages to be fast and bit-exact at once. Data lives in NumPy arrays end to end, so a whole vector moves through one C-level call instead of a Python loop over elements — and the result still matches the Vitis HLS datapath bit for bit. Split into Python (defining NumPy-backed vectors and computing on them, one page per element type) and HLS (packing arrays into words: the raw array and its lane loop, the generated wrapper struct, and complex elements).
  • Simulation - Run a whole system in Python: a SimPy discrete-event simulation that wires components through Interface objects and drives the pre_sim / run_proc / post_sim lifecycle — the milestone of validating a design before any C++.
  • Interfaces - The Python transactional interface model — how modules communicate over streams, memory-mapped ports, BRAM, register maps, and schema/array transfers in the SimPy simulation. Presented in two parts, split by one question: does this interface build on another one? A primitive is a module’s direct connection to the outside; a derived one composes primitives whose endpoints it owns and drives.
  • Modules - Reference for hardware modules: what a HwModule is (typed ports and a behavior, the single source of truth for a hardware block), its kinds and the cut; writing a free-running module (a leaf's run_iter, a composite's graph, state across firings); developing module by module (harnesses, hostile stand-ins, calibration, composition); the XSI simulation components (kernel, RTL and BFM modules); parameterization; and toward the board. The flow these serve is the Flow Overview.
  • Module Code Generation - Waveflow generates HLS and related C++ from certain HwModules — automatically for the mechanical parts (top function, AXI pragmas, regmap struct, testbench harness), semi-automatically where you supply the compute body as a hook. Each distinct code output is a target; four are built (control_driven_kernel and sequential_vitis_tb for Flow 1, composite_kernel and sequential_xsi_tb for Flow 2) and only bitstream is not. check(source, target) answers whether a given module would lower, running the same rules generate does.
  • Custom Hooks - The hand-written codegen path: when the HwStmt extractor can't lower a datapath, you attach a hand-written Vitis C++ kernel to a component method with @synthesizable. Covers the boundary with auto-generated codegen, the hook mechanism, and a decision guide over the three hook patterns (block / stream / complex).
  • Build System - The path from a Python design to its Vitis outputs, modelled as a DAG of typed steps. Each step declares the named artifacts it consumes and produces — files on disk or in-memory Python objects — and the DAG wires the dependencies, runs them in topological order, propagates failures, and skips whatever is already fresh. One flow and one fidelity ladder (schema/codegen, pysim golden, csim, csynth) with a fork only at the RTL rung: a control-driven top goes through Vitis cosim, a free-running composite through XSI and a BFM. Also covers sweeping a parameter grid through the same DAG.
  • Memory Modeling - Storage in Waveflow is six categories ordered by the SCOPE OF SHARING — not by size and not by lifetime. Local temporaries and per-module persistent state (HwState) are inside one module; a BramMod is shared between modules but inside the top; AXI-MM (MemoryMod, MemMgr) is outside it; and two categories are storage the tool creates for you — a channel's FIFO depth, and the ping-pong buffer Vitis builds whether or not you asked. Includes what each backend models and what csynth counts.
  • RF converters - Modelling a design that talks to one or more RF data converters — ADC/DAC blocks such as the RFDC on an AMD RFSoC. Rfdc emulates the converter itself, with an AXI-Stream side identical to the AMD IP and an RF side you can attach sources, sinks and channels to; the RfShotBuf and RfStreamBuf families sit on top of it when you want to hold samples rather than pass them through.
  • Platforms - A platform is the target a design is built and measured against: an FPGA part, a synthesis clock, and the resource counters that technology is measured in — plus a directory holding everything fit or measured for it. It is not a calibration-only concept: the same identity drives the csynth set_part / create_clock, so the part a design is synthesized for cannot drift from the part its models were fit for. Covers the identity, the directory layout, and the commands that create, inspect and publish one.
  • Stream Blocks - Waveflow's own stream blocks: small, general free-running modules that move framed streams between a design's kernels, so a stream-only design does not rewrite them. Each is framework code -- a Python model, an HLS body templated on its ports' word types (so one body serves the block at a top, at a composite's boundary and inside one), a build step that copies the body, and an RTL gate in its own harness. Today: StreamBroadcast (one stream in, n copies out), StreamArbiter (n streams into one, a frame at a time, its winner on a side stream), StreamDemux (one stream out to n, by a side stream or a header field), StreamFramer (TLAST put back on a stream framed by count) and StreamDispatch (one job stream out to a pool of n workers, each job to a worker holding a credit).
  • Vitis L1 Blocks - Waveflow HwModules that wrap AMD Vitis Libraries vendor IP, starting with the SSR FFT. What the L1 / L2 / L3 levels of the Vitis Libraries are and which one a Waveflow design uses; the three things a vendor block needs to be an ordinary Waveflow module (a bit-exact Python model, the vendor call as its task body, and timing and resources calibrated on a platform); and which blocks exist today.
  • DSP Blocks - Waveflow's own DSP blocks, written as free-running Waveflow modules rather than wrapped vendor IP: the full-rate SSR FFT, bit-exact with AMD's Vitis L1 FFT and ten times its throughput as shipped, and the complex fixed-point linear-algebra components -- the systolic matrix multiply, the CG vector unit and the programmable vector unit -- with the conventions they share.
  • Timing Analysis Tools - Getting time back out of a run. Two complementary views, each buildable by hand or from a trace — timing diagrams (waveforms, a value box per transition, for a 10 to 50 cycle zoom) and activity diagrams (activity bands plus an optional occupancy panel, for the whole run and stage overlap) — plus the build steps that dump a VCD of a free-running kernel's internal channels and bind its signals by exact name, protocol analysis for AXI-Lite, AXI-Stream and AXI-MM, and the three subtle ways such a measurement goes silently wrong.
  • Resource Analysis Tools - The measurement side of FPGA resource utilization: what an FPGA's resources are, how Vitis estimates them after C-synthesis, how to read that report with CsynthParser, and how to decompose a composite kernel's total into the modules and the interface logic that caused it. This section extracts the numbers; Resource models predict them, and Model calibration stores and fits them.
  • Model calibration - The machinery both model axes share. One CalibModel base: get_params extracts what the corpus records, transform derives features, predict_feat answers, and every answer carries a Confidence. One corpus format (corpus.csv, one row per measurement, derived from each axis's raw tier). One set of model kinds — lookup, prior, concat, and two regressions. Timing and resource models are the same class; only the source of a number differs.
  • Timing Models - How a module says how long its work takes, and how those numbers are recovered from measurement. A module declares timed phases -- spans between events at its own ports, a function of features, learned by a model -- and its body waits them: one span for a sequential body, two (latency, fill) for a pipelined one. Calibrating them is generated from the declaration: the RTL transfers on the named ports, paired with pysim's records, fitted per span. The transfers time themselves; the platform's bus model and the framework's mem-stream residuals cover what modules do not declare.
  • Processor Model - A loosely-timed, calibrated model of a general-purpose processor for the software a system runs beside its accelerators: schedulers, bookkeeping, irregular control code. Software is Python that reports the work it did as counters; a cost model calibrated on gem5 turns the counters into cycles and energy; a Processor schedules the calls over N cores with priorities, context switches and optional preemption, all in the same SimPy simulation as the hardware. Ships with a calibrated Cortex-A53 platform (the RFSoC 4x2's, gem5 HPI, McPAT 22 nm).
  • Agentic DSE - Design-space exploration by an AI agent: given a fixed architecture, choose its parameters to meet an objective within a budget of tool time, using an untimed bit-exact simulation, synthesis, RTL simulation and, in Waveflow, pysim. What DSE is, why this section covers the parametric kind, and the running example (the LTBF receiver's shared-memory system, examples/ltbf_cg_mem_dse, explored in examples/dse_cg).
  • Resource Models - Predicting a design's resource utilization without synthesizing it, so a design-space exploration can price thousands of configurations from a handful of syntheses. Every module has a model — the default recalls measurements and needs no authoring; others derive from declared structure or regress from a corpus. Every prediction carries a confidence saying how much to believe it, and a composed estimate reports its weakest link rather than its average.
  • Developers - Notes for people editing the Waveflow package itself rather than building designs with it. Currently one topic: running the MCP server's tests headless, without a host editor to supply the file tools.
  • Legacy flows - The sequential (host-activated) flow, kept for the designs and courses that use it: a control-driven kernel the host launches with ap_start, a sequential C++ testbench (SeqTB), Vitis C-simulation and C/RTL co-simulation as the gate. It is the shortest path from a Python function to a verified kernel, and Vitis drives it directly -- but it cannot express concurrency, and Waveflow's system flow is the flow new designs use. Host-activated MODULES are not legacy: an ap_ctrl_hs kernel behind s_axilite is still a kind of device in a system; what is legacy is verifying a design through a sequential testbench.
  • AI Tooling - The Waveflow MCP server: a small local program your AI assistant launches, which gives it Waveflow's guide and reference examples, the step-by-step process for building an accelerator, and a scaffold that starts every project from a working design. Nothing leaves your machine and no API key is needed. Optional, and experimental.