Abstract
Verification remains the primary bottleneck in digital circuit design, with engineers dedicating nearly half of their development cycle to writing testbenches. While Large Language Models (LLMs) have demonstrated proficiency in generating Register-Transfer Level (RTL) code, they often fail to produce rigorous, syntactically correct, and exhaustive testbenches. We present AutoBench, a framework that utilizes a hybrid Verilog-Python architecture and a multi-stage Chain-of-Thought workflow to automate testbench generation. Our results demonstrate a 57% improvement in testbench quality over direct LLM generation and a 3.36x performance boost for complex sequential circuits. Furthermore, we introduce AutoEval, a multi-tiered grading system to systematically measure testbench effectiveness through syntax validation, golden-model verification, and mutant-based bug detection.
1. Introduction
In the contemporary semiconductor industry, the complexity of hardware verification often outweighs the complexity of the design itself. Despite the emergence of LLMs as assistants for hardware description languages (HDLs), their application in verification is hindered by several factors. LLMs frequently produce "lazy" testbenches that cover only trivial edge cases, suffer from signal timing hallucinations, and generate code with frequent syntax errors. Moreover, the field lacks a standardized, automated methodology for evaluating the quality and bug-catching capabilities of LLM-generated testbenches. AutoBench addresses these challenges by restructuring the generation process and providing a robust evaluation framework.
2. Methodology
2.1 AutoBench: The Hybrid Workflow
AutoBench departs from traditional monolithic Verilog testbenches by adopting a Hybrid Testbench architecture. This approach bifurcates the verification task into two distinct components:
- Verilog Driver: This component manages hardware-specific timing and drives stimuli into the Design Under Test (DUT).
- Python Checker: This component serves as the logical evaluator, reading the DUT's output and verifying it against expected behavior.
This hybrid model leverages the fact that LLMs are trained on significantly more Python code than Verilog, allowing the model to express complex verification logic in a language where it possesses higher proficiency.
2.2 Chain-of-Thought Pipeline
The generation process is structured into a multi-stage pipeline to mitigate model "laziness" and ensure comprehensive coverage:
- Classification & Specification: The system first discriminates between combinational and sequential circuits to generate a formal JSON specification.
- Scenario Generation: Before writing code, the LLM must explicitly list test scenarios. This forces the model to consider edge cases and functional requirements upfront.
- Implementation: The framework generates Python checking rules, the Verilog driver, and finally integrates them into a complete Python checker.
2.3 Auto-Debug and Reboot
To ensure reliability, AutoBench incorporates an Auto-Debug and Reboot mechanism. If the generated code fails simulation or interpretation, error logs are fed back into the LLM for iterative correction. If repeated failures occur, the system "reboots" to an earlier stage of the pipeline to attempt a different architectural approach.
2.4 AutoEval: The Grading System
To quantify testbench quality, we propose three levels of evaluation:
- Eval0 (Syntax): Validates if the code compiles and runs without syntax errors.
- Eval1 (Correctness): Checks if the testbench reports a "pass" when executed against a known-correct "golden" RTL design.
- Eval2 (Rigor): Measures the ability to detect bugs by running the testbench against "mutants" (intentionally buggy versions of the design).
3. Experimental Setup
The framework was evaluated using an extended version of VerilogEval-Human, comprising 156 problems from the HDLBits platform. For the Eval2 metric, LLMs were used to generate 10 distinct mutant versions for each problem, creating a benchmark of over 1,500 buggy designs to test the rigor of the generated testbenches.
4. Key Results and Insights
4.1 Performance Metrics
AutoBench significantly outperforms direct LLM generation across all metrics:
- Pass@1 Ratio: Achieved a 57% improvement in the probability that the first generated testbench is correct.
- Sequential Circuit Performance: For complex sequential designs, AutoBench proved 3.36 times more effective than baseline methods.
- Reliability: Syntax reliability (Eval0) reached 95.71%, compared to 70.06% for the baseline.
4.2 The Python Advantage and Standardization
The shift to Python for verification logic proved critical. By using a language orthogonal to the design language (Verilog), the framework reduces the likelihood of the LLM repeating the same logic errors present in the RTL. Additionally, the implementation of a "Standardization Script" to handle signal exporting to text files significantly improved success rates in sequential circuits, where timing-accurate data logging is often a point of failure for LLMs.
5. Conclusion
AutoBench demonstrates that a structured, multi-language approach can overcome the inherent limitations of LLMs in hardware verification. While the system shows remarkable success at the unit level, future work will focus on scaling these techniques to System-on-Chip (SoC) levels involving complex protocols like PCIe or DDR. The modular, Python-based nature of the generated testbenches also provides a foundation for human-in-the-loop refinement, allowing engineers to easily audit and extend automated verification suites.
Summary updated