实现论文:MCP4EDA: 基于LLM的模型上下文协议RTL到GDSII自动化与后端感知综合优化
一个全面的模型上下文协议(MCP)服务器,提供电子设计自动化(EDA)工具集成,适用于像Claude Desktop和Cursor IDE这样的AI助手。此服务器通过统一接口使AI能够执行Verilog综合、仿真、ASIC设计流程以及波形分析。
https://github.com/user-attachments/assets/65d8027e-7366-49b5-8f11-0430c1d1d3d6
EDA MCP服务器演示,展示Verilog综合、仿真和ASIC设计流程
在使用此MCP服务器之前,您需要安装以下EDA工具:
macOS (Homebrew):
brew install yosys
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install yosys
从源码安装:
# 安装依赖项
sudo apt-get install build-essential clang bison flex \
libreadline-dev gawk tcl-dev libffi-dev git \
graphviz xdot pkg-config python3 libboost-system-dev \
libboost-python-dev libboost-filesystem-dev zlib1g-dev
# 克隆并构建
git clone https://github.com/YosysHQ/yosys.git
cd yosys
make -j$(nproc)
sudo make install
替代方案 - OSS CAD Suite (推荐): 从以下链接下载完整的工具链:https://github.com/YosysHQ/oss-cad-suite-build/releases
macOS (Homebrew):
brew install icarus-verilog
Ubuntu/Debian:
sudo apt-get install iverilog
Windows: 从以下链接下载安装程序:https://bleyer.org/icarus/
直接下载 (推荐):
brew install --cask gtkwavesudo apt-get install gtkwave其他安装方法:
# macOS (Homebrew)
brew install --cask gtkwave
# Ubuntu/Debian
sudo apt-get install gtkwave
# 从源码安装 (所有平台)
git clone https://github.com/gtkwave/gtkwave.git
cd gtkwave
meson setup build && cd build && meson install
直接下载:
brew install --cask docker安装步骤:
docker run hello-world注意: Docker Desktop 包含Docker引擎、Docker CLI和Docker Compose。
简单安装方法 (推荐):
# 使用pip安装OpenLane
pip install openlane
# 拉取Docker镜像
docker pull efabless/openlane:latest
# 验证安装
docker run hello-world
使用示例:
# 创建项目目录
mkdir -p ~/openlane-projects/my-design
cd ~/openlane-projects/my-design
# 创建Verilog文件 (计数器示例)
cat > counter.v << 'EOF'
module counter (
input wire clk,
input wire rst,
output reg [7:0] count
);
always @(posedge clk or posedge rst) begin
if (rst)
count <= 8'b0;
else
count <= count + 1;
end
endmodule
EOF
# 创建配置文件
cat > config.json << 'EOF'
{
"DESIGN_NAME": "counter",
"VERILOG_FILES": ["counter.v"],
"CLOCK_PORT": "clk",
"CLOCK_PERIOD": 10.0
}
EOF
# 运行RTL到GDSII流程
python3 -m openlane --dockerized config.json
关键优势:
--dockerized标志可自动处理所有工具依赖项直接下载 (推荐):
brew install --cask klayoutsudo apt install klayout其他安装方法:
# macOS (Homebrew)
brew install --cask klayout
# Ubuntu/Debian
sudo apt install klayout
git clone https://github.com/NellyW8/mcp-EDA
cd mcp-EDA
npm install
npm run build
npx tsc
mcp-EDA/
├── src/
│ └── index.ts # 主服务器代码
├── build/
│ └── index.js # 编译后的JavaScript
├── package.json
├── tsconfig.json
└── README.md
此方法使用Docker Desktop内置的MCP扩展,以获得最简单的设置体验。
安装Docker Desktop扩展:
配置Docker MCP连接:
这会自动配置Claude Desktop和Cursor IDE:
{
"mcpServers": {
"MCP_DOCKER": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"alpine/socat",
"STDIO",
"TCP:host.docker.internal:8811"
]
}
}
}
添加您的EDA MCP服务器:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"MCP_DOCKER": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"alpine/socat",
"STDIO",
"TCP:host.docker.internal:8811"
]
},
"eda-mcp": {
"command": "node",
"args": [
"/绝对路径/到/你的/eda-mcp-server/build/index.js"
],
"env": {
"PATH": "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
"HOME": "/你的家目录"
}
}
}
}
重启Claude Desktop 并在Settings > Developer中验证两个服务器是否都在运行。
打开Cursor设置:
Ctrl + Shift + P (Windows/Linux) 或 Cmd + Shift + P (macOS)添加MCP服务器: 点击“添加新的MCP服务器”并配置:
{
"mcpServers": {
"MCP_DOCKER": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"alpine/socat",
"STDIO",
"TCP:host.docker.internal:8811"
]
},
"eda-mcp": {
"command": "node",
"args": [
"/绝对路径/到/你的/eda-mcp-server/build/index.js"
],
"env": {
"PATH": "/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin",
"HOME": "/你的家目录"
}
}
}
}
启用MCP工具:
询问Claude: “能否将这个计数器模块综合到ice40 FPGA?”
module counter(
input clk,
input rst,
output [7:0] count
);
reg [7:0] count_reg;
assign count = count_reg;
always @(posedge clk or posedge rst) begin
if (rst)
count_reg <= 8'b0;
else
count_reg <= count_reg + 1;
end
endmodule
询问Claude: “请模拟这个加法器,并生成测试台”
// 设计
module adder(
input [3:0] a,
input [3:0] b,
output [4:0] sum
);
assign sum = a + b;
endmodule
// 测试台将自动生成或您可以提供一个
询问Claude: “运行这个设计的完整ASIC流程,时钟周期为10ns”
module simple_cpu(
input clk,
input rst,
input [7:0] data_in,
output [7:0] data_out
);
// 您的RTL设计在此处
endmodule
完成后您将得到:
runs/RUN_*/final/gds/design.gds - 最终GDSII布局runs/RUN_*/openlane.log - 完整执行日志runs/RUN_*/reports/ - 时序、面积、功耗分析报告询问Claude: “查看项目ID为abc123的仿真波形”
MCP服务器未检测到:
Docker权限错误:
sudo groupadd docker
sudo usermod -aG docker $USER
sudo reboot
工具未找到错误:
yosys --version, iverilog -V, gtkwave --version/opt/homebrew/binOpenLane超时:
GTKWave/KLayout GUI问题:
检查MCP服务器日志:
~/Library/Logs/Claude/mcp*.log (macOS)手动测试工具:
yosys -help
iverilog -help
docker run hello-world
gtkwave --version
klayout -v
验证Node.js环境:
node --version
npm --version
对于问题和疑问:
注意: 此MCP服务器需要本地安装EDA工具。该服务器作为AI助手与本地EDA工具链之间的桥梁,通过自然语言交互支持复杂的硬件设计工作流。
@misc{wang2025mcp4edallmpoweredmodelcontext,
title={MCP4EDA: 基于LLM的模型上下文协议RTL到GDSII自动化与后端感知综合优化},
author={Yiting Wang and Wanghao Ye and Yexiao He and Yiran Chen and Gang Qu and Ang Li},
year={2025},
eprint={2507.19570},
archivePrefix={arXiv},
primaryClass={cs.AR},
url={https://arxiv.org/abs/2507.19570},
}