The-OpenROAD-Project / OpenROAD

OpenROAD's unified application implementing an RTL-to-GDS Flow. Documentation at https://openroad.readthedocs.io/en/latest/
https://theopenroadproject.org/
BSD 3-Clause "New" or "Revised" License
1.42k stars 496 forks source link

sta doesn't remove delete pin from clock #3590

Open maliberty opened 12 months ago

maliberty commented 12 months ago

Describe the bug

Sta doesn't handle when a Pin is deleted, and is present in a Clock's leafpins list, it isn't removed. This subsequently leads to a crash.

In this particular test case the problem manifests that the deleted dbITerm is reused by the db during repair_clock_inverters when the inverter is cloned and destroyed. This unrelated dbITerm (a VSS pin) then appears to be part of the clock definition which makes no sense and leads to the subsequent failure.

Expected Behavior

No crash. The Pin should be removed from the Clock. Ideally repair_clock_nets would actually clone the constraint.

Environment

Head of master OR (commit 12e051bf46754b25b033f97905419f7ab4533ecf)

To Reproduce

Run openroad test.tcl in the attached test case.

The test case is a minimal reproducer extracted from a much larger full chip run. It was also converted ng45 from a closed PDK. By itself it is a bit odd but shows the issue.

Relevant log output

[INFO CTS-0046]     Number of wire segments: 1632.
[INFO CTS-0047]     Number of keys in characterization LUT: 1632.
[INFO CTS-0048]     Actual min input cap: 1.
Signal 11 received
Stack trace:
 0# 0x0000000003D56615 in openroad
 1# 0x00007F26B148A400 in /lib64/libc.so.6
 2# sta::Vertex::bfsInQueue(sta::BfsIndex) const in openroad
 3# sta::BfsIterator::enqueue(sta::Vertex*) in openroad
 4# sta::ClkNetwork::findClkPins(bool, sta::Map<sta::Pin const*, sta::Set<sta::Clock*, sta::ClockIndexLess>, std::less<sta::Pin const*> >&) in openroad
 5# sta::ClkNetwork::findClkPins() in openroad
 6# sta::ClkNetwork::ensureClkNetwork() in openroad
 7# sta::Sta::ensureClkNetwork() in openroad
 8# sta::dbSta::findClkNets() in openroad

Screenshots

No response

Additional Context

No response

maliberty commented 12 months ago

repro.zip