diff --git a/anabatic/src/PreRouteds.cpp b/anabatic/src/PreRouteds.cpp index 8648d48f..96c337ff 100644 --- a/anabatic/src/PreRouteds.cpp +++ b/anabatic/src/PreRouteds.cpp @@ -66,12 +66,14 @@ namespace Anabatic { - void AnabaticEngine::setupPreRouteds () + size_t AnabaticEngine::setupPreRouteds () { cmess1 << " o Looking for fixed or manually global routed nets." << endl; openSession(); + size_t toBeRouteds = 0; + for ( Net* net : getCell()->getNets() ) { if (net == _blockageNet) continue; if (net->getType() == Net::Type::POWER ) continue; @@ -85,9 +87,52 @@ namespace Anabatic { bool isFixed = false; size_t rpCount = 0; - if (net->isDeepNet()) { - rpCount = 2; + for( Component* component : net->getComponents() ) { + if (dynamic_cast(component)) continue; + const RegularLayer* layer = dynamic_cast(component->getLayer()); + if (layer and (layer->getBasicLayer()->getMaterial() == BasicLayer::Material::blockage)) + continue; + + Horizontal* horizontal = dynamic_cast(component); + if (horizontal) { + segments.push_back( horizontal ); + isPreRouted = true; + if (horizontal->getWidth() != Session::getWireWidth(horizontal->getLayer())) + isFixed = true; + } else { + Vertical* vertical = dynamic_cast(component); + if (vertical) { + isPreRouted = true; + segments.push_back( vertical ); + if (vertical->getWidth() != Session::getWireWidth(vertical->getLayer())) + isFixed = true; + } else { + Contact* contact = dynamic_cast(component); + if (contact) { + isPreRouted = true; + contacts.push_back( contact ); + if ( (contact->getWidth () != Session::getViaWidth(contact->getLayer())) + or (contact->getHeight() != Session::getViaWidth(contact->getLayer())) + or (contact->getLayer () == Session::getContactLayer(0)) ) + isFixed = true; + } else { + RoutingPad* rp = dynamic_cast(component); + if (rp) { + ++rpCount; + } else { + // Plug* plug = dynamic_cast(component); + // if (plug) { + // cerr << "buildPreRouteds(): " << plug << endl; + // ++rpCount; + // } + } + } + } + } + } + + if ((not isFixed and not isPreRouted) and net->isDeepNet()) { Net* rootNet = dynamic_cast( dynamic_cast(net)->getRootNetOccurrence().getEntity() ); for( Component* component : rootNet->getComponents() ) { @@ -95,50 +140,6 @@ namespace Anabatic { if (dynamic_cast (component)) { isFixed = true; break; } if (dynamic_cast (component)) { isFixed = true; break; } } - } else { - for( Component* component : net->getComponents() ) { - if (dynamic_cast(component)) continue; - - const RegularLayer* layer = dynamic_cast(component->getLayer()); - if (layer and (layer->getBasicLayer()->getMaterial() == BasicLayer::Material::blockage)) - continue; - - Horizontal* horizontal = dynamic_cast(component); - if (horizontal) { - segments.push_back( horizontal ); - isPreRouted = true; - if (horizontal->getWidth() != Session::getWireWidth(horizontal->getLayer())) - isFixed = true; - } else { - Vertical* vertical = dynamic_cast(component); - if (vertical) { - isPreRouted = true; - segments.push_back( vertical ); - if (vertical->getWidth() != Session::getWireWidth(vertical->getLayer())) - isFixed = true; - } else { - Contact* contact = dynamic_cast(component); - if (contact) { - isPreRouted = true; - contacts.push_back( contact ); - if ( (contact->getWidth () != Session::getViaWidth(contact->getLayer())) - or (contact->getHeight() != Session::getViaWidth(contact->getLayer())) ) - isFixed = true; - } else { - RoutingPad* rp = dynamic_cast(component); - if (rp) { - ++rpCount; - } else { - // Plug* plug = dynamic_cast(component); - // if (plug) { - // cerr << "buildPreRouteds(): " << plug << endl; - // ++rpCount; - // } - } - } - } - } - } } if (isFixed or isPreRouted or (rpCount < 2)) { @@ -156,6 +157,8 @@ namespace Anabatic { state->setFlags ( NetRoutingState::Fixed ); } else { if (rpCount > 1) { + ++toBeRouteds; + cmess2 << " - <" << net->getName() << "> is manually global routed." << endl; for ( auto icontact : contacts ) { AutoContact::createFrom( icontact ); @@ -169,10 +172,14 @@ namespace Anabatic { } } } + } else { + ++toBeRouteds; } } Session::close(); + + return toBeRouteds; } diff --git a/anabatic/src/anabatic/AnabaticEngine.h b/anabatic/src/anabatic/AnabaticEngine.h index e6363930..9c1ec782 100644 --- a/anabatic/src/anabatic/AnabaticEngine.h +++ b/anabatic/src/anabatic/AnabaticEngine.h @@ -240,7 +240,7 @@ namespace Anabatic { inline void setBlockageNet ( Net* ); void chipPrep (); void setupSpecialNets (); - void setupPreRouteds (); + size_t setupPreRouteds (); void loadGlobalRouting ( uint32_t method ); void computeNetConstraints ( Net* ); void toOptimals ( Net* ); diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index 6c35dbaa..71f4cc2f 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -234,10 +234,14 @@ namespace Katana { setupRoutingPlanes(); } setupSpecialNets(); - setupPreRouteds(); - if (not isChannelMode()) { - setupPowerRails(); - protectRoutingPads(); + if (not setupPreRouteds()) { + setState( Anabatic::EngineDriving ); + throw Error( "KatanaEngine::digitalInit(): All nets are already routed, doing nothing." ); + } else { + if (not isChannelMode()) { + setupPowerRails(); + protectRoutingPads(); + } } _runKatanaInit();