bb-invoke-magic

SkillDev tools

Invokes Magic 8.3.641 to perform PD operations: floorplan / place / DRC / layout extraction. Trigger scenarios: (1) bba-guru-pd performs floorplan and placement; (2) DRC after routing; (3) extract SPICE before LVS; (4) explicit /bb-invoke-magic.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the bb-invoke-magic skill

What this skill tells your AI

The instructions your AI receives, as published by amoslee2026/babel in .claude/skills/bb-invoke-magic/SKILL.md and read by ahel’s review.

职责

action 切换四种模式调 Magic:floorplan / place / drc / extract

注(M-05 dedup)action=floorplan 在本 skill 中保留为底层入口;bba-guru-pd 实际不直接调 floorplan,而是先调 bb-create-floorplan 生成 TCL,再以 action=place 把 TCL 执行(floorplan TCL 被 place_design 流程 source)。action=floorplan 仅供 ad-hoc 调试场景使用。

  • 调用者:bba-guru-pd
  • 禁止使用:Task / Agent / Skill

Input Args

argtyperequired说明
tech_filepathtrueASAP7 Magic tech file(.tech
layout_inputpathtruefloorplan/place:.tcl;drc/extract:.def/.mag
actionenumtruefloorplan | place | drc | extract
design_namestringtrue
top_modulestringtrue
stampstringfalse<auto>

Output Contract

field值(按 action)
artifact_pathdrc→designs/<name>/pd/drc_report.txt;place→pd/placed.def;floorplan→pd/floorplan.mag;extract→pd/extracted.spice
script_pathdesigns/<name>/pd/magic_<action>_<stamp>.tcl
log_pathdesigns/<name>/pd/magic_<action>_<stamp>.log
violationsint(drc)
violation_list[{type,layer,coord}](drc)
cleanbool(drc:violations==0)
validbool
errorstring|null

4-Phase 执行

Phase 1 — render_magic_tcl

scripts/render_magic_tcl.py 按 action 生成 TCL:

# action=drc
tech load <tech_file>
load designs/<name>/pd/routed.def
drc check
drc count
drc find
writeall force
quit
# action=place
source <layout_input>
place_design
write_def designs/<name>/pd/placed.def
quit
# action=extract
tech load <tech_file>
load designs/<name>/pd/<top>.mag
extract all
ext2spice -o designs/<name>/pd/extracted.spice
quit

Phase 2 — run_magic

scripts/run_magic.py

  1. source ~/wrk/eda_opensources/eda_env.sh
  2. magic --version | grep "8.3" 否则 VERSION_MISMATCH
  3. timeout 1800 magic -dnull -noconsole -T <tech_file> -rcfile /dev/null < <tcl> > <log> 2>&1

Phase 3 — parse_magic

  • drc:正则 DRC style.*?(\d+) error,violation 列表 (\w+) at (\d+),(\d+) layer (\w+)
  • place:检查 placed.def 存在 + size>0
  • floorplan:log 无 Error:
  • extractextracted.spice 存在

magic_<action>_<stamp>.json

Phase 4 — return

按 action 返回对应字段。bba-guru-pd

  • drc.clean=false → optimization loop(调整 utilization)
  • place.valid=false → 重 floorplan
  • extract → 触发 bb-invoke-netgen

收敛 / 失败

action通过
drcviolations == 0
placeplaced.def 存在
floorplanlog 无 Error
extractextracted.spice 存在

失败 ≤5 次重试;超出开 synth-needs-fix

资源索引

  • scripts/render_magic_tcl.pyscripts/run_magic.pyscripts/parse_magic.py
  • references/asap7_magic_tech.md
  • Gotcha/magic_pitfalls.md

Signals

GitHub stars
42
Forks
10
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
bb-invoke-magic
Source
github.com/amoslee2026/babel