TL;DR
This paper introduces LLM4DV, a novel framework that leverages Large Language Models (LLMs) to automate the generation of test stimuli for hardware design verification (DV). By orchestrating LLMs with sophisticated prompting strategies, LLM4DV aims to significantly reduce the human effort traditionally required for this complex and time-consuming task, showing promising results in achieving high test coverage.
What Problem Does This Paper Address?
Hardware design verification (DV) is a critical but notoriously labor-intensive process. It ensures that a hardware design functions correctly according to its specifications. A major bottleneck in DV is the generation of test stimuli – the inputs and conditions used to probe the design. Creating effective stimuli is challenging because hardware designs are complex, and the "testing space" is vast. Engineers often spend 60-70% of their development time on DV, manually crafting stimuli to achieve comprehensive test coverage. While LLMs have shown success in software automation, their application to hardware DV, particularly for test stimuli generation, has been underexplored due to differences in hardware description languages (HDLs) and the inherent scalability issues in hardware testing. This paper tackles the problem of automating hardware test stimuli generation to make DV more efficient and less reliant on human expertise.
Methods
The core contribution is the LLM4DV framework, which acts as an orchestrator for LLMs in the DV process. Instead of relying on traditional, often inefficient, constrained-random testing (CRT), LLM4DV uses LLMs to generate stimuli. The framework integrates with a standard DV flow:
- Prompt Generation: A prompt generator creates instructions for the LLM, incorporating feedback from the coverage monitor and a coverage plan.
- LLM Interaction: The LLM receives the prompt and generates natural language responses.
- Stimulus Extraction: Test stimuli values are extracted from the LLM's response.
- Simulation & Coverage Feedback: These stimuli are fed into the hardware design (Device Under Test - DUT) and its golden model. The coverage monitor tracks which test bins (specific conditions or scenarios) are hit and provides this feedback.
- Iterative Refinement: The coverage feedback is used to refine subsequent prompts, guiding the LLM to generate stimuli that target uncovered areas.
The paper also introduces several prompting enhancements to improve LLM performance:
- Missed-bin sampling: Prioritizes uncovered bins in prompts.
- Best-iterative-message sampling: Selectively retains relevant past messages to maintain context without exceeding LLM limits.
- Dialogue restarting: Resets the LLM's conversation if it gets stuck or repeats errors.
- Providing DUT code: Including the HDL code in prompts allows the LLM to better understand the design's logic.
- Few-shot prompting: Providing examples of stimuli and their coverage hits in the initial prompt.
Datasets
The paper introduces the LLM4DV benchmark, which comprises eight Device Under Test (DUT) modules. These include three custom-designed modules and five open-source designs, chosen for their representation of common computer architectures (CPUs, GPUs, accelerators). The DUTs are:
- Primitive Data Prefetcher Core
- Ibex Instruction Decoder
- Ibex CPU
- Asynchronous FIFO
- AMPLE Prefetcher Weight Bank
- AMPLE Prefetcher Fetch Tag
- SDRAM Controller
- MIPS CPU
These DUTs are used to evaluate six different commercially available LLMs. The benchmark is made open-source to facilitate community research.
Key Insights and Ideas
- LLMs as DV Assistants: The research demonstrates that LLMs can be effectively integrated into the hardware DV workflow, acting as intelligent agents that generate test stimuli. This moves beyond LLMs for code generation to LLMs for verification tasks.
- Prompting is Paramount: The effectiveness of LLMs in DV is highly dependent on sophisticated prompting strategies. The paper's proposed enhancements significantly improve coverage rates, highlighting that simply feeding a coverage plan to an LLM is insufficient.
- Bridging the HDL Gap: While HDLs differ from software languages, the LLM4DV framework, especially with the inclusion of DUT code, shows that LLMs can learn to interpret and generate stimuli relevant to hardware designs.
- Efficiency Gains: LLM-driven stimulus generation has the potential to significantly reduce the manual effort and time required for DV, offering a more efficient alternative to traditional methods like CRT, especially for complex scenarios.
Key Results
The LLM4DV framework, utilizing optimized prompting techniques, achieved impressive test coverage rates ranging from 89.74% to 100% across various LLM-DUT pairs in realistic settings. In many cases, the LLM-generated stimuli matched or exceeded the coverage achieved by naive constrained-random testing (CRT). For instance, for the Primitive Data Prefetcher Core, GPT-3.5 Turbo with few-shot prompting achieved 98.26% coverage. For the Asynchronous FIFO, multiple LLMs achieved 100% coverage. The framework also showed a reduction in "effective message count" (a metric for efficient LLM usage) for some configurations, indicating faster convergence to desired coverage.
Limitations and Future Work
The authors acknowledge that LLMs still struggle with more complex designs, suggesting that while they hold promise, they are not yet a complete replacement for human expertise in all scenarios. The limited context window of LLMs can restrict the ability to provide full DUT code for very large designs. Future work could explore more advanced techniques for handling larger designs, further refining prompting strategies, and investigating LLMs for other aspects of hardware verification beyond stimulus generation. The paper also calls for the creation of more open datasets and benchmarks to fully quantify the potential of LLMs in chip design.
Summary updated