SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoning

Yiting Wang, Wanghao Ye, Ping Guo, Yexiao He, Ziyao Wang, Bowei Tian, Shwai He, Guoheng Sun, Zheyu Shen, Sihan Chen, Ankur Srivastava, Qingfu Zhang, Gang Qu, Ang Li

Abstract

Optimizing Register Transfer Level (RTL) code is a foundational step in digital chip design, directly influencing the final Power, Performance, and Area (PPA) of integrated circuits. While Large Language Models (LLMs) offer generative flexibility for code rewriting, they often struggle with functional correctness and logical rigor in hardware description languages like Verilog. This paper introduces SymRTLO, a neuro-symbolic framework that integrates the creative potential of LLMs with the structural constraints of symbolic reasoning. By utilizing Abstract Syntax Tree (AST) templates, a Retrieval-Augmented Generation (RAG) rule library, and formal verification, SymRTLO achieves a 97.5% pass@1 rate and significant PPA improvements over traditional and LLM-based baselines.

Introduction

In the early stages of digital design, engineers write RTL code to define the logic of a chip. The quality of this code determines the efficiency of the physical implementation. Traditionally, this optimization is a manual, iterative process where designers use Electronic Design Automation (EDA) tools to refine logic. While modern compilers provide automated optimizations, they often rely on rigid heuristics that struggle to balance conflicting goals, such as reducing area without increasing signal delay.

Recent attempts to leverage LLMs for RTL optimization have faced significant hurdles. Pure LLM approaches frequently "hallucinate" invalid syntax, produce functionally incorrect logic, or fail to align with specific PPA targets. SymRTLO addresses these challenges by implementing symbolic "guardrails" that guide the LLM, ensuring that the generated hardware remains logically sound while pursuing aggressive optimization goals.

The SymRTLO Framework

SymRTLO moves away from the standard "text-to-text" prompt engineering. Instead, it employs a multi-stage neuro-symbolic pipeline designed to handle the unique complexities of hardware logic.

1. LLM Dispatcher

The process begins with an LLM Dispatcher that analyzes the input Verilog code. It identifies whether the code primarily involves data flow logic, control flow logic, or a combination of both, routing the task to the appropriate specialized optimization path.

2. Data Flow Optimization via RAG and ASTs

For data flow logic, SymRTLO avoids raw code generation. Instead, it utilizes a Retrieval-Augmented Generation (RAG) system containing a library of hardware optimization rules sourced from technical manuals and textbooks. To ensure structural integrity, the LLM does not write free-form code; it fills out Abstract Syntax Tree (AST) templates. By manipulating the AST directly, the system guarantees that the output adheres to valid hardware syntax and preserves the intended structural hierarchy.

3. Control Flow and FSM Symbolic Reasoning

Finite State Machines (FSMs) are notoriously difficult for LLMs to optimize through text alone. SymRTLO extracts the FSM into a symbolic mathematical representation. Rather than asking the LLM to "fix the FSM," the system tasks the LLM with writing a custom minimization script tailored to that specific symbolic model. This allows the LLM to act as a strategist, applying mathematical state-reduction techniques that are far more precise than simple text manipulation.

4. Automated Verification Loop

To eliminate the risk of functional errors, SymRTLO employs a two-step verification pipeline:

  • Functional Check: The LLM generates testbenches for rapid simulation.
  • Formal Equivalence Checking: If the simulation passes, the system uses formal tools (such as Yosys or Synopsys Formality) to mathematically prove that the optimized code is logically identical to the original. If a check fails, the error is fed back to the LLM to attempt a different optimization template.

Experimental Evaluation

The framework was evaluated using the RTLRewriter Benchmark, which consists of 11 short benchmarks focused on wire/cell counts and 10 complex algorithm/FSM examples. Performance was measured using industry-standard tools, including Yosys for open-source analysis and Synopsys Design Compiler for rigorous PPA metrics.

Key Results

  • Functional Reliability: SymRTLO achieved a 97.5% pass@1 rate, vastly outperforming base models like GPT-4o (45.9%) and GPT-4-Turbo (42.9%).
  • PPA Improvements: On complex benchmarks, SymRTLO demonstrated superior optimization capabilities compared to state-of-the-art compilers and previous LLM methods, reaching improvements of up to 43.9% in power, 62.5% in delay, and 51.1% in area.
  • Ablation Insights: Removal of the AST templates or the symbolic FSM module led to a sharp decline in performance, confirming that the integration of symbolic logic is essential for hardware-grade reliability.

Conclusion and Future Work

SymRTLO demonstrates that the key to using LLMs in hardware design is not larger models, but better constraints. By wrapping generative models in symbolic frameworks, SymRTLO bridges the gap between creative optimization and formal correctness.

While the results are promising, the authors note that current benchmarks are often biased toward area optimization. Future research will focus on expanding these benchmarks to include more diverse, industrial-scale designs that place greater emphasis on complex timing and power constraints, further testing the limits of neuro-symbolic RTL design.

Summary updated

BibTeX
@inproceedings{wang2025symrtlo,
  author = {Yiting Wang and Wanghao Ye and Ping Guo and Yexiao He and Ziyao Wang and Bowei Tian and Shwai He and Guoheng Sun and Zheyu Shen and Sihan Chen and Ankur Srivastava and Qingfu Zhang and Gang Qu and Ang Li},
  title = {{SymRTLO: Enhancing RTL Code Optimization with LLMs and Neuron-Inspired Symbolic Reasoning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=XFP5jntOdx},
}
Figure