The design of post-quantum cryptography (PQC) hardware is a complex and hierarchical process with many challenges. A primary bottleneck is the conversion of PQC reference codes from C to high-level synthesis (HLS) specifications, which requires extensive manual refactoring. Another bottleneck is the scalability of synthesis for complex PQC primitives, including number theoretic transform (NTT) accelerators and wide memory interfaces. While large language models (LLMs) have shown remarkable results for coding in general-purpose languages like Python, coding for hardware design is more challenging; feedback-driven and agentic integration are key principles of successful state-of-the-art approaches. Here, we propose LLM4PQC, an LLM-based framework that refactors high-level PQC specifications and reference C codes into HLS-ready and synthesizable C code. Our framework generates and verifies the resulting RTL code. For correctness, we leverage a hierarchy of checks, covering fast C compilation and simulation as well as RTL simulation. Case studies on NIST PQC reference designs demonstrate a reduction in manual effort and accelerated design-space exploration compared to traditional flows. Overall, LLM4PQC provides a powerful and efficient pathway for synthesizing complex hardware accelerators.
翻译:后量子密码(PQC)硬件设计是一个复杂且层次化的过程,面临诸多挑战。主要瓶颈之一在于将PQC参考代码从C语言转换为高层次综合(HLS)规范,这需要大量的人工重构工作。另一瓶颈是复杂PQC原语(包括数论变换(NTT)加速器和宽内存接口)的综合可扩展性问题。尽管大语言模型(LLM)在Python等通用编程语言的代码生成方面已展现出显著成果,但面向硬件设计的代码生成更具挑战性;反馈驱动与智能体化集成是当前最先进方法取得成功的关键原则。本文提出LLM4PQC,一种基于LLM的框架,可将高层次PQC规范及参考C代码重构为符合HLS要求且可综合的C代码。本框架能生成并验证所得RTL代码。在正确性保障方面,我们采用分层校验机制,涵盖快速C编译与仿真以及RTL仿真。通过对NIST PQC参考设计的案例研究,证明相较于传统流程,该方法能有效减少人工工作量并加速设计空间探索。总体而言,LLM4PQC为复杂硬件加速器的综合提供了一条强大而高效的途径。