coriolis/anabatic/src/PreRouteds.cpp

188 lines
6.7 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2014-2018, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PreRouteds.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/Warning.h"
#include "hurricane/BasicLayer.h"
#include "hurricane/RegularLayer.h"
#include "hurricane/DeepNet.h"
#include "hurricane/Pin.h"
#include "hurricane/RoutingPad.h"
#include "crlcore/AllianceFramework.h"
#include "anabatic/AnabaticEngine.h"
namespace Anabatic {
using std::cerr;
using std::cout;
using std::endl;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::BasicLayer;
using Hurricane::RegularLayer;
using Hurricane::Component;
using Hurricane::Pin;
using Hurricane::DeepNet;
using Hurricane::Cell;
using Hurricane::NetRoutingExtension;
using CRL::RoutingGauge;
using CRL::RoutingLayerGauge;
using CRL::AllianceFramework;
void AnabaticEngine::setupSpecialNets ()
{
AllianceFramework* af = AllianceFramework::get();
for ( Net* net : _cell->getNets() ) {
const char* excludedType = NULL;
if (net->getType() == Net::Type::POWER ) excludedType = "POWER";
if (net->getType() == Net::Type::GROUND) excludedType = "GROUND";
if (excludedType) {
cparanoid << Warning( "%s is not a routable net (%s,excluded)."
, getString(net).c_str(), excludedType ) << endl;
}
if (af->isBLOCKAGE(net->getName())) excludedType = "BLOCKAGE";
if (excludedType) {
NetData* ndata = getNetData( net, Flags::Create );
NetRoutingState* state = ndata->getNetRoutingState();
state->setFlags( NetRoutingState::Fixed );
ndata->setGlobalRouted( true );
}
}
}
size_t AnabaticEngine::setupPreRouteds ()
{
cmess1 << " o Looking for fixed or manually global routed nets." << endl;
Anabatic transient commit 18. Port of Kite (Katana), Yeah, Baby! Yeah! * Bug: In Hurricane, in StaticObservable::getObserver(), if the slot pointer is NULL, do not try to access the owner. Returns NULL, so the caller can be aware of the situation... * Change: In Hurricane, in BreakpointWidget & ExceptionWidget some cosmetic changes (fonts and window sizes). * Bug: In Anabatic, In AutoHorizontal::getConstraints(), take into account the constraints from the source AutoContact, as it holds the constraints transmitted by the RoutingPads and sets up by propageConstraintsFromRp(). It is likely to be a bug affecting the original Katabatic as well. * Change: In Anabatic, in RawGCellsUnder(), check that the segment is not completly oustside the cell abutment box and truncate the coordinates to the part that is inside. Use the "shrink" if we reach the east/north border. * Change: In Anabatic, in Configuration, no more decorator because we will use a true derived relationship. Katana *derives* from *Anabatic* and do not *decorate* it, so the Configuration can do the same. It also implies that we directly create a Katana engine, not an Anabatic one. * Change: In Anabatic, in Session, do not allow the opening of the Session in a standalone fashion (with a static method). Instead it must be opened using the relevant method of the Anabatic/Katana engine. This ensure we are opening the right Session type. * Change: In Anabatic, in AutoSegment_Aligneds() collection the seed segment is not part of the collection by default, but will be included if the Flags::WithSelf is set. * Change: In Configuration, all the flags value are now defined in two steps. Declared in the header and initialized in the module. This is to prevent the fact that on some cases, in relation with the Python "extern C" part modules, we need a true allocated variable. It was causing weird linking problems. A side effect is that they can no longer be used as entry is switches, have to replace them by if/else. * New: In Anabatic, new GCell::getNeighborAt() utility function. * Bug: In Anabatic, in GCell::doGrid(), tag all the GCells of the grid with the grid type... Back annote all the edges capacity (north & east) with the reserved local capacity. * New: Complete portage of Kite over Anabatic. The new engine is christened "Katana" for Kite-Analogic. When it's capabilities and performances will be on a part with Kite, it is to completly replace it (and take back the "Kite" name). Preliminary tests seems to show that, contrary to intuition (because built on a more complex/slower grid), it is even slightly faster than Kite 8-).
2016-08-15 09:30:13 -05:00
openSession();
size_t toBeRouteds = 0;
for ( Net* net : getCell()->getNets() ) {
if (net == _blockageNet) continue;
if (net->getType() == Net::Type::POWER ) continue;
if (net->getType() == Net::Type::GROUND) continue;
// Don't skip the clock.
vector<Segment*> segments;
vector<Contact*> contacts;
bool isPreRouted = false;
bool isFixed = false;
size_t rpCount = 0;
for( Component* component : net->getComponents() ) {
if (dynamic_cast<Pin*>(component)) continue;
const RegularLayer* layer = dynamic_cast<const RegularLayer*>(component->getLayer());
if (layer and (layer->getBasicLayer()->getMaterial() == BasicLayer::Material::blockage))
continue;
Horizontal* horizontal = dynamic_cast<Horizontal*>(component);
if (horizontal) {
segments.push_back( horizontal );
isPreRouted = true;
if (horizontal->getWidth() != Session::getWireWidth(horizontal->getLayer()))
isFixed = true;
} else {
Vertical* vertical = dynamic_cast<Vertical*>(component);
if (vertical) {
isPreRouted = true;
segments.push_back( vertical );
if (vertical->getWidth() != Session::getWireWidth(vertical->getLayer()))
isFixed = true;
} else {
Contact* contact = dynamic_cast<Contact*>(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<RoutingPad*>(component);
if (rp) {
++rpCount;
} else {
// Plug* plug = dynamic_cast<Plug*>(component);
// if (plug) {
// cerr << "buildPreRouteds(): " << plug << endl;
// ++rpCount;
// }
}
}
}
}
}
if ((not isFixed and not isPreRouted) and net->isDeepNet()) {
Net* rootNet = dynamic_cast<Net*>(
dynamic_cast<DeepNet*>(net)->getRootNetOccurrence().getEntity() );
for( Component* component : rootNet->getComponents() ) {
if (dynamic_cast<Horizontal*>(component)) { isFixed = true; break; }
if (dynamic_cast<Vertical*> (component)) { isFixed = true; break; }
if (dynamic_cast<Contact*> (component)) { isFixed = true; break; }
}
}
if (isFixed or isPreRouted or (rpCount < 2)) {
NetData* ndata = getNetData( net, Flags::Create );
NetRoutingState* state = ndata->getNetRoutingState();
state->unsetFlags( NetRoutingState::AutomaticGlobalRoute );
state->setFlags ( NetRoutingState::ManualGlobalRoute );
ndata->setGlobalRouted( true );
if (rpCount < 2)
state->setFlags ( NetRoutingState::Unconnected );
if (isFixed) {
Improved handling of short nets (fully included in one GCell). The short net mode degrade the routing in some cases. This will be fixed in a next batch of commits. * New: In Hurricane::NetRoutingProperty, added "ShortNet" flag for Nets that are completly inside *one* GCell. * Bug: In CRL::BlifParser::Model::staticInit(), when looking for the output of zero and one cell, also skip the blockage net (as well as automatic and supplies). * New: In Anabatic::AutoSegment, added "ShortNet" flag to know if the segment is part of a short net (fully included in *one* GCell). Also add accessor/mutators for the _analogMode flag (was it ever used before?). * New: In Anabatic::NetBuilder::singleGCell(), if a RoutingPad is vertically small, add a vertical segment to give it some slack. * New: In Anabatic::Dijkstra::_materialize(), detect "short net" as they have only one GCell in their source list... * Bug: In AnabaticEngine::_loadGrbyNet(), reset the AutoSegment "short net" and "analog mode" creation flags between two different nets. * New: In Katana::Configuration, added dedicated ripup for short net segmnts. * New: In Katana: partially implemented support for "short dogleg", that is dogleg that are always kept in same metal because they connect neighboring perpandicular tracks. Not finished neither activated yet. * New: In Katana::TreckElement and derived, export the the *short net* support from AutoSegment. * Bug: In Katana::RoutingEvent::_processRepair(), when a segment is successfully inserted, re-process any perpandicular that is in repair state, as it may have a new chance to be placed. * New: In Katana::SegmentFsm::slackenTopology(), always reject short nets. * Bug: In Katana::Track::check(), correctly handle wide segments instead of issuing false check messages.
2018-07-16 04:16:51 -05:00
if (rpCount > 1)
cmess2 << " - <" << net->getName() << "> is fixed." << endl;
state->unsetFlags( NetRoutingState::ManualGlobalRoute );
state->setFlags ( NetRoutingState::Fixed );
} else {
if (rpCount > 1) {
++toBeRouteds;
cmess2 << " - <" << net->getName() << "> is manually global routed." << endl;
for ( auto icontact : contacts ) {
AutoContact::createFrom( icontact );
}
for ( auto isegment : segments ) {
AutoContact* source = Session::lookup( dynamic_cast<Contact*>( isegment->getSource() ));
AutoContact* target = Session::lookup( dynamic_cast<Contact*>( isegment->getTarget() ));
AutoSegment* autoSegment = AutoSegment::create( source, target, isegment );
Katana manage wide wires, and they can also be symmetric. * New: In Anabatic::AutoContact and the derived classes, manages wide wires. The contact self dimension itself according to the segments it is connected to. Special case for the AutoContactTerminal which also read the size of the component it is anchored upon. New refresh method "updateSize()" and flag CntInvalidatedWidth. to compute the size. In AutoContactTerminal, compute the constraint box according to the width of the segment. * New: In Anabatic::AutoSegment, flags are now implemented as "static const" attributes of the class. The flags are stored into a uint64_t as they are more than 32. Added new flag "SegWide" and associated predicates. * Change: In GCellTopology::_doHChannel() and GCellTopology::_doVChannel(), uses the simpler overload of AutoSegment::create() in order to detect the wire width automatically. * New: In Katana::Manipulator, split insertToTrack() and forceToTrack() into a one-track method and a segment level method that iterate over the track span of the segment. * New: In Katana::SegmentFsm, for each cost in the table, now allow access to a specific track. So the base functions have now two parameters: "icost" and "itrack" (has a cost can have multiple tracks in the case of wide segments). * Change: In Katana::TrackElement, remove the index of the element inside it's track, as for a wide segment it will not be meaningful for the non-base track. This means that we have to use the Track::find() method each time instead. Remove the wide flag, as it is a duplicate of the one in AutoSegment. Added a getTrackCount() method to tell the number of track the segment is inserted into. Needed in the Track destroy step to delete a segment only when the last track that refers it is destroyed. Added getSymmetricAxis() to correct the computation of the symmetric base track in case of wide segment as the base track is not centered but the the leftmost one. * Change: In Track::insert() insert wide segments in their whole track span. * Change: In TrackCost, create an array of costs according to the segment track span. * Change: In TrackSegment::create(), now activate the factory and create wide segments. * Bug: In Katana::AutoSegments_Perpandicular, correct the debug indentation problem (ever shifting to the right).
2017-07-28 08:30:22 -05:00
autoSegment->setFlags( AutoSegment::SegUserDefined|AutoSegment::SegAxisSet );
}
}
}
} else {
++toBeRouteds;
}
}
Anabatic transient commit 18. Port of Kite (Katana), Yeah, Baby! Yeah! * Bug: In Hurricane, in StaticObservable::getObserver(), if the slot pointer is NULL, do not try to access the owner. Returns NULL, so the caller can be aware of the situation... * Change: In Hurricane, in BreakpointWidget & ExceptionWidget some cosmetic changes (fonts and window sizes). * Bug: In Anabatic, In AutoHorizontal::getConstraints(), take into account the constraints from the source AutoContact, as it holds the constraints transmitted by the RoutingPads and sets up by propageConstraintsFromRp(). It is likely to be a bug affecting the original Katabatic as well. * Change: In Anabatic, in RawGCellsUnder(), check that the segment is not completly oustside the cell abutment box and truncate the coordinates to the part that is inside. Use the "shrink" if we reach the east/north border. * Change: In Anabatic, in Configuration, no more decorator because we will use a true derived relationship. Katana *derives* from *Anabatic* and do not *decorate* it, so the Configuration can do the same. It also implies that we directly create a Katana engine, not an Anabatic one. * Change: In Anabatic, in Session, do not allow the opening of the Session in a standalone fashion (with a static method). Instead it must be opened using the relevant method of the Anabatic/Katana engine. This ensure we are opening the right Session type. * Change: In Anabatic, in AutoSegment_Aligneds() collection the seed segment is not part of the collection by default, but will be included if the Flags::WithSelf is set. * Change: In Configuration, all the flags value are now defined in two steps. Declared in the header and initialized in the module. This is to prevent the fact that on some cases, in relation with the Python "extern C" part modules, we need a true allocated variable. It was causing weird linking problems. A side effect is that they can no longer be used as entry is switches, have to replace them by if/else. * New: In Anabatic, new GCell::getNeighborAt() utility function. * Bug: In Anabatic, in GCell::doGrid(), tag all the GCells of the grid with the grid type... Back annote all the edges capacity (north & east) with the reserved local capacity. * New: Complete portage of Kite over Anabatic. The new engine is christened "Katana" for Kite-Analogic. When it's capabilities and performances will be on a part with Kite, it is to completly replace it (and take back the "Kite" name). Preliminary tests seems to show that, contrary to intuition (because built on a more complex/slower grid), it is even slightly faster than Kite 8-).
2016-08-15 09:30:13 -05:00
Session::close();
return toBeRouteds;
}
} // Anabatic namespace.