Skip to content
cccskills
FreePublished on GitHub

bb-check-lint

调用 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.

See how to install

Files included (9)

  • SKILL.md7.3 KB
  • assets/asap7_rules.cfg1.5 KB
  • assets/tb_waiver.vbl1.9 KB
  • Gotcha/verible_parser_limitations.md1.1 KB
  • Gotcha/verible_rule_pitfalls.md1.1 KB
  • scripts/babel_lsp_lint.py6.2 KB
  • scripts/parse_lint.py2.8 KB
  • scripts/render_lint_sh.py1.1 KB
  • scripts/run_lint.py2.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

bb-check-lint

职责

对 HDL 源码执行 lint 检查,提取所有 error / warning 至 JSON。src 代码必须可综合,零 error 才通过;tb 代码允许 verification constructs(covergroup 等)。不允许 waive src 错误。

后端选择(2026-07-21 新增 babel-lsp)

backend触发条件实现
auto默认按 babel-lsp → verible 顺序尝试
babel-lsp显式指定或 auto 首选babel-lsp MCP/CLI,基于 slang 引擎(IEEE 1800-2023)
verible显式指定或 babel-lsp 不可用verible-verilog-lint,CHIPS Alliance
  • 调用者:bba-guru-rtl
  • 禁止使用:Task / Agent / Skill

Input Args

argtyperequired默认说明
target_dirpathfalse—目标目录(自动扫描所有 .sv/.v/.vh 文件)
file_listpathfalse—file_list.f;显式指定检查文件列表
rules_configpathfalse内置 ASAP7 default rulesetverible rules.cfg(仅 verible 后端)
design_namestringfalse<target_dir或file_list_basename>设计名称
stampstringfalse<auto>时间戳
lint_modestringfalsesrc_onlysrc_only / src_and_tb / tb_only
backendstringfalseautoauto / babel-lsp / verible

输入优先级:

  1. 若提供 file_list → 使用 file_list 中列出的文件
  2. 若提供 target_dir → 自动扫描目录下所有 HDL 文件
  3. 若两者都未提供 → 报错 valid=false

自动发现 HDL 文件逻辑

# src_only mode: 仅检查可综合代码
find <target_dir> -path "*/src/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort

# src_and_tb mode: 分开检查 src 和 tb
src_files=$(find <target_dir> -path "*/src/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)
tb_files=$(find <target_dir> -path "*/tb/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)

# tb_only mode: 仅检查 testbench
find <target_dir> -path "*/tb/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort

合规标准

代码类型要求允许的 constructs
src(RTL)✅ 必须可综合,零 syntax error仅 synthesizable SV
tb(验证)⚠️ 允许 verification constructscovergroup, coverpoint, bins, class, program

Output Contract

field值
artifact_pathdesigns/<name>/rtl/lint_<stamp>.json
script_pathdesigns/<name>/rtl/lint_<stamp>.sh
log_pathdesigns/<name>/rtl/lint_<stamp>.log
errors[{file,line,col,rule,msg}] — 仅 src 文件的 syntax errors
warnings[{file,line,col,rule,msg}]
src_cleanbool(src_errors==[])
tb_cleanbool(tb 无 blocking issues)
cleanbool(src_clean && tb_clean)
validbool
iterationint(修复迭代次数,max=3)

5-Phase 执行(含修复迭代)

Phase 0 — 收集文件列表(按 lint_mode)

case "$lint_mode" in
  src_only)
    lint_files=$(find "$target_dir" -path "*/src/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)
    ;;
  src_and_tb)
    src_files=$(find "$target_dir" -path "*/src/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)
    tb_files=$(find "$target_dir" -path "*/tb/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)
    ;;
  tb_only)
    lint_files=$(find "$target_dir" -path "*/tb/*" -type f \( -name "*.sv" -o -name "*.v" \) | sort)
    ;;
esac

Phase 1 — render_lint_sh

根据 backend 选择渲染不同脚本:

babel-lsp 后端(默认优先):

#!/bin/bash
set -eo pipefail
# babel-lsp 语法检查 — 使用 slang 引擎,IEEE 1800-2023 完整支持
# 2026-07-21: 新增 babel-lsp 后端,替代 verible 作为首选

# 优先使用 MCP 工具(若 babel-lsp MCP server 已配置)
# 回退到 CLI: slang --check-only 直接调用

for f in $src_files; do
    slang --check-only --error-limit=0 "$f" 2>&1
done

for f in $tb_files; do
    slang --check-only --error-limit=0 "$f" 2>&1
done

verible 后端(回退):

#!/bin/bash
set -eo pipefail
source ~/wrk/eda_opensources/eda_env.sh

# src lint: 严格检查
verible-verilog-lint --rules_config <rules_config> $src_files 2>&1

# tb lint: 使用 waiver 跳过 verification constructs(可选)
verible-verilog-lint --rules_config <rules_config> $tb_files 2>&1

Phase 2 — run_lint

timeout 300 bash <script_path> > <log> 2>&1,追加 exit:<rc>。

Phase 3 — parse_lint

分类 errors / warnings:

  • syntax error → 归入 errors[]
  • [Style:xxx] → 归入 warnings[]
  • 区分 src 和 tb 文件来源

Phase 4 — fix_and_iterate(新增)

# 若 src_clean=false,调用修复
if not src_clean and iteration < 3:
    # 提取 src errors 详情
    src_errors = [e for e in errors if '/src/' in e['file']]
    
    # 调用 bb-rtl-coder 修复
    fix_result = fix_rtl_errors(src_errors)
    
    # 重新 lint
    iteration += 1
    rerun_lint()

Phase 5 — return

返回 JSON。

收敛 / 失败

状态行动
src_clean=true✅ src 合规,进 bb-find-module-deps
src_clean=false & iter<3🔧 调用 bb-rtl-coder 修复,重新 lint
iter≥3 & src_clean=false❌ error="lint persistent after 3 iter",开 arch-needs-fix issue
tb 有 verification constructs⚠️ 记录但不阻塞流程

资源索引

  • scripts/babel_lsp_lint.py — babel-lsp CLI wrapper(slang 诊断 + 可综合性检查)
  • scripts/render_lint_sh.py、scripts/run_lint.py、scripts/parse_lint.py — verible 后端
  • assets/asap7_rules.cfg — 默认 verible 规则集
  • assets/tb_waiver.vbl — testbench waiver(跳过 covergroup/coverpoint/bins)
  • Gotcha/verible_rule_pitfalls.md
  • Gotcha/verible_parser_limitations.md — verible 不支持的 SV constructs

项目级 Coding Style 参考:

  • wiki/codingstyle/systemverilog_styleguide.md — SystemVerilog Style Guide (systemverilog.io)
  • wiki/codingstyle/freescale_verilog_standard.md — Freescale Verilog HDL Coding Standard SRS V3.2

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

基于 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.

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