PyHDL-Eval: An LLM Evaluation Framework for Hardware Design Using Python-Embedded DSLs
Embedding hardware design frameworks within Python is a promising technique to improve the productivity of hardware engineers. At the same time, there is significant interest in using large-language models (LLMs) to improve key chip design tasks. This paper describes PyHDL-Eval, a new framework for evaluating LLMs on specification-to-RTL tasks in the context of Python-embedded domain-specific languages (DSLs). The framework includes 168 problems, Verilog reference solutions, Verilog test benches, Python test scripts, and workflow orchestration scripts. We use the framework to conduct a detailed case study comparing five LLMs (CodeGemma 7B, Llama3 8B/70B, GPT4, and GPT4 Turbo) targeting Verilog and five Python-embedded DSLs (PyMTL3, PyRTL, MyHDL, Migen, and Amaranth). Our results demonstrate the promise of in-context learning when applied to smaller models (e.g., pass rate for CodeGemma 7B improves from 14.9% to 32.7% on Verilog) and Python-embedded DSLs (e.g., pass rate for LLama3 70B improves from 0.6% to 33.0% on PyMTL3). We find LLMs perform better when targeting Verilog as compared to Python-embedded DSLs (e.g., pass rate for GPT4 Turbo is 72.2% on Verilog and 29.8-62.0% on the Python-embedded DSLs) despite using a popular general-purpose host language. PyHDL-Eval will serve as a useful framework for future research at the intersection of Python-embedded DSLs and LLMs.
Authors
- Brucek Khailany (ORCID: https://orcid.org/0000-0002-7584-3489)
- Mingjie Liu (ORCID: https://orcid.org/0000-0002-3488-9763)
- Haoxing Ren (ORCID: https://orcid.org/0000-0003-1028-3860)
- Nathaniel Pinckney (ORCID: https://orcid.org/0000-0001-6159-8964)
- Christopher Batten (ORCID: https://orcid.org/0000-0002-2835-667X)
Institutions
- Cornell University (US)
- Nvidia (United States) (US)
Publication Details
- Published
- 2024-09-03
- DOI
- https://doi.org/10.1145/3670474.3685948
- Citations
- 6
- Primary Topic
- Embedded Systems Design Techniques
- Type
- article
- Field-Weighted Citation Impact
- 2.93