一键导入
bb-find-module-deps
扫描 RTL 目录提取模块层次依赖,拓扑排序后写 file_list.f(叶模块在前,top 在最后),供 Yosys/Verilator 使用。触发场景:(1) bba-guru-rtl 生成 RTL 后生成 file_list;(2) 显式 /bb-find-module-deps。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
扫描 RTL 目录提取模块层次依赖,拓扑排序后写 file_list.f(叶模块在前,top 在最后),供 Yosys/Verilator 使用。触发场景:(1) bba-guru-rtl 生成 RTL 后生成 file_list;(2) 显式 /bb-find-module-deps。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
基于 AST 检查 CDC/RDC 违例:对比 MAS clock_domains 找跨域信号,检查是否被 2ff-sync CBB 保护。触发场景:(1) bba-guru-synthesis 综合前;(2) 显式 /bb-check-cdc。
调用 verible-verilog-lint 检查 SV 源码。src 必须可综合(零 syntax error),tb 允许 verification constructs。发现 src error 时自动修复重检(max 3 iter)。触发:(1) bba-guru-rtl 生成后;(2) RTL 修复重检;(3) 显式 /bb-check-lint。
解析 Verilator coverage.dat + sim log,输出 functional + code coverage 数值,判断是否 100% 达标。触发场景:(1) bb-invoke-verilator 后;(2) 每次回归后;(3) 显式 /bb-collect-coverage。
从 MAS(io_ring/pad_list/clock_plan)+ 综合网表生成 Magic floorplan TCL,交给 bb-invoke-magic 执行。触发场景:(1) bba-guru-pd 综合后做 floorplan;(2) DRC 失败后调整 utilization 重生成;(3) 显式 /bb-create-floorplan。
从 MAS(clock_domains / io_timing / path_exceptions)派生 Synopsys SDC 时序约束文件,OpenSTA 语法校验。触发场景:(1) bba-guru-synthesis 综合前;(2) post-PD timing fail 修订约束;(3) 显式 /bb-create-sdc。
统一质量门禁:RTL / 综合 / 测试 / PD 四阶段验收。调用共享 gate_runner.py 参数化。触发:(1) bba-guru-* 在阶段结束时调用;(2) 显式 /bb-gate <domain>。
| name | bb-find-module-deps |
| description | 扫描 RTL 目录提取模块层次依赖,拓扑排序后写 file_list.f(叶模块在前,top 在最后),供 Yosys/Verilator 使用。触发场景:(1) bba-guru-rtl 生成 RTL 后生成 file_list;(2) 显式 /bb-find-module-deps。 |
| user-invocable | true |
扫 designs/<name>/rtl/*.sv,构建 module → file 映射 + module instantiation 图,Kahn 拓扑排序,写 file_list.f。
bba-guru-rtlbb-check-lint、bb-invoke-yosys、bb-invoke-verilator| arg | type | required | 默认 | 说明 |
|---|---|---|---|---|
| rtl_dir | path | true | — | designs/<name>/rtl/ |
| top_module | string | true | — | 顶层名 |
| design_name | string | true | — | — |
| include_dirs | list[path] | false | [] | +incdir+ 列表 |
| defines | list[str] | false | [] | +define+KEY=VAL |
| stamp | string | false | <auto> | — |
| field | 值 |
|---|---|
artifact_path | designs/<name>/file_list.f |
script_path | designs/<name>/rtl/gen_filelist_<stamp>.py |
module_count | int |
top_module | str |
order | list[str](拓扑序模块名) |
valid | bool |
error | string|null |
scripts/render_filelist_py.py 生成 Python:
# 优先用 verible-verilog-syntax 解析(识别 interface/class/package 与 module,避免误判 — fix M-04)
# 失败时退到正则 fallback
try:
import subprocess, json
out = subprocess.check_output(["verible-verilog-syntax", "--export_json", f]).decode()
ast = json.loads(out)
# 遍历 ast 找 ModuleDeclaration nodes
except Exception:
# fallback: 正则 `^\s*module\s+(\w+)` + 排除 interface/class/package 关键字
pass
# 然后建 dep 图:parent_module → set(child_module)
# Kahn 拓扑(child 先 parent 后);检测环
# 写 file_list.f:incdir / define / 拓扑序文件
scripts/run_filelist.py:timeout 180 uv run python <script_path> > <log> 2>&1
scripts/parse_filelist.py:
file_list.f 存在top_module 对应文件是最后一个module_countCyclic dependency → error="cyclic: A->B->A"返回 JSON。bba-guru-rtl 直接把 artifact_path 传给下游。
+incdir+designs/<name>/rtl/include
+define+TARGET_ASAP7
designs/<name>/rtl/uart_fifo.sv
designs/<name>/rtl/uart_rx.sv
designs/<name>/rtl/uart_tx.sv
designs/<name>/rtl/uart_ctrl.sv
designs/<name>/rtl/uart_top.sv
| 状态 | 行动 |
|---|---|
| valid=true | 进 bb-check-lint |
| cyclic | 开 arch-needs-fix(模块循环必须重设计) |
| 找不到 top_module | error="top not found",bba-guru-rtl 修正 |
scripts/render_filelist_py.py、scripts/run_filelist.py、scripts/parse_filelist.pylib/sv_module_regex.py — module/instantiation 正则集Gotcha/sv_pitfalls.md — 接口/类等被误识别为 instantiation