Systolic: An Engine against Its Bounds
Unit 11 bounds a systolic array three ways: by its compute (every tile of the output, at
the array’s period), by its input (the operands, a word a cycle) and by its output (the
result, a word a cycle). This demo checks those bounds against a real design: Waveflow’s
SystolicEngine, an output-stationary array of complex fixed-point multiply-accumulates. You
simulate the engine in Python (pysim) for several product shapes, compute the three bounds for
each, and compare the simulation and the RTL measurements with the bounds.
No Vitis is needed: pysim is Waveflow’s cycle-approximate Python model. The RTL numbers were
measured on the lab machine with Vitis HLS / Vivado xsim 2025.1, xczu48dr at 4 ns, and are
read from Waveflow’s examples/systolic/measured.json.
The engine
The engine’s centre configuration: an array of R × C = 4 × 8 processing elements (PEs),
L = 4 lanes to drain results, products up to 8 × 8 × 32 in one panel and up to four panels of
k. A command carries m, k and n; then A and B stream in on one input, and C streams
out. Its guide page is Waveflow’s docs/guide/dsp/systolic/, and the example the RTL numbers
come from is docs/examples/systolic/.
The bounds
For a product C = A·B, A being m × k and B being k × n, with LW values in a word (two
at 64 bits, four at 128, since each complex value is two 16-bit lanes):
| Bound | Cycles | Why |
|---|---|---|
| compute | T · P, with T = (m/R)(n/C) and P = max(k, R·C/L, L) |
each tile of R × C outputs takes P steps, tiles back to back |
| input | k(m + n) / LW |
every value of A and B comes in once, a word a cycle |
| output | m·n / LW |
every value of C goes out once, a word a cycle |
A product takes at least the largest of the three. It is compute-bound when
m·n / (m + n) ≥ R·C / LW.
Running it
From a checkout of this repository next to a Waveflow checkout, with Waveflow installed
(pip install -e ".[dev]" in the Waveflow folder):
cd demos/systolic
python systolic_bounds.py # every product at 64- and 128-bit words
python systolic_bounds.py --only 8x8x32 --word-bits 128
For each product the script runs pysim twice, with 4 and with 8 products back to back. The
difference in run length, divided by 4, is the steady cost of one product: the run’s fill and
drain cancel. It prints a table and writes results/bounds.json and results/bounds.png.
What it shows
product word compute input output binds pysim RTL
8x8x32 64 64 160 128 input 162 171
8x1x32 64 64 20 128 output 130 141
8x16x32 64 128 320 128 input 322
8x32x32 64 256 640 128 input 642
4x8x8 64 8 48 16 input 50
8x8x32 128 64 80 64 input 83 94
8x1x32 128 64 10 64 compute 83 94
8x16x32 128 128 160 64 input 161
8x32x32 128 256 320 64 input 321
4x8x8 128 8 24 8 input 32

- Every product is input-bound, except the short one,
k = 1, whose output binds. These shapes are too small to keep 32 PEs busy:8·32/(8+32) = 6.4, againstR·C/LW = 16at 64-bit words and 8 at 128. - pysim sits a cycle or two above its bound: the command word, and the
Respheader in front ofC. - The RTL is 9 to 11 cycles slower than pysim a product. These are fixed costs per command that pysim does not model: the receiver reading and checking the command (about 9 cycles), and at 128-bit words the core’s restart between commands. The Waveflow example’s timing page explains how they were found.
- The short product is not output-bound at 128 bits. Its output takes 64 cycles, as does the
compute, so neither binds alone: both pysim and the RTL meet the core’s own floor. (The RTL’s
shortworkload alternatesk = 1andk = 2, so its 94 is their average.)
Try it
- Add a product to
PRODUCTSinsystolic_bounds.py. Whichm,k,nmake the compute bound the largest? (The engine’s maxima limitm ≤ 8andn ≤ 32, multiples of 4 and 8. Can any shape be compute-bound at 64-bit words?) - At 128-bit words, find the product with the largest compute share. How far is pysim from the compute bound?
- Predict the 64-bit interval of
8x32x32before you run it.