AutoFSM: A Multi-agent Framework for FSM Code Generation with IR and SystemC-Based Testing

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Luo, Qiuming, Lei, Yanming, Wu, Kunzhong, Cao, Yixuan, Liu, Chengjian
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866917141736849408
author Luo, Qiuming
Lei, Yanming
Wu, Kunzhong
Cao, Yixuan
Liu, Chengjian
author_facet Luo, Qiuming
Lei, Yanming
Wu, Kunzhong
Cao, Yixuan
Liu, Chengjian
contents With the rapid advancement of large language models (LLMs) in code generation, their applications in hardware design are receiving growing attention. However, existing LLMs face several challenges when generating Verilog code for finite state machine (FSM) control logic, including frequent syntax errors, low debugging efficiency, and heavy reliance on test benchmarks. To address these challenges, this paper proposes AutoFSM, a multi-agent collaborative framework designed for FSM code generation tasks. AutoFSM introduces a structurally clear intermediate representation (IR) to reduce syntax error rate during code generation and provides a supporting toolchain to enable automatic translation from IR to Verilog. Furthermore, AutoFSM is the first to integrate SystemC-based modeling with automatic testbench generation, thereby improving debugging efficiency and feedback quality. To systematically evaluate the framework's performance, we construct SKT-FSM, the first hierarchical FSM benchmark in the field, comprising 67 FSM samples across different complexity levels. Experimental results show that, under the same base LLM, AutoFSM consistently outperforms the open-source framework MAGE on the SKT-FSM benchmark, achieving up to an 11.94% improvement in pass rate and up to a 17.62% reduction in syntax error rate. These results demonstrate the potential of combining LLMs with structured IR and automated testing to improve the reliability and scalability of register-transfer level (RTL) code generation.
format Preprint
id arxiv_https___arxiv_org_abs_2512_11398
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle AutoFSM: A Multi-agent Framework for FSM Code Generation with IR and SystemC-Based Testing
Luo, Qiuming
Lei, Yanming
Wu, Kunzhong
Cao, Yixuan
Liu, Chengjian
Software Engineering
Multiagent Systems
With the rapid advancement of large language models (LLMs) in code generation, their applications in hardware design are receiving growing attention. However, existing LLMs face several challenges when generating Verilog code for finite state machine (FSM) control logic, including frequent syntax errors, low debugging efficiency, and heavy reliance on test benchmarks. To address these challenges, this paper proposes AutoFSM, a multi-agent collaborative framework designed for FSM code generation tasks. AutoFSM introduces a structurally clear intermediate representation (IR) to reduce syntax error rate during code generation and provides a supporting toolchain to enable automatic translation from IR to Verilog. Furthermore, AutoFSM is the first to integrate SystemC-based modeling with automatic testbench generation, thereby improving debugging efficiency and feedback quality. To systematically evaluate the framework's performance, we construct SKT-FSM, the first hierarchical FSM benchmark in the field, comprising 67 FSM samples across different complexity levels. Experimental results show that, under the same base LLM, AutoFSM consistently outperforms the open-source framework MAGE on the SKT-FSM benchmark, achieving up to an 11.94% improvement in pass rate and up to a 17.62% reduction in syntax error rate. These results demonstrate the potential of combining LLMs with structured IR and automated testing to improve the reliability and scalability of register-transfer level (RTL) code generation.
title AutoFSM: A Multi-agent Framework for FSM Code Generation with IR and SystemC-Based Testing
topic Software Engineering
Multiagent Systems
url https://arxiv.org/abs/2512.11398