superrtl 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. superrtl-0.2.0/.gitignore +55 -0
  2. superrtl-0.2.0/CHANGELOG.md +52 -0
  3. superrtl-0.2.0/LICENSE +21 -0
  4. superrtl-0.2.0/PKG-INFO +360 -0
  5. superrtl-0.2.0/docs/INSTALL.md +239 -0
  6. superrtl-0.2.0/docs/README.md +323 -0
  7. superrtl-0.2.0/pyproject.toml +84 -0
  8. superrtl-0.2.0/shared/skills/verilog_cdc.md +213 -0
  9. superrtl-0.2.0/shared/skills/verilog_combinational_logic.md +102 -0
  10. superrtl-0.2.0/shared/skills/verilog_fifo.md +58 -0
  11. superrtl-0.2.0/shared/skills/verilog_fifo_async.md +228 -0
  12. superrtl-0.2.0/shared/skills/verilog_fifo_sync.md +150 -0
  13. superrtl-0.2.0/shared/skills/verilog_fir_filter.md +146 -0
  14. superrtl-0.2.0/shared/skills/verilog_fsm.md +54 -0
  15. superrtl-0.2.0/shared/skills/verilog_fsm_design.md +189 -0
  16. superrtl-0.2.0/shared/skills/verilog_sequential_logic.md +143 -0
  17. superrtl-0.2.0/shared/templates/counter.v +18 -0
  18. superrtl-0.2.0/shared/templates/register.v +19 -0
  19. superrtl-0.2.0/src/superrtl/__init__.py +6 -0
  20. superrtl-0.2.0/src/superrtl/cli.py +203 -0
  21. superrtl-0.2.0/src/superrtl/resources/__init__.py +13 -0
  22. superrtl-0.2.0/src/superrtl/resources/skills.py +56 -0
  23. superrtl-0.2.0/src/superrtl/resources/templates.py +54 -0
  24. superrtl-0.2.0/src/superrtl/runtime.py +117 -0
  25. superrtl-0.2.0/src/superrtl/server.py +246 -0
  26. superrtl-0.2.0/src/superrtl/setup.py +217 -0
  27. superrtl-0.2.0/src/superrtl/tools/__init__.py +19 -0
  28. superrtl-0.2.0/src/superrtl/tools/compile.py +112 -0
  29. superrtl-0.2.0/src/superrtl/tools/lint.py +88 -0
  30. superrtl-0.2.0/src/superrtl/tools/simulate.py +113 -0
  31. superrtl-0.2.0/src/superrtl/tools/synthesize.py +112 -0
  32. superrtl-0.2.0/src/superrtl/tools/testbench.py +157 -0
  33. superrtl-0.2.0/src/superrtl/tools/waveform.py +158 -0
  34. superrtl-0.2.0/src/superrtl/utils/__init__.py +59 -0
  35. superrtl-0.2.0/src/superrtl/utils/verilog.py +29 -0
  36. superrtl-0.2.0/tests/test_cli.py +249 -0
  37. superrtl-0.2.0/tests/test_compile.py +125 -0
  38. superrtl-0.2.0/tests/test_error_handling.py +155 -0
  39. superrtl-0.2.0/tests/test_integration.py +410 -0
  40. superrtl-0.2.0/tests/test_resources.py +106 -0
  41. superrtl-0.2.0/tests/test_server.py +217 -0
  42. superrtl-0.2.0/tests/test_testbench.py +123 -0
  43. superrtl-0.2.0/tests/test_utils.py +128 -0
  44. superrtl-0.2.0/tests/test_waveform.py +123 -0
@@ -0,0 +1,55 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual Environment
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+ env/
28
+
29
+ # IDE
30
+ .vscode/
31
+ .idea/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+
36
+ # Testing
37
+ .pytest_cache/
38
+ .coverage
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+
43
+ # EDA Tools (installed by superrtl setup)
44
+ .superrtl/
45
+
46
+ # OS
47
+ .DS_Store
48
+ Thumbs.db
49
+
50
+ # Logs
51
+ *.log
52
+
53
+ # Temporary files
54
+ *.tmp
55
+ *.bak
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+ - GitHub Actions CI/CD pipeline
12
+ - PyPI publishing workflow
13
+
14
+ ## [0.2.0] - 2026-06-13
15
+
16
+ ### Added
17
+ - **Automatic EDA tool installation**: `superrtl setup` command downloads OSS CAD Suite
18
+ - **Docker support**: Complete Dockerfile with all EDA tools pre-installed
19
+ - **Runtime environment management**: Automatic PATH configuration for local tools
20
+ - **New CLI commands**: `setup`, `uninstall`, `check-tools`
21
+ - **Cross-platform support**: Windows, Linux, macOS
22
+ - **Comprehensive test suite**: 110 tests with 83% coverage
23
+
24
+ ### Changed
25
+ - Migrated from bare subprocess calls to `run_command` wrapper
26
+ - Updated MCP Server to use correct `@app.list_tools()` decorator API
27
+ - Improved error handling in all tool wrappers
28
+ - Updated testbench generator to handle modules without clock/reset
29
+
30
+ ### Fixed
31
+ - Windows DLL dependency issues with iverilog
32
+ - Unicode encoding issues in Windows console
33
+ - Import order and unused import warnings
34
+ - Resources path resolution for skills and templates
35
+
36
+ ## [0.1.0] - 2026-06-11
37
+
38
+ ### Added
39
+ - Initial release
40
+ - MCP Server with 6 tools
41
+ - CLI with 8 commands
42
+ - Verilog compilation (Icarus Verilog)
43
+ - Verilog simulation (Icarus Verilog + vvp)
44
+ - Lint checking (Verilator)
45
+ - Synthesis checking (Yosys)
46
+ - Testbench generation
47
+ - VCD waveform analysis
48
+ - Skills and templates resources
49
+
50
+ [Unreleased]: https://github.com/RTL-Agent/SuperRTL/compare/v0.2.0...HEAD
51
+ [0.2.0]: https://github.com/RTL-Agent/SuperRTL/compare/v0.1.0...v0.2.0
52
+ [0.1.0]: https://github.com/RTL-Agent/SuperRTL/releases/tag/v0.1.0
superrtl-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RTL-Agent Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,360 @@
1
+ Metadata-Version: 2.4
2
+ Name: superrtl
3
+ Version: 0.2.0
4
+ Summary: Verilog EDA 工具的 MCP/CLI 客户端 - 一键安装,开箱即用
5
+ Project-URL: Homepage, https://github.com/RTL-Agent/SuperRTL
6
+ Project-URL: Repository, https://github.com/RTL-Agent/SuperRTL
7
+ Project-URL: Documentation, https://github.com/RTL-Agent/SuperRTL#readme
8
+ Project-URL: Issues, https://github.com/RTL-Agent/SuperRTL/issues
9
+ Project-URL: Changelog, https://github.com/RTL-Agent/SuperRTL/blob/main/CHANGELOG.md
10
+ Author-email: RTL-Agent Team <team@rtl-agent.dev>
11
+ License: MIT
12
+ License-File: LICENSE
13
+ Keywords: eda,fpga,icarus,mcp,rtl,verilator,verilog,yosys
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
25
+ Classifier: Topic :: Software Development :: Build Tools
26
+ Classifier: Topic :: Software Development :: Testing
27
+ Requires-Python: >=3.10
28
+ Requires-Dist: click>=8.0.0
29
+ Requires-Dist: mcp>=1.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # SuperRTL
39
+
40
+ > Verilog EDA 工具的 MCP/CLI 客户端
41
+
42
+ ---
43
+
44
+ ## 概述
45
+
46
+ **SuperRTL** 将 Verilog EDA 工具链封装为标准 MCP 接口,支持:
47
+
48
+ - **MCP Server 模式**:被 Claude Desktop、Cursor、Hermes Agent 等调用
49
+ - **CLI 命令行模式**:独立使用,无需 MCP Host
50
+ - **自动安装工具**:首次运行时自动下载 EDA 工具,无需手动配置
51
+
52
+ ---
53
+
54
+ ## 核心功能
55
+
56
+ ### MCP Tools
57
+
58
+ | Tool | 命令 | 功能 | 依赖 |
59
+ |------|------|------|------|
60
+ | `compile_verilog` | `superrtl compile` | 编译 Verilog 代码 | Icarus Verilog |
61
+ | `simulate_verilog` | `superrtl simulate` | 运行仿真 | Icarus Verilog |
62
+ | `lint_verilog` | `superrtl lint` | Lint 检查 | Verilator |
63
+ | `synthesize_verilog` | `superrtl synthesize` | 综合检查 | Yosys |
64
+ | `generate_testbench` | `superrtl testbench` | 生成测试平台 | 内置 |
65
+ | `analyze_waveform` | `superrtl waveform` | 分析波形 | 内置 |
66
+
67
+ ### MCP Resources
68
+
69
+ | Resource | 功能 |
70
+ |----------|------|
71
+ | `skills://{name}` | 获取设计模式文档 |
72
+ | `templates://{name}` | 获取代码模板 |
73
+
74
+ ---
75
+
76
+ ## 快速开始
77
+
78
+ ### 安装 SuperRTL
79
+
80
+ ```bash
81
+ # 从源码安装
82
+ cd SuperRTL
83
+ pip install -e .
84
+
85
+ # 或从 PyPI (发布后)
86
+ pip install superrtl
87
+ ```
88
+
89
+ ### 安装 EDA 工具
90
+
91
+ **方式一:自动安装(推荐)**
92
+
93
+ ```bash
94
+ # 自动下载并安装 EDA 工具
95
+ superrtl setup
96
+ ```
97
+
98
+ 这会自动下载 [OSS CAD Suite](https://github.com/YosysHQ/oss-cad-suite-build) 并安装到项目目录 `.superrtl/`。
99
+
100
+ **方式二:手动安装**
101
+
102
+ ```bash
103
+ # Ubuntu/Debian
104
+ sudo apt-get install iverilog yosys verilator
105
+
106
+ # macOS
107
+ brew install icarus-verilog yosys verilator
108
+
109
+ # Windows (Scoop)
110
+ scoop install iverilog yosys verilator
111
+ ```
112
+
113
+ ### 验证安装
114
+
115
+ ```bash
116
+ # 检查工具状态
117
+ superrtl check-tools
118
+ ```
119
+
120
+ 输出示例:
121
+ ```
122
+ EDA 工具状态
123
+
124
+ + iverilog: Icarus Verilog (编译仿真)
125
+ + vvp: Icarus Verilog (仿真器)
126
+ + yosys: Yosys (综合检查)
127
+ + verilator: Verilator (Lint)
128
+
129
+ 所有工具已安装
130
+ ```
131
+
132
+ ### 使用 CLI
133
+
134
+ ```bash
135
+ # 编译
136
+ superrtl compile design.v
137
+
138
+ # 仿真
139
+ superrtl simulate design.v testbench.v
140
+
141
+ # Lint
142
+ superrtl lint design.v
143
+
144
+ # 综合
145
+ superrtl synthesize design.v --top counter
146
+
147
+ # 生成 Testbench
148
+ superrtl testbench design.v
149
+
150
+ # 分析波形
151
+ superrtl waveform simulation.vcd
152
+ ```
153
+
154
+ ### 使用 MCP Server
155
+
156
+ ```bash
157
+ # 启动 MCP Server
158
+ superrtl mcp
159
+
160
+ # 指定传输方式
161
+ superrtl mcp --transport sse --port 8080
162
+ ```
163
+
164
+ ### 配置 MCP Host
165
+
166
+ **Claude Desktop** (`~/.claude/claude_desktop_config.json`):
167
+ ```json
168
+ {
169
+ "mcpServers": {
170
+ "superrtl": {
171
+ "command": "superrtl",
172
+ "args": ["mcp"]
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ **Cursor** (`.cursor/mcp.json`):
179
+ ```json
180
+ {
181
+ "mcpServers": {
182
+ "superrtl": {
183
+ "command": "superrtl",
184
+ "args": ["mcp"]
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Docker 支持
193
+
194
+ ### 构建镜像
195
+
196
+ ```bash
197
+ # 构建 Docker 镜像
198
+ docker build -t superrtl .
199
+ ```
200
+
201
+ ### 使用 Docker
202
+
203
+ ```bash
204
+ # 启动 MCP Server
205
+ docker run -it superrtl
206
+
207
+ # 挂载目录使用 CLI
208
+ docker run -v $(pwd):/workspace -it superrtl compile /workspace/design.v
209
+
210
+ # 交互式使用
211
+ docker run -it -v $(pwd):/workspace superrtl bash
212
+ ```
213
+
214
+ ---
215
+
216
+ ## CLI 命令
217
+
218
+ | 命令 | 说明 |
219
+ |------|------|
220
+ | `superrtl setup` | 安装 EDA 工具 |
221
+ | `superrtl check-tools` | 检查工具状态 |
222
+ | `superrtl compile <file>` | 编译 Verilog 代码 |
223
+ | `superrtl simulate <design> <testbench>` | 运行仿真 |
224
+ | `superrtl lint <file>` | Lint 检查 |
225
+ | `superrtl synthesize <file>` | 综合检查 |
226
+ | `superrtl testbench <file>` | 生成 Testbench |
227
+ | `superrtl waveform <file>` | 分析波形 |
228
+ | `superrtl mcp` | 启动 MCP Server |
229
+ | `superrtl uninstall` | 卸载 EDA 工具 |
230
+
231
+ ---
232
+
233
+ ## 技术栈
234
+
235
+ | 组件 | 选型 | 版本 |
236
+ |------|------|------|
237
+ | 语言 | Python | 3.10+ |
238
+ | MCP 协议 | mcp | >=1.0.0 |
239
+ | CLI 框架 | click | >=8.0.0 |
240
+ | 终端美化 | rich | >=13.0.0 |
241
+ | EDA 工具 | OSS CAD Suite | 2026.06 |
242
+
243
+ ---
244
+
245
+ ## 项目结构
246
+
247
+ ```
248
+ SuperRTL/
249
+ ├── src/superrtl/
250
+ │ ├── __init__.py
251
+ │ ├── server.py # MCP Server 主入口
252
+ │ ├── cli.py # CLI 入口
253
+ │ ├── setup.py # EDA 工具安装管理
254
+ │ ├── runtime.py # 运行时环境管理
255
+ │ │
256
+ │ ├── tools/ # MCP Tools
257
+ │ │ ├── compile.py
258
+ │ │ ├── simulate.py
259
+ │ │ ├── lint.py
260
+ │ │ ├── synthesize.py
261
+ │ │ ├── testbench.py
262
+ │ │ └── waveform.py
263
+ │ │
264
+ │ ├── resources/ # MCP Resources
265
+ │ │ ├── skills.py
266
+ │ │ └── templates.py
267
+ │ │
268
+ │ └── utils/
269
+ │ ├── __init__.py # run_command
270
+ │ └── verilog.py
271
+
272
+ ├── shared/ # 共享资源
273
+ │ ├── skills/ # 设计模式文档
274
+ │ └── templates/ # 代码模板
275
+
276
+ ├── .superrtl/ # EDA 工具安装目录(自动生成)
277
+ │ └── oss-cad-suite/
278
+ │ ├── bin/
279
+ │ └── lib/
280
+
281
+ ├── Dockerfile # Docker 镜像
282
+ ├── tests/
283
+ ├── examples/
284
+ └── pyproject.toml
285
+ ```
286
+
287
+ ---
288
+
289
+ ## 工作原理
290
+
291
+ ### 自动安装
292
+
293
+ 1. 运行 `superrtl setup`
294
+ 2. 检测操作系统和架构
295
+ 3. 从 GitHub 下载对应的 OSS CAD Suite
296
+ 4. 解压到 `.superrtl/oss-cad-suite/`
297
+ 5. 运行时自动添加到 PATH
298
+
299
+ ### 运行时
300
+
301
+ 1. 工具调用时自动检测本地安装
302
+ 2. 优先使用 `.superrtl/oss-cad-suite/bin/` 中的工具
303
+ 3. 回退到系统 PATH
304
+ 4. 自动处理 Windows DLL 依赖问题
305
+
306
+ ---
307
+
308
+ ## 示例
309
+
310
+ ### CLI 示例
311
+
312
+ ```bash
313
+ # 编译并仿真
314
+ $ superrtl compile counter.v
315
+ [OK] 编译成功: counter
316
+ 耗时: 0.058s
317
+
318
+ $ superrtl simulate counter.v counter_tb.v
319
+ [OK] 仿真通过
320
+ 耗时: 0.456s
321
+ 输出: PASS
322
+ ```
323
+
324
+ ### MCP 调用示例
325
+
326
+ ```json
327
+ // tools/call
328
+ {
329
+ "name": "compile_verilog",
330
+ "arguments": {
331
+ "code": "module counter(...); ...",
332
+ "top_module": "counter"
333
+ }
334
+ }
335
+
336
+ // 返回
337
+ {
338
+ "content": [
339
+ {
340
+ "type": "text",
341
+ "text": "{\"success\": true, \"message\": \"编译成功\"}"
342
+ }
343
+ ]
344
+ }
345
+ ```
346
+
347
+ ---
348
+
349
+ ## 许可证
350
+
351
+ MIT License
352
+
353
+ ---
354
+
355
+ ## 致谢
356
+
357
+ - [Icarus Verilog](https://github.com/steveicarus/iverilog)
358
+ - [Yosys](https://github.com/YosysHQ/yosys)
359
+ - [Verilator](https://github.com/verilator/verilator)
360
+ - [OSS CAD Suite](https://github.com/YosysHQ/oss-cad-suite-build)
@@ -0,0 +1,239 @@
1
+ # SuperRTL 安装指南
2
+
3
+ ---
4
+
5
+ ## 一、系统要求
6
+
7
+ | 项目 | 要求 |
8
+ |------|------|
9
+ | Python | 3.10+ |
10
+ | 操作系统 | Windows / macOS / Linux |
11
+
12
+ ---
13
+
14
+ ## 二、安装 SuperRTL
15
+
16
+ ### 从源码安装
17
+
18
+ ```bash
19
+ cd SuperRTL
20
+ pip install -e .
21
+ ```
22
+
23
+ ### 验证安装
24
+
25
+ ```bash
26
+ superrtl --version
27
+ ```
28
+
29
+ ---
30
+
31
+ ## 三、安装 EDA 工具
32
+
33
+ ### Windows (使用 Scoop)
34
+
35
+ [Scoop](https://scoop.sh/) 是 Windows 下的包管理器,推荐使用。
36
+
37
+ #### 1. 安装 Scoop
38
+
39
+ ```powershell
40
+ # 打开 PowerShell,执行:
41
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
42
+ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
43
+ ```
44
+
45
+ #### 2. 添加 Bucket
46
+
47
+ ```powershell
48
+ # 添加主 bucket
49
+ scoop bucket add main
50
+
51
+ # 添加 extras bucket (包含更多工具)
52
+ scoop bucket add extras
53
+ ```
54
+
55
+ #### 3. 安装 Verilog 工具
56
+
57
+ ```powershell
58
+ # 安装 Icarus Verilog (编译仿真)
59
+ scoop install main/iverilog
60
+
61
+ # 安装 Yosys (综合检查)
62
+ scoop install main/yosys
63
+
64
+ # 安装 Verilator (Lint)
65
+ scoop install main/verilator
66
+ ```
67
+
68
+ #### 4. 验证安装
69
+
70
+ ```powershell
71
+ # 检查版本
72
+ iverilog -V
73
+ yosys -V
74
+ verilator --version
75
+ ```
76
+
77
+ #### 5. 常见问题
78
+
79
+ **问题:scoop 找不到包**
80
+
81
+ ```powershell
82
+ # 更新 scoop
83
+ scoop update
84
+
85
+ # 搜索包
86
+ scoop search iverilog
87
+ scoop search yosys
88
+ scoop search verilator
89
+ ```
90
+
91
+ **问题:iverilog 安装后命令不可用**
92
+
93
+ ```powershell
94
+ # 检查 PATH
95
+ echo $env:PATH
96
+
97
+ # 手动添加 PATH
98
+ scoop prefix iverilog
99
+ # 将输出的路径添加到 PATH
100
+ ```
101
+
102
+ **问题:yosys 安装失败**
103
+
104
+ ```powershell
105
+ # 尝试从 extras 安装
106
+ scoop install extras/yosys
107
+
108
+ # 或者从 GitHub 下载
109
+ # https://github.com/YosysHQ/yosys/releases
110
+ ```
111
+
112
+ ---
113
+
114
+ ### macOS (使用 Homebrew)
115
+
116
+ ```bash
117
+ # 安装 Homebrew (如果没有)
118
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
119
+
120
+ # 安装工具
121
+ brew install icarus-verilog
122
+ brew install yosys
123
+ brew install verilator
124
+
125
+ # 验证
126
+ iverilog -V
127
+ yosys -V
128
+ verilator --version
129
+ ```
130
+
131
+ ---
132
+
133
+ ### Linux (Ubuntu/Debian)
134
+
135
+ ```bash
136
+ # 更新包列表
137
+ sudo apt-get update
138
+
139
+ # 安装工具
140
+ sudo apt-get install -y iverilog
141
+ sudo apt-get install -y yosys
142
+ sudo apt-get install -y verilator
143
+
144
+ # 验证
145
+ iverilog -V
146
+ yosys -V
147
+ verilator --version
148
+ ```
149
+
150
+ ---
151
+
152
+ ## 四、安装 MCP Host (可选)
153
+
154
+ ### Claude Desktop
155
+
156
+ 1. 下载: https://claude.ai/download
157
+ 2. 配置 MCP Server:
158
+
159
+ 编辑 `~/.claude/claude_desktop_config.json`:
160
+
161
+ ```json
162
+ {
163
+ "mcpServers": {
164
+ "superrtl": {
165
+ "command": "superrtl",
166
+ "args": ["mcp"]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ ### Cursor
173
+
174
+ 1. 下载: https://cursor.sh/
175
+ 2. 配置 MCP Server:
176
+
177
+ 创建 `.cursor/mcp.json`:
178
+
179
+ ```json
180
+ {
181
+ "mcpServers": {
182
+ "superrtl": {
183
+ "command": "superrtl",
184
+ "args": ["mcp"]
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## 五、验证完整安装
193
+
194
+ ```bash
195
+ # 1. 检查 SuperRTL
196
+ superrtl --version
197
+
198
+ # 2. 检查 EDA 工具
199
+ superrtl check-tools
200
+
201
+ # 3. 测试编译
202
+ echo 'module test(input clk, output reg [3:0] cnt); always @(posedge clk) cnt <= cnt + 1; endmodule' > test.v
203
+ superrtl compile test.v
204
+
205
+ # 4. 启动 MCP Server
206
+ superrtl mcp
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 六、卸载
212
+
213
+ ### 卸载 SuperRTL
214
+
215
+ ```bash
216
+ pip uninstall superrtl
217
+ ```
218
+
219
+ ### 卸载 EDA 工具 (Windows Scoop)
220
+
221
+ ```powershell
222
+ scoop uninstall iverilog
223
+ scoop uninstall yosys
224
+ scoop uninstall verilator
225
+ ```
226
+
227
+ ### 卸载 EDA 工具 (macOS)
228
+
229
+ ```bash
230
+ brew uninstall icarus-verilog
231
+ brew uninstall yosys
232
+ brew uninstall verilator
233
+ ```
234
+
235
+ ### 卸载 EDA 工具 (Linux)
236
+
237
+ ```bash
238
+ sudo apt-get remove iverilog yosys verilator
239
+ ```