Waveflow Architecture
What is Waveflow?
Waveflow is a Python package for designing hardware and simulating it in the environment it will work in. Its first target is hardware for wireless communications and sensing. The hardware being built is the DUT. The environment is several things running at once: the DUT itself – kernels and memories joined by streams and interconnects – and the world around it, such as host processors, peripherals, wireless channels and RF components.
The simulations answer three questions about the hardware:
- Accuracy and correctness. Are the computations right, and how accurate are they? For example, how does the number of iterations, or the bit-width of a fixed-point approximation, change the result?
- Timing. How fast is it? The system’s throughput, its latency, how often a deadline is missed.
- Cost. What does the hardware take? Resources (LUTs, DSPs, BRAM), estimated from calibrated models in Python and measured by synthesis; energy, for the processor model.
In most designs accuracy, throughput and cost trade off against one another. Waveflow is built to explore that trade-off quickly, by hand or with an agent searching the design space.
This page is what is built and simulated. How to build it, step by step, is the Flow Overview. Every term used here is defined in the Glossary.
Three levels of simulation
Waveflow simulates the DUT at three levels:
| level | what runs | what it tells you |
|---|---|---|
| golden | the operation as pure, bit-exact Python functions: no time, no modules | functional accuracy, fast enough to search a design space at scale; the reference the other two levels are checked against |
| pysim | the DUT’s modules in Python, timed, in a Simulation with its environment |
throughput, latency, missed deadlines; whether the modules work together, without a protocol error or a deadlock; cost from calibrated models |
| RTL | the DUT’s Verilog in an HwSystem, cycle by cycle, its testbench as C++ twins |
whether the hardware does what the Python does; exact cycle counts; cost measured by synthesis |
There are two descriptions of the DUT, not three. The golden and pysim share the first: a
kernel’s Python behavior (run_iter) calls the golden’s functions, so pysim computes exactly what
the golden does and adds time. The second is each kernel’s HLS body, written separately in C++; the
RTL simulation runs it, and its outputs are compared with pysim’s word for word. In the running example,
the golden’s poly_eval is what
PolyKernel.run_iter evaluates, and the HLS body is
written to read the same way.
The golden takes three forms, all from the same functions: the functions themselves (what it
does, Designing the DUT); a module’s golden(kind), the
bursts each output must record for a workload, which its harness checks pysim against
(verification); and a design’s golden(params, workload) for design-space
search, the accuracy metrics of an untimed run (DSE context).
Around the DUT: pysim and RTL
The two simulated levels hold the same DUT. What changes is the layer around it:
flowchart LR
subgraph S["Simulation: pysim"]
direction TB
H1["host program"] --> D1[["DUT"]]
C1["wireless channel"] --> D1
T1["traffic source"] --> C1
D1 --> P1["processor model"]
end
subgraph H["HwSystem: RTL simulation"]
direction TB
H2["host<br/>(C++ twin)"] --> D2[["DUT<br/>(its RTL)"]]
DR["stream driver<br/>(AxisMaster)"] --> D2
D2 --> SK["stream sink<br/>(AxisSlave)"]
end
- In pysim the outer layer is a
Simulation: a discrete-event simulation ofSimObjs. The DUT is one of them (every module is aSimObj), and the rest is anything the question needs – a host program, a wireless channel, a traffic source, a processor model – at whatever level of detail. Anything can join aSimulation. - At RTL the outer layer is an
HwSystem(sim, dut): a simulation with one module named the DUT. Everything else is its testbench, derived, never listed: hosts, stream drivers and sinks, memory models, each running as a C++ twin beside the DUT’s Verilog. Only what has an RTL twin can join anHwSystem. A wireless channel model has none, so a study with one is a pysim study, and its RTL simulation draws the testbench where everything has a twin (Simulating at RTL).
Inside the DUT
The DUT is the same tree at both simulated levels. Two pages describe it:
- Kernels do the work. A kernel is a
FreeRunModwhose interfaces are all streams – a leaf with its ownrun_iter, or a composite of child kernels – yours or the library’s. - Devices and the DUT is everything else. An adaptor joins streams to something
that is not a stream: memory through
m_axi, a bus through a slave adaptor’s front and views. A device is kernels plus their adaptors, built as an HLS top and RTL in one sub-top, one IP. The DUT is devices, memories and the interconnect. That page also lists what you write and what Waveflow provides.
Next: Kernels – what does the work, and how it talks; then Devices and the DUT, Command-response, and the Flow Overview. Every term on this page, with its class and the page that defines it, is in the Glossary.
Table of contents
- Kernels - What a kernel is and how it talks. A kernel is a FreeRunMod whose interfaces are all streams: a component of the hardware, described in Python by its operation, written by you or taken from the library. It is free-running -- no host starts it; it waits on its input streams and acts on each message. Kernels are hierarchical: a leaf has its own run_iter and becomes one hls::task; a composite has child kernels wired by streams and no body of its own. Anything that is not a stream -- memory, a bus, an interrupt -- is reached through an adaptor, and kernels with their adaptors form a device (Devices and the DUT). One stream for each thing a kernel talks to (another kernel, a bus master, a far queue, memory, host settings). Every stream is typed by schemas: a message is a burst closed by TLAST, read and written by its schema, never by hand. Read in the order written, or deadlock. BRAM is the one exception: storage, not an event.
- Devices and the DUT - What the DUT is made of: devices, memories and the interconnect. An adaptor is a module with streams on one side and something that is not a stream on the other -- m_axi to memory (MemRStream, MemWStream), an AXI slave (a front and its views), an RF converter edge. A device is kernels plus the adaptors that join them to the world that is not streams; with no adaptor, a device is just its kernels. Kernels and some adaptors (the memory readers and writers, bus writers) have HLS bodies, and together they are the device's HLS top, what Vitis synthesizes; other adaptors (fronts and views) are framework Verilog, and a kernel can be pre-written Verilog too (rtl_module). The device's sub-top joins the HLS top and the RTL into one Verilog module, one IP. The same tree in pysim and at RTL; any module can be the DUT of its own harness. What you write, and what Waveflow provides.
- Command–response - What kernels say on their streams. Work is requested by a command, and command-response is the default shape: read a command carrying n, do the work on n elements, answer; the other shapes (continuous stream, configured stream, host-launched one-shot) are named. The protocol has a data plane and a status plane -- s_in carries Cmd | data, m_out carries Resp(tx_id, n) | results, m_status carries Status(tx_id, code) per command -- every message a schema, and an error is fatal: the kernel closes its data, reports, and stops taking input until a reset. Why two output streams, the rules that make it robust, the bus mapping, the variable-length variant (a tagged union ending in END). Memory is reached the same way: a kernel sends MemRCmd to its memory reader and gets the data, sends MemWCmd and the data to its writer and gets an echo when the write is done. Through a pipeline the command travels with the data and the last stage answers.
- Sharing a kernel - A kernel K used by several clients, or whose output comes back to its own input. The four questions any shared K answers (how commands merge, where data lives, how results get back, what keeps one client's full buffer from stalling K) and the six ways to answer them (shared memory, dedicated streams, inline with credits, data resident at K, a centralized requester, a static schedule), with replicating K as the baseline. The rules on the return path (K never blocks on a result; requests and responses on separate channels; a request-then-wait is a poll loop; a feedback frame announced only once complete; a unit on a cycle must flush an isolated frame). The blocks: StreamArbiter, StreamDemux, a tag beside K, SsrFft with the direction chosen per frame, wait_any for a polling body's model. A cycle inside a composite: what the generator does with it, credit as an end-to-end token, link depths from the credit, and why a deadlock looks like success. Why AMD's stream switch and streamNToOne do not fit inside a composite.
- Library blocks and their models - The catalog to search before designing a block: every reusable Waveflow block, named in the words of the signal processing it does (an FFT or IFFT for OFDM, a Gram matrix HᴴH, applying an MMSE or beamforming filter, a conjugate-gradient or least-squares solve, a dot product, a matched filter, a memory read, the ADC and DAC, software on the A53), with its class, its guide page, its interfaces, and the state of its timing and resource models -- calibrated, a formula, or measured points only. What no block covers (a direct matrix inverse, Cholesky or QR, LDPC, polar or Viterbi decoding, demapping, CORDIC) is listed too, so a design names what it must build. Then how to price a point without synthesis: the formulas, the calls, and the part's capacity. The page an architecture is planned from.
- Flow Overview - How to build a system with Waveflow, start to finish, a page per step: designing the DUT (what it does as a golden, its modules, interfaces and messages; the stream patterns; the command-response protocol; each kernel's Python model and HLS body), simulating it in Python, simulating it at RTL, verifying it, calibrating its timing and resources, and exploring the design space. What is built -- the levels of simulation and the DUT's tree -- is on Waveflow Architecture, read first. The HLS bodies are needed only from the RTL step on. One running example (the free-running polynomial) on every page, with steps up to a pipeline (block_eq) and a bus system (markov).
- Designing the DUT - The first step of the flow, on the running example: designing the DUT. Five questions answered before any code is written: what it does (a bit-exact golden from intents), its kernels (a leaf, or a composite of child kernels where work should overlap), what each kernel talks to (a stream for each, and an adaptor -- making it a device -- for a bus or memory), the messages on each stream (schemas), and one firing (what each leaf run_iter reads, computes and writes). The polynomial: one leaf kernel on three streams, no adaptor. Steps up to a composite (block_eq) and a bus system of devices (markov).
- Stream patterns - How the modules of a free-running design talk: on streams, and only on streams. A message is a burst closed by TLAST (framed ports; one Python write is one burst); several elements share a word, read and written by the generated lane routines, never by hand; a reader reads in the order the writer writes, and a blocking read on the wrong stream deadlocks. The rule under every free-running design -- a module's own logic reads and writes only streams, and memory, bus masters and interrupts reach it through adaptors (MemRStream / MemWStream, a MemSlaveAdaptor's views, IrqIF) -- and why: one event model, logic decoupled from transport. Between kernels: stream blocks (StreamBroadcast), the depth of an internal link, a token per job through every stage, and credit when blocking would stall something shared.
- Defining the kernel in Python and HLS - Writing a leaf kernel, twice: a Python model and an HLS body, which must agree -- the Python is the specification, the HLS is the hardware, and the RTL comparison is what checks them against each other. The class has a fixed structure: its C++ name, its build parameters as dataclass fields, its streams and timed phases in __post_init__, its behavior in run_iter (one firing, one job), its HLS body behind kernel_task(), and its scenarios in workload(kind). Shown on the polynomial's PolyKernel; then the command-response kernel's Python model, its HLS body written to read the same way, and the host that drives it.
- Simulating in Python - The second step of the flow: the DUT in a Simulation. A Simulation is a discrete-event simulation of any SimObjs -- the design's modules and anything else the question needs: a host program, a wireless channel, a traffic source, a processor model. A free-running module's behavior is its run_iter, one firing per message, with its timing declared as timed phases. The cut: any module can be the DUT of its own harness, harness(Module, workload=...), with a generated stand-in at each port -- so each module is simulated alone, against the golden, before the whole. Then the composite (each stage alone, then together) and the system with its host. Reading results off the objects.
- Simulating at RTL - The third step of the flow: the DUT as hardware. An HwSystem(sim, dut) is a simulation with one module named the DUT -- what is synthesized -- and a testbench of everything else, each part with an RTL twin (a stream driver's AxisMaster, a host's C++ program); anything without one stays in pysim. Each module's HLS body behind kernel_task() -- hand-written or generated, one body for the module alone and inside a composite (framed ports). The system flow on a build DAG: codegen, csynth, system_rtl, scenario, pysim, system_xsi, compare; run under XSI cycle by cycle from the same scenario pysim ran. What becomes what: Vitis HLS, hand-written framework RTL, vendor IP, the testbench.
- Functional verification - How to verify a kernel or a system, in pysim and at RTL -- the fourth step of the flow: what is compared with what, and what a passing gate proves. Three links -- the golden reproduces the spec's worked examples; pysim against the golden, burst for burst, from the harness's sinks; RTL against pysim, word for word (compare), so the RTL is the golden's too. The error scenarios (a bad command mid-scenario, nothing answered after it). Every gate asserts counts, because a deadlock looks like success. With a host: its bus traces identical at RTL and in pysim, the host finished, no polls. Hostile stand-ins for robustness, an exact cycle count as a regression gate, and what none of this proves.
- Timing and resources - The fifth step of the flow: how long the design takes and what it costs, measured per module and composed. A module's timing is declared as timed phases -- spans between handshakes at its own ports, with the features they depend on -- and calibrated in its harness against its RTL (add_calib_steps), the fit filed under the module's identity and loaded wherever the module sits. A parent's timing is then composed from its modules' records with nothing fitted to it, and checked once against the parent's RTL: the polynomial behind AXI-MM within 2%, markov within 1%. When a composition misses, the miss names what is not yet modeled. Resources: each top's csynth report, and the system's from Vivado.
- Design-space exploration - The outer loop of the flow: choosing among designs that work. A design's build parameters (HwParam) are the axes; a sweep runs the flow at every point of a grid and keeps what each step measured (ParamGrid, SweepRunner); calibrated timing and resource models price a point without synthesizing it, each prediction carrying a confidence; and a few syntheses check the predictions. What is built today -- sweeps, resource models, calibrated timing, per-device synthesis -- and what is not yet: an exploration loop as a framework tool. The mimo_cg study is the worked case.
- Glossary - Every term the guide uses for what Waveflow builds and simulates, with its class and the page that defines it: what is simulated (golden, simulation, SimObj, system, DUT, testbench, twin, harness, workload, host), what is built (module, free-running and host-activated modules, leaf, composite, kernel, HLS body, plain module, adaptor, slave adaptor, view, front, device, bus writer, memory reader and writer, memory, crossbar), what joins them and what travels (interface, port, stream, credit stream, BRAM, interrupt, schema, command / response / status), sharing a kernel (shared kernel, client, arbiter, demux, tag, end-to-end credit, slot, feedback frame), and the words used loosely (module vs kernel, device vs composite, adaptor vs view).