Expand description
keccak_rtl — the flagship silicon FACT.
The handout’s Keccak throughput was a “design point.” This module makes it real: an
iterative Keccak-f[1600] core (one round/cycle, 24-cycle permutation) emitted as
synthesizable Verilog whose round function is generated FROM THE SAME θ/ρ+π/χ/ι
constants the proven-fast native kernel uses (logicaffeine_system::keccak:: keccak_f1600), so the two cannot diverge by transcription. The RTL is checked
bit-exact against the real 24-round oracle under iverilog, synthesized to real
ECP5 numbers, and two of its layers are proven by our own certified SAT (θ is
GF(2)-linear; χ is a bijection on a row). Plus the ML-KEM NTT butterfly (Montgomery
fqmul) emitted, oracle-checked, and its Montgomery invariant SAT-proven.
Structs§
- NttCuts
- Where the pipelined butterfly’s registers go:
self.0[i]puts one after stepi(NTT_STEPS). The operands and the results are always registered.
Constants§
- KYBER_Q
- q and Montgomery constant — identical to
logicaffeine_system::ntt. - KYBER_
QINV_ I16 - NTT_
STEPS - The steps of
emit_ntt_butterfly_pipelined_verilog’s datapath a register may follow: the four levels of the product’s adder tree;m’s high-byte correction;m; the two partial sums of13·m + (m >>> 8); that sum;t. - RC
- The 24 Keccak-f round constants (FIPS-202) — same table as the native kernel.
Functions§
- emit_
keccak_ core_ half_ verilog - Emit
keccak_core_half: the iterative core with a register between theta and the rest of each round, two clocks a round (48 for the permutation), each half carrying only its own wiring — theta’s column parities, then rho and pi’s lane moves into chi. The same ports and handshake askeccak_core. - emit_
keccak_ core_ verilog - Emit the clocked iterative core:
startlatchess_in, then one round/cycle for 24 cycles applyingRC[round];donepulses withs_out= the permutation result. - emit_
keccak_ round_ verilog - Emit the combinational one-round
Keccak-f[1600]module: states+ round constantrc→o. Lane i occupies bits[64*i +: 64](little-endian lane packing). - emit_
keccak_ testbench - Self-checking testbench: load the input state + the oracle’s 24-round output from
keccak_vec.hex(50 × 64-bit words: 25 input lanes then 25 expected lanes), run the core, compare bit-exact. Prints PASS/FAIL. - emit_
keccak_ top_ verilog - Emit a NARROW-BUS wrapper around
keccak_coreso it place-and-routes on a real FPGA: the bare core exposes a 1600-bit parallel state port (fine for simulation, but 1600 pins exceed any FPGA’s IO), sokeccak_topstreams the 25 lanes in and out over a 64-bit bus addressed by a 5-bit lane index.wewritesdinto laneidx;golaunches the permutation;donemarks completion;doutreads laneidxof the result. ~140 IOs — routes on the ECP5. - emit_
ntt_ butterfly_ pipelined_ verilog - Emit module
name:emit_ntt_butterfly_verilog’s butterfly as a pipeline taking one butterfly a cycle, its resultNttCuts::latencyedges after its operands, registered after the stepscutsnames. Each value a later stage reads reaches it through one register a stage, and only those values are carried. - emit_
ntt_ butterfly_ verilog - Emit the combinational Montgomery
fqmul+ one Cooley–Tukey butterfly: inputsa,b(the two coefficients) andzeta; outputshi = a + t,lo = a - twheret = fqmul(zeta, b)— all wrapping 16-bit, matchingntt_scalar’s inner step. - fqmul
- montgomery_
reduce - The reference Montgomery reduction (mirrors
ntt::montgomery_reduce) — the oracle the emitted RTL is checked against.