Introduction
The transition from mathematical algorithms, typically prototyped in MATLAB, to physical hardware implementations on Field-Programmable Gate Arrays (FPGAs) remains a formidable challenge in digital design. High-Level Synthesis (HLS) has mitigated some complexity by allowing developers to use C/C++ instead of low-level Hardware Description Languages (HDLs) like Verilog. However, achieving high-performance hardware still demands "black belt" expertise in hardware-specific optimizations, such as memory architectures and parallelization pragmas.
While Large Language Models (LLMs) have demonstrated impressive coding capabilities, their application to hardware design is often hindered by "hallucinations" regarding hardware features, context loss in complex files, and a lack of awareness regarding physical resource constraints like Look-Up Tables (LUTs) and Digital Signal Processors (DSPs). This paper introduces A2H-MAS (Algorithm-to-HLS Multi-Agent System), a modular framework designed to automate the Algorithm-to-HLS pipeline reliably and efficiently.
Methodology: The A2H-MAS Framework
A2H-MAS departs from traditional single-prompt LLM interactions by implementing a hierarchical, multi-agent architecture. Each agent is assigned a specific role—such as the "Matlab Optimization Agent"—and operates through standardized input/output interfaces to maintain context and prevent drift.
The system follows a rigorous eight-phase workflow to ensure both functional correctness and hardware efficiency:
- Modularization & Test Generation: Complex code is broken into testable sub-modules with automatically generated test vectors.
- Function Flattening: MATLAB built-ins are expanded into explicit code, allowing the LLM to perform deep optimization.
- Algorithm-Hardware Co-Design: The system prioritizes hardware-friendly algorithmic changes (e.g., replacing standard loops with circular buffers) over simple compiler hints.
- Translation & Refinement: Optimized MATLAB is converted to HLS C++, followed by iterative Design Space Exploration (DSE).
A critical component of A2H-MAS is the integration of deterministic tools. Agents utilize real-world utilities (e.g., matlab -batch) to verify their outputs at every stage. If a test fails, the error feedback is automatically routed back to the agent for iterative correction, ensuring "functional equivalence" between the math and the hardware.
Experimental Evaluation
The framework was evaluated using two high-complexity wireless communication benchmarks:
- 5G NR (SSB Detection): A 3GPP-compliant synchronization signal detection system.
- WLAN (Synchronization): A multi-bandwidth (20/40/80 MHz) hardware-oriented model.
Results and Discussion
The experimental results highlight the superiority of the A2H-MAS approach over naive LLM prompting. The system consistently achieved high clock frequencies (up to 337 MHz) and significant resource savings.
A standout result was observed in the calcThreshold module. A direct LLM translation resulted in a massive footprint of 36,500 LUTs and failed to meet timing requirements. In contrast, the A2H-MAS "Refinement" process produced a design using only 173 LUTs—a reduction of over 99%. Similarly, the extractSSBsig module saw a 73% reduction in latency, dropping from 24,890 to 6,730 cycles.
These findings underscore a key insight: choosing the correct hardware-oriented algorithm is far more impactful than merely tuning HLS pragmas. By reducing the cognitive load on the LLM through modularization and "flattening," A2H-MAS effectively eliminates common failure modes like forgetting and hallucination.
Conclusion and Future Work
A2H-MAS demonstrates that a structured, tool-augmented multi-agent system can bridge the gap between high-level algorithms and efficient hardware implementation. While currently focused on wireless communications and Xilinx FPGAs, future work aims to expand the system's "Knowledge Library" to include domains like computer vision and AI acceleration, as well as support for additional hardware backends.
Summary updated