返回市场
麦普-EDA

麦普-EDA

作者:NellyW845 星标更新:2025-07-29

项目介绍

EDA 工具 MCP 服务器

实现论文: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设计流程

特性

  • Verilog 综合:使用Yosys对各种FPGA目标(通用、ice40、xilinx)进行Verilog代码综合
  • Verilog 仿真:使用Icarus Verilog进行设计仿真,并自动执行测试台
  • 波形查看:启动GTKWave以可视化VCD文件并分析信号
  • ASIC 设计流程:使用OpenLane完成从RTL到GDSII的全流程,并集成Docker
  • 布局查看:在KLayout中打开GDSII文件以检查物理设计
  • 报告分析:读取并分析OpenLane报告,评估PPA指标和设计质量

预备条件

在使用此MCP服务器之前,您需要安装以下EDA工具:

1. Yosys (Verilog 综合)

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

2. Icarus Verilog (仿真)

macOS (Homebrew):

brew install icarus-verilog

Ubuntu/Debian:

sudo apt-get install iverilog

Windows: 从以下链接下载安装程序:https://bleyer.org/icarus/

3. GTKWave (波形查看器)

直接下载 (推荐):

  • Windows:SourceForge下载
  • macOS:SourceForge下载或使用Homebrew: brew install --cask gtkwave
  • Linux:SourceForge下载或使用包管理器: sudo 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

4. Docker Desktop (推荐用于OpenLane)

直接下载:

安装步骤:

  1. 从官方网站下载并安装Docker Desktop
  2. 启动Docker Desktop并确保其正在运行
  3. 验证安装: docker run hello-world

注意: Docker Desktop 包含Docker引擎、Docker CLI和Docker Compose。

5. OpenLane (ASIC 设计流程)

简单安装方法 (推荐):

# 使用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标志可自动处理所有工具依赖项

6. KLayout (布局查看器)

直接下载 (推荐):

其他安装方法:

# macOS (Homebrew)
brew install --cask klayout

# Ubuntu/Debian
sudo apt install klayout

安装

1. 克隆并构建MCP服务器

git clone https://github.com/NellyW8/mcp-EDA
cd mcp-EDA
npm install
npm run build
npx tsc   

2. 项目结构

mcp-EDA/
├── src/
│   └── index.ts          # 主服务器代码
├── build/
│   └── index.js          # 编译后的JavaScript
├── package.json
├── tsconfig.json
└── README.md

配置

Docker Desktop MCP集成

此方法使用Docker Desktop内置的MCP扩展,以获得最简单的设置体验。

预备条件

  • 已安装并运行Docker Desktop 4.39.0+
  • 已安装Claude Desktop

设置步骤

  1. 安装Docker Desktop扩展:

    • 启动Docker Desktop
    • 从左侧菜单选择“扩展”
    • 搜索“AI Tools”或“Docker MCP Toolkit”
    • 安装“Labs: AI Tools for Devs”扩展
  2. 配置Docker MCP连接:

    • 打开已安装的“Labs: AI Tools for Devs”扩展
    • 点击右上角的齿轮图标
    • 选择“MCP Clients”标签
    • 对于“Claude Desktop”或“Cursor IDE”,点击“Connect”
    <img src="assets/docker.png" alt="Docker 设置" width="700">

    这会自动配置Claude Desktop和Cursor IDE:

    {
      "mcpServers": {
        "MCP_DOCKER": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "alpine/socat",
            "STDIO",
            "TCP:host.docker.internal:8811"
          ]
        }
      }
    }
    

Cursor IDE 设置

  1. 添加您的EDA MCP服务器:

    • 找到Claude Desktop配置文件,Settings > Developer > Edit Config:
      • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
      • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • 将您的EDA服务器添加到现有配置中:
    {
      "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": "/你的家目录"
          }
        }
      }
    }
    
  2. 重启Claude Desktop 并在Settings > Developer中验证两个服务器是否都在运行。

Cursor IDE 设置

  1. 打开Cursor设置:

    • Ctrl + Shift + P (Windows/Linux) 或 Cmd + Shift + P (macOS)
    • 搜索“Cursor Settings”
    • 导航到侧边栏中的“MCP”
  2. 添加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": "/你的家目录"
          }
        }
      }
    }
    
  3. 启用MCP工具:

    • 转到Cursor设置 → MCP
    • 启用“eda-mcp”服务器
    • 您应该看到服务器状态变为“已连接”

使用示例

1. Verilog 综合

询问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

2. Verilog 仿真

询问Claude: “请模拟这个加法器,并生成测试台”

// 设计
module adder(
    input [3:0] a,
    input [3:0] b,
    output [4:0] sum
);
    assign sum = a + b;
endmodule

// 测试台将自动生成或您可以提供一个

3. ASIC 设计流程

询问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/ - 时序、面积、功耗分析报告
  • 所有中间结果 (DEF文件、网表等)

4. 波形分析

询问Claude: “查看项目ID为abc123的仿真波形”

故障排除

常见问题

  1. MCP服务器未检测到:

    • 验证配置中的绝对路径
    • 检查Node.js是否已安装且可访问
    • 在配置更改后重启Claude Desktop/Cursor
  2. Docker权限错误:

    sudo groupadd docker
    sudo usermod -aG docker $USER
    sudo reboot
    
  3. 工具未找到错误:

    • 验证工具是否已安装: yosys --version, iverilog -V, gtkwave --version
    • 检查MCP配置中的PATH环境变量
    • 在macOS上,确保Homebrew路径包含: /opt/homebrew/bin
  4. OpenLane超时:

    • 服务器对OpenLane流程有10分钟的超时限制
    • 对于复杂的设计,考虑简化或分多次迭代运行
  5. GTKWave/KLayout GUI问题:

    • 在macOS上: GTKWave/KLayout可能需要在安全与隐私设置中手动批准
    • 在Linux上: 如果使用远程系统,请确保X11转发正常工作
    • 在Windows上: 确保可以从命令行启动GUI应用程序

调试

  1. 检查MCP服务器日志:

    • Claude Desktop: ~/Library/Logs/Claude/mcp*.log (macOS)
    • Cursor: 在MCP设置面板中检查错误消息
  2. 手动测试工具:

    yosys -help
    iverilog -help
    docker run hello-world
    gtkwave --version
    klayout -v
    
  3. 验证Node.js环境:

    node --version
    npm --version
    

支持

对于问题和疑问:

  • 查看上面的故障排除部分
  • 查阅MCP服务器日志
  • 手动测试各个工具
  • 提交详细错误信息和环境信息的问题

注意: 此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}, 
}