BP decoder
StaticTannerCore
is the shared fixed-graph min-sum network.
VanillaBpDecoder
adds its autonomous early-terminating controller.
Static Tanner network
TannerGraph.fromRows
builds the graph from the nonzero column indices of each parity-check row.
TannerNodeGraphs.from
derives local CNU and VNU ports from its stable, row-major edge identifiers.
Rows are sorted by variable index; duplicate or out-of-range entries, empty
checks, and unused variables are rejected. The graph representation permits
degree-one checks, but
StaticTannerCore
requires every check to have degree at least two. Variable degree one is valid.
StaticTannerCore instantiates:
one
StaticCheckStagefor each parity check;one
StaticVariableStagefor each variable;one fixed connection for every graph edge; and
one combinational
ConvergenceCheckerfor \(H\hat{\mathbf e} + \boldsymbol\sigma\) over \(\mathrm{GF}(2)\).
An accepted load stores the syndrome and unsigned quantized priors \(\lambda_j\).
StaticVariableStage
initializes \(M_j=\lambda_j\), \(R_{i,j}=+\lambda_j\), and \(\hat e_j=0\).
An accepted step starts one iteration. All check stages update on the first
clock and all variable stages commit on the second. The immediate commit
view is used by autonomous controllers;
StaticTannerDatapath
exposes the registered result view. The phase enables and fixed edge wires
are constructed by
StaticTannerCore;
there is no row-by-row runtime schedule.
From messages to RTL
Check \(i\) and variable \(j\) exchange \(R_{i,j}\) (variable to check) and \(\sigma_{i,j}\) (check to variable). The measured syndrome is \(\boldsymbol\sigma\); \(\mathcal N(i)\) and \(\mathcal N(j)\) denote the neighbors of the indicated node. The QEC background introduces these messages. Here the equations describe the quantized hardware values; the links beside them identify their production implementation.
VNU: one total, three outputs
The full-width total feeds every output branch. Per-edge subtraction bypasses the stored marginal’s saturation. The drawing shows an ordinary iteration; at a Relay leg transition the edge-message register instead reloads the prior, as described below.
Where the RTL contract differs from ideal arithmetic
VariableLogic.apply
reconstructs signed check messages, adds the bias, and reuses one
total for the marginal, hard decision, and every outgoing extrinsic message:
Here \(T_j\) is the full working-width sum and \(M_j\) the stored signed marginal.
Arithmetic.clipSigned
implements sat on \([-2^{w_a-1},2^{w_a-1}-1]\);
Arithmetic.toSignMag
implements pack, clipping magnitude to \(2^{w_m}-1\) and canonicalizing zero.
Subtraction and decision occur before clipping the stored marginal.
Arithmetic.hardDecision
selects zero for \(T_j=0\).
Arithmetic.sum
uses a balanced tree padded to
\(w_a+\max(1,\operatorname{bitlength}(|\mathcal N(j)|))\) bits, as derived by
VariableConfig.workBits.
Quantization
requires \(w_a\geq w_m+1\). A bias lies in the signed \(w_a\)-bit range, while each
check message has magnitude at most \(2^{w_m}-1\). These bounds fit both the
working sum and the subsequent recipient subtraction without arithmetic wrap.
Vanilla drives \(B_j\) from the immutable prior; Relay
computes \(B_j\) from the prior and the previous stored marginal.
StaticVariableStage
connects this bias to the leaf port named VariableNode.prior; that port is the
current bias, not necessarily the immutable frame prior.
On a normal VNU commit, the stage stores all three calculated outputs.
When Relay asserts restartMessages at a leg boundary,
StaticVariableStage
still stores the newly calculated \(M_j\) and \(\hat e_j\), but stores
\(R_{i,j}=+\lambda_j\) for the next leg instead of the calculated extrinsic message.
The immutable prior is not reloaded from the external input at that boundary.
Clock and initialization boundaries
The arithmetic leaves are combinational RawModules.
StaticCheckStage stores
the syndrome on load and the CNU result on step.fire. StaticVariableStage
commits the next marginal, decision, and edge messages on the following VNU
phase, subject to the Relay restart override above. The autonomous controllers
first test convergence after a completed iteration, including when the loaded
syndrome is zero.
For the manually stepped
StaticTannerDatapath,
load and step use ready/valid handshakes. Before the first accepted load,
step.ready is false. A pending load.valid has priority over a step;
neither request can be accepted during the VNU phase. Its result is a
one-cycle Valid pulse, with no ready signal or output backpressure.
Consumers must sample the registered snapshot while result.valid is high.
StaticTannerCore.commit
uses the combinational next VNU decisions for convergence on the VNU phase;
result exposes the registered snapshot afterward. The two-clock schedule
describes decoder computation, not input/output transport latency or an achieved
FPGA clock frequency.
For the published CNU and VNU datapath schematics, see Maurer et al., Sec. 4.1, Fig. 3(a–b). The diagrams above make the current chipsLDPC bundle and register boundaries explicit; the linked Scala sources define their implemented behavior.
Autonomous vanilla BP
VanillaBpConfig
requires a positive iteration limit and fixes the graph, quantization, and check
scaling. RelayDefaults.q
supplies four magnitude bits and seven signed marginal bits;
RelayDefaults.scale
supplies the default ramp policy.
VanillaBpDecoder
accepts StaticDecoderInput through io.in. It runs until
the residual is zero or the frame limit is reached, then holds a
BpDecoderResult
on io.out until accepted. The result contains:
success and correction bits;
final signed marginals and residual;
completed iterations; and
legsExecuted = 1andsolutionsFoundequal to the success flag.
When runtimeIterationLimit is elaborated, the optional limit port may select
any positive prefix of the configured capacity; it is sampled on io.in.fire.
For \(N\) completed iterations, io.out.valid first becomes high immediately
after the \(2N\)th rising clock edge following the accepted input edge.
This excludes the edge that accepts the result through io.out.fire.
Output backpressure extends interface latency but does not alter the reported
iteration count. A new input cannot be accepted until the current output has
been accepted and the controller has returned to its idle state.
Inspect and test
./scripts/emit.sh static-steane
./scripts/emit.sh vanilla-steane
./mill chipsLDPC.test.testOnly chipsldpc.TwoMinSpec chipsldpc.CheckNodeSpec chipsldpc.VariableNodeSpec
./mill chipsLDPC.test.testOnly chipsldpc.StaticTannerDatapathSpec
./mill chipsLDPC.test.testOnly chipsldpc.BpDecodersSpec
The maintained large experiment is in examples/BivariateBicycle144BpOnly/.
Relay control is described in Relay BP.