Skip to content
cccskills
FreePublished on GitHub

bb-invoke-verilator

调用 Verilator 5.012 编译 RTL + TB 并跑 coverage-driven simulation,产出 sim log / coverage.dat / VCD。

触发场景:(1) bba-guru-verification 完成 TB 后跑回归;(2) RTL 修复后回归验证;(3) 显式 /bb-invoke-verilator。

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

See how to install

Files included (6)

  • SKILL.md3.5 KB
  • Gotcha/verilator_pitfalls.md2.9 KB
  • references/verilator_flags.md2.7 KB
  • scripts/parse_sim_log.py3.0 KB
  • scripts/render_verilator_sh.py3.3 KB
  • scripts/run_verilator.py2.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

bb-invoke-verilator

职责

把 RTL(file_list.f)+ testbench(tb/tb_top.sv)编译为 verilator 可执行二进制并运行,产出 sim log、coverage 数据库、VCD 波形。

  • 调用者:bba-guru-verification
  • 下游消费者:bb-collect-coverage(读 coverage.dat)
  • 禁止使用:Task / Agent / Skill

Input Args

argtyperequired默认说明
file_listpathtrue—file_list.f,每行一个 RTL 源
tb_toppathtrue—designs/<name>/tb/tb_top.sv
design_namestringtrue—路径 designs/<name>/sim_results/
sim_timestringfalse--time-resolution-unit 1ns时间单位
seedintfalse1+rand_seed=<seed>
enable_vcdboolfalsetrue是否 --trace --trace-structs
stampstringfalse<auto YYYYMMDD-HHMMSS>后缀

Output Contract

写入 designs/<name>/sim_results/,返回:

field值
artifact_pathdesigns/<name>/sim_results/<stamp>.log
coverage_datdesigns/<name>/sim_results/coverage.dat
vcd_pathdesigns/<name>/sim_results/<stamp>.vcd (与 .log 同级,fix H-09)
obj_dirdesigns/<name>/sim_results/obj_dir_<stamp>/
script_pathdesigns/<name>/sim_results/run_sim_<stamp>.sh
validbool(编译+运行成功)
assertions_passbool(无 %Error / Assertion failed)
sim_time_nsint(log 末尾 $finish at)
errorstring|null

4-Phase 执行

Phase 1 — render_sim_script

scripts/render_verilator_sh.py 渲染:

#!/bin/bash
set -euo pipefail
source ~/wrk/eda_opensources/eda_env.sh
verilator --version | grep -q "Verilator 5.012" \
  || { echo "VERSION_MISMATCH"; exit 1; }

verilator --binary --coverage <vcd_flag> \
  -f <file_list> <tb_top> \
  --top-module tb_top \
  -Mdir designs/<name>/sim_results/obj_dir_<stamp>/ \
  -o sim_<stamp> -CFLAGS "-O2" -j 4

./designs/<name>/sim_results/obj_dir_<stamp>/sim_<stamp> \
  +rand_seed=<seed> 2>&1 | tee designs/<name>/sim_results/<stamp>.log

verilator_coverage \
  designs/<name>/sim_results/obj_dir_<stamp>/coverage.dat \
  --write designs/<name>/sim_results/coverage.dat

<vcd_flag> = --trace --trace-structs 当 enable_vcd=true。

Phase 2 — run_sim

scripts/run_verilator.py:timeout 1800 bash <script_path>,追加 exit:<rc>。

Phase 3 — parse_sim_log

scripts/parse_sim_log.py:

  • $finish at <ns> → sim_time_ns
  • %Error / Assertion failed → assertions_pass=false
  • exit:<rc> ≠ 0 → valid=false

写 sim_summary_<stamp>.json。

Phase 4 — return

返回 JSON。下游 bb-collect-coverage 立即解析 coverage.dat。

收敛 / 失败

状态处理
valid && assertions_pass调 bb-collect-coverage
断言失败开 rtl-needs-fix
Phase 2 timeout(1800s)error="SIM_TIMEOUT"
VERSION_MISMATCH修复 eda_env.sh
编译失败反馈 %Error: <file>:<line>

资源索引

  • scripts/render_verilator_sh.py — Phase 1
  • scripts/run_verilator.py — Phase 2
  • scripts/parse_sim_log.py — Phase 3
  • references/verilator_flags.md
  • Gotcha/verilator_pitfalls.md

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-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

See all skills by amoslee2026

Report a problem with this skill