This skill should be used when running Yosys synthesis for area/timing estimation, synthesizability checking, or generating SDC timing constraints. Detects inferred latches, unmapped cells, and produces Design Compiler/Genus-ready SDC.
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.
</Purpose>
<Use_When>
<Do_Not_Use_When>
<Why_This_Exists> Synthesis reveals RTL constructs that simulate correctly but are unsynthesizable or produce unexpected hardware (latches, priority encoders). Early synthesis feedback prevents late-stage surprises. </Why_This_Exists>
<Execution_Policy>
syn/scripts/run_syn.sh (creates syn/scr/replay/run_syn_*_latest.sh)SDC Generation (MANDATORY — before synthesis):
templates/design-constraints.sdc as the SDC scaffoldreferences/sdc-best-practices.md for writing rules and common mistakestclsh syn/constraints/design.sdcSynthesis 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: skip if tool unavailable (for non-blocking estimation)
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_sp, sram_tp, sram_dp from rtl/common/) contain behavioral memory arraysmemory pass infers these as memory blocks (BRAM on FPGA, mapped cells on ASIC)`ifdef SYNTHESIS guardsynth-summary.json memory_inference field to verify correct inferencememory -nomap; stat to debugCapture syn/log/{module}_synth.log (raw Yosys output)
synthesis-reporter parses: cell count, area (μm²), NAND2-FO2 gate count, critical path depth
gate_count = total_area_um2 / 0.798 (NAND2X1 area in NanGate45)Latch detection — check stat output for $_DLATCH_ cells:
$_DLATCH_* count > 0 is a HARD FAILdefault: in case, unassigned signal in if-else branchesreferences/yosys-commands.md for latch detection detailsCheck for other concerning cells: $mem (unintended RAM), $mul (area-heavy multipliers)
Write syn/summary.json (see templates/synth-summary.json for format).
Use skills/rtl-synth-check/scripts/parse_yosys_stat.py to automate parsing:
python 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>
syn/constraints/design.sdc),
rtl/common/ auto-inclusion, SRAM wrapper dont_touch placeholders,
report_area, report_timing, report_power, report_qor--script <tcl> to use a custom Tcl script instead of auto-generationdont_touch lines in generated script when using foundry macros<Tool_Usage>
# ============================================================
# Step 2: SDC Generation (MANDATORY — before synthesis)
# ============================================================
Task(subagent_type="rtl-agent-team:constraint-writer",
prompt="Generate comprehensive SDC for design top module. Read 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.")
# ============================================================
# 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 --skip-if-unavailable. Script handles sv2v conversion internally. Outputs: syn/rpt/ (reports), syn/vnet/ (netlist), syn/log/ (logs). Check output for inferred latches. If SKIPPED, record status.")
# ============================================================
# 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>
<Escalation_And_Stop_Conditions>
<Final_Checklist>
NAND2-FO2 gate count conversion:
stat -liberty) / 0.798Why NanGate45 for TSMC 28nm:
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.
</Advanced>