arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.00214cs.ARcs.SE
收藏

C2HLSC:利用大语言模型弥合软件到硬件的设计鸿沟

C2HLSC: Leveraging Large Language Models to Bridge the Software-to-Hardware Design Gap

Luca Collini, Siddharth Garg, Ramesh Karri

AI总结:

针对高级综合工具C代码兼容性受限的问题,提出基于大语言模型的C2HLSC自动化重构框架,通过预处理拆解层级、迭代反馈优化将C代码转为HLS兼容格式,在多类基准上验证了高成功率,可处理复杂度远超现有LLM生成Verilog方案的设计。

摘要:

高级综合(High-Level Synthesis,HLS)工具可基于C代码快速完成硬件设计,但其兼容性受代码结构限制。本文研究利用大语言模型(Large Language Models,LLMs)自动将C代码重构为HLS兼容格式。我们开展了一项案例研究,使用LLM将NIST 800-22随机性测试、QuickSort算法和AES-128的C代码重写为可被HLS综合的C代码。该LLM在系统提示和工具反馈的引导下迭代转换C代码,实现流式数据传输、硬件专用信号等功能。基于案例研究获得的经验,我们实现了一个全自动化框架,利用LLMs将C代码重构为HLS兼容格式。为应对复杂设计,我们加入了预处理步骤,拆解设计层级,采用分治的自底向上方式处理问题。我们在3个密码算法、1个哈希函数、5项NIST 800-22随机性测试以及1个QuickSort算法上验证了该框架。结果表明,该框架在基准测试上成功率很高,而这些基准测试的复杂度比现有LLM生成Verilog的实现对象高出数个数量级。

英文摘要:

High-Level Synthesis (HLS) tools offer rapid hardware design from C code, but their compatibility is limited by code constructs. This paper investigates Large Language Models (LLMs) for automatically refactoring C code into HLS-compatible formats. We present a case study using an LLM to rewrite C code for NIST 800-22 randomness tests, a QuickSort algorithm, and AES-128 into HLS-synthesizable C. The LLM iteratively transforms the C code guided by the system prompt and tool's feedback, implementing functions like streaming data and hardware-specific signals. With the hindsight obtained from the case study, we implement a fully automated framework to refactor C code into HLS-compatible formats using LLMs. To tackle complex designs, we implement a preprocessing step that breaks down the hierarchy in order to approach the problem in a divide-and-conquer bottom-up way. We validated our framework on three ciphers, one hash function, five NIST 800-22 randomness tests, and a QuickSort algorithm. Our results show a high success rate on benchmarks that are orders of magnitude more complex than what has been achieved generating Verilog with LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑