Introduce complete ripup functions for the router

This commit is contained in:
Gabriel Gouvine 2023-11-02 20:05:09 +01:00 committed by Gabriel Gouvine
parent 339ed4f9ff
commit 3757f64830
4 changed files with 72 additions and 0 deletions

View File

@ -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<Segment*> 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<Contact*> 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 () void AnabaticEngine::cleanupGlobal ()
{ {
UpdateSession::open(); UpdateSession::open();

View File

@ -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 ) void Edge::_setSource ( GCell* source )
{ {
if (source == _target) if (source == _target)

View File

@ -254,6 +254,7 @@ namespace Anabatic {
inline int incStamp (); inline int incStamp ();
Contact* breakAt ( Segment*, GCell* ); Contact* breakAt ( Segment*, GCell* );
void ripup ( Segment*, Flags ); void ripup ( Segment*, Flags );
void ripupAll ();
bool unify ( Contact* ); bool unify ( Contact* );
// Global routing related functions. // Global routing related functions.
void globalRoute (); void globalRoute ();

View File

@ -88,6 +88,7 @@ namespace Anabatic {
void remove ( Segment* ); void remove ( Segment* );
void replace ( Segment* orig, Segment* repl ); void replace ( Segment* orig, Segment* repl );
size_t ripup (); size_t ripup ();
size_t ripupAll ();
inline const Flags& flags () const; inline const Flags& flags () const;
inline Flags& flags (); inline Flags& flags ();
inline void revalidate () const; inline void revalidate () const;