Toroid: an AI writes properties for a chip design and a model checker proves them
Point Toroid at a Verilog module and its spec. Every property comes back proven, passed to a stated depth, or falsified with a counterexample trace. It catches a bug injected into a FIFO from start to finish.
Congruent applies formal methods to AI-written code. Toroid goes the other way and puts an AI to work on formal verification. It reads a hardware spec and a small Verilog module, has an LLM propose formal properties, runs them through an open-source model checker (Yosys and SymbiYosys), and works through the counterexamples. The LLM proposes and the solver disposes, so a property the model hallucinated can't pass.
The problem
A verification engineer reads the spec and the RTL, decides what must always be true, writes it as assertions, runs the model checker, reads the counterexample waveform, and works out whether the bug is in the design or in the property. Then they fix it and run again.
The work is slow and takes experienced people, and AI tooling has barely touched it, because a language model's opinion about a chip is worth nothing on its own. As a hypothesis for a solver to settle, it is worth a lot.
How it works
- Read the interface from the tool. The module's ports, widths, clock and reset come from Yosys, never from the model's guess.
- Propose, then compile. The model writes safety properties from that interface and the spec, limited to the assertion subset the open Yosys front end accepts. Anything that doesn't compile is rejected and sent back with the error, for a fixed number of attempts.
- Check. Bounded model checking, k-induction and PDR run through
SymbiYosys. A lighter Yosys-only backend installs with pip. Each property
comes back
PROVEN,BOUNDED-PASSorFALSIFIEDwith a trace. - Work through failures. A falsified property's trace is narrated cycle by cycle and classified as a bug in the RTL, a property that is too strong, or a missing assumption. The property is patched and checked again, for a fixed number of rounds.
The example: a FIFO with an injected bug
The buggy FIFO raises its full flag one slot early. Toroid checks that
full is set exactly when the count equals the depth. It proves that on the
correct FIFO and falsifies it on the buggy one. The solver returns a state
where the count is 4 and full is 0, which is the boundary the bug dropped.
In a recorded live run on a counter design, the model wrote nine properties: five safety assertions and four reachability covers. They compiled on the first attempt, and the checker proved all five assertions.
toroid equiv compares two designs directly. It proves them equivalent or
returns the input that tells them apart, such as a=4, b=2 against a "max"
module that returns the minimum.
Why you can trust a verdict
PROVENcomes only from an unbounded engine. Bounded model checking alone reportsBOUNDED-PASSwith its depth.- Vacuous passes are caught. A property that passes only because its
trigger can never happen is reported
VACUOUS. The repair loop rejects a patch that would turn a failing property into a vacuous pass. - The verdict rules are property-tested. Hypothesis feeds the verdict function every combination of raw solver results.
- CI replays the AI run without an API key. The live run is saved as a fixture and goes back through the real compile step and the real solver.
What it can't do
- Full concurrent SVA. Properties use the subset that open-source Yosys supports. The rest needs a commercial front end.
- Large designs. It works at the scale of a counter, a FIFO or an arbiter, with a single clock.
- Liveness. It checks safety properties only.
- Edit the RTL. When the design has a bug, Toroid points to it and stops.
Live synthesis differs from run to run, so the saved fixture is the reproducible artifact. The benchmarks cover three small designs and show that the flow works. They aren't a performance claim.