From 3757f64830cf09c6a31698a89fb9eba70cc758a7 Mon Sep 17 00:00:00 2001 From: Gabriel Gouvine Date: Thu, 2 Nov 2023 20:05:09 +0100 Subject: [PATCH] Introduce complete ripup functions for the router --- anabatic/src/AnabaticEngine.cpp | 51 ++++++++++++++++++++++++++ anabatic/src/Edge.cpp | 19 ++++++++++ anabatic/src/anabatic/AnabaticEngine.h | 1 + anabatic/src/anabatic/Edge.h | 1 + 4 files changed, 72 insertions(+) diff --git a/anabatic/src/AnabaticEngine.cpp b/anabatic/src/AnabaticEngine.cpp index 004e9509..b0bbf16c 100644 --- a/anabatic/src/AnabaticEngine.cpp +++ b/anabatic/src/AnabaticEngine.cpp @@ -1091,6 +1091,57 @@ namespace Anabatic { } + void AnabaticEngine::ripupAll () + { + openSession(); + for ( GCell* cell : getGCells() ) { + if (not cell->isMatrix()) continue; + for ( Edge* edge : cell->getEdges() ) { + if (not edge) continue; + edge->ripupAll(); + } + } + _ovEdges.clear(); + + // Explicitly destroy what remains + for ( Net* net : getCell()->getNets() ) { + if (net == _blockageNet) continue; + if (net->getType() == Net::Type::POWER ) continue; + if (net->getType() == Net::Type::GROUND) continue; + + std::vector segments; + for( Segment* segment : net->getSegments() ) { + if (!Session::isGLayer(segment->getLayer())) { + continue; + } + segment->getSourceHook()->detach(); + segment->getTargetHook()->detach(); + segments.push_back(segment); + } + for (Segment *segment : segments) { + segment->destroy(); + } + + std::vector contacts; + for( Contact* contact : net->getContacts() ) { + if (!Session::isGLayer(contact->getLayer())) { + continue; + } + contacts.push_back(contact); + } + for (Contact *contact : contacts) { + contact->destroy(); + } + + for( RoutingPad* rp : net->getRoutingPads() ) { + rp->getBodyHook()->detach(); + } + } + + Session::close(); + } + + void AnabaticEngine::cleanupGlobal () { UpdateSession::open(); diff --git a/anabatic/src/Edge.cpp b/anabatic/src/Edge.cpp index 6f11d8ce..81381ebf 100644 --- a/anabatic/src/Edge.cpp +++ b/anabatic/src/Edge.cpp @@ -411,6 +411,25 @@ namespace Anabatic { } + size_t Edge::ripupAll () + { + AnabaticEngine* anabatic = getAnabatic(); + size_t netCount = 0; + + sort( _segments.begin(), _segments.end(), SortSegmentByLength(anabatic) ); + for ( size_t i=0 ; i<_segments.size() ; ) { + if ((not _segments[i]) or isEnding(_segments[i])) { + ++i; continue; + } + NetData* netData = anabatic->getNetData( _segments[i]->getNet() ); + if (netData->isGlobalFixed ()) continue; + if (netData->isGlobalRouted()) ++netCount; + anabatic->ripup( _segments[i], Flags::Propagate ); + } + return netCount; + } + + void Edge::_setSource ( GCell* source ) { if (source == _target) diff --git a/anabatic/src/anabatic/AnabaticEngine.h b/anabatic/src/anabatic/AnabaticEngine.h index 9cc621aa..d54cccdd 100644 --- a/anabatic/src/anabatic/AnabaticEngine.h +++ b/anabatic/src/anabatic/AnabaticEngine.h @@ -254,6 +254,7 @@ namespace Anabatic { inline int incStamp (); Contact* breakAt ( Segment*, GCell* ); void ripup ( Segment*, Flags ); + void ripupAll (); bool unify ( Contact* ); // Global routing related functions. void globalRoute (); diff --git a/anabatic/src/anabatic/Edge.h b/anabatic/src/anabatic/Edge.h index bdbb813a..fcb928e6 100644 --- a/anabatic/src/anabatic/Edge.h +++ b/anabatic/src/anabatic/Edge.h @@ -88,6 +88,7 @@ namespace Anabatic { void remove ( Segment* ); void replace ( Segment* orig, Segment* repl ); size_t ripup (); + size_t ripupAll (); inline const Flags& flags () const; inline Flags& flags (); inline void revalidate () const;