Expand description
RTL / transition-system bounded model checking — including multi-bit (bitvector) registers.
A TransitionSystem is the classic (registers, property) model of synchronous
hardware: each Register has a width, an initial value, and a next-state expression
over the CURRENT state; a safety property must hold in every reachable state. 1-bit
registers are control/FSM bits; wider registers are datapath, handled through the
bit-blaster. This module time-indexes the model (r → r@t), lowers it through the
certified prover seam (super::sva_to_proof::bounded_to_proof), and drives
logicaffeine_proof::bmc. Pure Rust, certified, Z3-free.
parse_transition_system ingests a synthesizable Verilog subset (multi-bit reg,
initial, one always @(posedge clk) block, assert property) with a typed (bool /
bitvector) expression parser. Unsupported constructs error out — never a silent
mis-parse.
Structs§
- Register
- A hardware register: a width, an optional initial value, and its next-state function.
- RtlParse
Error - A Verilog parse error (kept distinct so the BMC layer can surface it verbatim).
- Transition
System - A synchronous transition system over Boolean and bitvector registers.
Enums§
- Next
State - A next-state function: a direct expression, or a guarded
if/else(from RTL reset/mux logic). Guards reference the current state and free inputs.
Functions§
- emit_
alu_ datapath_ verilog - Emit the GENERAL INTEGER ALU datapath — the combinational functional unit that executes the
arithmetic / bitwise / signed-comparison ops straight off a WIRE OPCODE BYTE. The
caselabels are the stablebinisaopcodes (one source of truth with the wire format), so the ALU decodes the same bytes the network carries. Each operation is proven correct by our own certified SAT (the identity batterythe_general_alu_datapath_is_proven_correct_by_our_sat); comparisons are SIGNED (matching the VM’s i64 semantics) and yield 0/1. This is the ratchet frontier grown from the reversible core. - emit_
isa_ core_ decoder_ verilog - Emit the ISA opcode decoder for the reversible core — the silicon FRONT-END that turns a wire
opcode BYTE (the exact byte
crate::vm::binisa::encode_programputs on the wire) into the reversible ALU’s 3-bit control select plus acorevalid flag. Thecaselabels are DERIVED fromcrate::vm::binisa::opcode, so the decoder and the wire format share ONE source of truth: the byte the network carries is the byte the chip decodes, with no translation layer. Compose withemit_reversible_alu_core_verilog— wireisa_core_decoder.sel → rev_alu_core.op. - emit_
reversible_ alu_ core_ verilog - Emit the LOGOS reversible ALU CORE as synthesizable Verilog — the abelian charge-recovery datapath
of the VM: two
width-bit registersa,band a 3-bit opcode selectingRevAdd/RevSub/RevXor/RevNeg/RevSwap. For every fixed opcode the transition on(a,b)is a BIJECTION, so the whole ALU runs backward with zero erased bits. The 32-bit form place-and-routes on a Lattice ECP5 (ULX3S) viascripts/synth-soft-core.sh(benchmarks/silicon/rev_alu_core.v): 336 LUTs + 64 FFs at ~136 MHz. - emit_
reversible_ alu_ verilog - Emit a synthesizable Verilog SOFT-CORE for the reversible ALU datapath (corner 5, phase 3) — the
register-VM’s
RevAddcharge-recovery core as RTL: awidth-bit register advanced bystepeach clock.q := (q + step) mod 2^widthis a PERMUTATION of the state space (a cyclic reversible datapath whose reverse module is the−stepdecrement), and the emitted text is real synthesizable Verilog —parse_transition_systemaccepts it and BMC / k-induction discharge its obligations. This is the round-tripping HDL twin of the softwareRevAdd; the full VM-datapath soft-core + a VM↔RTL SMT equivalence are the larger MAKE_A_CHIP build this slice opens. - emit_
reversible_ datapath_ verilog - Emit the reversible
RevAddDATAPATH as synthesizable Verilog — awidth-bit accumulator advanced by a data INPUT each clock (q := (q + delta) mod 2^width), the genuine charge-recovery ALU slice (its reverse isq := q − delta). For every fixeddeltathe clocked transition is a bijection inq. Unlike the constant-stepemit_reversible_alu_verilog, this is the real datapath the VM’sRevAddmaps to;benchmarks/silicon/synthesizes + place-and-routes the 32-bit form on an ECP5 FPGA. - emit_
shared_ divider_ testbench - Emit the divider’s self-checking testbench: drive the sequential
shared_divider, wait fordone, and check quotient+remainder against the combinational$signeddiv/mod oracle over every sign/edge case plus a 4000-pair pseudo-random sweep. PASS iff all match. - emit_
shared_ divider_ verilog - Emit the SHARED ITERATIVE DIVIDER — one sequential restoring divider that computes signed
quotient AND remainder, replacing the ~24,600-cell COMBINATIONAL
$signed(a)/$signed(b)+$signed(a)%$signed(b)the ALU instantiates per-op (Div/Mod/FloorDiv). It costs 833 LUT / 204 FF placed-and-routed on the ECP5-85K at ~100 MHz — a ~26× LUT drop vs the ~22,000-LUT combinational divide, the lever that fits the full 113-op CPU under 83,640. Truncated (round-toward-zero) semantics matching the VM: quotient sign = sign(a)^sign(b), remainder sign = sign(a); b==0 → q=r=0. One 1-bit/cycle restoring loop over |a|/|b| (W cycles) then a sign fixup; the soft-core pulsesstartand stalls untildone. The module is Verilog-parameterized (default W=32; instantiate #(.W(64)) for the BigInt lane), so this emitter is the single source for the on-diskshared_divider.v, proven == the combinational oracle by iverilog (emit_shared_divider_testbench). - emit_
yosys_ tapeout_ flow - Emit a yosys synthesis FLOW (
.ys) that takes the reversible soft-core RTL to a gate-level netlist (corner 5, phase 5). This is the tape-out-ready boundary produced IN-REPO: the synthesizable, formally-verified reversible RTL (emit_reversible_alu_verilog) PLUS this flow. Executing it needs the externalyosyssynthesizer (not installed here); mapping the generic gate set to an adiabatic / charge-recovery PDK and running a foundry are the physical tape-out steps beyond software. The flow reads the module, elaborates, techmaps, maps to a generic gate library, and writes the gate-level netlist + a resource report. - lec_
next_ state_ matches_ vm - LOGICAL EQUIVALENCE CHECK (corner 5, phase 3) — discharged by OUR OWN certified SAT, not yosys’s
SAT or Z3. Parse the soft-core RTL, extract register
reg’s next-state, and prove it equalsspec(the VM op’s datapath function) for EVERY input by refuting the miterrtl_next ≠ specwithlogicaffeine_proof::sat::prove_unsat— a bit-blasted CDCL refutation, the LEC “back-check”. This is the equivalence a tool like yosysequivruns on its internal SAT, done here on ours. ReturnsSome(true)iff the RTL datapath is equivalent to the VM spec,Some(false)if a differing input exists,Noneif the RTL / next-state / miter can’t be lowered to the bit-blaster. - parse_
transition_ system - Parse a synthesizable Verilog module into a
TransitionSystem. Errors (never silently mis-parses) on anything outside the supported subset.