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 [1]-[3]. 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 agentic 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)规范,这需要大量的人工重构工作[1]-[3]。另一个瓶颈是复杂PQC原语(包括数论变换(NTT)加速器和宽内存接口)的综合可扩展性问题。尽管大语言模型(LLM)在Python等通用编程语言的代码生成方面已展现出显著成果,但面向硬件设计的代码生成更具挑战性;反馈驱动与智能体集成是当前成功的前沿方法的关键原则。本文提出LLM4PQC,一种基于LLM的智能体框架,能够将高层次PQC规范及参考C代码重构为可直接用于HLS且可综合的C代码。本框架同时生成并验证生成的RTL代码。为确保正确性,我们采用分层校验机制,涵盖快速C编译与仿真以及RTL仿真。基于NIST PQC参考设计的案例研究表明,相较于传统流程,该方法减少了人工工作量并加速了设计空间探索。总体而言,LLM4PQC为合成复杂硬件加速器提供了一条强大而高效的途径。