feat(designwithppa): add automated environment install script scripts/install_env.sh downloads and installs the plugin external toolchain on Ubuntu (apt) and macOS (Homebrew), pinned to the README versions: yosys v0.68 and OpenSTA >= 3.1.0 built from source, Temurin JDK 17 installed to ~/.local/share/ucagent-toolchains/jdk-17, the Mill 0.4.2 launcher installed to ~/.local/bin, and a Mill warm-up that pre-resolves the pinned Chisel 7.15.0 / Scala 2.13.18 toolchain. Already-satisfying installations are detected and skipped, Ubuntu 22.04 cmake/swig shortfalls are upgraded automatically, and –with-picker optionally builds picker together with a Verilator = 5.020. The README dependency section documents the script usage.
feat(designwithppa): add automated environment install script
scripts/install_env.sh downloads and installs the plugin external toolchain on Ubuntu (apt) and macOS (Homebrew), pinned to the README versions: yosys v0.68 and OpenSTA >= 3.1.0 built from source, Temurin JDK 17 installed to ~/.local/share/ucagent-toolchains/jdk-17, the Mill 0.4.2 launcher installed to ~/.local/bin, and a Mill warm-up that pre-resolves the pinned Chisel 7.15.0 / Scala 2.13.18 toolchain. Already-satisfying installations are detected and skipped, Ubuntu 22.04 cmake/swig shortfalls are upgraded automatically, and –with-picker optionally builds picker together with a Verilator
= 5.020. The README dependency section documents the script usage.
基于大模型进行自动化 UT 验证 AI 代理
English Introduction | UCAgent 在线文档
UCAgent 是一个基于大语言模型的自动化硬件验证 AI 代理,专注于芯片设计的单元测试(Unit Test)验证工作。通过 AI 技术自动分析硬件设计,生成测试用例,执行验证任务并生成测试报告,从而提高验证效率。
核心特点:
更多详细介绍请参考 UCAgent 在线文档
[!TIP] RISC-V Summit Europe 2026 上 UCAgent workshop 的幻灯片、代码和环境已经全部开源在官方仓库中:https://github.com/XS-MLVP/tutorial-records
git clone https://github.com/XS-MLVP/UCAgent.git cd UCAgent
pip3 install -r requirements.txt
请参考 https://opencode.ai/ 安装opencode。 其他 Code Agent 请参考对应文档,例如 claude code, copilot-cli, kilo-cli, iflow, qwen-code 等。
export OPENAI_MODEL=<model_name> # 例如 glm-5.3-flash export OPENAI_API_KEY=<your_key> # API key export OPENAI_API_BASE=<base_url> # 例如智谱的 https://open.bigmodel.cn/api/coding/paas/v4 export OPENAI_CONTEXT_SIZE=<max_context_size> # 可选,例如 819200 (800k上下文) export OPENAI_OUTPUT_SIZE=<max_output_size> # 可选,例如 131072 (128k最大输出)
也可以把上述内容写入 ~/.ucagent_env,然后:
~/.ucagent_env
source ~/.ucagent_env
以 example 中的 Adder 为例。
# backend can be: langchain, claude, opencode, copilot, kilo, qwen, iflow, etc. make mcp_Adder ARGS="--loop --backend=opencode"
该命令会创建工作目录、启动 MCP Server,并自动调用 opencode 执行验证任务;opencode 使用的模型即上一步配置的 LLM API。
已经支持的后端请参考 ucagent/setting.yaml 中的backend部分。
backend
💡 更多使用方式: 除了本快速开始的 MCP 协同模式,UCAgent 还支持直接接入 LLM、人机协同等多种模式,详见 使用文档
默认情况下,UCAgent只是启用内部的Python Checker进行阶段结果检查,属于启发式。如果需要验证质量提升,可以引入 LLM 阶段结果检查,如果需要达到“交付级”质量,还需要进一步引入人工阶段检查。
Python Checker
LLM 阶段结果检查
人工阶段检查
开启LLM阶段结果检查
开启人工阶段结果检查
阶段默认检查顺序:Python Checker -> LLM -> 人工
如果验证结果需要交付,建议:
make formal_mcp_Adder ARGS="--loop --backend=opencode"
UCAgent提供了Master模式,基于它可以通过Web界面进行Agent集中管理、创建任务、查看状态、在线终端等操作。
环境变量与快速开始的配置 LLM API一节相同(OPENAI_MODEL、OPENAI_API_KEY、OPENAI_API_BASE 等)。若已持久化到 ~/.ucagent_env,启动前加载即可:
OPENAI_MODEL
OPENAI_API_KEY
OPENAI_API_BASE
make as_master_persist # 或者,如果安装了ucagent,也可以直接运行ucagent启动master模式 ucagent --as-master-persist --as-master
然后在浏览器中访问 http://localhost:8800 即可。
http://localhost:8800
容器启动时通过 -e 传入相同的 LLM API 环境变量:
-e
docker run -it --rm \ -e OPENAI_API_BASE=<your_openai_api_base> \ -e OPENAI_API_KEY=<your_openai_api_key> \ -e OPENAI_MODEL=<your_openai_model> \ -p 8800:8800 \ ghcr.io/xs-mlvp/ucagent:latest ucagent --as-master-persist --as-master
如果 ghcr.io 无法访问,可以直接替换其为 ghcr.nju.edu.cn 等镜像地址。
ghcr.nju.edu.cn
启动成功后,在浏览器中访问 http://localhost:8800 即可。
+
📖 详细操作说明: 查看 TUI 使用文档
ctrl + 上/下/左/右
ctrl + h/j/k/l
ctrl + c
ctrl + t
ctrl + /
f1
shift + 右
shift + 左
tab
pageup / pagedown
esc
白色
红色
绿色
*
hmcheck_pass [msg]
黄色
q
tui
tool_list
help
loop [prompt]
Q: 如何配置不同的 AI 模型?
A: 在 config.yaml 中修改 openai.model_name 字段,支持任何 OpenAI 兼容的 API。详见配置文档。
config.yaml
openai.model_name
Q: 验证过程中出现错误怎么办?
A: 使用 Ctrl+C 进入交互模式,通过 status 查看当前状态,使用 help 获取调试命令。
Ctrl+C
status
Q: MCP 服务器无法连接?
A: 检查端口是否被占用,确认防火墙设置,可以通过 --mcp-server-port 指定其他端口。
--mcp-server-port
Q: 为何有上次执行信息残留?
A: UCAgent 默认会从工作目录中查找 .ucagent/ucagent_info.json 文件,来加载上次执行信息接着执行。如果不需要历史信息,请删除该文件或者使用参数 --no-history 忽略加载历史。
.ucagent/ucagent_info.json
--no-history
Q: 如何运行长时间验证?
A: 请参考 CodeAgent 的自定义后端 examples/CustomBackend/README.md。
Q: 可以自定义验证阶段吗?
A: 可以,详见自定义文档。
Q: 如何添加自定义工具?
A: 在 ucagent/tools/ 目录下创建新的工具类,继承 UCTool 基类,并通过 --ex-tools 参数加载。详见工具列表文档。
ucagent/tools/
UCTool
--ex-tools
🔍 更多问题: 查看完整 FAQ 文档
Makefile 提供文档相关辅助目标(MkDocs + Material):
make docs-help
make docs-install
docs/requirements-docs.txt
make docs-serve
make docs-build
docs/site
make docs-clean
第一次使用(安装依赖):
make docs-install # 安装 mkdocs 和 material 主题等依赖
日常开发(预览文档):
make docs-serve # 启动本地服务器,访问 http://127.0.0.1:8030 查看 # 修改文档后浏览器会自动刷新
本地生成和查看(构建生产版本):
make docs-build # 生成静态网站到 docs/site 目录 # 在本地浏览器中打开 docs/site/index.html 查看 make docs-clean # 清理构建产物(可选)
# 1. 首次设置:安装依赖 make docs-install # 2. 开发阶段:预览文档(可反复执行) make docs-serve # 在浏览器中访问 http://127.0.0.1:8030 # ...编辑文档... # 按 Ctrl+C 停止服务 # 3. 本地生成:构建生产版本 make docs-build # 生成 docs/site 目录 # 在本地浏览器中打开 docs/site/index.html 查看 # 4. 清理(可选) make docs-clean # 删除 docs/site 目录
docs/Makefile
用于生成较高排版质量开发者 PDF 手册:
make pdf
ucagent-doc.pdf
make pdf-one
pdf
make pdf-clean
make pdf make MONO="JetBrains Mono" pdf # 覆盖等宽字体 make TWOSIDE=1 pdf # 双面排版(文件名添加 -twoside) make pdf-clean
pandoc-crossref
MONO
TWOSIDE
fonts-noto-cjk
texlive-full
输出:ucagent-doc.pdf 可随版本发布分发。
欢迎提交 Issue 和 Pull Request!
UnityChip Verification AI-Agent
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
UCAgent(UnityChip verification Agent)
基于大模型进行自动化 UT 验证 AI 代理
English Introduction | UCAgent 在线文档
项目简介
UCAgent 是一个基于大语言模型的自动化硬件验证 AI 代理,专注于芯片设计的单元测试(Unit Test)验证工作。通过 AI 技术自动分析硬件设计,生成测试用例,执行验证任务并生成测试报告,从而提高验证效率。
核心特点:
更多详细介绍请参考 UCAgent 在线文档
系统要求
快速开始
1. 下载源码
2. 安装依赖
3. 安装 OpenCode
请参考 https://opencode.ai/ 安装opencode。 其他 Code Agent 请参考对应文档,例如 claude code, copilot-cli, kilo-cli, iflow, qwen-code 等。
4. 配置 LLM API
也可以把上述内容写入
~/.ucagent_env,然后:5. 开始验证
以 example 中的 Adder 为例。
该命令会创建工作目录、启动 MCP Server,并自动调用 opencode 执行验证任务;opencode 使用的模型即上一步配置的 LLM API。
已经支持的后端请参考 ucagent/setting.yaml 中的
backend部分。6. 如何提升验证质量(可选)
默认情况下,UCAgent只是启用内部的
Python Checker进行阶段结果检查,属于启发式。如果需要验证质量提升,可以引入LLM 阶段结果检查,如果需要达到“交付级”质量,还需要进一步引入人工阶段检查。开启LLM阶段结果检查
开启人工阶段结果检查
阶段默认检查顺序:Python Checker -> LLM -> 人工
7. 验证交付
如果验证结果需要交付,建议:
make formal_mcp_Adder ARGS="--loop --backend=opencode")通过Web界面交互
UCAgent提供了Master模式,基于它可以通过Web界面进行Agent集中管理、创建任务、查看状态、在线终端等操作。
本地启动
1. 配置环境变量
环境变量与快速开始的配置 LLM API一节相同(
OPENAI_MODEL、OPENAI_API_KEY、OPENAI_API_BASE等)。若已持久化到~/.ucagent_env,启动前加载即可:2. 启动 UCAgent Master
然后在浏览器中访问
http://localhost:8800即可。容器启动
容器启动时通过
-e传入相同的 LLM API 环境变量:如果 ghcr.io 无法访问,可以直接替换其为
ghcr.nju.edu.cn等镜像地址。启动成功后,在浏览器中访问
http://localhost:8800即可。基本操作
+按钮(或者launch按钮),创建一个新的任务。更多功能
基本操作
TUI 快捷键
ctrl + 上/下/左/右:调节界面布局(Console 高度 / Mission 面板宽度)ctrl + h/j/k/l:Vim 风格调节界面布局(等同于 ctrl+左/下/上/右)ctrl + c:取消运行中的命令;无命令运行时退出 TUIctrl + t:打开主题选择器ctrl + /或f1:显示/隐藏快捷键帮助面板shift + 右:清空控制台输出shift + 左:清空输入行tab:命令补全;连续按 Tab 循环浏览候选项pageup / pagedown:Console 输出区翻页esc:退出滚动/分页/帮助面板,或清空输入行阶段颜色提示
白色:待执行红色:正在执行绿色:执行通过*:hmcheck_pass [msg]后 AI 才能继续黄色:跳过该阶段常用交互命令
q:退出 TUI(或退出 UCAgent)tui:进入 TUItab: 命令补全tool_list:列出所有可用工具help:查看所有命令帮助loop [prompt]:继续当前任务常见问题 (FAQ)
Q: 如何配置不同的 AI 模型?
A: 在
config.yaml中修改openai.model_name字段,支持任何 OpenAI 兼容的 API。详见配置文档。Q: 验证过程中出现错误怎么办?
A: 使用
Ctrl+C进入交互模式,通过status查看当前状态,使用help获取调试命令。Q: MCP 服务器无法连接?
A: 检查端口是否被占用,确认防火墙设置,可以通过
--mcp-server-port指定其他端口。Q: 为何有上次执行信息残留?
A: UCAgent 默认会从工作目录中查找
.ucagent/ucagent_info.json文件,来加载上次执行信息接着执行。如果不需要历史信息,请删除该文件或者使用参数--no-history忽略加载历史。Q: 如何运行长时间验证?
A: 请参考 CodeAgent 的自定义后端 examples/CustomBackend/README.md。
Q: 可以自定义验证阶段吗?
A: 可以,详见自定义文档。
Q: 如何添加自定义工具?
A: 在
ucagent/tools/目录下创建新的工具类,继承UCTool基类,并通过--ex-tools参数加载。详见工具列表文档。文档构建与预览(MkDocs)
Makefile 提供文档相关辅助目标(MkDocs + Material):
make docs-helpmake docs-installdocs/requirements-docs.txt安装构建依赖make docs-servemake docs-builddocs/sitemake docs-cleandocs/site目录使用流程
第一次使用(安装依赖):
日常开发(预览文档):
本地生成和查看(构建生产版本):
完整工作流示例
说明
docs/Makefile中,可自行修改。make docs-serve适合开发时使用,支持热重载make docs-build生成完整的静态网站文件,输出到 docs/site 目录,可本地预览最终效果(打开 docs/site/index.html)PDF 手册构建(Pandoc + XeLaTeX)
用于生成较高排版质量开发者 PDF 手册:
make pdfucagent-doc.pdfmake pdf-onepdf等价(方便 CI 调用)make pdf-clean示例
依赖
pandoc-crossref自定义变量
MONO更换等宽字体TWOSIDE非空启用双面模式常见问题
fonts-noto-cjk)。texlive-full)。pandoc-crossref在 PATH 中。输出:
ucagent-doc.pdf可随版本发布分发。获取更多帮助
贡献指南
欢迎提交 Issue 和 Pull Request!