Automated hardware repair is a bit like trying to fix a leaky pipe when you aren't sure if the blueprint is wrong, the plumber made a mistake, or the homeowner just described the problem poorly. In the world of hardware design, this "triple threat" of ambiguity involves the high-level specification, the formal assertions (the rules used to check the design), and the RTL implementation (the actual code).
Traditional repair tools usually assume the rules are perfect and only the code is broken. But in reality, a failed check is often the result of a buggy assertion or a vague specification. Enter FormalFixer, a new framework that jointly refines all three artifacts to ensure they are "intent-aligned."
TL;DR
FormalFixer is an automated hardware repair framework that uses Large Language Models (LLMs) and formal verification to jointly fix buggy RTL code, incorrect assertions, and ambiguous specifications. By treating the original specification as the ultimate authority and iteratively aligning it with verification feedback, it achieves up to an 89% success rate in complex repair scenarios.
What Problem Does This Paper Address?
In Formal Property Verification (FPV), engineers write assertions to prove that their Register-Transfer Level (RTL) code behaves correctly. When an assertion fails, it generates a "counterexample"—a trace showing exactly how the code broke the rule.
However, a failure doesn't tell you where the root cause lies. Is the RTL code buggy? Is the assertion itself written incorrectly? Or is the natural language specification so vague that the engineer misinterpreted it? Existing automated repair methods are "RTL-centric"—they try to patch the code to satisfy the assertions. If the assertion is wrong, the tool will "fix" the code into a state that is also wrong, a problem known as overfitting.
Methods
FormalFixer introduces a multi-stage, "intent-driven" workflow. Instead of jumping straight to patching code, it follows a structured pipeline:
- Spec Analyzer: It treats the original natural language spec as the "ground truth." It uses an LLM to mine the RTL and assertions for latent constraints, appending "refined specs" to clarify implicit details (like reset conditions or bit-widths) without overwriting the original intent.
- Pre-verification Fixer: Before running expensive formal tools, it proactively fixes "low-hanging fruit"—obvious mismatches between the refined spec and the code or assertions.
- Main Repair Loop: This is the core of the system, illustrated in the workflow below:
If a property fails during verification, FormalFixer generates a Counterexample (CEX) Cone Graph. This graph traces the logic dependencies back from the point of failure. The Verilog Fixer then uses this structured feedback to generate localized patches. If a patch breaks other properties, the system rolls back and tries again.
Datasets
The authors evaluated FormalFixer on two new benchmarks:
- SVA-EVAL-HUMAN: 38 cases curated from expert designs.
- SVA-EVAL-MACHINE: 875 cases where bugs were systematically injected into both the RTL and the assertions using controlled templates.
These datasets are unique because they explicitly include "buggy verification artifacts," forcing the repair tool to decide whether to fix the code or the assertion.
Key Insights and Ideas
- Preserve the "Source of Truth": By keeping the original specification authoritative and only appending refinements, FormalFixer prevents the LLM from hallucinating new design requirements.
- Staged Decomposition: The paper proves that fixing assertions before RTL is crucial. If you try to fix both simultaneously in one LLM call, the model often gets "entangled," leading to unstable edits.
- CEX Cone Graphs are Better than Raw Traces: Providing the LLM with a graph of signal dependencies (the "cone of influence") is much more effective for localization than giving it a long, flat list of signal values over time.
- Intent Alignment: The "aha moment" here is treating repair as a three-way correspondence check. As shown in the traffic light example below, the tool must align the button signal (Spec), the counter logic (RTL), and the timing property (Assertion) simultaneously.
Key Results
Using the GLM-4.7 model, FormalFixer achieved impressive results:
- 89.47% Pass@5 on the Human dataset.
- 84.46% Pass@5 on the Machine dataset.
- Ablation Success: Including the Spec Analyzer improved the pass rate by over 21 percentage points compared to a baseline that only edited code and assertions.
- Complexity Scaling: While performance is strongest on small-to-medium designs, the tool remains robust as code length increases, though "false negatives" (where a patch passes checks but is semantically wrong) become more frequent in very long designs.
Limitations and Future Work
While FormalFixer is a significant step forward, the authors note a few hurdles:
- Block-Level Focus: The current benchmarks focus on individual RTL blocks. Scaling to full "System-on-Chip" (SoC) designs with long-horizon architectural defects remains a challenge.
- Templated Bugs: The assertion bugs in the machine dataset are based on common patterns (like polarity or bit-width errors) but may not capture the full creative variety of human-made mistakes.
- Future Directions: The team aims to extend the framework to handle multi-bug interactions and larger industrial-scale assertion-error corpora.
Summary updated