Papers
Topics
Authors
Recent
Search
2000 character limit reached

Evidence-Driven LLM Agent for C-to-Synthesizable-C Conversion and Verification

Published 25 Jun 2026 in cs.AR and cs.AI | (2606.28409v1)

Abstract: Software-compilable C programs routinely fail to complete the four-stage pipeline of a high-level synthesis (HLS) toolchain -- compilation, C simulation (CSim), synthesis, and C/RTL co-simulation (CoSim) -- because HLS accepts only a synthesizable subset of C (HLS-C). Yet most existing LLM systems built for HLS code repair only cover the early pipeline stages and feed raw tool logs directly to the model, yielding brittle and hard-to-reproduce fixes. We formulate C-to-HLS-C conversion as a closed-loop generation-verification-diagnosis-repair problem on an HLS tool (Xilinx Vitis), contributing three components: an end-to-end workflow of cooperating agents closed by the four-stage verifier under strict evidence isolation; a Progressive Mismatch Localization Chain (PMLC) that localizes CSim/CoSim mismatches through log normalization, AST backward slicing, and dual-trace instrumentation; and a typed-query, two-stage evidence RAG backed by a self-evolving, family-routed repair-card pool. Experimental results show that the proposed workflow substantially outperforms all comparable state-of-the-art models.

Summary

  • The paper introduces a closed-loop generation–verification pipeline that converts standard C/C++ programs to synthesizable HLS-C, lifting four-stage all-pass rates from 20.83% to 70.83%.
  • The methodology employs a Progressive Mismatch Localization Chain (PMLC) and a self-evolving mixture-of-experts RAG system to pinpoint cycle-level mismatches and reduce repair iterations to an average of 1.577.
  • The approach demonstrates robust empirical results across real-world benchmarks while providing a verifiable, audit-based framework for automated program repair in HLS toolchains.

Evidence-Driven LLM Agent for Robust C-to-HLS-C Conversion and Verification

Overview and Motivation

"Evidence-Driven LLM Agent for C-to-Synthesizable-C Conversion and Verification" (2606.28409) introduces a formalized, agentic framework for translating standard C/C++ programs into synthesizable C (HLS-C) suitable for commercial high-level synthesis (HLS) toolchains. The work addresses the well-known attrition problem: GCC-compilable C programs frequently fail multiple stages—compilation, C simulation (CSim), synthesis, and C/RTL co-simulation (CoSim)—within HLS flows due to unsupported language features, pointer ambiguity, or contractual violations. Direct LLM-driven HDL generation is infeasible given the scarcity of HDL corpora and high error rates; thus, the practical approach relies on LLMs to generate HLS-C and leverages mature toolchains for RTL synthesis and verification.

The paper is technically distinguished by its closed-loop generation–verification–diagnosis–repair pipeline, strict evidence isolation, novel Progressive Mismatch Localization Chain (PMLC) for trace-driven bug localization, and a self-evolving mixture-of-experts (MoE) retrieval-augmented generation (RAG) system. The system outperforms contemporary LLM-based and traditional agentic baselines across all metrics, especially in challenging cycle-level mismatch cases and on diverse real-world benchmarks. Figure 1

Figure 1: Comparison of four hardware-design paradigms; the proposed paradigm (d) integrates LLM-driven C-to-HLS-C generation with a closed-loop verifier leveraging agentic repair.

System Architecture: Closed-Loop Agent Workflow

The workflow distributes responsibility across four lightweight agents: planner, programmer, orchestrator, and failure analyst. The planner extracts an interface-lossless brief from the original C and testbench context, the programmer generates candidate HLS-C, and the orchestrator invokes a four-stage Vitis HLS verifier with short-circuit semantics. On failure, the failure analyst constructs structured, localized evidence from tool logs, and coordinates iterative patching under strict isolation: only the current failing code, stage, compact evidence, and local window are visible to the LLM, preventing leakage from reference HLS or bug labels. Figure 2

Figure 2: The closed-loop C-to-HLS-C conversion, where the planner issues a brief, the programmer emits candidates, and the HLS verifier triggers repair cycles as needed.

A key architectural element is the prompt contract: initial generation admits only public source and interface, while repair prompts are constructed from failure evidence, patch scope, and must-preserve contract, preserving auditability and enforcing information discipline.

Progressive Mismatch Localization Chain (PMLC)

Cycle-level mismatches (e.g., CSim/CoSim failures) are notoriously non-local and hard to address due to the verbosity and lack of causal information in simulation logs. PMLC provides a hierarchical three-layer evidence chain:

  • Layer 1: Log normalization—extracts matched counts, first failing cycle, failed outputs.
  • Layer 2: AST backward slicing—localizes variables and lines related to failed outputs, defines merged suspect code regions, retains precision via bounded depth.
  • Layer 3: Dual-trace instrumentation—aligns probes in original C and candidate HLS-C to precisely identify the first-divergence cycle and faulty variable(s).

This structured evidence monotonically shrinks the repair space and grounds patches in runtime observations, avoiding the long-context drift and hallucinations characteristic of raw log prompting. Figure 3

Figure 3: The PMLC evidence chain compresses mismatch trace data, AST slices, and dual-trace alignment to a minimal suspect set for effective patch generation.

Empirical validation on mismatch-dense subsets demonstrates a four-stage all-pass uplift from 20.83% (strongest baseline) to 70.83%, confirming the advantage of structured localization.

MoE-Style Self-Evolving RAG for Repair Augmentation

RAG is deployed as a family-specific, typed-query retrieval system. Stage 1 hard-routes failures by stage, family, and mismatch flag to one of several expert buckets; stage 2 conducts exact matching on critical fields. Repair cards are admitted only after human-audited, reference-free chains, forming a self-evolving evidence base rather than static heuristics or tool manuals.

This MoE-inspired strategy ensures that family-aligned, verified hints are injected only when precise matching occurs, preventing spurious or generic rules from contaminating repair prompts. The approach cuts the average repair-iteration count from ~2.8 (baselines) to 1.577, efficiently targeting hard failure families. Figure 4

Figure 4: MoE RAG organizes repair hints in family-routed buckets; queries are typed, and retrieval is strictly conditional for grounding repair evidence.

Information Stratification and Auditability

A strict separation exists between prompt-facing evidence and artifact-only (audit) traces, enforced by well-defined schemas and hard isolation from reference leakage channels. Prompt evidence is restricted to brief, candidate code, stage, structured excerpt, and minimal code window. Evidence size is bounded and shrinks monotonically through PMLC, and leakage is precluded and auditable. Figure 5

Figure 5: Visualization of information stratification, showing prompt-facing evidence layers and forbidden leakage channels controlled by strict audit rules.

Empirical Results and Ablations

On CFull107, a benchmark of 107 functionally diverse designs, the agent workflow achieves an 87.85% four-stage all-pass (absolute gain +53.27% vs. best baseline), robust across reasoning backends (74.77–95.33%). The PMLC and MoE RAG concentrate gains on mismatch and synthesis-dense subsets; ablations show localization achieves 90–100% accuracy in real diagnostic suites. The approach is transferable: it outperforms the original metrics on ChatHLS HLSFixer612 and HLSTrans 17 apps, indicating broad applicability.

The workflow gain dominates model scaling; zero-shot prompting, even with system-level context, is insufficient (all-pass <30%). Control-heavy designs represent the main limitation, where data-flow localization loses efficacy.

Implications and Future Directions

The paper formalizes C-to-HLS-C conversion as an evidence-grounded, verifier-closed loop, establishing a principled basis for agentic repair systems in HLS. Practically, the approach enables robust, batch translation of software C to synthesizable C without reference solutions, tool-specific labels, or golden outputs. Theoretically, the evidence-chain approach provides a framework for information-limited, auditable repair, generalizable to other domains involving multi-stage verification and synthesis.

Extensions include control-flow-heavy fault localization, cross-toolchain adaptation, PPA-aware optimization, and further automated grounding of repair cards. The methodology also invites exploration of scalable audit chains and more nuanced role specialization in multi-agent reinforcement learning under resource and information constraints.

Conclusion

Evidence-driven, agentic workflows grounded in progressive mismatch localization and self-evolving RAG enable robust C-to-HLS-C conversion, substantially lifting four-stage all-pass rates and reducing repair effort. The formal isolation and audit discipline provide a template for trustworthy, verifiable program repair across electronic design automation pipelines. Limitations for control-centric designs and domain-generalization point to promising future research in agentic HLS and automated debugging.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 7 likes about this paper.