A2H-MAS: An Algorithm-to-HLS Multi-Agent System for Automated and Reliable FPGA Implementation

Jie Lei, Ruofan Jia, J. Andrew Zhang, Hao Zhang

TL;DR

This paper introduces A2H-MAS, a novel multi-agent system that automates the conversion of MATLAB algorithms into efficient FPGA implementations using High-Level Synthesis (HLS). By breaking down the complex process into specialized agents and leveraging deterministic tools for validation, A2H-MAS overcomes the limitations of single LLM agents, delivering reliable and performant hardware designs for demanding applications like wireless communication.

What Problem Does This Paper Address?

Developing high-performance hardware, especially for latency- and resource-constrained applications like wireless communication, is a significant challenge. Engineers often prototype algorithms in MATLAB due to its rich ecosystem and ease of iteration. However, translating these MATLAB models into efficient FPGA implementations using High-Level Synthesis (HLS) is far from trivial. It requires extensive manual effort, deep expertise in HLS pragmas, and lengthy design cycles involving tuning and verification. While Large Language Models (LLMs) show promise for automating this, existing LLM-based approaches struggle with reliability issues like hallucinations, forgetting, and a lack of focus on critical hardware metrics (latency, throughput, resource usage). This paper aims to bridge this gap by providing a robust, automated, and reliable system for transforming MATLAB algorithms into high-quality HLS code.

Methods

A2H-MAS employs a modular and hierarchical multi-agent system. The core idea is to decompose the complex MATLAB-to-HLS-to-FPGA pipeline into smaller, manageable tasks, each handled by a specialized agent. This approach addresses LLM limitations by:

  • Modular Decomposition: The system breaks down the algorithm into functionally coherent submodules using a dataflow-oriented approach.
  • Standardized Interfaces: Agents communicate through well-defined input/output specifications, minimizing inter-agent coupling and ensuring functional independence.
  • Deterministic Tooling & Validation: Critical tasks like verification, simulation, and file operations are delegated to deterministic tools (e.g., MATLAB batch execution, simulators). This provides a crucial safeguard against LLM hallucinations and ensures reproducibility.
  • Hierarchical Workflow: The system follows a structured, multi-phase workflow:
  • Modularization: Decomposing the MATLAB algorithm into smaller submodules.
  • Test Data Generation: Creating representative input-output pairs for each submodule.
  • Function Flattening: Replacing MATLAB built-in functions with their explicit implementations for better LLM understanding.
  • Code Optimization: Transforming frame-based MATLAB code into sample-based, streaming-oriented code suitable for FPGAs, leveraging a knowledge library of buffering and streaming patterns.
  • Algorithm-Hardware Co-Design: Prioritizing algorithmic transformations (e.g., table-based implementations) over pragma tuning for significant efficiency gains.
  • Code Translation: Converting optimized MATLAB to HLS-compatible C++.
  • Refinement: Performing design space exploration (DSE) for parameter tuning and optimization.
  • Integration & Implementation: Assembling refined submodules into a unified hardware system.

Datasets

The paper does not explicitly mention training datasets for LLMs. However, it uses representative wireless communication algorithms (5G NR SSB detection and WLAN synchronization) for evaluation. The system relies on generated test data and reference outputs derived from the original MATLAB implementations for validation.

Key Insights and Ideas

  • Decomposition is Key: Breaking down the complex MATLAB-to-HLS pipeline into specialized agents with clear responsibilities is crucial for overcoming LLM limitations like hallucination and forgetting.
  • Deterministic Tools are Essential: Relying on established tools for verification, simulation, and code generation provides a robust foundation for reliable hardware design, complementing the generative capabilities of LLMs.
  • Algorithm Choice Trumps Pragma Tuning: The paper highlights that selecting the right algorithm (e.g., using table-based methods) can yield orders-of-magnitude improvements in hardware efficiency, far more than fine-tuning HLS pragmas.
  • Knowledge Library for Optimization: A growing library of well-established buffering and streaming patterns aids the optimization agent in transforming MATLAB code for efficient FPGA execution.
  • Iterative Refinement is Necessary: Even with automation, a design space exploration and refinement phase is vital to achieve optimal performance and meet stringent hardware constraints.

Key Results

Experiments on 5G NR SSB detection and WLAN synchronization demonstrated that A2H-MAS:

  • Produces Functionally Correct Designs: The system successfully generates hardware implementations that are functionally equivalent to the original MATLAB algorithms.
  • Achieves High Operating Frequencies: The 5G NR SSB detection system achieved 292.23 MHz at the top level, and the WLAN synchronization achieved 337.61 MHz.
  • Generates Resource-Efficient Designs: Ablation studies showed significant reductions in LUTs (e.g., from 36,500 to 173 for calcThreshold) and other resources through the Adaption and Refinement stages.
  • Enables Reliable Integration: The framework successfully integrates multiple optimized submodules into complete, task-level hardware systems.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that while A2H-MAS significantly improves reliability, LLM-based approaches can still be susceptible to occasional issues.
  • The current implementation focuses on specific wireless communication algorithms.
  • Future Work:
    • Extending A2H-MAS to support a broader range of algorithmic domains (e.g., signal processing, computer vision) and hardware targets.
  • Integrating richer feedback mechanisms and adaptive optimization strategies.
  • Scaling up benchmark evaluations to further strengthen robustness and generality.

Summary updated

Abstract

Bridging the gap between high-level algorithm development and efficient FPGA implementation remains a fundamental challenge, particularly in latency- and resource-constrained domains such as wireless communications. In practice, many signal processing and communication algorithms are first developed and validated at the software level, where rapid iteration and numerical flexibility are critical, making MATLAB a de facto environment for algorithm prototyping and verification. To deploy these algorithms on FPGA platforms, High-Level Synthesis (HLS) is commonly adopted as an intermediate step that enables hardware generation from high-level descriptions. Although HLS significantly improves productivity compared with register-transfer level design, translating MATLAB models into high-quality HLS implementations still requires substantial manual effort and deep domain expertise. Designers must carefully restructure computation patterns, redesign dataflows, and tune synthesis parameters to meet strict performance and resource constraints. Recent advances in large language models (LLMs) suggest a promising direction for automating this translation process. However, current LLM-based approaches remain unreliable in complex hardware design workflows, as they suffer from hallucinations, forgetting, limited domain expertise, and often overlook key performance metrics such as latency, throughput, and resource utilization.
BibTeX
@inproceedings{lei2026h,
  author = {Jie Lei and Ruofan Jia and J. Andrew Zhang and Hao Zhang},
  title = {{A2H-MAS: An Algorithm-to-HLS Multi-Agent System for Automated and Reliable FPGA Implementation}},
  booktitle = {FPGA},
  year = {2026},
  doi = {10.1145/3748173.3779557},
}

Loading related content...

Figure