---
title: Recomputation with Swapped Operand (RESWO)
url: https://www.emergentmind.com/topics/recomputation-with-swapped-operand-reswo
type: topic
---

# Recomputation with Swapped Operand (RESWO)

Recomputation with Swapped Operand (RESWO) is a recomputation-based fault detection scheme introduced for Barrett reduction in the Cooley–Tukey Butterfly Unit (CT‑BU) of lattice-based post-quantum cryptographic hardware, particularly Kyber implementations on FPGA. In the formulation reported for CT‑BU, RESWO operates inside the Number Theoretic Transform (NTT) datapath, where modular multiplication by a twiddle factor is followed by Barrett reduction. Its purpose is to detect transient and permanent faults in a security-critical and latency-dominant block by recomputing an algebraically equivalent result and comparing remainders. The method was introduced alongside two adapted recomputation schemes, Recomputation with Negated Operand (RENO) and Recomputation with Shifted Operand (RESO), with RESWO reported to have similar implementation cost and lower delay under the evaluated conditions [2509.04070].

## 1. Position within lattice-based PQC hardware

Structured lattice-based schemes such as Kyber KEM, CRYSTALS‑Dilithium, Falcon, and NTRU work over rings of the form $\mathbb{Z}_q[x]/(x^n+1)$. The reported examples include Kyber with $n=256$, $q=3329$; Dilithium with $n=256$, $q=8380417$; and Falcon/NTRU variants with $n=512$ or $2048$, $q=12289$. Polynomial multiplication is accelerated by the NTT, and the CT‑BU is the core datapath element of the transform [2509.04070].

For coefficient pair $(U,\alpha[j+t])$ and twiddle factor $\omega$, the CT‑BU produces
\[
\bar{\alpha}[j] = (U + V) \bmod q,\qquad \bar{\alpha}[j+t] = (U - V) \bmod q,
\]
where
\[
V = (\alpha[j+t] \cdot \omega) \bmod q.
\]
The multiplication by $\omega$ followed by reduction modulo $q$ is typically implemented with Barrett reduction because it is efficient in hardware and avoids expensive divisions. The CT‑BU described in the source is pipelined into three stages: buffering $r=\omega[m+i]$ and $U=\alpha[j]$; computing $V=\text{MBRFD}(\alpha[j+t],r,q)$; and then computing the butterfly sum and difference.

Barrett reduction is singled out as “the most resource-intensive, latency-critical, and energy-demanding operation in the NTT transformation.” It is also security-critical, because faults in modular reduction propagate through polynomial multiplications, and single or few faulty NTT outputs can be exploited in differential fault analysis against schemes such as Kyber and Dilithium. RESWO is therefore targeted at a block that is simultaneously performance-dominant and attack-relevant [2509.04070].

## 2. Algorithmic construction of RESWO

The reported architecture first defines a Modified Barrett Reduction for Fault Detection (MBRFD), which performs multiplication and reduction word-wise. Inputs $\alpha$ and $\beta$ are $l$-bit integers partitioned into words of size $w$ bits. For each word pair $(i,j)$, the main datapath extracts $\alpha w_i$ and $\beta w_j$, computes the partial product $c=\alpha w_i \times \beta w_j$, aligns it by zero-padding according to the word positions, reduces it by Barrett reduction to obtain $r$, and compares that result against a recomputed remainder $r^f$ produced by a recomputation unit [2509.04070].

RESWO is the recomputation unit specific to this design. Its defining operation is not the exchange of $\alpha$ and $\beta$ as whole operands. Instead, two bit positions $i'$ and $j'$ inside the current word of $\alpha$ are swapped to form $\alpha_{\text{swapped}}$. The method then computes
\[
\delta = \alpha[i'] - \alpha[j'], \qquad
\Delta = \delta \times (2^{i'} - 2^{j'}),
\]
and forms the recomputed product
\[
c^f = (\alpha_{\text{swapped}} \times \beta) + \Delta \times \beta.
\]
After the same zero-padding used in the main datapath, $c^f$ is reduced with the same Barrett constant $\mu$ and the same slice $[2k-1 \dots k]$ to produce $r^f$ [2509.04070].

The central invariant is given as Lemma 1. For word segments $\alpha w_i$ and $\beta w_j$, with swapped version ${\alpha w_i}^{\text{swapped}}$ and correction term $\Delta w_i = \delta w_i (2^{i'} - 2^{j'})$, the following identity holds:
\[
({\alpha w_i}^{\text{swapped}} \times \beta w_j) + \Delta w_i \times \beta w_j
= \alpha w_i \times \beta w_j.
\]
The proof sketch reported in the source is straightforward: swapping two bits changes the numeric value of the word by exactly $-\Delta w_i$; multiplying the swapped value by $\beta w_j$ and then adding back $\Delta w_i \times \beta w_j$ recovers the original product. Consequently, in the fault-free case, the recomputed partial product equals the main partial product, and the reduced outputs must satisfy $r^f = r$ [2509.04070].

This construction gives RESWO an algebraic equivalence test rather than a heuristic redundancy check. A mismatch between $r$ and $r^f$ is interpreted as a fault indication.

## 3. CT‑BU integration and micro-architecture

In the protected CT‑BU, the MBRFD block contains the main Barrett Reduction block, a ReComp block implementing one of RESWO, RENO, or RESO, and a comparator that checks $r$ against $r^f$. Polynomial coefficient memory and the associated multiplexers/demultiplexers connect the CT‑BU to the rest of the NTT and polynomial-arithmetic system. For each word, the pipeline feeds $\alpha$ and the twiddle factor into stage 2, where the main Barrett path and the recomputation path execute in parallel. If the comparator reports equality, the design accepts $V=r$ and continues the butterfly update; otherwise, `Fault = 1` is raised, and the source notes that $V$ is then not used [2509.04070].

The RESWO block itself contains a swap block, arithmetic for $\delta$ and $\Delta$, multipliers for ${\alpha w_i}^{\text{swapped}} \times \beta w_j$ and for the Barrett-reduction subcomputations, an adder that forms $c^f$, a left shifter implementing alignment by $(i+j)w$, and a subtractor computing
\[
r^f = c^f - (c^f \times \mu)_{[2k-1 \dots k]} \times q.
\]
The design therefore keeps the same Barrett reduction structure as the main datapath and changes only the way the recomputed product is generated [2509.04070].

The implementation parameters reported for synthesis are Xilinx Artix‑7 FPGA device xc7a100tcsg324‑3, VHDL, and Vivado 22.02, with a 100 MHz baseline clock. For Kyber CT‑BU with $n=256$, $q=3329$, $l=12$, and $w=4$, the baseline CT‑BU is reported as 573 slices, 972 LUTs, 239 FFs, 1 BRAM, 131 mW, and 9.39 ns. The Barrett block alone is reported as 76 slices, 254 LUTs, 89 FFs, 101 mW, and 7.18 ns. The RESWO block is reported as 52 slices, 190 LUTs, 38 FFs, 2 mW, and 9.51 ns [2509.04070].

## 4. Comparison with RENO and RESO

RESWO is evaluated beside RENO and RESO, both adapted to Barrett reduction in the same CT‑BU setting. All three schemes share the same structural idea: apply an invertible transform, recompute, and compensate so that the recomputed result equals the original in the absence of faults. Their difference lies in the chosen transform and in the amount of correction logic required [2509.04070].

RENO negates $\alpha$, computes a negated product, performs a corresponding Barrett reduction, and then uses a 2’s-complement step to undo the transformation. RESO shifts both operands left by one bit, changes Barrett slice indices to account for the extra factor of $2^2$, and then right-shifts the result by two bits. RESWO, by contrast, alters only one operand locally at the bit level, uses the same Barrett slice indices as the main unit, and requires no 2’s complement or end-stage rescaling. The source attributes the lower delay of RESWO to this reduced post-processing complexity [2509.04070].

| Scheme | Added block metrics | CT‑BU overhead |
|---|---|---|
| RESWO | 52 slices, 190 LUTs, 38 FFs, 9.51 ns | ~9.07% area, ~2.02% delay, ~1.52% power |
| RENO | 56 slices, 197 LUTs, 48 FFs, 9.67 ns | ~9.77% area, ~2.98% delay, ~1.52% power |
| RESO | 51 slices, 182 LUTs, 42 FFs, 9.61 ns | ~8.9% area, ~2.34% delay, ~1.52% power |

Within this evaluation, area is close across all three schemes, while RESWO has the shortest critical path at 9.51 ns, compared with 9.67 ns for RENO and 9.61 ns for RESO. The reported interpretation is that RESWO remains structurally closest to the plain Barrett datapath while adding only a swap block, a correction-term product, and an adder [2509.04070].

## 5. Fault model, detection efficiency, and security role

The reported threat model includes both transient and permanent faults abstracted at logic level as single- and multi-bit flips, random faults, and burst faults. Faults may occur in either operand or both, and in intermediate registers of the Barrett reduction and recomputation datapaths. For evaluation, the study uses Python-based fault injection with $l=24$-bit operands, 1.5 million trials, and fault sizes $\eta \in \{1,3,5,11,17,23\}$ under both random and burst patterns. Faults are injected into $\alpha$ only, $\beta$ only, or both operands [2509.04070].

For RESWO, Table 6 reports fault detection efficiency for $w=4$, $8$, and $24$. Across the tested settings, random faults in $\alpha$ or $\beta$ are reported at 99.94–99.97%, burst faults at 99.94–99.98%, and faults in both operands up to 99.97%. Example values given in the source include 99.97% for a random single-bit fault in $\alpha$ at $w=4$, and 99.97% for a 23-bit burst fault in both operands at $w=4$. The authors also state that “the fault detection efficiency of RESWO, RENO, and RESO ranges from 99.95\% to 99.97\% across different fault injection scenarios and fault modes,” and that the study of $w$ versus error detection efficiency “shows that $w$ has no effect on error detection efficiency” [2509.04070].

These results support the security rationale for local checking inside the CT‑BU. Under the tested model, if a fault affects the main Barrett datapath or the recomputation path, the equality $r=r^f$ is very likely to be violated, causing `Fault = 1`. The intended system-level response is abort, reset, or discard of the result, thereby denying an attacker access to exploitable faulty ciphertexts or signatures. The source classifies RESWO, RENO, and RESO as Type 2 fault detection methods, meaning generic, algorithm-independent building blocks applicable to polynomial multiplication with modular reduction [2509.04070].

## 6. Terminological clarifications, related work, and limitations

A common source of confusion is the phrase “swapped operand.” In RESWO, it does not denote swapping the two inputs of a multiplication. It denotes swapping two bits inside $\alpha$ and then compensating algebraically through $\Delta \times \beta$. This distinction is explicit in the source and is central to the method’s invariant [2509.04070].

That usage differs from the operand-swapping strategy studied in “SWAPPER: Dynamic Operand Swapping in Non-commutative Approximate Circuits for Online Error Reduction” [2503.02608]. SWAPPER targets hardware approximate computing, not fault detection in PQC arithmetic. It dynamically chooses between $\tilde{f}(A,B)$ and $\tilde{f}(B,A)$ using a 1-bit rule, performs only one evaluation, and aims to reduce approximation error in non-commutative approximate multipliers. The paper explicitly contrasts such single-pass selection with RESWO-like recomputation strategies, which conceptually involve evaluating both operand orders or otherwise using a second computation. This suggests that the acronymic overlap between RESWO and operand-swapping methods in approximate computing should not be read as methodological identity [2503.02608].

The reported limitations of RESWO are tied to the evaluated model. Coverage is high but not 100%, and the source does not catalogue specific undetected patterns. The fault model is based on random and burst bit flips and does not explicitly model highly structured correlated faults that identically affect both main and recomputation paths, nor timing faults that yield the same erroneous value in both paths. The protection scope is also partial: the work addresses Barrett reduction inside CT‑BU rather than the full PQC implementation stack. Finally, while the overheads are characterized as low, they may remain relevant in highly resource-constrained settings [2509.04070].

The broader applicability reported for RESWO is to Barrett units in Kyber, CRYSTALS‑Dilithium, Falcon, and NTRU, with the same recomputation scheme retained while only parameters such as $q$, $n$, and $w$ change. A plausible implication is that subsequent work may extend the same recomputation principle to other arithmetic cores, or combine it with parity, CRC, masking, or ASIC-oriented optimizations where the same locality and algebraic equivalence properties can be preserved [2509.04070].

Source: https://www.emergentmind.com/topics/recomputation-with-swapped-operand-reswo