The architecture
In the study the ring below is compared with a pool of buffers in the same memories; the pool, and the study’s three-sector configuration ($C = 12$, two words a cycle), are on Results: ring and pool. The sizes on this page are mostly the earlier study’s ($C = 8$).
Status: under construction. The architecture is described; its sizes, formats and several policies are open (listed at the end), and nothing is built.
Overview
The diagram is generated by make_diagrams.py in this folder.
The DUT and its devices
In Waveflow’s terms (Devices and the DUT), a device is one or more kernels and the adaptors that join them to what is not a stream, and becomes one sub-top in the system’s Verilog; its kernels together are one HLS top. The DUT is the devices, the memories and the interconnect: the streams between devices and the crossbar.
| Kernels | Adaptors | |
|---|---|---|
| Front end | the capture and power detector | a slave adaptor with views: the ring’s BRAM window (port A on the bus; the kernel keeps port B), the threshold registers, the counters |
| Controller | the controller, the two pools’ StreamDispatch and StreamArbiter |
a slave adaptor for the host: its threshold registers, the result queue, the summary interrupt |
| Systolic unit, $N_s$ copies | the unit | a memory reader (MemRStream) on the crossbar |
| Vector unit, $N_v$ copies | the unit | a memory reader on the crossbar |
| Interconnect | the AXI crossbar (the units’ reads to the ring; the host’s access to both slave adaptors), and the direct streams: notifications and state messages between the front end and the controller, jobs and results between the controller and each unit |
Built at RTL (plans/aoa_capture_rtl.md, plans/aoa_devices_rtl.md; Vitis HLS 2025.1, xczu48dr
at 4 ns, each device gated against pysim in xsim 2025.1):
| Device | Its HLS top | Where | csynth (est. clock; DSP) |
|---|---|---|---|
| Front end | aoa_capture_1b_cu: the capture’s two stages (the samples, the end of the block), in one adaptor with the ring’s window, the header window and the register bank |
capture.capture_kernel, src/aoa_capture_task.h |
2.90 ns; 32 |
| Controller | aoa_ctl_2s2c: the controller and both pools’ dispatcher and arbiter (a pool of one is wired straight) |
controller.controller_device, src/aoa_controller_task.h |
2.70 ns; 0 |
| Vector unit | aoa_check_1b: the unit and its MemRStream |
units.check_device, src/aoa_check_unit_task.h |
2.92 ns; 62 |
| Systolic unit | aoa_srch: the sequencer, one SystolicEngine (16 × 16, 512-bit words, GRAM, Kmax 256) and its MemRStream |
search_unit.py, src/aoa_search_seq_task.h |
2.92 ns; 1,067 |
| Systolic unit, 8 × 8 | aoa_srch_a8: the same at A = 8 (256-bit words, the ring’s re-worded by the sequencer) |
search_unit.search_device(8, 8) |
2.92 ns; 291 |
| Systolic unit, stand-in | aoa_srch_<table>: the unit’s reads and the golden’s result at the modelled time (designs 1 to 5 below) |
search_standin.py, src/aoa_search_standin_task.h |
2.92 ns; 0 |
| Front end, $C = 12$ | aoa_capture_c12_2b_cu_g1 (2 × 512) and aoa_capture_c12_4b_cu_g1 (4 × 256): two sample words a cycle, the decide stage gated by sector |
capture.capture_kernel(..., C=12), src/aoa_capture_task.h |
2.87 ns; 64 |
| Controller, $C = 12$ | aoa_ctl_c12_2s2c |
controller.controller_device(2, 2, 12) |
2.70 ns; 0 |
| Vector unit, $C = 12$ | aoa_check_c12_2b, aoa_check_c12_4b |
units.check_device(n_banks, R, 12) |
2.92 ns; 62, 34 |
| Systolic unit, $C = 12$ | aoa_srch_c12_<n>b_o1 (16 × 16) and aoa_srch_c12_<n>b_a8_o1 (8 × 8): v4’s unit, the engine’s store compiled out, the block forwarded, split or joined to the engine’s word |
search_unit.search_device(R, A, ("no_store",), n_banks, 12) |
2.92 ns; 1,067, 291 |
The controller’s slave adaptor for the host is not built: its thresholds are constant tables (the
golden’s, generated) and its results a stream to the testbench, as the study needs. The systolic unit
(search_unit.py, plans/aoa_devices_rtl.md Part D) runs the search as two commands of one engine –
the Gram matrix (GRAM: the block read once, rounded to its own register, c_gram) and the scan (MUL,
W in 32-bit lanes) – and folds W into p and the largest direction as it streams out, one job at a
time: 2,033 cycles a search from the job to its result at RTL, every result the golden’s, every
cycle pysim’s (search_system.py; xsim 2025.1). At 8 × 8 (A = 8) a search takes 4,554, the
block entering the engine at half the ring’s rate. Two 16 × 16 engines a unit would double its DSPs, so the
two commands share one, as the study prices it. SystolicEngine itself is characterized at 8 × 8 and
16 × 16 (examples/systolic/aoa_points.py: the search on the fed engine, 612 cycles back to back). The whole DUT is examples/aoa_detect/dut_system.py, its
gate tests/examples/test_aoa_dut_xsi.py: against pysim within the shared front’s order, five designs
ranked alike (First results). At $C = 12$ (the three-sector
site, plans/aoa_site_c12_rtl.md) each device was rebuilt and gated against pysim again, and the whole DUT
is examples/aoa_detect/dut_v4.py: five v4 designs on the gated site, ranked alike by RTL and pysim
(the timing).
Each unit is its own device. A device’s kernels synthesize together as one HLS top, so if the controller’s device held the units, changing $N_s$ would synthesize every unit again. As separate devices, a unit is synthesized and calibrated once, and a pool of any size instantiates copies of the same sub-top: every pool size in the exploration reuses that synthesis and its calibration records.
The testbench, outside the DUT, is three things:
- the sample source, which drives the front end’s sample stream (the workload’s samples, replayed from a file at RTL), with the truth log beside it;
- the thresholds, written once before the first block;
- the results capture: every result message, with the cycle it arrived. Every metric is a comparison of these with the truth log.
The host is not modelled. A deployed design has the A53 set the thresholds and drain the results and
the summaries over the crossbar. The study needs none of it: the summary enters no metric, and its
traffic (a few words every $P$ blocks, to the controller’s own adaptor) never meets the ring’s banks.
So there is no SwHost thread, no C++ host twin and no interrupt path to build.
Port B is joined (plans/bram_window_port_b.md): the capture kernel’s ring ports are
BramIFMasters bound to the windows’ port B, in pysim and in the generated system top. The two RTL
gaps are closed (plans/stream_width_and_views.md): a stream net is as wide as its link, so the
512-bit sample input has its net beside a bus of any width; and each view of a multi-view adaptor is
its own size, placed largest first, so a 256 KB bank is one window beside the 4 KB views. Both are
gated at RTL by examples/bram_ring/wide_ring.py (a 512-bit input on a 128-bit bus, banks of 4 KB to
256 KB; xsim 2025.1).
Two rules shape the design:
- The sample path never stalls. Samples arrive from the converters at a fixed rate, and nothing that faces a converter may wait. The capture and power detector therefore never reads memory, never waits for a reader, and never blocks on its outputs.
- Reading happens downstream. Every read of the samples goes through the ring’s other port, over the crossbar, where the downstream jobs compete with each other. That is where the read delay and the contention are, and they are part of what is measured.
The capture and power detector
One streaming kernel (a FreeRunMod) at the head of the chain. It writes every sample into the ring
and computes each channel’s energy in the same pass, as the samples go by. It makes no detection
decision: it only decides, from energy and state, whether downstream should look at a block.
State
- A state per channel, one of three:
absent: no emitter is being tracked. The channel is notified when its energy is above the arrival threshold.active: an emitter is being tracked. The channel is notified when its energy is below the departure threshold.pending: a notification is out and its answer has not come back. The channel is not notified again until downstream sets it toactiveorabsent.
All channels start
absent. Only a state message from downstream changesactiveorabsent; the kernel itself moves a channel topendingwhen it notifies. - The block index, counting blocks since start.
- The ring’s write slot, the block index modulo $R$.
pending is what keeps one emitter from causing two searches. Without it, an absent channel whose next
block is also above the arrival threshold would be notified again before downstream had answered the
first notification. It also sets the late-block policy of the problem:
while a channel is pending, its newer blocks are skipped.
Interfaces
| Interface | Direction | What |
|---|---|---|
| Sample stream | in | blocks of $B \cdot C \cdot n_{rx}$ samples, at line rate |
| Ring, port B | out, write only | every sample, into the current slot |
| Registers (memory-mapped, host) | in | the arrival and departure thresholds, common to all channels for now, changed rarely |
| Counters (memory-mapped, host) | out, read only | blocks seen; notifications sent and dropped, per channel |
| State messages | in, a queue | from downstream: channel $j$ → active or absent |
| Notifications | out, a credit stream | to downstream: one message per notified channel-block |
The thresholds are stored already scaled by the host: the register holds the threshold on the sum $\sum |x|^2$ over a channel’s block ($B \cdot n_{rx}$ terms), not on the mean, so the kernel compares without dividing.
Operation, per block
- For each sample word: write it to the ring through port B, into the current slot, at its channel’s place in the slot’s layout (below); add $|x|^2$ of each element into the channel’s accumulator, with a lane loop over the word’s antennas, unpacked with the generated array utilities. The slot’s header word (the block index) is written, in the ring’s header memory, before the block’s first sample.
- At the block’s end, with the $C$ energies complete, read the two thresholds.
- For each channel, by its state:
absentand energy ≥ arrival threshold → an arrival notification;activeand energy < departure threshold → a departure notification;pending, or neither condition → nothing.
- For each notification, in order: if a credit is free, send the message and set the channel to
pending. If not, drop it: count the drop, and leave the channel’s state as it was. - Reset the accumulators; move to the next slot.
A dropped notification repairs itself. The channel’s state is unchanged, so if its energy is still past the threshold, the next block notifies again. What the drop costs is delay, which is measured.
Catch-up: the blocks a pending channel missed. While a channel is pending the detector does not
notify it, but it still computes its energy every block. With catch-up it keeps, per channel, two
bits for each of the ring’s last $R$ blocks (below the departure threshold; at or above the arrival
one). When the answer comes, it notifies the earliest block since the job whose bit for the
channel’s new state is set, if that block is still in the ring, so an emitter that ended, or a new one
that began, while the job ran is still seen, a block or two late. Without it, only the block the
answer lands in is compared, and those edges are lost: in the first results that is the
whole of the timing loss, and catch-up removes it at the recommended point (and makes it worse where
the ring’s port has no room). A design parameter, catch_up.
The notification order matters when credits are short. If several channels qualify in one block and fewer credits are free, a fixed channel order always favours the low channel numbers. Options: departures first (cheap and important), round-robin over channels, or highest energy first. It is a design parameter.
The notification
| Field | What |
|---|---|
tx_id |
the notification’s id, echoed by downstream’s state message |
block |
the block index (the delay is measured from it) |
channel |
$j$ |
type |
arrival or departure |
energy |
the measured sum |
slot |
the ring slot holding the block |
The samples are not in the message. Downstream reads them from the ring.
Credits
The notification stream carries a credit per message in flight; the credit pool’s size, the most notifications downstream can hold at once, is a design parameter. When downstream finishes with a notification it returns the credit. A credit bounds how much work is queued downstream. It does not protect the block’s data: the ring does not wait for readers (below).
Why it always keeps up
- Its writes go to its own memory port, which nothing else uses, at one word a cycle.
- It never reads memory.
- Its notification output never blocks: no credit means a drop, not a wait.
- The state-message input is polled, never waited on.
So it runs at line rate whatever happens downstream, and nothing downstream can make it lose a sample.
At C = 12: two words a cycle, gated by sector
The three-sector site has $C = 12$ streams, and its samples arrive two words a cycle: a 1,024-bit beat
is two adjacent channels of one sample (capture.sample_burst’s order), 1,536 beats a block
(plans/aoa_site_c12_rtl.md, Part A; Vitis HLS 2025.1).
- Two banks of 512 bits: each word of the beat goes to its channel’s bank, both at the beat’s one address, the cycle it arrives.
- Four banks of 256 bits: a channel’s 512-bit word is two bank words, and a beat’s two channels go to one pair of banks – banks 0 and 1 on even beats, 2 and 3 on odd – each bank writing the first half the beat its word arrives and the second the next, while the other pair takes that beat. Every bank writes every cycle; a block takes one extra beat to finish its last words.
- The two stages’ link is 1,024 bits wide, so the block’s message (twelve energies, 608 bits) is one word: at 512 bits its reader walked two words with the energies at a variable index, the decide stage’s slowest path (4.13 ns estimated against 4).
- The sector gate (the site’s,
golden.sector_gate): an arrival crossing counts only if the stream’s block energy, shifted left one bit, is at least the largest of its frequency’s three sectors – so an emitter seen by the next sector’s antennas through their sidelobes is not searched for twice. A shift and a compare a stream beside the threshold’s; the gated bit is the one catch-up keeps. It costs no cycle.
Each bank is still written one word a cycle on its own port, so the rules above hold at twice the rate.
The ring
True dual-port BRAMs (bram_t2p.v; in pysim MemSlaveBramWindow, waveflow/hw/mm_bram.py) holding
$R$ slots, each one block of every channel ($B \cdot C \cdot n_{rx}$ samples), and a header word per
slot.
- Banks. The samples are in
n_banksbanks of512 / n_banks-bit words, so a 512-bit sample word is written in one cycle across them. Channel $j$ is in bank $j \bmod n_{banks}$; a slot holds, in each bank, its $C / n_{banks}$ channels’ blocks. Recommended: one bank of 512 bits (a 512-bit bus): behind the one adaptor front the generator builds, readers of different banks take turns, so four 128-bit banks are one 128-bit port, while one 512-bit bank reads a block four times faster (first results, The shared front). Four banks would pay only with a crossbar port per bank, a device shape not built. - The header memory. The slots’ headers are in a small memory of their own, $R$ words as wide as a bank (each memory’s port A is a bus word),
not in the banks. A bank then holds samples only, $R \cdot C\, B\, n_{rx} \cdot 32 / 512$ words:
16,384 at every
n_banks, a power of two, as abram_t2pmust be deep (it addressesmem[addr[AW-1:0]]). With a header word in each slot, a bank would be 16,392 words and need a 32,768-word memory. Each bank and the header memory is a window, all views of the front end’s one slave adaptor, placed by size. - Port B: the capture and power detector only, write only, one word a cycle, in every bank and the header memory.
- Port A: every downstream reader, over the crossbar.
- Layout: channel by channel,
slot[channel][sample][antenna]. Every job reads one channel’s block, $B \cdot n_{rx}$ samples, and with this layout that is one contiguous run. If a slot were laid out sample by sample with all channels together, a job would read $C$ times the data it needs, on the one port every reader shares. Port B can write any address, so the capture places each word in its channel’s region; this is simplest when each input word holds one channel’s antennas for one sample, which is the requirement on the sample stream.
The memory has no lock. The two ports are independent, and a read of the address being written in the same cycle returns whatever the BRAM’s read-during-write mode gives (BRAM interface). This is what lets the writer never stall, and it means nothing in the memory stops a reader from reading a slot the writer has started to reuse. The ring’s contract does that instead:
The ring’s contract: the header first, the header last.
- The writer writes the header first. Each slot’s write starts with its header word, the block index $n$, then the samples, in order, on its own ports.
- The reader reads the header last. A reader takes $n$ and the slot from its notification, reads the samples it needs, and then reads the slot’s header.
- If the header still says $n$, the data was intact for the whole read. If it says $n + R$, the writer had started overwriting the slot: the job reports late, its result is discarded, and the lateness is counted.
One check, at the end, is enough. A notification goes out only after block $n$ is completely written. The slot is next touched when block $n + R$ begins, and its header is the first word written. So if any sample the reader read had been overwritten, the header was overwritten before it, and the reader’s header read, which comes last, sees it. Two orderings carry this: the writer writes the header (in the header memory) before any sample of the slot (in the banks), and the reader’s header read is issued after its data reads have finished. The header and the samples are in different memories, so the order is the writer’s, not one port’s.
The ring’s depth sets how late a read may be. A slot is overwritten $R$ block periods after it was written, so a job must finish reading within about $R - 1$ block periods of its block’s end. $R$ is a design parameter: a deeper ring costs BRAM and tolerates more queueing. At the proposed sizes a slot is $C\, B\, n_{rx} = 32{,}768$ samples, 128 KB at 32 bits a sample, so $R = 8$ is about 1 MB, which fits in the xczu48dr’s URAM.
Lateness is a measured outcome, not an error. It is how overload shows up in the ring, alongside dropped notifications.
At $C = 12$ (plans/aoa_site_c12_rtl.md, Part A; Vivado 2025.1, out of context at 4 ns): the ring is two
banks of 512 bits or four of 256, so that the two words a cycle are written across them. A bank holds
$R \cdot 1{,}536$ words (512-bit) or $R \cdot 3{,}072$ (256-bit), padded to the next power of two, so a
quarter of each is unused; a bram_t2p with an exact depth would save it (a separate Waveflow task). The
banks are block RAM, not UltraRAM – bram_t2p is read-first, and UltraRAM writes no-change only – so at
$R = 8$ the ring is about 470 RAMB36, 43% of the part, before any unit. The front end closes at 4 ns at
$R$ = 2 and 4 as built, and at $R = 8$ with the banks’ block-RAM cascades capped at four
(synth_design -max_bram_cascade_height 4), which the study’s builds at $R = 8$ use.
Two checks for the timing model
- pysim’s port B is untimed (a method call). The capture kernel’s own timing model must spread its writes over the block period, one word a cycle. Otherwise a whole block appears at one instant in pysim, and the overwrite race the header guards against can never occur there.
- A collision check at RTL. No error from the memory is visible in the XSI flow today; the check is
a scan of the trace after the run (
waveflow.utils.bram_trace.find_read_during_write). A stickycollisionoutput on the memory, proposed inplans/rtl_module.md, would make the header protocol checkable in both backends.
The controller
A hardware kernel between the power detector and the units. It is not the A53: at $C$ channels and a block every $B / f_s$, an interrupt per notification would swamp the processor. The A53 sees a summary, not the events.
State
A table per channel:
| Field | What |
|---|---|
| state | absent or active (the detector holds pending) |
| $\hat{\ell}$ | the tracked direction, as an index into the direction grid ($\hat{\theta} = \theta_{\hat{\ell}}$) |
| $\hat{\gamma}$ | the SNR estimate |
| last block | the block of the last decision |
and counters: detections, stops, late reads, and jobs dispatched per unit type.
What it does
On a notification from the power detector, it turns it into a job:
- arrival → an arrival job to the systolic pool:
tx_id, channel, block, slot address; - departure → a departure job to the vector pool: the same, plus $\hat{\ell}$ from the table.
The job goes to a pool’s StreamDispatch, which sends it to a free unit (first free). The pool’s
credits bound how many jobs wait at each unit. When every unit of a type is busy, the job waits in the
controller.
On a result, from either pool’s result stream (the controller waits on both):
- A late read → no decision. The detector is told the channel’s state is unchanged, so its next block notifies again, and the lateness is counted.
- Arrival: the detection test of a.4: $p_{\ell^} \ge \tau_p$ →
activewith $\hat{\ell} = \ell^$, $\hat{\gamma} = p_{\ell^*} - 1$; otherwise it staysabsent. - Departure: the stop test of b.2: $p_b - 1 < \tau_\gamma$ →
absent; otherwise it staysactive. - Answer the notification: send the detector a state message for the channel (
activeorabsent, ending itspending), and return the notification’s credit.
Every notification is answered exactly once, so a channel is never left pending.
The result message
On every decision, an arrival detected or a departure declared, the controller emits a result message on its results output:
| Field | What |
|---|---|
channel |
$j$ |
block |
the block the decision came from |
decision |
arrival or departure |
theta |
$\hat{\ell}$, the direction grid index (arrival only) |
gamma |
$\hat{\gamma}$ (arrival only) |
A search that finds nothing, or a departure check that finds the emitter still there, changes no state and emits nothing. The decision time is measured from the arrival of the block to this message (what is measured).
Not modelled in the study (above, The testbench): the result messages go to a host-readable queue that the A53 drains without an interrupt per message, and every $P$ blocks the controller also writes a summary record (each channel’s state, $\hat{\theta}$ and $\hat{\gamma}$, and the counters since the last record) and raises one interrupt, so the host reads the results and the summary together. $P$ sets how stale the host’s view is against how often it is interrupted; it does not enter the decision time.
The thresholds it uses
$\tau_p$ (detection) and $\tau_\gamma$ (stop) are memory-mapped registers on the controller, set by the host like the detector’s two. The units compute statistics; only the controller decides.
The units
Two unit types, each a pool: a StreamDispatch in front, a StreamArbiter behind, the pattern of
A pool of workers. Each pool has its own arbiter, because
the arbiter’s m_sel (which unit just finished) is that pool’s dispatcher’s credit; one arbiter across
both pools would give credits that index two dispatchers. The controller reads the two pools’ result
streams, waiting on either.
Systolic units: arrival jobs
One arrival job is the whole search for one block, a.2 and a.3:
- read the channel’s block $X$ ($n_{rx} \times B$) from the ring over the crossbar;
- form $\hat{Q} = X X^H / B$ on the systolic array;
- scan the grid: $W = \hat{Q} U$, then $p_\ell = \mathrm{Re}(u_\ell^H w_\ell)$, keeping the largest;
- read the slot’s header;
- return $\ell^$, $p_{\ell^}$ and whether the read was late.
$U$, the $n_{rx} \times L$ steering vectors, is a constant table inside each unit. $\hat{Q}$ never leaves the unit: it is $n_{rx} \times n_{rx}$ (256 values at $n_{rx} = 16$), produced by step 2 and used by step 3 of the same job, so it sits in the unit’s own registers or a small BRAM. No shared memory holds it.
Vector units: departure jobs
One departure job is b.2: read the channel’s block, form $u(\theta_{\hat{\ell}})^H X$ (a $1 \times n_{rx}$ times $n_{rx} \times B$ product) and its squared norm, read the header, and return $p_b$ and the late flag. It needs $n_{rx}$ complex multiply-accumulates a cycle, so it takes about $B$ cycles of compute, and reads the block once.
Why not the systolic array for this too. On an $R \times C$ systolic array, a product with one row uses one row of the array, about $1/R$ of it, and holds the whole array for the job’s length. A vector unit does the same work at a small fraction of the cost and leaves the systolic units to the searches.
What the units share
- The ring’s port A, over the crossbar. Every job, of both types, reads its block there. That is the contended resource: when several channels are searched and tracked at once, the reads queue at the port, and a job’s time is not its time alone.
- The controller, through each pool’s arbiter: a result waits there behind the other results of its pool.
The flow of one notification
block n complete ─► detector: channel j past its threshold, credit free ─► notification (j, n, slot)
─► controller: arrival → systolic pool / departure → vector pool
─► a free unit reads slot n's channel-j block over the crossbar, computes, reads the header
─► result ─► controller: the test → state message to the detector, credit returned
─► on a decision: a result message (the decision time ends here)
The decision time runs from block $n$’s arrival (its last sample written) to the result message:
waiting for a free unit, the read contended at port A, the computation, the result’s return through
its pool’s arbiter, and the controller’s test. An emitter’s detection delay, from its onset, adds the
blocks that passed before the decision: blocks before its energy crossed the threshold, and any whose
notification was dropped, whose channel was pending, or whose read was late.
Extensions
- A shared store for $\hat{Q}$. Splitting a search into a Gram job and a scan job, so the controller can interleave shorter jobs, or averaging $\hat{Q}$ over several blocks for a weak emitter (open in the algorithm), needs $\hat{Q}$ kept between jobs. That would be a local memory with its own arbiter shared by the controller and the systolic units, not the ring, whose write port is reserved.
- Mixed pools. A systolic unit could take departure jobs when idle, at a loss of efficiency.
Open
- The sample word’s layout: one channel’s antennas per word is assumed.
- The notification order when credits are short.
- The sizes: the credit pool, the ring’s depth $R$, the number of units of each type, the systolic array’s shape (and, deployed, the summary period $P$).
- Whether the thresholds become per channel.