Keywords: Code translation, MATLAB-to-HDL transpilation, VHDL, syntax repair, program repair, agentic frameworks, Model Context Protocol (MCP), retrieval-augmented generation (RAG), conditional tool use, context management, FPGA/ASIC deployment, large language models (LLMs)
TL;DR: Isolating syntax repair in MATLAB to HDL, we compare a fixed script to an MCP agent on Qwen 8B/30B/235B (42 fns). Conditional retrieval + tight context let it boost progression (30B reach 72.1 to 95.3%). Always-on RAG hurts small/mid; 235B saturates.
Abstract: Translating algorithms from high-level languages like MATLAB to hardware description languages (HDLs) is a resource-intensive but necessary step for deployment on FPGAs and ASICs. While large language models (LLMs) offer a path to automation, their limited training on HDL code makes end-to-end transpilation brittle and prone to syntax errors. We compare two LLM-driven methods for syntax repair in a MATLAB-to-HDL pipeline: a structured, expert-designed flow that follows a fixed sequence of operations, and a more autonomous agentic approach that uses the Model Context Protocol (MCP) \cite{anthropic2024mcp} to dynamically select its own tools. We study 42 MATLAB signal-processing functions and isolate the syntax-repair stage. Across three model scales, the agentic approach is more effective at resolving initial syntax errors, unblocking a greater number of candidates to proceed through the pipeline. This upstream improvement yields measurable downstream improvements, most notably on mid-sized models, where it increases the simulation reach rate by over 20 percentage points. We hypothesize the gains come from short prompts, aggressive context management, and conditional tool use. Conditional retrieval helps at 8B and 30B; at 235B final-success gains are small and a naive RAG variant attains the highest final success. Our findings suggest that these agentic frameworks, when properly designed, are most effective at compensating for the capacity limits of small and mid-sized models.
Submission Number: 59
Loading