bb-create-sdc

SkillFiles & storage

Derives Synopsys SDC timing constraint files from MAS (clock_domains / io_timing / path_exceptions), with syntax validation via OpenSTA. Trigger scenarios: (1) before synthesis with bba-guru-synthesis; (2) revising constraints after post-PD timing fail; (3) explicit /bb-create-sdc.

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-create-sdc skill

What this skill tells your AI

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

职责

按 MAS clock_domains / io_timing / path_exceptions + target_freq 生成 SDC,OpenSTA 解析校验。ADR-016:SDC 来源是 MAS,不从 RTL 推断。

  • 调用者:bba-guru-synthesis
  • 上游:bb-mas
  • 下游:bb-check-cdcbb-invoke-yosysbb-invoke-opensta
  • 禁止使用:Task / Agent / Skill

Global Paths

# Skill-local scripts (this skill's own scripts/ dir), consistent with all other bb-* skills.
PROJECT_SCRIPTS   = .claude/skills/bb-create-sdc/scripts

Input Args

argtyperequired默认说明
mas_pathpathtruedesigns/<name>/mas/mas.json
target_freq_mhzinttrue目标频率(MHz)
design_namestringtrue
process_cornerstringfalsett_0p77v_25cASAP7 corner
io_delay_pctfloatfalse0.3IO delay 占周期比
stampstringfalse<auto>

Output Contract

field
artifact_pathdesigns/<name>/constraints/<design>.sdc
script_pathdesigns/<name>/synth/gen_sdc_<stamp>.py
clocksint
io_constraintsint
exceptionsint
validbool
errorstring|null

SDC 模板

#==============================================================================
# {{ DESIGN_NAME }} Timing Constraints
# Source: spec/MAS/{{ MODULE_NAME }}/MAS.md §7
# Spec Hash: {{ sha256:xxxxxxxxxxxx }}
# Generated by bb-create-sdc @ {{ TIMESTAMP }}
# REQ Coverage: REQ-NFR-01, REQ-ARCH-01, REQ-M##-F##
#==============================================================================

# ── REQ-NFR-01: 主时钟频率 ──────────────────────────────────────────────────
# @requirement REQ-NFR-01
# @spec_ref MAS/{{ MODULE_NAME }}/MAS.md §7.1
create_clock -name clk -period <period> [get_ports clk]

# ── REQ-ARCH-01: CDC 策略 ───────────────────────────────────────────────────
# @requirement REQ-ARCH-01
# @spec_ref ARCH/clock_reset_spec.md §3
set_false_path -from [get_ports rst_n]

# ── REQ-M##-F##: IO 时序 ────────────────────────────────────────────────────
# @requirement REQ-M##-F##
# @spec_ref MAS/{{ MODULE_NAME }}/MAS.md §7.2
set_input_delay  -clock clk -max <io_max> [get_ports {<in_ports>}]
set_output_delay -clock clk -max <io_max> [get_ports {<out_ports>}]

# ── REQ-M##-F##: 多周期路径 ─────────────────────────────────────────────────
# @requirement REQ-M##-F##
# @spec_ref MAS/{{ MODULE_NAME }}/MAS.md §7.3
set_multicycle_path 2 -setup -from [...]  ;# from MAS.path_exceptions

Traceability 规则

SDC → REQ 关联

SDC 命令关联 REQ 类型来源
create_clockREQ-NFR-## (频率)PRD.md §3 PPA
set_input_delay / set_output_delayREQ-M##-F## (IO 时序)MAS.md §7.2
set_false_pathREQ-ARCH-## (CDC/复位)ARCH/clock_reset_spec.md
set_multicycle_pathREQ-M##-F## (多周期路径)MAS.md §7.3
set_clock_groupsREQ-ARCH-## (时钟域)ARCH/clock_reset_spec.md

生成流程

  1. 读取 MAS.md §7 时序约束
  2. traceability/requirements_matrix.arch.csv 查找关联 REQ_ID
  3. 生成 SDC 文件,每个约束前添加 @requirement + @spec_ref 注释
  4. 计算 @spec_hash(使用 .claude/skills/bb-rtl-coder/scripts/compute_spec_hash.py,该 helper 归 bb-rtl-coder 所有)
  5. 生成 traceability/requirements_matrix.sdc.csv

CSV 输出

req_id,req_desc,module,sdc_command,sdc_file,line_number,status
REQ-NFR-01,主时钟频率 ≥ 500MHz,SYS,create_clock,constraints/{{ DESIGN }}.sdc,12,implemented
REQ-ARCH-01,CDC 策略,SYS,set_false_path,constraints/{{ DESIGN }}.sdc,18,implemented

4-Phase 执行

Phase 1 — render_sdc_py

import json
mas = json.load(open(mas_path))
period = 1000.0 / target_freq_mhz   # ns
io_max = period * io_delay_pct
# 渲染 create_clock / set_input_delay / set_output_delay / set_false_path / set_multicycle_path

Phase 2 — run_sdc_gen

timeout 120 uv run python <script_path> > <artifact_path>

Phase 3 — sdc_syntax_check

sta -exit "read_sdc <artifact_path>; exit" 2>&1

$PROJECT_SCRIPTS/parse_sdc.py

  • log 含 Error:valid=false
  • 否则计 clocks / io_constraints / exceptions 数

Phase 4 — return

返回 JSON。

收敛 / 失败

状态行动
valid=truebb-check-cdcbb-invoke-yosys
valid=false重试 1 次,仍失败 error="sdc invalid"
post-PD timing failbba-guru-pd 触发本 skill 加 false_path / multicycle

资源索引

  • $PROJECT_SCRIPTS/render_sdc_py.py$PROJECT_SCRIPTS/run_sdc_gen.py$PROJECT_SCRIPTS/parse_sdc.py
  • assets/sdc.tcl.tmpl
  • references/asap7_corner_period.md — 各 corner 推荐 margin
  • Gotcha/sdc_pitfalls.md — virtual clock / clock group / generated clock

Signals

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