用HLS结果校验LLM生成的硬件代码,既保正确又提效率。
CorrectHDL: Agentic HDL Design with LLMs Leveraging High-Level Synthesis as Reference
- 用HLS参考设计对比修正LLM生成的HDL功能错误
- 生成电路面积和功耗比传统HLS优化30%以上
- 适合想用AI加速芯片设计且重视可靠性的工程师
大型语言模型(LLMs)在使用硬件描述语言(HDL)进行前端硬件设计方面展现出巨大潜力。然而,其固有的幻觉倾向常导致生成的HDL设计出现功能错误。为此,我们提出CorrectHDL框架,利用高层次综合(HLS)结果作为功能参照,纠正LLM生成的HDL设计中的潜在错误。该框架输入为指定目标电路功能的C/C++程序,由LLM直接生成HDL设计,通过检索增强生成(RAG)机制修复语法错误。通过将生成电路的仿真行为与传统HLS工具产生的参考设计进行迭代比对,逐步提升功能正确性,尽管这可能导致面积和功耗效率低于最优,但实验表明,所生成电路的面积和功耗效率显著优于传统HLS设计,并接近人工设计水平。同时,最终实现的HDL代码保持了高正确性,验证了结合LLM生成能力与传统设计流程严谨性的代理式硬件设计的有效性和潜力。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have demonstrated remarkable potential in hardware front-end design using hardware description languages (HDLs). However, their inherent tendency toward hallucination often introduces functional errors into the generated HDL designs. To address this issue, we propose the framework CorrectHDL that leverages high-level synthesis (HLS) results as functional references to correct potential errors in LLM-generated HDL designs.The input to the proposed framework is a C/C++ program that specifies the target circuit's functionality. The program is provided to an LLM to directly generate an HDL design, whose syntax errors are repaired using a Retrieval-Augmented Generation (RAG) mechanism. The functional correctness of the LLM-generated circuit is iteratively improved by comparing its simulated behavior with an HLS reference design produced by conventional HLS tools, which ensures the functional correctness of the result but can lead to suboptimal area and power efficiency. Experimental results demonstrate that circuits generated by the proposed framework achieve significantly better area and power efficiency than conventional HLS designs and approach the quality of human-engineered circuits. Meanwhile, the correctness of the resulting HDL implementation is maintained, highlighting the effectiveness and potential of agentic HDL design leveraging the generative capabilities of LLMs and the rigor of traditional correctness-driven IC design flows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。