本文へ移動
cccskills
無料GitHub で公開

bb-invoke-yosys

调用 Yosys 0.35 对 RTL 进行逻辑综合并技术映射到 ASAP7 标准单元,产出门级网表 + QoR 报告。支持并行综合(基于空闲CPU数量)。Workflow: (1)生成综合脚本;(2)并行执行综合;(3)LLM检查结果并迭代优化。

触发场景:(1) bba-guru-synthesis 已完成 SDC 与 CDC 检查、需要生成 netlist;(2) PD 反馈 area/path 超标需要重综合;(3) 显式 /bb-invoke-yosys。

インストール方法を見る

含まれるファイル(10)

  • SKILL.md7.3 KB
  • Gotcha/yosys_errors.md1.7 KB
  • references/asap7_libs.md1.3 KB
  • references/yosys_tcl_template.md2.3 KB
  • scripts/generate_synthesis_config.py5.8 KB
  • scripts/parse_qor.py5.5 KB
  • scripts/render_yosys_tcl.py5.1 KB
  • scripts/run_parallel_synthesis.py7.1 KB
  • scripts/run_synthesis_first_run.py10.7 KB
  • scripts/run_yosys.py4.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

bb-invoke-yosys

职责

把 RTL 综合 → 技术映射 → ASAP7 标准单元网表,并产出供下游(OpenSTA、PD)使用的 QoR JSON。

核心 Workflow(LLM驱动):

  1. 生成综合脚本: 调用 generate_synthesis_config.py + render_yosys_tcl.py
  2. 并行执行综合: 调用 run_parallel_synthesis.py(并行数=空闲CPU数)
  3. LLM检查迭代: 分析 synthesis_summary.json,修复问题并重试

调用者:bba-guru-synthesis。 被调用方:Yosys 内置 abc 命令(独立 skill bb-invoke-abc 已 DEPRECATED,仅 mapping_effort=high 等高级调优时才链式调用)。 禁止使用:Task / Agent / Skill(本 skill 是叶子 skill,不递归调用其他 agent)。

Input Args

argtyperequired默认说明
file_listpathtrue—file_list.f,每行一个 RTL 源文件路径
sdc_pathpathtrue—constraints/<name>.sdc(yosys 仅做时序参考)
tech_libpathfalselibs/asap7/.../asap7sc7p5t.libASAP7 Liberty(脚本 --tech-lib 有默认值,可省略)
top_modulestringtrue—顶层模块名
design_namestringtrue—用于路径 designs/<name>/synth_parallel/
abc_optionsstringfalse-g AND,OR,NAND,NOR,XORABC 优化参数
mapping_effortenumfalsemediumlow / medium / high
enable_retimingboolfalsefalse是否启用 retiming pass
modeenumfalsesinglesingle(单模块)/ hierarchical(分层多模块)
modulespathfalse—JSON文件列出子模块(hierarchical模式)

Output Contract

写入 designs/<name>/synth_parallel/,返回 summary JSON:

field值
synthesis_summary.json综合结果汇总
results[].artifact_pathdesigns/<name>/synth_parallel/<module>/netlist_<stamp>.v
results[].qor_pathdesigns/<name>/synth_parallel/<module>/qor_<stamp>.json
results[].validbool(综合成功 true)
results[].cell_countint
results[].chip_area_um2float
results[].wire_countint
results[].errorstring|null
max_parallelint(并行执行数=空闲CPU数)

5-Phase 执行(LLM驱动)

Phase 1 — generate_config

调用 scripts/generate_synthesis_config.py,生成 synthesis_config.json:

python3 scripts/generate_synthesis_config.py \
    --file-list designs/<name>/rtl/file_list.f \
    --sdc designs/<name>/constraints/<name>.sdc \
    --top <top_module> \
    --design-name <name> \
    --tech-lib libs/asap7/.../asap7sc7p5t.lib \
    --out designs/<name>/synth_parallel/synthesis_config.json \
    --mode single|hierarchical

LLM职责: 根据MAS/RTL结构决定 mode,准备输入参数。

Phase 2 — render_scripts

run_parallel_synthesis.py 内部调用 scripts/render_yosys_tcl.py,为每个模块生成TCL脚本:

  1. read_verilog -sv 逐行展开 file_list.f
  2. hierarchy -check -top <top_module> 检查顶层
  3. synth -top <top_module> 通用综合
  4. dfflibmap -liberty <tech_lib> DFF 映射
  5. abc -liberty <tech_lib> <abc_options> 技术映射
  6. 可选:abc -liberty <tech_lib> -script +retime (若 enable_retiming)
  7. opt_clean -purge
  8. write_verilog -noattr <netlist>
  9. stat -liberty <tech_lib> 输出统计

并行准备: 所有模块的TCL脚本同时生成,不阻塞。

Phase 3 — parallel_synthesis

调用 scripts/run_parallel_synthesis.py:

python3 scripts/run_parallel_synthesis.py \
    --config designs/<name>/synth_parallel/synthesis_config.json \
    --timeout 600

并行执行:

  • 自动检测空闲CPU数量 (get_idle_cpu_count())
  • 使用 ProcessPoolExecutor 并行运行综合
  • max_workers = min(idle_cpus, module_count)

每个模块执行:

  1. source ~/wrk/eda_opensources/eda_env.sh
  2. 校验 yosys -V 输出含 Yosys 0.35
  3. 以 600s 超时执行 yosys -c <tcl_path> > <log_path> 2>&1
  4. 把退出码追加到 log 末尾:exit:<rc>

Phase 4 — parse_results

run_parallel_synthesis.py 内部调用 scripts/parse_qor.py,从 log 提取:

  • Chip area for module <top>: <float> → chip_area_um2
  • Number of cells: <int> → cell_count
  • Number of wires: <int> → wire_count
  • 任何 ERROR: / Error: 行 → error

生成 synthesis_summary.json:

{
  "stamp": "20260519_120000",
  "total_elapsed": 45.3,
  "max_parallel": 4,
  "modules_total": 3,
  "modules_passed": 2,
  "modules_failed": 1,
  "results": [...]
}

Phase 5 — llm_analysis_and_iteration

LLM职责:

  1. 读取 synthesis_summary.json
  2. 分析失败模块(valid=false)
  3. 根据错误类型决定修复策略:
    • MULTIDRIVEN / latch inferred → rtl-needs-fix
    • WIDTHEXPAND (≥5次) → rtl-needs-fix
    • YOSYS_TIMEOUT → 降低复杂度、增加 opt -fast
    • VERSION_MISMATCH → 修复EDA环境
  4. 调整参数重试(最多6次)
  5. 成功后返回给 bba-guru-synthesis

命令行用法

# Step 1: Generate config
python3 scripts/generate_synthesis_config.py \
    --file-list designs/uart16550/rtl/file_list.f \
    --sdc designs/uart16550/constraints/uart16550.sdc \
    --top uart16550 \
    --design-name uart16550 \
    --out designs/uart16550/synth_parallel/synthesis_config.json

# Step 2: Run parallel synthesis
python3 scripts/run_parallel_synthesis.py \
    --config designs/uart16550/synth_parallel/synthesis_config.json \
    --timeout 600

# Step 3: LLM analyzes synthesis_summary.json and iterates

并行执行策略

空闲CPU模块数max_parallel
1N1(串行)
433(全并行)
4104(分批并行)
8108(分批并行)

检测方法:读取 /proc/loadavg 计算 idle_cpus = total_cpus - load_avg

收敛 / 失败

状态处理
modules_failed == 0调用 bb-invoke-opensta 做 STA
modules_failed > 0(RTL错误)返回错误,调整后重试
Phase 3 timeout(600s)返回 {valid:false, error:"YOSYS_TIMEOUT"}
VERSION_MISMATCH返回 {valid:false, error:"VERSION_MISMATCH"}

资源索引

  • scripts/generate_synthesis_config.py — Phase 1(配置生成)
  • scripts/render_yosys_tcl.py — Phase 2(TCL渲染)
  • scripts/run_parallel_synthesis.py — Phase 3(并行执行)
  • scripts/run_yosys.py — 单模块执行器
  • scripts/run_synthesis_first_run.py — 首轮/无库通用综合执行器(被 run_parallel_synthesis.py 使用)
  • scripts/parse_qor.py — Phase 4(QoR解析)
  • references/yosys_tcl_template.md — TCL 模板
  • references/asap7_libs.md — ASAP7 库位置
  • Gotcha/yosys_errors.md — 常见错误与修复

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

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

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

bb-arch

無料

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

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

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.

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

amoslee2026/Babel492026年8月4日 更新

amoslee2026 のスキルをすべて見る

このスキルの問題を報告する