LLM-assisted Bug Identification and Correction for Verilog HDL

Author:

Qayyum Khushboo1ORCID,Jha Chandan Kumar2ORCID,Ahmadi-Pour Sallar3ORCID,Hassan Muhammad14ORCID,Drechsler Rolf51ORCID

Affiliation:

1. Cyber Physical Systems, DFKI, Bremen, Germany

2. FB3, University of Bremen, Bremen, Germany

3. Group of Computer Architecture, University of Bremen Faculty 3 Mathematics and Computer Science, Bremen, Germany

4. Faculty 03 Mathematics and Computer Science, Computer Science, University of Bremen, Bremen, Germany

5. Computer Science, University of Bremen Faculty 03 Mathematics and Computer Science, Bremen, Germany

Abstract

As technology continues to advance, it becomes increasingly integrated into daily life facilitating complex tasks across a range of environments. While some applications such as smartphones and smartwatches are less critical, others like healthcare devices and autonomous vehicles demand bug-free performance to prevent financial loss or harm. Traditionally, simulation-based testing and formal verification played a major role in ensuring a bug-free device. However, the simulation of bigger systems is limited to a definite number of scenarios on the Design under Verification  (DUV). Hence, it is unable to explore all possible inputs that can occur. Formal verification, on the other hand, offers a higher level of assurance through mathematical proofs but is both time-consuming and suffers from scalability issues, especially as designs grow in complexity. Recently, Large Language Models  (LLMs) have shown promise in tasks previously limited to human expertise. Their natural language processing capabilities can assist in handling extensive specifications and source code, particularly in debugging hardware descriptions and analyzing security and functionality. The utilization of Retrieval Augmented Generation  (RAG) has further enhanced LLMs by incorporating large specification or source code bases, thereby improving their bug-identification and correction capabilities. While recent advancements in LLMs, particularly with RAG, have yielded promising results in bug identification and correction for a small class of hardware bugs, significant gaps remain in their full potential for systematically addressing a wide range of hardware bugs. For instance, existing LLM methodologies struggle to detect bugs involving incorrect constant values, i.e., the use of wrong constants in source code. This limitation underscores the need for further exploration in utilizing LLMs to fully optimize the verification process. To bridge this gap, we propose a 3-phased 4-stage LLM-assisted systematic bug closure methodology that focuses on functional bugs in Verilog HDL rather than structural or syntactic issues. Our approach extracts functional properties of the DUV and systematically breaks down complex expressions into smaller sub-expressions to facilitate bug detection and correction. By employing RAG, the LLM is guided using the functional specifications and source code to identify and correct bugs. If the initial guidance through RAG is insufficient, our methodology initiates an iterative bug closure process. This includes incorporating more extensive information from the specifications, fetching additional lines of code for bug localization, and breaking down complex Verilog HDL expressions. In our comprehensive evaluation, we assess the LLM’s capabilities using 9 different categories of bugs. As benchmarks, we use 5 OpenTitan Intellectual Property  (IP) cores to demonstrate the scalability and effectiveness of our bug closure methodology where \(\approx 60\% \) of the bugs were corrected. Specifically, we evaluate OpenAI’s GPT-4 in its ability to identify and correct functional bugs in Verilog HDL code.

Publisher

Association for Computing Machinery (ACM)

Reference42 articles.

1. [n. d.]. LangChain. ([n. d.]). https://python.langchain.com/docs/get_started

2. On Hardware Security Bug Code Fixes by Prompting Large Language Models

3. CirFix: automatically repairing defects in hardware design code

4. Mohammad Akyash and Hadi Mardani Kamali. 2024. Self-HWDebug: Automation of LLM Self-Instructing for Hardware Security Verification. arXiv preprint arXiv:2405.12347(2024).

5. all-MiniLM-L6-v2. 2023. all-MiniLM-L6-v2. (2023). https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.7亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2025 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3