bb-invoke-klayout
SkillDev toolsInvoke KLayout 0.30.8 to perform GDSII export (stream out), GDS-level DRC, or post-export verification. Produces the final .gds (signoff artifact) at the end of the PD flow. Trigger scenarios: (1) GDS export after bba-guru-pd routing; (2) DRC checks at the GDS level; (3) post-export verification; (4
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the bb-invoke-klayout skill
What this skill tells your AI
The instructions your AI receives, as published by amoslee2026/babel in .claude/skills/bb-invoke-klayout/SKILL.md and read by ahel’s review.
职责
按 action 切换三种模式调 KLayout:gdsii_export(DEF → GDS,别名 export_gds)、drc(GDS 层规则检查)、或 verify(导出后回读 + 单元完整性校验)。
- 调用者:
bba-guru-pd - 禁止使用:Task / Agent / Skill
Input Args
| arg | type | required | 说明 |
|---|---|---|---|
| input_def | path | true | export/verify: pd/routed.def 或 gdsii/<name>.gds;drc: pd/*.gds |
| tech_file | path | true | ASAP7 KLayout tech file(.lyt) |
| action | enum | true | gdsii_export (== export_gds alias) | drc | verify |
| design_name | string | true | — |
| top_module | string | true | — |
| runset | path | false | DRC 模式 runset 路径(默认 ASAP7 内置) |
| stamp | string | false | <auto YYYYMMDD-HHMMSS> |
Output Contract
| field | 值 |
|---|---|
artifact_path | export→designs/<name>/gdsii/<name>.gds;drc→designs/<name>/pd/klayout_drc_<stamp>.lyrdb;verify→designs/<name>/gdsii/<name>_verify_<stamp>.json |
script_path | designs/<name>/pd/klayout_<action>_<stamp>.lym |
log_path | designs/<name>/pd/klayout_<action>_<stamp>.log |
gds_size_bytes | int(export 模式) |
violations | int(drc 模式) |
verify_ok | bool(verify 模式:cells_expected == cells_found 且无 open 错误) |
valid | bool |
error | string|null |
4-Phase 执行
Phase 1 — render_klayout_script
scripts/render_klayout.py 按 action 渲染 LYM/Ruby 脚本,承载:
- gdsii_export / export_gds: DEF→GDS stream out(
assets/export_gdsii.lym) - drc: 加载 runset(
assets/drc_runset.drc) - verify: 重新打开导出的 GDS,遍历 top cell hierarchy,统计 cells / nets,与 placed.def 期望值比对
Phase 2 — run_klayout
scripts/run_klayout.py:
source ~/wrk/eda_opensources/eda_env.shklayout -v 2>&1 | grep "0.30"否则VERSION_MISMATCHtimeout 1800 klayout -b -rd input=<def> -rd tech=<tech> -rd output=<gds> -r <script> > <log> 2>&1- log 末尾追加
exit:<rc>
Phase 3 — parse_klayout
scripts/parse_klayout.py:
- gdsii_export / export_gds:
.gds存在 + size>0 →valid=true,记gds_size_bytes - drc:解析
.lyrdb中<item>数 →violations - verify:log 中
cells_found=<N>、opens=<M>等指标 →verify_ok = (opens==0 && cells_found>=cells_expected)
写 klayout_<action>_<stamp>.json。
Phase 4 — return
返回 JSON。
- export
valid=true→ 触发verify二次校验后 PD signoff - drc
violations==0→ 干净 - verify
verify_ok=true→ 最终签字
收敛 / 失败
| 状态 | 行动 |
|---|---|
| export valid=true | signoff |
| export valid=false | 上溯 Magic DRC 定位 |
| drc violations>0 | bba-guru-pd 开 synth-needs-fix(综合冲突)或重布线 |
VERSION_MISMATCH | 修 eda_env.sh |
| Phase 2 timeout(1800s) | error="KLAYOUT_TIMEOUT" |
资源索引
scripts/render_klayout.py、scripts/run_klayout.py、scripts/parse_klayout.pyassets/export_gdsii.lym— DEF→GDS LYM 模板assets/drc_runset.drc— ASAP7 DRC runset 模板references/asap7_klayout_tech.mdGotcha/klayout_pitfalls.md
Signals
- GitHub stars
- 42
- Forks
- 10
- Last commit
- Aug 2026
Advanced
- Catalog kind
- skill
- Gateway key
bb-invoke-klayout- Source
- github.com/amoslee2026/babel