bb-trace-signal-path

SkillMonitoring & ops

Performs signal path tracing on AST JSON: extracts propagation paths from source to sink across module hierarchy and determines whether a path crosses clock domains. Intended for CDC violation root-cause analysis and critical path assistance. Trigger scenarios: (1) bb-check-cdc reports a violation a

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the bb-trace-signal-path skill

What this skill tells your AI

The instructions your AI receives, as published by amoslee2026/babel in .claude/skills/bb-trace-signal-path/SKILL.md and read by ahel’s review.

职责

读取 bb-parse-ast 产出的 AST JSON,DFS 跟踪 source 信号到 sink 的赋值/连线链,输出路径节点列表 + CDC 标记。

  • 调用者:bba-guru-synthesisbb-check-cdc
  • 上游:bb-parse-ast(或 fallback)
  • 禁止使用:Task / Agent / Skill

Input Args

argtyperequired默认说明
ast_pathpathtrueAST JSON
source_signalstringtrue完整 hierarchical path:top.inst.sub.sig 或 模块本地:<module>.<signal>(fix M-11)
sink_signalstringtrue同 source_signal 格式
design_namestringtrue
max_depthintfalse50DFS 深度上限(防环)
stampstringfalse<auto>

接受两种 source 格式:

  • hierarchical: top.u_rx.fifo.wr_data — 全局唯一
  • module-local: uart_rx.rx_data — 当跨同名实例时歧义,trace 在歧义时返回多条 path

Output Contract

field
artifact_pathdesigns/<name>/ast/signal_path_<stamp>.json
script_pathdesigns/<name>/ast/trace_<stamp>.py
sourcestr
sinkstr
path[{module, signal, line, op}]
crosses_clock_domainbool
validbool
errorstring|null

4-Phase 执行

Phase 1 — render_trace_py

scripts/render_trace_py.py 渲染 Python:

import json
ast = json.load(open(ast_path))
path, cdc = trace(ast, source_signal, sink_signal, max_depth)
json.dump({"path": path, "crosses_clock_domain": cdc}, open(out, "w"))

trace() 实现:以 source 为起点,按 cont_assign / non_blocking_assign / port_connection 边 DFS,记录每跳的 module/signal/line/op。

Phase 2 — run_trace

scripts/run_trace.pytimeout 300 uv run python <script_path> > <log> 2>&1

Phase 3 — parse_trace

scripts/parse_trace.py

  • 输出 JSON 解析;path == []error="path not found"
  • 任一跳的 clk_domain 与下一跳不同 → crosses_clock_domain=true

Phase 4 — return

返回 JSON。调用方据 crosses_clock_domain + path 决定开 CDC issue 或调整 RTL。

收敛 / 失败

状态行动
valid=true提供详细 path
path not foundAST 不完整 / 信号名错;切 fallback 重解析
超 max_deptherror="trace depth exceeded"(疑似环)

资源索引

  • scripts/render_trace_py.pyscripts/run_trace.pyscripts/parse_trace.py
  • lib/cdc_classifier.py — 节点 clock domain 推断
  • references/ast_traversal_rules.md

Signals

GitHub stars
44
Forks
10
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
bb-trace-signal-path
Source
github.com/amoslee2026/babel