Skip to content

feat: add C++ port of STA CLI pipeline (cppver/)#2

Open
LenfIcefrost wants to merge 3 commits into
RayChang987:masterfrom
LenfIcefrost:feat/cpp
Open

feat: add C++ port of STA CLI pipeline (cppver/)#2
LenfIcefrost wants to merge 3 commits into
RayChang987:masterfrom
LenfIcefrost:feat/cpp

Conversation

@LenfIcefrost

Copy link
Copy Markdown
Contributor

Summary

  • Reimplements the Python main.py STA CLI pipeline in C++17 (cppver/) — liberty parsing, timing graph construction, and delay/slack propagation — organized into domain modules (liberty, constraints, placement, ranking, netlist, graph, sta), each with a matching sub-namespace. Verified to produce identical TNS/WNS/critical-path output to the Python version.
  • Adds cppver/ARCHITECTURE.md documenting the module layout and dataflow through the pipeline.
  • Refactors the STA propagation hot path to prep for GPU parallelization: caches each TimingArc's resolved TimingArcDef pointer at graph-build time (avoiding a string-key rebuild + hash lookup into CellInfo::timing_arcs per fanin arc on every calculate_node() call, falling back to by-key lookup only for resizable nodes), and adds graph::levelize() to group the topo order into dependency-free levels so calculate_delay()'s forward pass walks level by level — marking where a future parallel/GPU dispatch would split. Documents what a real CUDA/Metal port would additionally need (CSR-style flattening of the graph).

Test plan

  • Build cppver/ via CMake and confirm it compiles cleanly
  • Run cppver/run.sh (or the built binary) against a sample netlist/liberty/SDC set and diff TNS/WNS/critical-path output against the Python main.py result
  • Spot-check graph::levelize() output ordering matches the original topo order's dependency constraints

🤖 Generated with Claude Code

LenfIcefrost and others added 3 commits July 24, 2026 09:19
Reimplements the main.py CLI path (liberty parsing, timing graph
construction, delay/slack propagation) in C++17, organized into
domain modules (liberty, constraints, placement, ranking, netlist,
graph, sta) each with a matching sub-namespace. Verified to produce
identical TNS/WNS/critical-path output to the Python version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Cache each cell TimingArc's resolved TimingArcDef pointer at graph-build
time so calculate_node() no longer rebuilds a string key and hashes into
CellInfo::timing_arcs on every fanin arc; falls back to the by-key lookup
only for resizable nodes. Add graph::levelize() to group the topo order
into dependency-free levels, and walk calculate_delay()'s forward pass
level by level, marking the loop boundary a future parallel/GPU dispatch
would split on. Document both in ARCHITECTURE.md along with what a real
CUDA/Metal port would still need (CSR-style flattening of the graph).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant