Codes for Metastability-Containing Addition
We investigate the fundamental task of addition under uncertainty, namely, addends that are represented as intervals of numbers rather than single values. One potential source of such uncertainty can occur when obtaining discrete-valued measurements of analog values, which are prone to metastability. Naturally, unstable bits impact gate-level and, consequently, circuit-level computations. Using Binary encoding for such an addition produces a sum with an amplified imprecision. Hence, the challenge is to devise an encoding that does not amplify the imprecision caused by unstable bits. We call such codes recoverable. While this challenge is easily met for unary encoding, no suitable codes of high rates are known. In this work, we prove an upper bound on the rate of preserving and recoverable codes for a given bound on the addends’ combined uncertainty. We then design an asymptotically optimal code that preserves the addends’ combined uncertainty. We then discuss how to obtain adders for our code. The approach can be used with any known or future construction for containing metastability of the inputs. We conjecture that careful design based on existing techniques can lead to significant latency reduction.
💡 Research Summary
The paper tackles a fundamental problem in digital design: how to perform addition when the inputs are uncertain because some bits may be metastable. Metastability, which arises in clock‑domain crossings, analog‑to‑digital converters, and time‑to‑digital converters, manifests as a third logical value (often denoted “X” or “M”) that can be interpreted as either 0 or 1. When such a metastable bit appears in a binary‑encoded operand, a conventional adder amplifies the uncertainty: a single metastable input bit can cause most of the output bits to become metastable, as illustrated in Table 1 of the paper. This amplification defeats the purpose of using metastability‑containing (mc) circuits, because the information loss is already baked into the encoding.
The authors therefore introduce two new properties for encodings that are meant to be used together with mc addition circuits:
- Preserving – an encoding is preserving if, after the metastable bits in the output are resolved, the set of possible integer values exactly matches the sum of the intervals represented by the two inputs. In other words, the addition does not increase the total uncertainty.
- Recoverable – an encoding is recoverable if there exists a deterministic mapping from any n‑bit string (including non‑codewords) to a valid codeword such that, after metastability resolution, the mapped codeword still lies inside the correct sum interval.
With these definitions the paper’s first major theoretical contribution is an upper bound on the achievable rate of any code that preserves an uncertainty of size ℓ (ℓ‑precision). They prove that for an n‑bit code the rate cannot exceed O(2^{n‑ℓ}·ℓ/n). This shows that some redundancy is unavoidable: the more uncertainty we must tolerate, the more extra bits we need.
To approach this bound the authors construct a concrete hybrid code γ_{h}^{n,ℓ} of length n+ℓ bits. The first n bits are a binary reflected Gray code (BRGC); the remaining ℓ bits form a unary (thermometer) sub‑code. The Gray part provides a compact representation of the coarse integer value, while the unary part refines the value within a small window. The hybrid code is ℓ‑preserving and ⌈ℓ/2⌉‑recoverable. Its rate is 1−O(ℓ/n), which for constant ℓ is asymptotically optimal with respect to the earlier bound.
The paper then addresses how to add two operands encoded with this hybrid code. The addition algorithm consists of three steps:
- Mapping non‑codewords to codewords – any stable (non‑metastable) string that does not belong to the code is rounded to the nearest valid codeword (e.g., by Hamming distance). This step is simple and does not affect asymptotic complexity.
- Standard addition on stable codewords – a conventional binary adder (parallel or serial) is applied to the Gray parts, while the unary parts are summed using a simple counting circuit. The result is a stable codeword that represents the exact sum of the underlying integer intervals.
- Metastability‑containing implementation – the combinational circuit from step 2 is transformed into an mc circuit. Using masking registers (or masking latches) as described in prior work, the authors obtain a circuit of size O((n+ℓ)·ℓ) and depth O(log n + log ℓ). An alternative construction without masking registers yields size O((n+ℓ)·ℓ²) and depth O(ℓ·log n). In both cases the worst‑case output interval matches the sum of the input intervals, satisfying the preserving property.
A concrete example (Table 2) demonstrates the hybrid code in action: adding an operand that may be 25 or 26 (encoded with one metastable bit) to a stable operand 37 yields a result that may be 62 or 63, exactly as expected. The example also shows how the unary part cycles through a Gray‑like sequence, ensuring that consecutive codewords differ in only one bit, which is crucial for limiting metastability propagation.
The authors discuss a practical application: fault‑tolerant clock synchronization using the Lynch‑Welch algorithm. In that setting, each node obtains several phase measurements from a TDC, each measurement being a Gray or unary code with at most one metastable bit. The node discards outliers, sums the remaining measurements, and divides by two. The hybrid code with ℓ = 2 (k = 2) fits this scenario perfectly, requiring only two redundant bits beyond the standard n‑bit Gray code, and allowing the addition to be performed without resorting to inefficient unary adders.
Finally, the paper connects the hybrid construction to existing error‑correcting codes and to prior work on metastability‑containing circuits, suggesting that the ideas could be extended to higher‑precision or lower‑latency designs.
In summary, the work makes four key contributions:
- Formal definitions of preserving and recoverable codes for addition under uncertainty.
- A provable upper bound on the rate of any code that can preserve a given uncertainty.
- An asymptotically optimal (n+ℓ)-bit hybrid code that meets the bound and is both ℓ‑preserving and ⌈ℓ/2⌉‑recoverable.
- Concrete circuit constructions (both with and without masking registers) that implement metastability‑containing addition for this code, achieving linear size and logarithmic depth.
These results advance the state of the art by providing a high‑rate, low‑latency solution for arithmetic on uncertain data, opening the door to more robust digital systems that can tolerate metastability without the heavy latency penalties of traditional synchronizers.
Comments & Academic Discussion
Loading comments...
Leave a Comment