Skip to content
cccskills
FreePublished on GitHub

bb-check-cdc

基于 AST 检查 CDC/RDC 违例:对比 MAS clock_domains 找跨域信号,检查是否被 2ff-sync CBB 保护。触发场景:(1) bba-guru-synthesis 综合前;(2) 显式 /bb-check-cdc。

The English summary is being prepared. Showing the original description.

See how to install

Files included (7)

  • SKILL.md2.7 KB
  • Gotcha/cdc_false_positives.md1.3 KB
  • references/2ff_sync_pattern.md1.3 KB
  • scripts/check_cdc.py12.5 KB
  • scripts/parse_cdc.py4.5 KB
  • scripts/render_cdc_py.py1.1 KB
  • scripts/run_cdc.py3.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

bb-check-cdc

职责

读 bb-parse-ast 的 AST + MAS.clock_domains,识别跨时钟域 register-to-register 路径,检查是否通过 2ff 同步器,输出 violation 报告。

  • 调用者:bba-guru-synthesis
  • 上游:bb-parse-ast(backend=auto 自动降级到 verible/slang)
  • 禁止使用:Task / Agent / Skill

Input Args

argtyperequired默认说明
file_listpathtrue—file_list.f
ast_pathpathtrue—bb-parse-ast 产出
mas_pathpathtrue—designs/<name>/mas/mas.json
design_namestringtrue——
stampstringfalse<auto>—

Output Contract

field值
artifact_pathdesigns/<name>/cdc/cdc_report.json
script_pathdesigns/<name>/cdc/check_cdc_<stamp>.py
log_pathdesigns/<name>/cdc/cdc_<stamp>.log
violations[{type,from_clk,to_clk,signal,line,waived:bool}]
cleanbool(unwaived violations==[])
validbool

4-Phase 执行

Phase 1 — render_cdc_py

scripts/render_cdc_py.py 渲染:

import json
ast = json.load(open(ast_path))
mas = json.load(open(mas_path))
domains = mas["clock_domains"]
# 1. 抽取所有 always_ff (@posedge clk) blocks
# 2. 对每条赋值,标注其 clock domain (信号→sensitivity clock)
# 3. R-to-R 路径:from_clk != to_clk → 候选 violation
# 4. 检查 sink 之前是否经过 wiki/cbb/2ff-sync 实例
violations = analyze(ast, domains)
json.dump({"violations": violations}, open(out, "w"))

Phase 2 — run_cdc

timeout 600 uv run python <script_path> > <log> 2>&1,追加 exit:<rc>。

Phase 3 — parse_cdc

scripts/parse_cdc.py:

  • 解析输出 JSON
  • clean = all(not v.waived for v in violations)
  • 写 cdc_report.json

Phase 4 — return

返回 JSON。clean=false → bba-guru-synthesis 开 rtl-needs-fix(CDC 不允许 waive)。

收敛 / 失败

状态行动
clean=true进 yosys
clean=false(unwaived)开 rtl-needs-fix 退出
pyverilog 解析失败重试 bb-parse-ast --backend verible(或 slang)
Phase 2 timeout(600s)error="CDC_TIMEOUT"

资源索引

  • scripts/render_cdc_py.py、scripts/run_cdc.py、scripts/parse_cdc.py
  • references/2ff_sync_pattern.md — 同步器识别规则
  • Gotcha/cdc_false_positives.md — handshake / gray code 等不视为 violation

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

<一句话说清『这个 skill 做什么 + 何时调用』。把最关键的触发场景放最前面。结尾给 2-3 个用户会说的关键词。>

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

从粗略 idea 设计芯片或功能模块架构,输出专业架构文档到 spec_arch 目录。Trigger: 芯片架构设计, IC架构, 电路模块设计, 硬件架构. Generate IC/Chip architecture specification from rough ideas.

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

调用 babel-lsp / 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。

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

Babel internal issue protocol — close a handoff after downstream agent picked it up or user signed off. Moves designs/<name>/.handoff/<label>.md to .handoff/closed/ (using mv per CLAUDE.md), appends to handoff_log.jsonl.

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

对抗性代码评审:代码质量 / 可维护性 / 时序风险 / 综合友好度 / MAS 对齐度。默认 ruthless 模式,找 EVERY flaw。触发场景:(1) RTL lint 后;(2) 显式 /bb-code-review。

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

解析 Verilator coverage.dat + sim log,输出 functional + code coverage 数值,判断是否 100% 达标。触发场景:(1) bb-invoke-verilator 后;(2) 每次回归后;(3) 显式 /bb-collect-coverage。

The English summary is being prepared. Showing the original description.

amoslee2026/Babel49Updated Aug 4, 2026

See all skills by amoslee2026

Report a problem with this skill