Coding assistants · Research feature

Multi-agent framework improves RTL code generation with verification and repair

A new multi-agent system uses design contracts and formal verification to generate more accurate and reliable Register-Transfer Level code.

Adapted from research by Jiale Liu, Taiyu Zhou, Tianqi Jiang.

arXiv preprint revision · 2026-10-15 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

The study evaluates Veri-Sure, a multi-agent framework designed for Register-Transfer Level (RTL) code generation. It compares performance against standalone large language models and prior agentic systems, measuring verified-correct code output on industrial-grade tasks. The framework uses a shared design contract to align agent intent, reducing semantic drift, and applies static dependency slicing for localized repairs instead of whole-file rewrites. The evaluation leverages VerilogEval-v2-EXT, a benchmark expanded with 53 industrial tasks across difficulty levels. Findings show Veri-Sure outperforms standalone LLMs and earlier agentic systems in verified correctness. Results are based on simulation and formal verification metrics, not full system deployment or production use cases.

Introduction

Large language models (LLMs) have recently made rapid progress in software code generation, suggesting a compelling opportunity to generate RTL code directly from natural-language specifications. However, RTL code generation poses requirements that are fundamentally different from those of software, since HDL describes concurrent hardware behavior with strict cycle-level timing, protocol semantics, and hierarchical structural constraints. As a result, general-purpose coding models, which are optimized for autoregressive, sequential text generation, often achieve surface-level syntactic correctness yet fail to reliably preserve temporal intent, handshake protocols, or globally consistent structure. These failures are worsened by the scarcity of high-quality HDL data relative to software corpora, which limits the models’ exposure to high-quality RTL patterns and actual verification-driven development practices.

To bridge this gap, recent methods have strengthened LLM-based RTL code generation through domain adaptation and tool augmentation, including supervised fine-tuning (SFT) and reinforcement learning (RL) on curated HDL corpora, retrieval of reference implementations, and tool-in-the-loop prompting with simulation feedback. While these techniques improve compile rates and module-level functional pass rates compared to baselines, they remain insufficient for industrial-scale RTL blocks where correctness depends on subtle temporal corner cases and multi-iteration refinements. In particular, we identify that existing LLM-based pipelines are still bottlenecked by (i) sparse feedback and limited test coverage of simulation-centric evaluation, (ii) regression risk, repair hallucinations, and inefficiency caused by whole-file regeneration during debugging, and (iii) semantic drift as cycle-accurate intent is gradually reinterpreted across repair iterations and agent handoffs. Given that hardware bugs can survive simulation and lead to costly tape-out failures, an effective RTL code generation system should not only be able to generate HDL code but also independently perform verification and debugging to ensure the reliability and correctness of the whole design.

Automatic RTL Code Generation

Early studies explored open-loop RTL code generation with general-purpose LLMs via zero-shot or few-shot prompting, and domain-adapted models such as ChipNeMo demonstrated the promise of natural-language-to-RTL workflows. These efforts also highlighted a recurring gap that models may produce syntactically plausible Verilog code while violating cycle-accurate behavior, protocol semantics, or synthesizability constraints.

To improve domain alignment, subsequent work moved beyond vanilla prompting toward domain-adapted training and generation scaffolding. Fine-tuning on curated HDL corpora, as demonstrated by VeriGen and RTLLM, improves syntax validity and basic module-level functionality. RTLCoder further filters examples through verification to reduce noisy RTL patterns. BetterV introduces a generative discriminator to steer outputs toward more verifiable implementations, while CodeV-R1 trains a reasoning model with a distill-then-RL pipeline whose rewards come from testbench-based equivalence checking. Orthogonally, AutoVCoder leverages retrieval-augmented generation to condition synthesis on relevant reference designs.

Tool-Integrated LLM Systems for HDL

Recent work has moved toward tool-in-the-loop and agentic pipelines that iteratively generate RTL, run simulation, and repair failures. ChatEDA showed that an LLM agent can orchestrate EDA tools through their interfaces, AutoChip closes the loop using simulator feedback, and RTLFixer supports iterative debugging with error-driven edits. These approaches reduce syntax errors and shallow functional bugs. However, their debugging signals are dominated by sparse pass/fail outcomes or textual logs, which provide limited observability for diagnosing timing-dependent failures and localizing root causes in multi-cycle designs.

As tasks scale to larger subsystems and multi-module designs, multi-agent frameworks have been proposed to decompose the workflow into planning, coding, and checking. REvolution frames generation as an evolutionary search with LLM-driven mutations, VerilogCoder coordinates collaborative agents for generation and validation, and MAGE improves candidate quality via diversified sampling and targeted debugging. Despite this progress, most agentic systems remain heavily dependent on test coverage, often apply coarse-grained edits that risk regressions, and can accumulate semantic drift across iterations and agent handoffs.

Formal Verification and Automated Debugging

Formal verification aims to mathematically prove the correctness of a design against a specification and is thus also useful for catching bugs in RTL code. Assertion-based verification embeds temporal properties in the design, which bounded model checking with Boolean satisfiability (SAT) solvers can check up to a fixed depth. Since hand-written assertions are costly, AssertLLM uses multiple LLMs to generate them from design specifications. For combinational logic, equivalence checking reduces comparing two circuits to proving their miter unsatisfiable, which tools such as SymbiYosys can easily automate with satisfiability modulo theories (SMT) solvers like Z3.

To achieve automated debugging, prior work has explored both software and hardware contexts. In software, program slicing narrows a failure to the statements that can affect it, and generate-and-validate repair searches for patches that pass a test suite. In hardware, CirFix repairs Verilog by genetic programming and RTL-Repair synthesizes minimal repairs with an SMT solver, but both draw edits from fixed mutation operators or repair templates. LLM-based debuggers lift this limit: MEIC iterates a debug agent with an LLM scoring agent that triggers rollbacks, UVLLM couples LLM repair with testing under the Universal Verification Methodology (UVM), and LiK localizes bugs from the specification and code alone.

The Veri-Sure Framework

We propose Veri-Sure, a multi-agent framework that brings a real EDA-style closed loop for development and testing to RTL synthesis from natural language. Rather than treating generation as a one-shot translation problem, Veri-Sure tightly couples code synthesis with automated validation and actionable debugging signals. Unlike prior multi-agent systems that primarily coordinate through natural-language context and thus risk specification drift and coarse, regression-prone rewrites, Veri-Sure uses trace-driven analysis to localize failures to concrete time windows, signals, and violated requirements, enabling targeted fixes and improving robustness on multi-cycle corner cases. It also integrates simulation with formal checks to continuously enforce design requirements and aid debugging.

Overall Architecture

When the compilation or simulation fails, Veri-Sure enters the debugging loop, in which the failing code is passed to (4) a Debugger agent. Rather than relying solely on textual error messages, the Debugger calls trace-driven temporal analysis and static dependency slicing tools, which turn the raw failure into a trace report of the failing time window and signals, plus a small set of suspect RTL blocks. To provide a denser diagnostic signal, the Debugger also invokes (5) an Asserter agent to generate temporal assertions that expose sequential/protocol violations, and (6) a Boolean Proofer agent to check combinational logic against the contract for counterexamples. Their outputs are injected into the Debugger’s prompt as hints. The Debugger then patches only the suspect blocks, rolling back any patch that does not improve the failure signature, and iterates until all checks pass or the repair budget is exhausted.

Contract Design

Natural-language RTL specifications are often underspecified in details like reset polarity, sampling edge, or cycle latency, which easily leads to inconsistent interpretations across agents. Veri-Sure mitigates this by having the Architect agent compile the prompt into a compact, structured design contract that makes such choices explicit before any code is written.

The resulting contract records the chosen source of truth, a typed module interface, clock/reset and sequential semantics, per-output latency, a precise functional summary with corner cases, a directed test plan, and guidance for the Verifier, Coder, and Debugger. When the prompt underspecifies details, the Architect makes assumptions explicit so they become checkable requirements. A lightweight contract linter then validates the schema and basic consistency, preventing malformed or contradictory contracts from propagating into code generation and verification.

Boolean Proofer for Combinational Equivalence

The formal hints produced by the branches are injected into the Debugger prompt, separating timing faults from pure Boolean faults and improving repair generalization. Since these formal artifacts are generated from LLM-derived specifications, we use them only as diagnostic hints and the final acceptance still requires passing the golden testbench. The reliability of these hints is analyzed in subsection C.3.

The VerilogEval-v2-EXT Benchmark

We introduce VerilogEval-v2-EXT, an expanded benchmark for evaluating LLMs on realistic RTL code generation. It extends VerilogEval-v2 with 53 new, industrial-grade design tasks, increasing the total from 156 to 209 problems. All tasks follow the same evaluation protocol as VerilogEval-v2: each problem provides a natural-language specification, a fully specified module interface, and an executable testbench used for functional checking, enabling direct comparison with prior results.

Benchmark

We evaluate on our VerilogEval-v2-EXT benchmark and report Pass@1 for syntax and functional correctness. Syntax success means the simulator compiles the generated RTL code without errors. Functional success means the compiled DUT passes the provided testbench. Following MAGE, the golden testbench is provided to the Architect and Verifier as optional context and also serves as the final pass condition. “Verified-correct” denotes functional verification in the standard EDA sense, meaning that the design passes the golden testbench.

Main Results

Frontier closed models are strong out of the box: Among standalone LLMs, commercial closed-source models deliver consistently high syntax success and strong functional accuracy, especially on Medium and Hard tasks. This suggests that large-scale general pretraining already confers substantial competence in RTL code generation and code-level reasoning, even without hardware-specific fine-tuning.

Specialized small models lag behind general large models: In contrast, smaller models that are fine-tuned for RTL code generation do not necessarily outperform state-of-the-art general-purpose large models. While these models often achieve reasonable syntax rates, their functional pass rates are markedly lower on the harder tasks, indicating that parameter scale and broad pretraining remain critical for multi-step temporal reasoning, corner cases, and control-heavy designs. Practically, this gap is difficult to close by fine-tuning alone because training large backbones is compute-intensive.

Under-Specified Descriptions

Among the 14 tasks that Veri-Sure fails to solve, one is a tooling artifact, and 10 of the remaining 13 true failures are timing-related, such as FSM transitions with ambiguous timing or misaligned output pulses (subsection C.1). In most of these cases, Veri-Sure locates the faulty logic correctly, but the repair budget runs out before a correct fix is found, usually because the description does not fully determine the intended behavior (e.g., Prob117 and Prob145) or the agents fail to infer it. Since patches that do not improve the failure signature are rolled back, extra iterations never make a design worse.

Contract Fidelity

We audited all 209 contracts generated by the Architect and found errors in 12 of them (5.7%), mostly functional contradictions and a few hallucinated constraints, with no interface errors (subsection C.2). Among the 12 tasks, only 3 fail and they still fail without the contract. The other 9 are solved because the Debugger relies on trace reports from simulating the golden testbench, not on the contract. Contracts are also least precise on hard arithmetic, such as floating-point rounding and subnormal handling, which accounts for the remaining 3 (arithmetic) true failures.

Reliability of Formal Hints

Since the assertions and Boolean reference models are generated from the LLM-derived contract, they inherit its errors and can also fail on their own. In a full-benchmark run, the Boolean Proofer aborted in 4 of its 30 invocations (SMT solver timeout, unsupported constructs, or an UNKNOWN solver result), and generated assertions can miss the temporal condition behind a failure. Therefore, both branches only provide hints to the Debugger, and acceptance always requires passing the golden testbench.

Conclusion

In this work, we present Veri-Sure, a contract-aware multi-agent framework that closes the RTL development loop by aligning generation with verification and localized repair. By distilling natural-language intent into a shared design contract, Veri-Sure mitigates semantic drift across agents, while its waveform tracing and static slicing mechanisms enable precise patching that avoids whole-file rewrites and reduces regression risk. Beyond simulation-centric feedback, we integrate formal verification to achieve better debugging capability. To measure the progress on realistic RTL tasks, we also introduce VerilogEval-v2-EXT, including 53 more industrial-grade problems and difficulty stratification. Experiments show that Veri-Sure achieves state-of-the-art verified-correct performance, reaching 93.30% overall functional pass rate and ablations confirm that the gains come primarily from our debugging pipeline. Overall, Veri-Sure demonstrates that the proposed methods can effectively aid LLMs in generating RTL code, moving automated design closer toward silicon-grade correctness.

Appendices

We supplement some additional technical content here in the appendices. Specifically, Appendix A presents additional details of the VerilogEval-v2-EXT benchmark; Appendix B documents implementation details of the Veri-Sure framework; Appendix C provides failure, design-contract, formal-signal reliability, repairing mechanism, and cost analyses; Appendix D reports three successful case studies; and Appendix E offers a detailed comparison with other related frameworks.

Grading Scheme

To enable a more fine-grained analysis, we stratify the 209 problems into Easy/Medium/Hard using a rule-based structural complexity score computed from the canonical RTL implementation. The complexity of hardware description language (HDL) code can be systematically decomposed into three orthogonal dimensions: (i) structural complexity, which is measured by the number of lines of code (LOC) to reflect the scale and modularity of the design; (ii) data complexity, usually reflected by the bit width for processing data to indicate numerical precision and storage requirements; and (iii) temporal complexity, which is characterized by the diversity of temporal structures and nesting depth to represent the complexity of temporal logic such as clock domains, state machines, and pipelines.

These three dimensions jointly determine the difficulty of understanding, implementing, and verifying the design. During the construction process, these three dimensions are scored, with structural complexity mapped to the macroscopic indicator of lines of code (LOC); data complexity is mainly represented by the maximum bit width (Max Width); and temporal complexity is jointly characterized by the complexity of assignment statements (#assign), the number of blocks (#always), and conditional branches (#case) among other syntactic elements.

Issues with Prob099

To fix the issue, we made the testbench consistent with the reference/DUT interface and with the benchmark’s intended observation points. We renamed the internal signals and updated the named port connections in both instantiations accordingly. We also aligned the testbench’s declaration of the state vector to the canonical module interface by changing it from a 1-based range (logic [6:1] y) to the conventional 0-based range (logic [5:0] y) in both the stimulus generator and the top-level testbench. After these changes, Verilator is able to compile the testbench successfully and execute the simulation, and the DUT (when wrapped to mirror the reference) produces matching Y1 and Y3 outputs over the randomized one-hot stimulus set.

Schema Usage

The same contract instance is injected into: (i) the Coder prompt (to enforce interface/timing consistency), (ii) the Verifier prompt (to generate a self-checking testbench consistent with the contract), (iii) the Debugger prompt (as the reference that repairs must preserve, alongside the trace report), (iv) the Asserter prompt (to generate temporal assertions for the clock/reset/latency obligations), and (v) the Boolean Proofer (to extract combinational obligations for formal equivalence when applicable).

Failure Mode Analysis

This distribution explains the gap between high syntax pass rates and lower functional pass rates on the hardest tasks. Once syntax and simple combinational logic are solved, the dominant failures arise from temporal corner cases that require consistent reasoning across multiple cycles, or from arithmetic specifications whose corner cases are difficult to infer from natural language alone.

Cost and Token Analysis

Veri-Sure uses more input tokens because it carries structured diagnostic context, traces, and formal hints across the repair loop. However, localized patching substantially reduces output tokens by avoiding whole-file regeneration. Since output tokens are more expensive than input tokens in the measured API pricing, Veri-Sure is cheaper than other multi-agent frameworks while solving more tasks in the main evaluation.

Problem Description

The contract specifies a rising-edge clock and an asynchronous active-high reset, so predict_history should change only after a rising clock edge or when areset is asserted. From these clocking obligations, the Asserter generated a NO_NEGEDGE_UPDATE monitor intended to catch updates on the wrong clock edge. Like all Asserter outputs, the monitor is bound to the DUT and evaluated during Verilator simulation rather than by a formal solver.

Root Cause Identification

Starting from predict_history, the static slice contains two blocks: the continuous assignment that drives the output and the clocked always block that updates GH. In the original RTL, the output is a direct copy of the register (assign predict_history = GH;), so its reset behavior is only implied by the reset branch of the clocked block. Guided by the Asserter’s wrong-edge/reset hint, the Debugger kept the clocked update logic unchanged and targeted the output assignment.