SDC-first flow: SDC constraints are generated BEFORE synthesis to ensure timing-aware optimization.
Flow: 1. SDC generation → 2. sv2v conversion → 3. Yosys synthesis with NanGate45 liberty → 4. PPA report
Outputs: syn/log/ (logs), syn/rpt/ (reports), syn/vnet/ (netlist), syn/summary.json, and syn/constraints/design.sdc.
See references/yosys-commands.md for command reference and latch detection guide.
See references/sdc-best-practices.md for SDC writing rules and tool-specific commands.
SDC Generation (MANDATORY — before synthesis):
- constraint-writer reads docs/phase-1-research/iron-requirements.json (clock frequencies), docs/phase-3-uarch/*.md (multicycle paths), RTL top-level (port list)
- Use
templates/design-constraints.sdc as the SDC scaffold
- See
references/sdc-best-practices.md for writing rules and common mistakes
- Generates syn/constraints/design.sdc with: clock definitions, IO delays, false paths, multicycle paths, design rules
- Validates Tcl syntax:
tclsh syn/constraints/design.sdc
- SDC must exist before synthesis estimation proceeds
Synthesis execution (via replayable wrapper):
run_syn.sh handles tool selection, sv2v conversion (Yosys path), and output normalization
internally. Do NOT run sv2v manually — the script manages it as a Layer 2 concern.
# Preferred: replayable wrapper (auto-includes rtl/common/, handles sv2v internally)
syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --liberty NangateOpenCellLibrary_typical.lib
# With commercial tool (no sv2v needed):
syn/scripts/run_syn.sh --tool dc_shell --top {module} -f rtl/filelist_{module}.f
# Optional only for exploratory/non-gating estimates:
# syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --skip-if-unavailable
ASIC synthesis estimation (NanGate45 liberty — TSMC 28nm proxy):
Use the replayable wrapper or templates/yosys-synth-script.ys for script template:
syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --liberty NangateOpenCellLibrary_typical.lib
For manual debugging:
yosys -p "read_verilog rtl/{module}/{module}_v2v.v; \
hierarchy -check -top {module}; proc; opt; fsm; opt; \
memory; opt; techmap; opt; \
dfflibmap -liberty NangateOpenCellLibrary_typical.lib; \
abc -liberty NangateOpenCellLibrary_typical.lib; clean; \
stat -liberty NangateOpenCellLibrary_typical.lib" \
| tee syn/log/{module}_synth.log
Note: Always use NanGate45 (ASIC target). Do NOT use generic synthesis (no liberty) or FPGA synthesis.
4.5. SRAM wrapper handling during synthesis:
- SRAM wrappers (
sram_sp, sram_tp, sram_dp from rtl/common/) contain behavioral memory arrays
- Yosys
memory pass infers these as memory blocks (BRAM on FPGA, mapped cells on ASIC)
- For ASIC with foundry macros: wrapper body replaced via
`ifdef SYNTHESIS guard
- Check
synth-summary.json memory_inference field to verify correct inference
- If SRAM incorrectly inferred as FFs → check
memory -nomap; stat to debug
Capture syn/log/{module}_synth.log (raw Yosys output)
synthesis-reporter parses: cell count, area (μm²), NAND2-FO2 gate count, critical path depth
- Gate count formula:
gate_count = total_area_um2 / 0.798 (NAND2X1 area in NanGate45)
Latch detection — check stat output for $_DLATCH_ cells:
- Any
$_DLATCH_* count > 0 is a HARD FAIL
- Common causes: missing
default: in case, unassigned signal in if-else branches
- See
references/yosys-commands.md for latch detection details
Check for other concerning cells: $mem (unintended RAM), $mul (area-heavy multipliers)
Write syn/summary.json (see templates/synth-summary.json for format).
Use {plugin_root}/skills/rtl-synth-check/scripts/parse_yosys_stat.py to automate parsing ({plugin_root} = plugin root resolved from .rat/state/spawn-context.json):
python {plugin_root}/skills/rtl-synth-check/scripts/parse_yosys_stat.py syn/log/{module}_synth.log
Output includes: area_um2, gate_count_nand2, technology target
9.5. Commercial synthesis (when available):
Use the replayable wrapper which auto-generates tool scripts with SDC loading,
SRAM don't-touch handling, and full PPA reporting (area/timing/power/QoR):
# Synopsys Design Compiler
syn/scripts/run_syn.sh --tool dc_shell --top {top} -f rtl/filelist_top.f --liberty <tech.lib>
# Cadence Genus
syn/scripts/run_syn.sh --tool genus --top {top} -f rtl/filelist_top.f --liberty <tech.lib>
- Auto-generated scripts include: SDC source (
syn/constraints/design.sdc),
rtl/common/ auto-inclusion, SRAM wrapper dont_touch placeholders,
report_area, report_timing, report_power, report_qor
- Provide
--script <tcl> to use a custom Tcl script instead of auto-generation
- SRAM wrappers: uncomment
dont_touch lines in generated script when using foundry macros
- Flag any inferred latches as hard errors
============================================================
Step 3-4: ASIC Synthesis Estimation via wrapper (NanGate45 / TSMC 28nm proxy)
============================================================
Task(subagent_type="rtl-agent-team:eda-runner",
prompt="Run ASIC synthesis estimation using wrapper: syn/scripts/run_syn.sh --tool yosys --top {top} -f rtl/filelist_top.f --liberty NangateOpenCellLibrary_typical.lib. Script handles sv2v conversion internally. Outputs: syn/rpt/ (reports), syn/vnet/ (netlist), syn/log/ (logs). Check output for inferred latches. Treat tool/license unavailability as a blocked required gate unless the user explicitly requested a non-gating exploratory estimate.")
============================================================
Step 6-9: Parse results → gate count (NAND2-FO2 equivalent)
============================================================
Task(subagent_type="rtl-agent-team:synthesis-reporter",
prompt="Parse syn/log/ and syn/rpt/ Yosys output. Extract cell count, area (um2), compute NAND2-FO2 gate count (area / 0.798). Flag any inferred latches as hard errors. Write syn/summary.json with gate_count_nand2 field. Technology: ASIC TSMC 28nm (NanGate45 proxy).")
</Tool_Usage>
<Examples>
<Good>
ASIC 28nm estimation (NanGate45): 12,450 cells; area 9,935 μm²; 12,450 NAND2-FO2 gate equivalents;
max logic depth 18; no latches; SDC with 200MHz sys_clk constraint applied before synthesis.
</Good>
<Bad>
Running generic synthesis (no liberty file) — area/timing estimates are meaningless without technology mapping.
Skipping SDC creation — timing-unaware optimization produces unreliable PPA estimates.
Ignoring Yosys latch warnings — inferred latches cause hold-time violations in silicon.
Using FPGA synthesis (synth_xilinx) for ASIC estimation — wrong target technology.
</Bad>
</Examples>
<Escalation_And_Stop_Conditions>
- Synthesis errors (not warnings) → report to rtl-coder for RTL fix
- Inferred latches found → hard FAIL, report to rtl-coder with latch location
- Area estimate >2x target → report to rtl-architect for redesign consideration
</Escalation_And_Stop_Conditions>
<Final_Checklist>
- [ ] SDC generated BEFORE synthesis (syn/constraints/design.sdc)
- [ ] Every clock has create_clock or create_generated_clock
- [ ] All I/O ports have set_input_delay / set_output_delay
- [ ] Every set_false_path has justification comment
- [ ] Every set_multicycle_path has both -setup and -hold
- [ ] SDC passes Tcl syntax check
- [ ] sv2v conversion done before Yosys
- [ ] Yosys synthesis estimation completed with NanGate45 liberty (ASIC target)
- [ ] No inferred latches
- [ ] syn/summary.json written with gate_count_nand2 field
- [ ] Area reported in NAND2-FO2 gate equivalents (area_um2 / 0.798)
- [ ] Technology recorded as "ASIC TSMC 28nm (NanGate45 proxy)"
</Final_Checklist>
<Advanced>
**Default ASIC synthesis flow (NanGate45 — TSMC 28nm proxy):**
```bash
# NanGate45 is the DEFAULT and ONLY target for ASIC estimation
dfflibmap -liberty NangateOpenCellLibrary_typical.lib
abc -liberty NangateOpenCellLibrary_typical.lib
stat -liberty NangateOpenCellLibrary_typical.lib
NAND2-FO2 gate count conversion:
- NanGate45 NAND2X1 area = 0.798 μm²
- Gate count = Chip area (from
stat -liberty) / 0.798
- This is the standard area metric for all PPA reports
- Example: 9,935 μm² → 12,450 NAND2 gate equivalents
Why NanGate45 for TSMC 28nm:
- NanGate45 (FreePDK45) is the closest open-source liberty to real 28nm
- Gate count ratios (relative proportions) are representative
- Absolute area: apply scaling factor (45nm→28nm) ≈ (28/45)² ≈ 0.39 for physical area
- For estimation purposes, gate count is technology-independent
Key stat output fields to monitor:
| Cell |
Concern |
$_DFF_* |
Normal flip-flops (count should match intent) |
$_DLATCH_* |
CRITICAL — must be zero |
$_MUX_ |
High count may indicate priority encoding |
$add, $mul |
Check if area-efficient implementation needed |
$mem |
Check if SRAM inference was intended |
Additional useful commands: scc -max_depth 10 (combinational loop check),
write_verilog syn/netlist.v (export netlist), show -format dot (schematic).
See references/yosys-commands.md for complete command reference.
1---2name: rtl-synth-check3description: Yosys synthesis estimation on lint-clean RTL — 'synth check', 'area/timing estimate', 'generate SDC'; detects latches, emits DC/Genus-ready SDC.4---56<Purpose>7Run Yosys synthesis estimation on RTL targeting **ASIC TSMC 28nm** (approximated via NanGate45 liberty).8Area is reported in **NAND2 gate equivalents** (NAND2X1 fanout-of-2, ≈ 0.798 μm² in NanGate45).910**SDC-first flow**: SDC constraints are generated BEFORE synthesis to ensure timing-aware optimization.11Flow: 1. SDC generation → 2. sv2v conversion → 3. Yosys synthesis with NanGate45 liberty → 4. PPA report1213Outputs: syn/log/ (logs), syn/rpt/ (reports), syn/vnet/ (netlist), syn/summary.json, and syn/constraints/design.sdc.1415See `references/yosys-commands.md` for command reference and latch detection guide.16See `references/sdc-best-practices.md` for SDC writing rules and tool-specific commands.17</Purpose>1819<Use_When>20- RTL is lint-clean and pre-synthesis area/timing estimates are needed21- Checking whether RTL is synthesizable (no latches, no unresolved references)22- Comparing area impact of an RTL change23- SDC timing constraints needed for Design Compiler, Genus, or OpenSTA24- Pre-tapeout constraint review gate25</Use_When>2627<Do_Not_Use_When>28- RTL has lint errors (fix with rtl-lint-check first)29- Commercial synthesis tool required for signoff (Yosys is for estimation only)30- Only simulation results needed31</Do_Not_Use_When>3233<Why_This_Exists>34Synthesis reveals RTL constructs that simulate correctly but are unsynthesizable or produce35unexpected hardware (latches, priority encoders). Early synthesis feedback prevents late-stage surprises.36</Why_This_Exists>3738<Execution_Policy>39- **SDC-first**: constraint-writer generates SDC BEFORE synthesis (mandatory, not optional)40- eda-runner executes Yosys synthesis estimation with NanGate45 liberty41- For replayable execution, use `syn/scripts/run_syn.sh` (creates `syn/scr/replay/run_syn_*_latest.sh`)42- synthesis-reporter parses output, computes NAND2-FO2 gate count, and produces structured summary43- Target: ASIC TSMC 28nm estimation (NanGate45 as proxy)44- Area metric: NAND2 gate equivalents (total_area_um2 / 0.798)45- Gate: no synthesis errors, no inferred latches (warnings acceptable with documentation)46</Execution_Policy>4748<Steps>491. Verify RTL uses `logic` (no `reg`/`wire`) before synthesis — flag violations early50512. **SDC Generation (MANDATORY — before synthesis)**:52 - constraint-writer reads docs/phase-1-research/iron-requirements.json (clock frequencies), docs/phase-3-uarch/*.md (multicycle paths), RTL top-level (port list)53 - Use `templates/design-constraints.sdc` as the SDC scaffold54 - See `references/sdc-best-practices.md` for writing rules and common mistakes55 - Generates syn/constraints/design.sdc with: clock definitions, IO delays, false paths, multicycle paths, design rules56 - Validates Tcl syntax: `tclsh syn/constraints/design.sdc`57 - **SDC must exist before synthesis estimation proceeds**58593. **Synthesis execution** (via replayable wrapper):60 `run_syn.sh` handles tool selection, sv2v conversion (Yosys path), and output normalization61 internally. Do NOT run sv2v manually — the script manages it as a Layer 2 concern.62 ```bash63 # Preferred: replayable wrapper (auto-includes rtl/common/, handles sv2v internally)64 syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --liberty NangateOpenCellLibrary_typical.lib6566 # With commercial tool (no sv2v needed):67 syn/scripts/run_syn.sh --tool dc_shell --top {module} -f rtl/filelist_{module}.f6869 # Optional only for exploratory/non-gating estimates:70 # syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --skip-if-unavailable71 ```72734. **ASIC synthesis estimation** (NanGate45 liberty — TSMC 28nm proxy):74 Use the replayable wrapper or `templates/yosys-synth-script.ys` for script template:75 ```bash76 syn/scripts/run_syn.sh --tool yosys --top {module} -f rtl/filelist_{module}.f --liberty NangateOpenCellLibrary_typical.lib77 ```78 For manual debugging:79 ```bash80 yosys -p "read_verilog rtl/{module}/{module}_v2v.v; \81 hierarchy -check -top {module}; proc; opt; fsm; opt; \82 memory; opt; techmap; opt; \83 dfflibmap -liberty NangateOpenCellLibrary_typical.lib; \84 abc -liberty NangateOpenCellLibrary_typical.lib; clean; \85 stat -liberty NangateOpenCellLibrary_typical.lib" \86 | tee syn/log/{module}_synth.log87 ```88 **Note**: Always use NanGate45 (ASIC target). Do NOT use generic synthesis (no liberty) or FPGA synthesis.89904.5. **SRAM wrapper handling during synthesis**:91 - SRAM wrappers (`sram_sp`, `sram_tp`, `sram_dp` from `rtl/common/`) contain behavioral memory arrays92 - Yosys `memory` pass infers these as memory blocks (BRAM on FPGA, mapped cells on ASIC)93 - For ASIC with foundry macros: wrapper body replaced via `` `ifdef SYNTHESIS `` guard94 - Check `synth-summary.json` `memory_inference` field to verify correct inference95 - If SRAM incorrectly inferred as FFs → check `memory -nomap; stat` to debug96975. Capture syn/log/{module}_synth.log (raw Yosys output)98996. synthesis-reporter parses: cell count, area (μm²), NAND2-FO2 gate count, critical path depth100 - **Gate count formula**: `gate_count = total_area_um2 / 0.798` (NAND2X1 area in NanGate45)1011027. **Latch detection** — check `stat` output for `$_DLATCH_` cells:103 - Any `$_DLATCH_*` count > 0 is a **HARD FAIL**104 - Common causes: missing `default:` in case, unassigned signal in if-else branches105 - See `references/yosys-commands.md` for latch detection details1061078. Check for other concerning cells: `$mem` (unintended RAM), `$mul` (area-heavy multipliers)1081099. Write syn/summary.json (see `templates/synth-summary.json` for format).110 Use `{plugin_root}/skills/rtl-synth-check/scripts/parse_yosys_stat.py` to automate parsing (`{plugin_root}` = plugin root resolved from `.rat/state/spawn-context.json`):111 ```bash112 python {plugin_root}/skills/rtl-synth-check/scripts/parse_yosys_stat.py syn/log/{module}_synth.log113 ```114 Output includes: area_um2, gate_count_nand2, technology target1151169.5. **Commercial synthesis** (when available):117 Use the replayable wrapper which auto-generates tool scripts with SDC loading,118 SRAM don't-touch handling, and full PPA reporting (area/timing/power/QoR):119 ```bash120 # Synopsys Design Compiler121 syn/scripts/run_syn.sh --tool dc_shell --top {top} -f rtl/filelist_top.f --liberty <tech.lib>122123 # Cadence Genus124 syn/scripts/run_syn.sh --tool genus --top {top} -f rtl/filelist_top.f --liberty <tech.lib>125 ```126 - Auto-generated scripts include: SDC source (`syn/constraints/design.sdc`),127 `rtl/common/` auto-inclusion, SRAM wrapper `dont_touch` placeholders,128 `report_area`, `report_timing`, `report_power`, `report_qor`129 - Provide `--script <tcl>` to use a custom Tcl script instead of auto-generation130 - SRAM wrappers: uncomment `dont_touch` lines in generated script when using foundry macros13113210. Flag any inferred latches as hard errors133</Steps>134135<Tool_Usage>136```137# ============================================================138# Step 2: SDC Generation (MANDATORY — before synthesis)139# ============================================================140Task(subagent_type="rtl-agent-team:constraint-writer",141 prompt="Generate comprehensive SDC for design top module. Read docs/phase-1-research/iron-requirements.json for clock frequencies, docs/phase-3-uarch/*.md for multicycle paths, RTL top-level for port list. Use templates/design-constraints.sdc as scaffold. Write syn/constraints/design.sdc with: create_clock for all clocks using {domain}_clk naming, set_input_delay/set_output_delay for all i_*/o_* ports, set_false_path for async resets with justification, set_multicycle_path (both -setup and -hold) from uarch pipeline specs, design rules (set_max_fanout, set_max_transition). Validate with tclsh. See references/sdc-best-practices.md for rules.")142143# ============================================================144# Step 3-4: ASIC Synthesis Estimation via wrapper (NanGate45 / TSMC 28nm proxy)145# ============================================================146Task(subagent_type="rtl-agent-team:eda-runner",147 prompt="Run ASIC synthesis estimation using wrapper: syn/scripts/run_syn.sh --tool yosys --top {top} -f rtl/filelist_top.f --liberty NangateOpenCellLibrary_typical.lib. Script handles sv2v conversion internally. Outputs: syn/rpt/ (reports), syn/vnet/ (netlist), syn/log/ (logs). Check output for inferred latches. Treat tool/license unavailability as a blocked required gate unless the user explicitly requested a non-gating exploratory estimate.")148149# ============================================================150# Step 6-9: Parse results → gate count (NAND2-FO2 equivalent)151# ============================================================152Task(subagent_type="rtl-agent-team:synthesis-reporter",153 prompt="Parse syn/log/ and syn/rpt/ Yosys output. Extract cell count, area (um2), compute NAND2-FO2 gate count (area / 0.798). Flag any inferred latches as hard errors. Write syn/summary.json with gate_count_nand2 field. Technology: ASIC TSMC 28nm (NanGate45 proxy).")154```155</Tool_Usage>156157<Examples>158<Good>159ASIC 28nm estimation (NanGate45): 12,450 cells; area 9,935 μm²; 12,450 NAND2-FO2 gate equivalents;160max logic depth 18; no latches; SDC with 200MHz sys_clk constraint applied before synthesis.161</Good>162<Bad>163Running generic synthesis (no liberty file) — area/timing estimates are meaningless without technology mapping.164Skipping SDC creation — timing-unaware optimization produces unreliable PPA estimates.165Ignoring Yosys latch warnings — inferred latches cause hold-time violations in silicon.166Using FPGA synthesis (synth_xilinx) for ASIC estimation — wrong target technology.167</Bad>168</Examples>169170<Escalation_And_Stop_Conditions>171- Synthesis errors (not warnings) → report to rtl-coder for RTL fix172- Inferred latches found → hard FAIL, report to rtl-coder with latch location173- Area estimate >2x target → report to rtl-architect for redesign consideration174</Escalation_And_Stop_Conditions>175176<Final_Checklist>177- [ ] SDC generated BEFORE synthesis (syn/constraints/design.sdc)178 - [ ] Every clock has create_clock or create_generated_clock179 - [ ] All I/O ports have set_input_delay / set_output_delay180 - [ ] Every set_false_path has justification comment181 - [ ] Every set_multicycle_path has both -setup and -hold182 - [ ] SDC passes Tcl syntax check183- [ ] sv2v conversion done before Yosys184- [ ] Yosys synthesis estimation completed with NanGate45 liberty (ASIC target)185- [ ] No inferred latches186- [ ] syn/summary.json written with gate_count_nand2 field187- [ ] Area reported in NAND2-FO2 gate equivalents (area_um2 / 0.798)188- [ ] Technology recorded as "ASIC TSMC 28nm (NanGate45 proxy)"189</Final_Checklist>190191<Advanced>192**Default ASIC synthesis flow (NanGate45 — TSMC 28nm proxy):**193```bash194# NanGate45 is the DEFAULT and ONLY target for ASIC estimation195dfflibmap -liberty NangateOpenCellLibrary_typical.lib196abc -liberty NangateOpenCellLibrary_typical.lib197stat -liberty NangateOpenCellLibrary_typical.lib198```199200**NAND2-FO2 gate count conversion:**201- NanGate45 NAND2X1 area = 0.798 μm²202- Gate count = Chip area (from `stat -liberty`) / 0.798203- This is the standard area metric for all PPA reports204- Example: 9,935 μm² → 12,450 NAND2 gate equivalents205206**Why NanGate45 for TSMC 28nm:**207- NanGate45 (FreePDK45) is the closest open-source liberty to real 28nm208- Gate count ratios (relative proportions) are representative209- Absolute area: apply scaling factor (45nm→28nm) ≈ (28/45)² ≈ 0.39 for physical area210- For estimation purposes, gate count is technology-independent211212Key `stat` output fields to monitor:213| Cell | Concern |214|------|---------|215| `$_DFF_*` | Normal flip-flops (count should match intent) |216| `$_DLATCH_*` | **CRITICAL — must be zero** |217| `$_MUX_` | High count may indicate priority encoding |218| `$add`, `$mul` | Check if area-efficient implementation needed |219| `$mem` | Check if SRAM inference was intended |220221Additional useful commands: `scc -max_depth 10` (combinational loop check),222`write_verilog syn/netlist.v` (export netlist), `show -format dot` (schematic).223See `references/yosys-commands.md` for complete command reference.224</Advanced>