C2HLSC: Can LLMs Bridge the Software-to-Hardware Design Gap?
Luca Collini, Siddharth Garg, Ramesh Karri
TL;DR
High-Level Synthesis (HLS) enables hardware generation from C, but requires refactoring away from constructs not supported by hardware. The authors explore using Large Language Models to automatically rewrite generic C code into HLS-synthesizable C, validating this approach through case studies on NIST 800-22 randomness tests, QuickSort, and AES-128. They report iterative, prompt-driven transformations that convert streaming data processing, abolish pointers/recursion, and introduce hardware signals, culminating in a hands-free C2HLSC prototype flow. The results indicate potential for substantial reductions in manual refactoring effort and faster hardware-software co-design, pointing toward broader automated tooling for C-to-HLS transitions.
Abstract
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 refactoring C code into HLS-compatible formats. We present several case studies by 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 user prompts, implementing functions like streaming data and hardware-specific signals. This evaluation demonstrates the LLM's potential to assist hardware design refactoring regular C code into HLS synthesizable C code.
