LongRTL: Graph-Similarity-Guided LLM-driven Long Context RTL Optimization
2026-06-08 • Hardware Architecture
Hardware ArchitectureProgramming Languages
AI summaryⓘ
The authors created a new method to improve hardware code (called RTL) using large language models, which usually struggle with very long and complex designs. They use three helper programs: one breaks the design into smaller pieces based on similarity to known templates, another rewrites these pieces using advanced code suggestions, and the third puts the pieces back together correctly. This approach helps optimize big, messy hardware designs more effectively. Their work aims to apply language models to real-world hardware projects instead of just simple examples.
Large Language ModelsRTL (Register Transfer Level)AST (Abstract Syntax Tree)Graph SimilarityRetrieval-Augmented Generation (RAG)PartitioningHardware OptimizationCode GenerationModularizationFunctional Equivalence
Authors
Yuyang Ye, Che-Kuan Shen, Xiangfei Hu, Yuchen Liu, Shuo Yin, Xufeng Yao, Bei Yu, Tsung-Yi Ho
Abstract
Large Language Models (LLMs) show great promise in RTL code generation and optimization. However, real-world RTL designs are typically long, entangled, and poorly modularized, posing a major challenge due to context-length limitations and lack of structure. To overcome these obstacles, we propose a scalable LLM-based RTL optimization framework guided by graph similarity. Our method introduces three collaborative agents: (1) a Partition Agent that decomposes RTL designs into semantically meaningful AST subtrees, guided by AST graph similarity to reusable design templates; (2) an Optimization Agent that generates RTL submodule code based on partitioned subtrees using multi-modal Retrieval-Augmented Generation (RAG) with both AST and RTL guidance; and (3) a Reconstruction Agent that reassembles optimized submodules based on logic-aware ordering and Graph-RAG prompting, ensuring global functional equivalence. Together, these components enable robust, structure-aware optimization of long-context RTL designs, bridging the gap between toy examples and industrial-scale hardware codebases.