Poster

RTLExplain: A Structured Approach to RTL Code Summarization and Question Answering for Medium-to-Large Designs Using LLMs

Abstract

Large Language Models (LLMs) show promise in assisting with Register Transfer Level (RTL) design tasks, including code summarization, documentation, and question answering. However, real-world RTL projects often involve extensive codebases that exceed the prompt length limitations of current LLMs, making it difficult for these models to fully comprehend the designs when only partial code snippets are provided. To overcome this challenge, we propose RTLExplain, a bottom-up, data-dependency-aware approach that processes structurally truncated code along with summaries of relevant signals and modules, presented as comments, to generate comprehensive summaries of RTL components. Our method does not require further training or fine-tuning. Experiments on code summarization demonstrate consistent improvements across various medium-to-large RTL projects, even when variable names are obfuscated. Furthermore, we generate documentation from the produced summaries and leverage project code and documentation for Retrieval-Augmented Generation (RAG) in question answering tasks. Experiments show that our enhanced database, when combined with RAG, improves question-answering accuracy by 37% compared to naïve prompting and 27% compared to conventional RAG.

Related