TL;DR
RTLREX is a Large Language Model (LLM)-guided framework designed to "reverse engineer" low-level gate netlists and truth tables back into high-level, human-readable Register-Transfer Level (RTL) code. By orchestrating domain-specific tools and enforcing formal equivalence proofs, it achieves 100% recovery coverage on standard benchmarks while producing code that is significantly more compact and easier to optimize than previous state-of-the-art methods.
What Problem Does This Paper Address?
In hardware engineering, designers often encounter "black box" components—third-party IPs or legacy designs—where the original high-level source code (RTL) is missing. Engineers are left with only gate-level netlists (a massive, unreadable "sea of gates") or input-output behavior (truth tables).
These low-level representations are a nightmare for functional analysis, debugging, or optimization. While logic synthesis tools are great at turning RTL into gates, the process is one-way and obscures the original arithmetic and control structures. Previous attempts at RTL recovery often struggled with complex arithmetic (like multipliers) or failed to guarantee that the recovered code was exactly equivalent to the original for every possible input.
Methods
RTLREX introduces a closed-loop framework that combines the reasoning capabilities of LLMs (specifically GPT-4 class models) with specialized Electronic Design Automation (EDA) tools. The process follows five key stages:
- Function Recovery: The LLM acts as an orchestrator, calling "Agent Skills"—domain-specific tools that probe the circuit's behavior using targeted and random input vectors to infer arithmetic or Boolean models.
- RTL Generation: The inferred models are translated into synthesizable Verilog.
- Independent Verification: This is the "exactness" guarantee. RTLREX uses formal methods like Combinational Equivalence Checking (CEC), SMT solvers (Z3), and a technique called arithmetic replay to prove the recovered RTL matches the original netlist bit-for-bit.
- Syntax-Cost Evaluation: The framework calculates a "syntax cost" based on code complexity (operators, branches, etc.).
- Cost-Guided Rewriting: If the code is verified but bulky, the LLM uses feedback to propose refactors (e.g., sharing common subexpressions) to minimize the syntax cost.
A standout feature is Arithmetic Replay, which handles "multiplication-rich" netlists that usually crash standard formal solvers. It breaks the proof down by identifying local arithmetic identities and verifying them in smaller, manageable chunks.
Datasets
The authors evaluated RTLREX on two primary benchmarks:
- PA-30: 30 combinational gate-level netlists from the ICCAD 2022 CAD Contest (Problem A). These are challenging circuits designed specifically to test reverse-engineering tools.
- TT-100: 100 complete truth tables from the IWLS 2026 Contest. These include complex numerical functions like Bfloat16 (BF16) and various floating-point (FP16, FP8) operations.
Key Insights and Ideas
- LLMs as Tool Orchestrators: Rather than asking the LLM to "guess" the logic, RTLREX uses it to interpret tool feedback. If a verification fails, the LLM analyzes the counterexample and decides which specific boundary values to probe next.
- Verification-Driven Refinement: The framework doesn't just stop at a "plausible" solution. The formal verification loop ensures that every recovered design is mathematically identical to the source, solving the "hallucination" problem common in LLMs.
- Optimization Space Expansion: Recovering high-level RTL isn't just about readability; it opens up a "larger optimization space." By starting from different high-level representations (e.g., Shannon expansion vs. algebraic form), downstream synthesis tools can find better area-delay tradeoffs.
Key Results
- 100% Coverage: RTLREX successfully recovered and verified all 30 benchmarks in the PA-30 suite, outperforming previous state-of-the-art tools like WolFEx (86.7%) and Hybrid-DATE (76.7%).
- Superior Compactness: On benchmarks solved by both, RTLREX reduced the mean syntax cost by 20.5% compared to WolFEx. On the TT-100 suite, it reduced syntax cost by a staggering 95.7% compared to a naive LLM baseline.
- Efficiency: The framework is fast, reducing the mean generation time per benchmark from 435.5 seconds (baseline) to 179.0 seconds.
- Resynthesis Gains: Using the recovered RTL for resynthesis led to a mean standard-cell area reduction of 1.75% and a delay reduction of 3.03% across the PA-30 suite, with some individual benchmarks seeing area reductions as high as 41.6%.
Limitations and Future Work
The paper focuses primarily on combinational logic (circuits without memory). Real-world hardware is heavily sequential (containing flip-flops and state machines), which adds a significant layer of temporal complexity. The authors note that extending this LLM-guided approach to sequential RTL recovery is a primary direction for future research. Additionally, while the framework is efficient, scaling it to multi-million gate hierarchical designs would likely require new strategies for automated circuit partitioning.
Summary updated