RTLDetective: Agentic RTL Debugging through Dataflow Analysis and Simulation-Guided Fault Localization

Neusha Javidnia, Ruisi Zhang, Farinaz KoushanfararXiv 2026

TL;DR

Finding a bug in computer chip designs is like trying to figure out which hidden domino fell wrong just by looking at the final pileup—and LLMs usually drown in the massive execution logs trying to guess the culprit. RTLDetective turns LLMs from passive guessers into active experimentalists: it predicts what internal signals should be doing, forces those values into live hardware simulations to test its hypotheses, and pinpoints the exact root cause without needing a pre-existing "perfect" chip for comparison. Using small, local open-weight models, it fixes 86.1% of benchmark hardware bugs, soundly beating existing tools while burning far fewer tokens.

What Problem Does This Paper Address?

Before a microchip is etched into silicon, engineers write its blueprint in Register-Transfer Level (RTL) code, like Verilog, which describes how digital signals flow between registers and logic gates over clock cycles. Catching bugs at this stage—functional verification—eats up a massive chunk of hardware development time.

Unlike software syntax errors where a compiler points right at your typo, functional hardware bugs are sneaky. A tiny logic error deep inside a submodule can ripple silently across clock cycles and module boundaries before finally corrupting an output wire.

While LLM agents seem like great candidates to automate RTL debugging, they hit three walls:

  1. Training Scarcity & IP Secrecy: Hardware languages are underrepresented in LLM training data, and chip companies refuse to send proprietary blueprints to cloud-hosted giants like GPT-4. Debugging needs to work on moderately sized, locally hosted models without expensive custom fine-tuning.
  2. Context Overload: Dumping raw simulation waveforms (which log every wire's state at every tick of the clock) into an LLM's prompt quickly overwhelms its context window and distracts it.
  3. Passive Guessing without an Oracle: Unless you already have a "golden reference model" (a working version of the chip—which defeats the purpose when building something new), nobody knows what intermediate internal signals are supposed to look like. Existing LLM tools just stare at traces and guess, rather than actively testing their suspicions.

Methods

RTLDetective pairs standard hardware compilers and simulators (Icarus Verilog) with a clever dual-agent architecture: a nimble Localizer Agent (Qwen3-8B) and a heavier Debug Agent (Qwen3-Coder-30B-A3B, an open-weight mixture-of-experts model).

Fig. 1. Overview of RTLDetective, a dual-agent RTL debugging framework supported by a curated knowledge base. Each iteration evaluates the current RTL candidate through compilation, static analysis, and simulation. Context Extraction constructs a signal dependency graph, traces dependencies backward from failing outputs, and summarizes waveforms leading up to the first failure. The Localizer Agent predicts expected values of intermediate signals and tests them through counterfactual simulation. Root Cause Analysis uses the validated predictions to identify suspicious logic. The Debug Agent uses the localized fault information and retrieved RTL debugging knowledge to generate the next repair candidate.

Here is how the pipeline separates standard practice from its novel contributions:

  • Smart Context Pruning (Refined Standard): Instead of feeding raw logs to the LLM, RTLDetective runs regex static analysis (linting) to catch obvious Verilog anti-patterns, builds a cross-module signal dependency graph tracing backward from the failing output, and compresses the waveform trace—sampling only relevant wires right before clock edges and stripping out unchanging rows.
  • Counterfactual Fault Localization (The Core Novelty): Without a golden reference, how do you know which internal wire went rogue first? The lightweight Localizer Agent reads the chip's text specification and predicts the expected values of intermediate driving signals. Then comes the magic: RTLDetective runs a counterfactual simulation, using Verilog force and release commands to temporarily inject those predicted values directly into the live circuit. If forcing a wire's value makes the testbench pass, the hypothesis is validated! By walking backward to find the first signal that is wrong while all its inputs are right, it isolates the exact faulty lines of code.
  • Knowledge-Guided Repair & Prefix Caching: The 30B Debug Agent receives the localized fault report alongside a compact (29 KB) curated knowledge base of RTL bug patterns stuffed straight into its system prompt. To keep multi-round conversations fast, it uses vLLM's Key-Value (KV) prefix caching so the model doesn't re-process prior history from scratch, paired with a rollback gate that reverts any patch that breaks previously passing tests.

Datasets

Because RTLDetective requires no model training, no training datasets were used. For evaluation, the authors used an extended version of the MEIC benchmark, which features 194 buggy RTL instances (113 syntax errors and 81 functional bugs) spread across 15 diverse hardware designs from the open-source RTLLM suite (ranging from adders and dividers to an asynchronous FIFO). Each instance includes a natural-language specification and a self-checking testbench.

Key Insights and Ideas

  • Intervene, Don't Just Observe: Passive reasoning over dependency graphs hits a ceiling when errors cascade. Treating the simulator as an interactive laboratory—forcing internal signals to test "what-if" counterfactuals—lets an 8B model verify root causes without needing an oracle reference chip.
  • Breaking the Iteration Plateau: Standard iterative debuggers fix easy syntax bugs on round one and then spin their wheels repeating bad guesses. Because RTLDetective's simulation feedback actively narrows down functional bugs, it keeps finding new fixes all the way to iteration 8.
Cumulative fix rate over 10 iterations, illustrating how RTLDetective breaks past MEIC's early plateau.
  • Growing Prompts Don't Have to Mean Growing Wait Times: Normally, keeping full conversation history across debugging loops makes LLM inference painfully slow. Because each round appends to a shared history and static 29 KB knowledge base, KV prefix caching reuses 82% of prompt tokens—giving a bigger speedup the longer the debugging session goes.

Key Results

Evaluated using the exact same 30B base repair model across all baselines:

  • Top-Tier Fix Rates: At 10 iterations, RTLDetective achieves an 86.1% overall fix rate (93.8% on syntax, 74.1% on functional bugs), beating the strongest baseline (MEIC at 72.2%) by 13.9 percentage points.
  • Doing More with Less: With just 3 iterations, RTLDetective hits an 80.9% fix rate—beating MEIC's 10-iteration run while using less than half the tokens (31.2k vs. 64.6k tokens/bug).
  • Crushing the Hard Stuff: On the 8 hardest hardware designs where a single-pass LLM fixes almost nothing (0–3 bugs), RTLDetective repairs 83 out of 106 bugs, compared to 59 for MEIC and 53 for UVLLM. Removing the Localizer Agent causes functional bug fixes in 3-iteration runs to drop by 7.4 percentage points (from 66.7% to 59.3%).
  • Caching Speedups: Prefix caching slashes the Debug Agent's Time to First Token (TTFT) by 3.9x overall (2370 ms down to 612 ms), trimming total end-to-end call time by 9.1%.

Limitations and Future Work

  • Wall-Clock Runtime Overhead: All those extra counterfactual simulations and localizer rounds take real-world time. At the full 10-iteration budget, RTLDetective averages 71.4 seconds per bug, compared to 28.4 seconds for MEIC (and because LLM token decoding dominates generation time, prefix caching only modestly shrinks total runtime).
  • Reliance on Failing Testbenches: The framework assumes you already have a sound natural-language spec and a self-checking testbench that catches the failure—if the testbench itself is buggy or incomplete, localization won't trigger properly.
  • Future Directions: The authors plan to adapt this model-agnostic counterfactual simulation trick to other verification headaches, including automated assertion generation and debugging faulty testbenches themselves.

Summary updated

Abstract

Large language model (LLM) agents have shown promise in RTL debugging, yet accurately localizing functional errors and generating reliable repairs remain challenging. We propose RTLDetective, a multi-agent framework that integrates signal dependency analysis, simulation-guided fault localization, and knowledge-based reasoning for automated RTL debugging and repair. RTLDetective constructs signal dependency graphs from RTL code and extracts failure information from waveform traces. A lightweight localizer agent predicts expected intermediate signal values and evaluates them through targeted simulation interventions, iteratively probing signal dependencies to isolate suspicious logic and identify potential fault locations. A debug agent combines this evidence with static analysis, a curated knowledge base of hardware design principles and RTL bug patterns, and reasoning to generate corrected RTL. To reduce inference overhead, the framework reuses cached context across debugging iterations. We evaluate RTLDetective on the MEIC benchmark, achieving an 86.1% fix rate, 13.9 percentage points above the best baseline, while making fewer LLM calls.
BibTeX
@misc{javidnia2026rtldetective,
  author = {Neusha Javidnia and Ruisi Zhang and Farinaz Koushanfar},
  title = {{RTLDetective: Agentic RTL Debugging through Dataflow Analysis and Simulation-Guided Fault Localization}},
  year = {2026},
  eprint = {2611.31709},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31709},
}
Figure