coriolis/anabatic/src/AnabaticEngine.cpp

1173 lines
36 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-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 : "./AnabaticEngine.cpp" |
// +-----------------------------------------------------------------+
#include <sstream>
#include <iostream>
#include "hurricane/Bug.h"
#include "hurricane/Error.h"
#include "hurricane/Breakpoint.h"
#include "hurricane/RegularLayer.h"
Anabatic transient commit 10. Ripup & reroute support in Dijsktra. * New: In Anabatic: - In AnabaticEngine, keep track of overflowed edges. - In AnabaticEngine, getNetsFromedge() to lookup all nets going through an Edge. - In Configuration, read the Kite "reserved local" parameter to decrease the Edge capacity (it's a guessing of the cost of the local routing). - In Edge, add an attribute to know if there is an associated segment of the current net (set by Dijkstra::_traceback()). Transparently manage the overflowed edges. - In GCell_Edges, correct a filtering bug when not all sides are selecteds. - New GCell::getEdgeTo() to find the edge between two adjacent GCells. - New GCell::unrefContact() to automatically removes global contacts no longer used by any global segments (used during the ripup step). - In Dijkstra::load(), now able to "reload" and already partially or completly routed net (look for Contact of "gcontact" layer and their attached segments). - In Dijkstra, keep the last net loaded until the next one is. Put the cleanup operations in an isolated function "_cleanup()". - In Dijkstra::_selectFirstsource() and run(), load first source component made of multiple vertexes. - In Dijkstra::_trackback(), link the Net segments to the Edges. - New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform the ripup of one edge of a Net (must be loaded in Dijkstra first). Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes - that are connecteds through edges *with* segments. - In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
#include "hurricane/Horizontal.h"
#include "hurricane/RoutingPad.h"
Anabatic transient commit 10. Ripup & reroute support in Dijsktra. * New: In Anabatic: - In AnabaticEngine, keep track of overflowed edges. - In AnabaticEngine, getNetsFromedge() to lookup all nets going through an Edge. - In Configuration, read the Kite "reserved local" parameter to decrease the Edge capacity (it's a guessing of the cost of the local routing). - In Edge, add an attribute to know if there is an associated segment of the current net (set by Dijkstra::_traceback()). Transparently manage the overflowed edges. - In GCell_Edges, correct a filtering bug when not all sides are selecteds. - New GCell::getEdgeTo() to find the edge between two adjacent GCells. - New GCell::unrefContact() to automatically removes global contacts no longer used by any global segments (used during the ripup step). - In Dijkstra::load(), now able to "reload" and already partially or completly routed net (look for Contact of "gcontact" layer and their attached segments). - In Dijkstra, keep the last net loaded until the next one is. Put the cleanup operations in an isolated function "_cleanup()". - In Dijkstra::_selectFirstsource() and run(), load first source component made of multiple vertexes. - In Dijkstra::_trackback(), link the Net segments to the Edges. - New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform the ripup of one edge of a Net (must be loaded in Dijkstra first). Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes - that are connecteds through edges *with* segments. - In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
#include "hurricane/Vertical.h"
#include "hurricane/Cell.h"
#include "hurricane/DebugSession.h"
#include "hurricane/UpdateSession.h"
#include "crlcore/RoutingGauge.h"
#include "crlcore/Measures.h"
#include "anabatic/GCell.h"
#include "anabatic/NetBuilderM2.h"
#include "anabatic/NetBuilderHV.h"
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
#include "anabatic/NetBuilderVH.h"
#include "anabatic/AnabaticEngine.h"
namespace Anabatic {
using std::cerr;
using std::cout;
using std::endl;
using std::ostringstream;
using Hurricane::Bug;
using Hurricane::Error;
using Hurricane::Breakpoint;
using Hurricane::RegularLayer;
Anabatic transient commit 10. Ripup & reroute support in Dijsktra. * New: In Anabatic: - In AnabaticEngine, keep track of overflowed edges. - In AnabaticEngine, getNetsFromedge() to lookup all nets going through an Edge. - In Configuration, read the Kite "reserved local" parameter to decrease the Edge capacity (it's a guessing of the cost of the local routing). - In Edge, add an attribute to know if there is an associated segment of the current net (set by Dijkstra::_traceback()). Transparently manage the overflowed edges. - In GCell_Edges, correct a filtering bug when not all sides are selecteds. - New GCell::getEdgeTo() to find the edge between two adjacent GCells. - New GCell::unrefContact() to automatically removes global contacts no longer used by any global segments (used during the ripup step). - In Dijkstra::load(), now able to "reload" and already partially or completly routed net (look for Contact of "gcontact" layer and their attached segments). - In Dijkstra, keep the last net loaded until the next one is. Put the cleanup operations in an isolated function "_cleanup()". - In Dijkstra::_selectFirstsource() and run(), load first source component made of multiple vertexes. - In Dijkstra::_trackback(), link the Net segments to the Edges. - New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform the ripup of one edge of a Net (must be loaded in Dijkstra first). Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes - that are connecteds through edges *with* segments. - In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
using Hurricane::Component;
using Hurricane::Horizontal;
using Hurricane::Vertical;
using Hurricane::NetRoutingExtension;
using Hurricane::Cell;
using Hurricane::DebugSession;
using Hurricane::UpdateSession;
using CRL::RoutingGauge;
using CRL::RoutingLayerGauge;
using CRL::addMeasure;
using CRL::getMeasure;
// -------------------------------------------------------------------
// Error messages.
const char* missingAnbt =
"%s :\n\n"
" Cell %s do not have any Anabatic (or not yet created).\n";
const char* badMethod =
"%s :\n\n"
" No method id %ud (Cell %s).\n";
const char* lookupFailed =
"Anabatic::Extension::getDatas(Segment*) :\n\n"
" Cannot find AutoSegment associated to %s (internal error).\n";
// -------------------------------------------------------------------
// Class : "Anabatic::RawGCellsUnder".
RawGCellsUnder::RawGCellsUnder ( const AnabaticEngine* engine, Segment* segment )
{
cdebug_log(112,1) << "RawGCellsUnder::RawGCellsUnder(): " << segment << 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
Box gcellsArea = engine->getCell()->getAbutmentBox();
Point sourcePosition = segment->getSourcePosition();
Point targetPosition = segment->getTargetPosition();
if ( (sourcePosition.getX() > gcellsArea.getXMax())
or (sourcePosition.getY() > gcellsArea.getYMax())
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
or (targetPosition.getX() <= gcellsArea.getXMin())
or (targetPosition.getY() <= gcellsArea.getYMin()) ) {
cerr << Error( "RawGCellsUnder::RawGCellsUnder(): %s is completly outside the GCells area (ignored)."
, getString(segment).c_str()
) << endl;
cdebug_tabw(112,-1);
DebugSession::close();
return;
}
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
DbU::Unit xsource = std::max( sourcePosition.getX(), gcellsArea.getXMin() );
DbU::Unit ysource = std::max( sourcePosition.getY(), gcellsArea.getYMin() );
DbU::Unit xtarget = std::min( targetPosition.getX(), gcellsArea.getXMax() );
DbU::Unit ytarget = std::min( targetPosition.getY(), gcellsArea.getYMax() );
if (xtarget == gcellsArea.getXMax()) --xtarget;
if (ytarget == gcellsArea.getYMax()) --ytarget;
GCell* gsource = engine->getGCellUnder( xsource, ysource );
GCell* gtarget = engine->getGCellUnder( xtarget, ytarget );
if (not gsource) {
cerr << Bug( "RawGCellsUnder::RawGCellsUnder(): %s source not under a GCell (ignored)."
, getString(segment).c_str()
) << endl;
cdebug_tabw(112,-1);
DebugSession::close();
return;
}
if (not gtarget) {
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
cerr << Bug( "RawGCellsUnder::RawGCellsUnder(): %s target not under a GCell (ignored)."
, getString(segment).c_str()
) << endl;
cdebug_tabw(112,-1);
DebugSession::close();
return;
}
if (gsource == gtarget) {
_elements.push_back( Element(gsource,NULL) );
cdebug_tabw(112,-1);
DebugSession::close();
return;
}
Flags side = Flags::NoFlags;
DbU::Unit axis = 0;
Horizontal* horizontal = dynamic_cast<Horizontal*>( segment );
if (horizontal) {
side = Flags::EastSide;
axis = horizontal->getY();
if (horizontal->getSourceX() > horizontal->getTargetX())
std::swap( gsource, gtarget );
} else {
Vertical* vertical = dynamic_cast<Vertical*>( segment );
side = Flags::NorthSide;
axis = vertical->getX();
if (vertical->getSourceY() > vertical->getTargetY())
std::swap( gsource, gtarget );
}
Edge* edge = gsource->getEdgeAt( side, axis );
while ( edge ) {
_elements.push_back( Element(edge->getSource(),edge) );
if (edge->getTarget() == gtarget) break;
edge = edge->getTarget()->getEdgeAt( side, axis );
}
_elements.push_back( Element(gtarget,NULL) );
cdebug_tabw(112,-1);
}
// -------------------------------------------------------------------
// Class : "Anabatic::NetData".
NetData::NetData ( Net* net )
: _net (net)
, _state (NetRoutingExtension::get(net))
, _searchArea()
, _rpCount (0)
, _sparsity (0)
, _flags ()
{
if (_state and _state->isMixedPreRoute()) return;
for ( RoutingPad* rp : _net->getRoutingPads() ) {
_searchArea.merge( rp->getBoundingBox() );
++_rpCount;
}
_update();
}
// -------------------------------------------------------------------
// Class : "Anabatic::AnabaticEngine".
Name AnabaticEngine::_toolName = "Anabatic";
AnabaticEngine* AnabaticEngine::get ( const Cell* cell )
{ return static_cast<AnabaticEngine*>(ToolEngine::get(cell,staticGetName())); }
const Name& AnabaticEngine::staticGetName ()
{ return _toolName; }
const Name& AnabaticEngine::getName () const
{ return _toolName; }
AnabaticEngine::AnabaticEngine ( Cell* cell )
: Super(cell)
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
, _configuration (new Configuration())
, _chipTools (cell)
, _state (EngineCreation)
, _matrix ()
, _gcells ()
, _ovEdges ()
, _netOrdering ()
, _netDatas ()
, _viewer (NULL)
, _flags (Flags::DestroyBaseContact)
, _stamp (-1)
, _densityMode (MaxDensity)
, _autoSegmentLut ()
, _autoContactLut ()
, _blockageNet (cell->getNet("blockagenet"))
{
_matrix.setCell( cell, _configuration->getSliceHeight() );
Edge::unity = _configuration->getSliceHeight();
if (not _blockageNet) _blockageNet = Net::create( cell, "blockagenet" );
}
void AnabaticEngine::_postCreate ()
{
Super::_postCreate();
UpdateSession::open();
GCell::create( this );
UpdateSession::close();
}
AnabaticEngine* AnabaticEngine::create ( Cell* cell )
{
if (not cell) throw Error( "AnabaticEngine::create(): NULL cell argument." );
if (cell->getAbutmentBox().isEmpty())
throw Error( "AnabaticEngine::create(): %s has no abutment box." , getString(cell).c_str() );
AnabaticEngine* engine = new AnabaticEngine ( cell );
engine->_postCreate();
return engine;
}
AnabaticEngine::~AnabaticEngine ()
{
delete _configuration;
for ( pair<unsigned int,NetData*> data : _netDatas ) delete data.second;
}
void AnabaticEngine::_preDestroy ()
{
cdebug_log(145,1) << "Anabatic::_preDestroy ()" << endl;
if (getState() < EngineGutted)
setState( EnginePreDestroying );
_gutAnabatic();
_state = EngineGutted;
cdebug_log(145,0) << "About to delete base class ToolEngine." << endl;
Super::_preDestroy();
//cmess2 << " - GCells := " << GCell::getAllocateds() << endl;
cmess2 << " - AutoContacts := " << AutoContact::getAllocateds() << endl;
cmess2 << " - AutoSegments := " << AutoSegment::getAllocateds() << endl;
cdebug_log(145,0) << "Exiting Anabatic::_preDestroy()." << endl;
cdebug_tabw(145,-1);
}
void AnabaticEngine::_gutAnabatic ()
{
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();
_flags.reset( Flags::DestroyBaseContact|Flags::DestroyBaseSegment );
if (_state == EngineDriving) {
cdebug_log(145,1) << "Saving AutoContacts/AutoSegments." << endl;
size_t fixedSegments = 0;
size_t sameLayerDoglegs = 0;
for ( auto isegment : _autoSegmentLut ) {
if (isegment.second->isFixed()) ++fixedSegments;
if (isegment.second->reduceDoglegLayer()) ++sameLayerDoglegs;
}
cmess1 << " o Driving Hurricane data-base." << endl;
cmess1 << Dots::asSizet(" - Active AutoSegments",AutoSegment::getAllocateds()-fixedSegments) << endl;
cmess1 << Dots::asSizet(" - Active AutoContacts",AutoContact::getAllocateds()-fixedSegments*2) << endl;
cmess1 << Dots::asSizet(" - AutoSegments" ,AutoSegment::getAllocateds()) << endl;
cmess1 << Dots::asSizet(" - AutoContacts" ,AutoContact::getAllocateds()) << endl;
cmess1 << Dots::asSizet(" - Same Layer doglegs" ,sameLayerDoglegs) << endl;
//for ( Net* net : _cell->getNets() ) _saveNet( net );
cdebug_tabw(145,-1);
}
if (_state < EngineGutted ) {
cdebug_log(145,0) << "Gutting Anabatic." << endl;
_state = EngineGutted;
_flags |= Flags::DestroyBaseContact;
_destroyAutoSegments();
_destroyAutoContacts();
_flags |= Flags::DestroyGCell;
for ( GCell* gcell : _gcells ) gcell->_destroyEdges();
for ( GCell* gcell : _gcells ) gcell->destroy();
_gcells.clear();
_ovEdges.clear();
}
Session::close();
}
Configuration* AnabaticEngine::getConfiguration ()
{ return _configuration; }
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
Interval AnabaticEngine::getUSide ( Flags direction ) const
{
Interval side;
Box bBox ( getCell()->getBoundingBox() );
if (direction & Flags::Horizontal) side = Interval( bBox.getXMin(), bBox.getXMax() );
else if (direction & Flags::Vertical ) side = Interval( bBox.getYMin(), bBox.getYMax() );
else {
cerr << Error( "AnabaticEngine::getUSide(): Unknown direction flag \"%i\""
, getString(direction).c_str() ) << endl;
}
return side;
}
int AnabaticEngine::getCapacity ( Interval span, Flags flags ) const
{
int capacity = 0;
Box ab = getCell()->getAbutmentBox();
RoutingGauge* rg = _configuration->getRoutingGauge();
span.inflate( 0, -1 );
if (span.isEmpty()) return 0;
const vector<RoutingLayerGauge*>& layerGauges = rg->getLayerGauges();
for ( size_t depth=0 ; depth <= _configuration->getAllowedDepth() ; ++depth ) {
if (layerGauges[depth]->getType() != Constant::Default) continue;
if (flags & Flags::Horizontal) {
if (layerGauges[depth]->getDirection() != Constant::Horizontal) continue;
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getYMin()
, span.getVMax() - ab.getYMin() );
Anabatic transient commit 8. More Dijkstra bugs correcteds. * Bug: In Anabatic: - In _propagate(), on reaching a target, forgot to remove it from the queue before pushing it back with the new distance. It also simplificate the core algorithm as target as treated normal nodes. * New: In Anabatic: - Update cdebug to use the fastest macro version. - More readable drawings of GCells and Edges. - Added timer support. - The distance is now computed in DbU::Unit (aka long) and not in normalized float. - The distance function is now a callback (std::function<>) that can be changed (a default is provided at initialization). - New concept of branch in the agglomerated connex component. Each trace back part create a "branch" (tagged with a "branchId"). When a node is reached with the same distance, but from two different branches, choose the the branch that was lastly created. This create a slightly different tree which grows outward from the newest branches. - Makes the horizontal edges *slightly* longer than the vertical ones to skew the tree to use vertical edges, as it is usually less congested than the horiontal one (due to metal1 cell terminals). It is also my understanding that it is useful to reduce the number of vias, whithout introducing a via cost. * New: In Bootstrap: - Script sprof.py to perform sprof & demangle libraries execution profile. * ToDo: In Anabatic: - Corner optimization. Sometimes when two corners are possible, the wrong one is choosen. That is, one of it's edge cannot be used for further grow of the tree.
2016-06-17 06:09:34 -05:00
//cdebug_log(110,0) << "Horizontal edge capacity:" << capacity << endl;
}
if (flags & Flags::Vertical) {
if (layerGauges[depth]->getDirection() != Constant::Vertical) continue;
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getXMin()
, span.getVMax() - ab.getXMin() );
Anabatic transient commit 8. More Dijkstra bugs correcteds. * Bug: In Anabatic: - In _propagate(), on reaching a target, forgot to remove it from the queue before pushing it back with the new distance. It also simplificate the core algorithm as target as treated normal nodes. * New: In Anabatic: - Update cdebug to use the fastest macro version. - More readable drawings of GCells and Edges. - Added timer support. - The distance is now computed in DbU::Unit (aka long) and not in normalized float. - The distance function is now a callback (std::function<>) that can be changed (a default is provided at initialization). - New concept of branch in the agglomerated connex component. Each trace back part create a "branch" (tagged with a "branchId"). When a node is reached with the same distance, but from two different branches, choose the the branch that was lastly created. This create a slightly different tree which grows outward from the newest branches. - Makes the horizontal edges *slightly* longer than the vertical ones to skew the tree to use vertical edges, as it is usually less congested than the horiontal one (due to metal1 cell terminals). It is also my understanding that it is useful to reduce the number of vias, whithout introducing a via cost. * New: In Bootstrap: - Script sprof.py to perform sprof & demangle libraries execution profile. * ToDo: In Anabatic: - Corner optimization. Sometimes when two corners are possible, the wrong one is choosen. That is, one of it's edge cannot be used for further grow of the tree.
2016-06-17 06:09:34 -05:00
//cdebug_log(110,0) << "Vertical edge capacity:" << capacity << endl;
}
}
return capacity;
}
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
void AnabaticEngine::openSession ()
{ Session::_open(this); }
void AnabaticEngine::reset ()
{
_gutAnabatic();
_flags.reset( Flags::DestroyMask );
_state = EngineCreation;
UpdateSession::open();
GCell::create( this );
UpdateSession::close();
}
void AnabaticEngine::setupNetDatas ()
{
size_t oindex = _netOrdering.size();
for ( Net* net : _cell->getNets() ) {
if (_netDatas.find(net->getId()) != _netDatas.end()) continue;
_netOrdering.push_back( new NetData(net) );
}
for ( ; oindex < _netOrdering.size() ; ++oindex ) {
_netDatas.insert( make_pair( _netOrdering[oindex]->getNet()->getId()
, _netOrdering[oindex] ) );
}
sort( _netOrdering.begin(), _netOrdering.end(), SparsityOrder() );
}
void AnabaticEngine::updateMatrix()
{
_matrix.setCell( getCell(), Session::getSliceHeight() );
Added support for 2-Metal block routing in Anabatic & Katana. * New: In AnabaticEngine::invalidateRoutingPads() this method is a temporary workaround for a Hurricane problems. When an instance is moved, the RoutingPads that use it must be moved accordingly, but they are not invalidated so they stay in the wrong QuadTree. New method ::_resizeMatrix() to be called when the associated Cell is resized. * Bug: In AutoHorizontal::getConstraints() and AutoVertical::getConstraints(), the *target* constraints where never merged. * Change: In AutoHorizontal::getCells() and AutoVertical::getGCells(), now return a boolean to tell if it was ok (must not encounter a NULL GCell while progessing from source to target). * New: In Anabatic::Configuration and Anabatic:Session, create new methods: - getDHorizontalLayer() - getDhorizontalDepth() - getDHorizontalWidth() - getDHorizontalPitch() And so on for Vertical and Contact. They supply depth-independant informations about the H/V layers to build the initial detailed routing. The AutoSegment::create() methods have been modificated accordingly. * New: In Anabatic::GCell, add two new types "StdCellRow" and "ChannelRow" for implementing 2-Metal blocks. Rename the GCell::setXY() method in GCell::setSouthWestCorner(), move the contents of GCell::updateContactsPosition() into it and suppress it. WARNING: In case of a GCell shrink this may cause problems. But for now we only expand... New method GCell::getNetCount() to count the number of Net going though the GCell. * Change: In Anabatic::Edge, add specific support for capacity of 2-Metal routing channels. * Change: In Anabatic::Dijsktra various methods, replace the "gcell->isMatrix()" calls by "not gcell->isAnalog()". Add more check so that the methods pertaining to the analog routing (GRData) are not called in digital mode. * New: In Anabatic::Dijkstra::materialize(), add support for 2-Metal specific cases. That is, always break in case of vertical pass-through or U-turn. The global routing must always be broken in H-Channel. * New: In Anabatic::GCell & Anabatic::Edge, make use of the Session mechanism to ensure the revalidation. The "::revalidate()" method is then moved as "::materialize()" (overload of Go) and "::_invalidate()" becomes "::invalidate()" * Change: In LoadGlobalRouting, cosmetic rename of SortHkByX in SortHookByX. * New: In GCellTopology, added support for building 2-Metal topologies. * ForkStack is now an object attribute as many methods do need it. * To push segments/hook on the stack, a new method "push()" is available. Perform NULL and fromHook checking. Can also setup _southWestContact or _northEastContact if it is the "from" edge. * N/S/E/W edges are now vector as in digital channel mode there can be more than one. * Added build topological build methods: - doRp_2m_Access() RoutingPad stem access. - _do_2m_1G_1M1() North or south access. - _do_2m_2G_1M1() North AND south access. - _do_2m_xG() H-Channel routing. * New: In Anabatic::Matrix, new ::resize() function, as Cell can be resizeds. * New: In Anabatic::Vertex, new static method ::getValueString() for a friendly text rendering. * New: In Katana::DigitalDistance, support for channel routing. * Change: In KatanaEngine::digitalSetup() and KatanaEngine::runGlobalrouter(), for channel routing, calls to setupPowerRails() and protectRoutingPads() must be called after the core block has been fully dimensionned. ::runGlobalrouter() contains the code tasked with the grid creation and channel sizing. * New: In KatanaEngine: Added support for core block, for 2-Metal routing. May be expanded for over-the-cell routing in the future. Added methods : - isDigitalMode() - isAnalogMode() - isMixedMode() - isChannelMode() - getBlock() / addBlock() - setupChannelMode() - createChannel() * New: In Katana, new class Block to manage core blocks and perform channel routing. * New: In Katana::Session, new convenience method "isOpen()".
2017-08-18 16:56:23 -05:00
for ( GCell* gcell : _gcells ) _updateLookup( gcell );
}
Anabatic transient commit 10. Ripup & reroute support in Dijsktra. * New: In Anabatic: - In AnabaticEngine, keep track of overflowed edges. - In AnabaticEngine, getNetsFromedge() to lookup all nets going through an Edge. - In Configuration, read the Kite "reserved local" parameter to decrease the Edge capacity (it's a guessing of the cost of the local routing). - In Edge, add an attribute to know if there is an associated segment of the current net (set by Dijkstra::_traceback()). Transparently manage the overflowed edges. - In GCell_Edges, correct a filtering bug when not all sides are selecteds. - New GCell::getEdgeTo() to find the edge between two adjacent GCells. - New GCell::unrefContact() to automatically removes global contacts no longer used by any global segments (used during the ripup step). - In Dijkstra::load(), now able to "reload" and already partially or completly routed net (look for Contact of "gcontact" layer and their attached segments). - In Dijkstra, keep the last net loaded until the next one is. Put the cleanup operations in an isolated function "_cleanup()". - In Dijkstra::_selectFirstsource() and run(), load first source component made of multiple vertexes. - In Dijkstra::_trackback(), link the Net segments to the Edges. - New Dijkstra::ripup(), Dijkstra::_propagateRipup() to perform the ripup of one edge of a Net (must be loaded in Dijkstra first). Dijkstra::_tagConnecteds() setup the connexId of a set of Vertexes - that are connecteds through edges *with* segments. - In GraphicAnabaticengine & GlobalRoute.cpp, embryo of a global routing tool with ripup & reroute.
2016-06-26 07:32:32 -05:00
size_t AnabaticEngine::getNetsFromEdge ( const Edge* edge, NetSet& nets )
{
size_t count = 0;
GCell* source = edge->getSource();
GCell* target = edge->getTarget();
const vector<Contact*>& contacts = source->getGContacts();
for ( Contact* contact : contacts ) {
for ( Component* component : contact->getSlaveComponents() ) {
if (edge->isHorizontal()) {
Horizontal* horizontal = dynamic_cast<Horizontal*>( component );
if (horizontal
and (horizontal->getSource() == contact)
and (target->hasGContact(dynamic_cast<Contact*>(horizontal->getTarget())))) {
nets.insert( horizontal->getNet() );
++count;
}
}
if (edge->isVertical()) {
Vertical* vertical = dynamic_cast<Vertical*>( component );
if (vertical
and (vertical->getSource() == contact)
and (target->hasGContact(dynamic_cast<Contact*>(vertical->getTarget())))) {
nets.insert( vertical->getNet() );
++count;
}
}
}
}
return count;
}
NetData* AnabaticEngine::getNetData ( Net* net, Flags flags )
{
NetData* data = NULL;
NetDatas::iterator idata = _netDatas.find( net->getId() );
if (idata == _netDatas.end()) {
data = new NetData( net );
_netDatas.insert( make_pair(net->getId(),data) );
_netOrdering.push_back( data );
// cerr << Bug( "AnabaticEngine::getNetData() - %s is missing in NetDatas table."
// , getString(net->getName()).c_str()
// ) << endl;
// return NULL;
} else
data = idata->second;
if ((flags & Flags::Create) and not data->getNetRoutingState()) {
data->setNetRoutingState( NetRoutingExtension::create(net) );
}
return data;
}
Contact* AnabaticEngine::breakAt ( Segment* segment, GCell* breakGCell )
{
size_t i = 0;
GCellsUnder gcells ( new RawGCellsUnder(this,segment) );
for ( ; i<gcells->size() ; ++i ) {
if (gcells->gcellAt(i) == breakGCell) break;
}
Contact* breakContact = breakGCell->getGContact( segment->getNet() );
if (i == gcells->size()) {
cerr << Error( "AnabaticEngine::breakAt(): %s is *not* over %s."
, getString(segment).c_str()
, getString(breakGCell).c_str()
) << endl;
return breakContact;
}
Component* targetContact = segment->getTarget();
segment->getTargetHook()->detach();
segment->getTargetHook()->attach( breakContact->getBodyHook() );
Segment* splitted = NULL;
Horizontal* horizontal = dynamic_cast<Horizontal*>(segment);
if (horizontal) {
splitted = Horizontal::create( breakContact
, targetContact
, getConfiguration()->getGHorizontalLayer()
, horizontal->getY()
, DbU::fromLambda(2.0)
);
} else {
Vertical* vertical = dynamic_cast<Vertical*>(segment);
if (vertical) {
splitted = Vertical::create( breakContact
, targetContact
, getConfiguration()->getGVerticalLayer()
, vertical->getX()
, DbU::fromLambda(2.0)
);
} else
return breakContact;
}
for ( ; i<gcells->size()-1 ; ++i ) gcells->edgeAt(i)->replace( segment, splitted );
return breakContact;
}
bool AnabaticEngine::unify ( Contact* contact )
{
size_t hCount = 0;
size_t vCount = 0;
Horizontal* horizontals[2];
Vertical* verticals [2];
for ( Component* slave : contact->getSlaveComponents() ) {
Horizontal* h = dynamic_cast<Horizontal*>( slave );
if (h) {
if (vCount or (hCount > 1)) return false;
horizontals[hCount++] = h;
} else {
Vertical* v = dynamic_cast<Vertical*>( slave );
if (v) {
if (hCount or (vCount > 1)) return false;
verticals[vCount++] = v;
} else {
// Something else depends on this contact.
return false;
}
}
}
if (hCount == 2) {
if (horizontals[0]->getTarget() != contact) std::swap( horizontals[0], horizontals[1] );
Interval constraints ( false );
GCellsUnder gcells0 = getGCellsUnder( horizontals[0] );
if (not gcells0->empty()) {
for ( size_t i=0 ; i<gcells0->size() ; ++i )
constraints.intersection( gcells0->gcellAt(i)->getSide(Flags::Vertical) );
}
GCellsUnder gcells1 = getGCellsUnder( horizontals[1] );
if (not gcells1->empty()) {
for ( size_t i=0 ; i<gcells1->size() ; ++i ) {
constraints.intersection( gcells1->gcellAt(i)->getSide(Flags::Vertical) );
if (constraints.isEmpty()) return false;
}
}
if (not gcells1->empty()) {
for ( size_t i=0 ; i<gcells1->size()-1 ; ++i )
gcells1->edgeAt(i)->replace( horizontals[1], horizontals[0] );
}
Component* target = horizontals[1]->getTarget();
horizontals[1]->destroy();
horizontals[0]->getTargetHook()->detach();
horizontals[0]->getTargetHook()->attach( target->getBodyHook() );
}
if (vCount == 2) {
if (verticals[0]->getTarget() != contact) std::swap( verticals[0], verticals[1] );
Interval constraints ( false );
GCellsUnder gcells0 = getGCellsUnder( verticals[0] );
if (not gcells0->empty()) {
for ( size_t i=0 ; i<gcells0->size() ; ++i )
constraints.intersection( gcells0->gcellAt(i)->getSide(Flags::Horizontal) );
}
GCellsUnder gcells1 = getGCellsUnder( verticals[1] );
if (not gcells1->empty()) {
for ( size_t i=0 ; i<gcells1->size() ; ++i ) {
constraints.intersection( gcells1->gcellAt(i)->getSide(Flags::Horizontal) );
if (constraints.isEmpty()) return false;
}
}
if (not gcells1->empty()) {
for ( size_t i=0 ; i<gcells1->size()-1 ; ++i )
gcells1->edgeAt(i)->replace( verticals[1], verticals[0] );
}
Component* target = verticals[1]->getTarget();
verticals[1]->destroy();
verticals[0]->getTargetHook()->detach();
verticals[0]->getTargetHook()->attach( target->getBodyHook() );
}
getGCellUnder( contact->getPosition() )->unrefContact( contact );
return true;
}
void AnabaticEngine::ripup ( Segment* seed, Flags flags )
{
Net* net = seed->getNet();
DebugSession::open( net, 112, 120 );
cdebug_log(112,1) << "AnabaticEngine::ripup(): " << seed << endl;
Contact* end0 = NULL;
Contact* end1 = NULL;
vector<Segment*> ripups;
ripups.push_back( seed );
vector< pair<Segment*,Component*> > stack;
if (flags & Flags::Propagate) {
stack.push_back( make_pair(seed,seed->getSource()) );
stack.push_back( make_pair(seed,seed->getTarget()) );
}
while ( not stack.empty() ) {
Contact* contact = dynamic_cast<Contact*>( stack.back().second );
Segment* from = stack.back().first;
stack.pop_back();
if (not contact) continue;
Segment* connected = NULL;
size_t slaveCount = 0;
for ( Hook* hook : contact->getBodyHook()->getHooks() ) {
Component* linked = hook->getComponent();
if ((linked == contact) or (linked == from)) continue;
if (dynamic_cast<RoutingPad*>(linked)) { ++slaveCount; continue; }
connected = dynamic_cast<Segment*>( linked );
if (connected) ++slaveCount;
}
if ((slaveCount == 1) and (connected)) {
stack .push_back( make_pair(connected,connected->getOppositeAnchor(contact)) );
ripups.push_back( connected );
} else {
if (not end0) {
end0 = contact;
cdebug_log(112,0) << "end0:" << contact << endl;
} else {
end1 = contact;
cdebug_log(112,0) << "end1:" << contact << endl;
}
}
}
for ( Segment* segment : ripups ) {
cdebug_log(112,1) << "| Destroy:" << segment << endl;
GCellsUnder gcells = getGCellsUnder( segment );
if (not gcells->empty()) {
for ( size_t i=0 ; i<gcells->size()-1 ; ++i )
gcells->edgeAt(i)->remove( segment );
}
Contact* source = dynamic_cast<Contact*>( segment->getSource() );
Contact* target = dynamic_cast<Contact*>( segment->getTarget() );
segment->getSourceHook()->detach();
segment->getTargetHook()->detach();
segment->destroy();
bool deletedSource = gcells->gcellAt( 0 )->unrefContact( source );
bool deletedTarget = gcells->gcellAt( gcells->size()-1 )->unrefContact( target );
if (deletedSource) {
if (source == end0) end0 = NULL;
if (source == end1) end1 = NULL;
}
if (deletedTarget) {
if (target == end0) end0 = NULL;
if (target == end1) end1 = NULL;
}
cdebug_tabw(112,-1);
}
if (end0) unify( end0 );
if (end1) unify( end1 );
getNetData( net )->setGlobalRouted( false );
cdebug_tabw(112,-1);
DebugSession::close();
}
void AnabaticEngine::cleanupGlobal ()
{
UpdateSession::open();
for ( GCell* gcell : _gcells ) gcell->cleanupGlobal();
UpdateSession::close();
}
void AnabaticEngine::loadGlobalRouting ( uint32_t method )
{
if (_state < EngineGlobalLoaded)
throw Error ("AnabaticEngine::loadGlobalRouting() : global routing not present yet.");
if (_state > EngineGlobalLoaded)
throw Error ("AnabaticEngine::loadGlobalRouting() : global routing already loaded.");
if (method == EngineLoadGrByNet ) { _loadGrByNet(); }
else {
throw Error( badMethod, "Anabatic::loadGlobalRouting()", method, getString(_cell).c_str() );
}
cleanupGlobal();
_state = EngineActive;
}
void AnabaticEngine::_loadGrByNet ()
{
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
cmess1 << " o Building detailed routing from global. " << endl;
startMeasures();
openSession();
int gaugeKind = 3;
if (getConfiguration()->isTwoMetals()) gaugeKind = 0;
if (getConfiguration()->isHV ()) gaugeKind = 1;
if (getConfiguration()->isVH ()) gaugeKind = 2;
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
if (gaugeKind < 3) {
for ( Net* net : getCell()->getNets() ) {
if (NetRoutingExtension::isAutomaticGlobalRoute(net)) {
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
DebugSession::open( net, 145, 150 );
AutoSegment::setAnalogMode( NetRoutingExtension::isAnalog(net) );
switch ( gaugeKind ) {
case 0: NetBuilder::load<NetBuilderM2>( this, net ); break;
case 1: NetBuilder::load<NetBuilderHV>( this, net ); break;
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
case 2: NetBuilder::load<NetBuilderVH>( this, net ); break;
}
Session::revalidate();
DebugSession::close();
}
}
AutoSegment::setAnalogMode( false );
}
#if defined(CHECK_DATABASE)
_check ( "after Anabatic loading" );
#endif
Session::close();
stopMeasures();
In Anabatic/Katana, add support for VH gauges (real technos). * Change: In Anabatic::AutoContactTerminal::getNativeConstraintBox(), when the anchor is a RoutingPad (which must be always the case), perform the true computation of it's position based on the segment occurrence. It is a important change, previously the area was in fact the "center line" of the connector while now it is really an area (mandatory for "half-offgrid" terminals of real technologies). The change is not complete yet, the area should be shrinked by the half size of a VIA, because the area applies to the center coordinate of the VIA (to be done quickly). * Bug: In Anabatic::AutoContactTurn::updateTopology(), when a dogleg is created (restore connexity after a layer change) the layer of the VIA, based on the segments it connects to must be re-computed *after* the dogleg has been made. * Change: In all files of Anabatic, when comparing two layers, no longer use the Layer pointer itself, but the layer mask. This allow a transparent management of both real and symbolic layers (which do share the same mask). Real metal layers (not VIAs) will be BasicLayer and symbolic metal layers will be RegularLayer. * New: Anabatic::Configuration::selectRpComponent(), select the best RoutingPad component for metal1 terminals. Look for the metal1 component with the biggest accessibility on-grid. RoutingPad using other metals are left untoucheds. * New: New function Anabatic::Vertex::getNeighbor(Edge*) to get the neighbor Vertex through an Edge*. This method allows to write clearer code as we no longer need to access the neighbor through the underlying GCell. Also add proxies for GCell methods in Vertex. * Bug: In Anabatic::Dijkstra::_toSources(), in the ripup stage, when a component with multiples vertexes is reached *and* two of it's vertexes are reached *at the same time* (one from which we backtrack and one still in the queue) extraneous edges may be created by _materialize(). Case occurs on snx/c35b4, "abc_5360_n903_1". To solve this, Dijkstra::_toSource() is modificated, the "from" edges of the newly reacheds vertexes are reset to NULL, *except* for the one we will be backtracking from. That is, the one given in the source argument. * Change: In Anabatic::NetBuilder class, put the various Hooks and RoutingPad sorting functions as class ones. * Bug: In AutoSegment::setLayer(), raise the SegInvalidatedFayer flag. This unset flag was causing AutoContactTurn::updateTopology() to not work as expected and making gaps, this was the cause of the last remaining warnings about layer connexity.
2018-01-06 09:55:53 -06:00
if (gaugeKind > 2) {
throw Error( "AnabaticEngine::_loadGrByNet(): Unsupported kind of routing gauge \"%s\"."
, getString(getConfiguration()->getRoutingGauge()->getName()).c_str() );
}
printMeasures( "load" );
addMeasure<size_t>( getCell(), "Globals", AutoSegment::getGlobalsCount() );
addMeasure<size_t>( getCell(), "Edges" , AutoSegment::getAllocateds() );
}
void AnabaticEngine::updateNetTopology ( Net* net )
{
DebugSession::open( net, 140, 150 );
cdebug_log(149,0) << "Anabatic::updateNetTopology( " << net << " )" << endl;
cdebug_tabw(145,1);
vector<AutoContact*> contacts;
for ( Component* component : net->getComponents() ) {
Contact* contact = dynamic_cast<Contact*>( component );
if (contact) {
AutoContact* autoContact = Session::lookup( contact );
if (autoContact and autoContact->isInvalidatedCache())
contacts.push_back( autoContact );
}
}
for ( size_t i=0 ; i<contacts.size() ; ++i )
contacts[i]->updateTopology();
cdebug_tabw(145,-1);
DebugSession::close();
}
void AnabaticEngine::finalizeLayout ()
{
cdebug_log(145,0) << "Anabatic::finalizeLayout()" << endl;
if (_state > EngineDriving) return;
_state = EngineDriving;
startMeasures();
_gutAnabatic();
stopMeasures ();
printMeasures( "fin" );
_state = EngineGutted;
}
void AnabaticEngine::_alignate ( Net* net )
{
DebugSession::open( net, 140, 150 );
cdebug_log(149,0) << "Anabatic::_alignate( " << net << " )" << endl;
cdebug_tabw(145,1);
//cmess2 << " - " << getString(net) << endl;
set<Segment*> exploredSegments;
vector<AutoSegment*> unexploreds;
vector<AutoSegment*> aligneds;
for ( Component* component : net->getComponents() ) {
Segment* segment = dynamic_cast<Segment*>(component);
if (segment) {
AutoSegment* seedSegment = Session::lookup( segment );
if (seedSegment) unexploreds.push_back( seedSegment );
}
}
sort( unexploreds.begin(), unexploreds.end(), AutoSegment::CompareId() );
for ( size_t i=0 ; i<unexploreds.size() ; i++ ) {
AutoSegment* seedSegment = unexploreds[i];
if (exploredSegments.find(seedSegment->base()) == exploredSegments.end()) {
cdebug_log(145,0) << "New chunk from: " << seedSegment << endl;
aligneds.push_back( seedSegment );
for ( AutoSegment* collapsed : seedSegment->getAligneds() ) {
cdebug_log(145,0) << "Aligned: " << collapsed << endl;
aligneds.push_back( collapsed );
exploredSegments.insert( collapsed->base() );
}
cdebug_tabw(145,1);
sort( aligneds.begin(), aligneds.end(), AutoSegment::CompareId() );
cdebug_log(145,0) << "Seed: " << (void*)aligneds[0]->base() << " " << aligneds[0] << endl;
for ( size_t j=1 ; j<aligneds.size() ; j++ ) {
cdebug_log(145,0) << "Secondary: " << (void*)(aligneds[j]->base()) << " " << aligneds[j] << endl;
}
cdebug_log(149,0) << "Align on " << aligneds[0]
<< " " << DbU::getValueString(aligneds[0]->getAxis()) << endl;
aligneds[0]->setAxis( aligneds[0]->getAxis(), Flags::Realignate );
aligneds.clear();
cdebug_tabw(145,-1);
}
}
cdebug_tabw(145,-1);
DebugSession::close();
}
void AnabaticEngine::_computeNetTerminals ( Net* net )
{
DebugSession::open( net, 140, 150 );
cdebug_log(149,0) << "Anabatic::_computeNetTerminals( " << net << " )" << endl;
cdebug_tabw(145,1);
for ( Segment* segment : net->getSegments() ) {
AutoSegment* autoSegment = Session::lookup( segment );
if (autoSegment == NULL) continue;
if (autoSegment->isInvalidated()) autoSegment->computeTerminal();
}
cdebug_tabw(145,-1);
DebugSession::close();
}
void AnabaticEngine::_saveNet ( Net* net )
{
DebugSession::open( net, 140, 150 );
cdebug_log(145,0) << "Anabatic::_saveNet() " << net << endl;
cdebug_tabw(145,1);
#if 0
cdebug_log(145,0) << "Deleting zero-length segments." << endl;
vector<Segment*> nullSegments;
set<const Layer*> connectedLayers;
forEach ( Segment*, segment, net->getSegments() ) {
if (segment->getLength()) {
if (net->isExternal()) {
NetExternalComponents::setExternal( *segment );
}
continue;
}
if (Session::lookup(*segment) == NULL) {
cdebug_log(145,0) << "* Not associated to an AutoSegment: " << *segment << endl;
continue;
}
if (not isTopAndBottomConnected(*segment,connectedLayers)) {
nullSegments.push_back( *segment );
cdebug_log(145,0) << "* Null Length: " << *segment << endl;
}
}
setFlags( EngineDestroyBaseSegment );
for ( size_t i = 0 ; i < nullSegments.size() ; i++ ) {
Contact* source = dynamic_cast<Contact*>(nullSegments[i]->getSource());
Contact* target = dynamic_cast<Contact*>(nullSegments[i]->getTarget());
if ( (source == NULL) or (target == NULL) ) {
cerr << Error("Unconnected source/target on %s.",getString(nullSegments[i]).c_str()) << endl;
continue;
}
if (source->getAnchor()) {
if (target->getAnchor()) {
continue;
//cerr << Bug("Both source & target are anchored while deleting zero-length segment:\n"
// " %s.",getString(nullSegments[i]).c_str()) << endl;
} else
swap( source, target );
}
cdebug_log(145,0) << "Deleting: " << nullSegments[i] << endl;
if (isTopAndBottomConnected(nullSegments[i],connectedLayers)) {
cdebug_log(145,0) << "Deletion cancelled, no longer top or bottom connected." << endl;
continue;
}
cdebug_log(145,0) << "* Source: " << (void*)source << " " << source << endl;
cdebug_log(145,0) << "* Target: " << (void*)target << " " << target << endl;
const Layer* layer = DataBase::getDB()->getTechnology()
->getViaBetween( *connectedLayers.begin(), *connectedLayers.rbegin() );
cdebug_log(145,0) << *connectedLayers.begin() << " + " << *connectedLayers.rbegin() << endl;
cdebug_log(145,0) << "* Shrink layer: " << layer << endl;
if ( !layer ) {
cerr << Error("NULL contact layer while deleting %s."
,getString(nullSegments[i]).c_str()) << endl;
continue;
}
Session::lookup( nullSegments[i] )->destroy ();
vector<Hook*> slaveHooks;
Hook* masterHook = source->getBodyHook()->getPreviousMasterHook();
while ( masterHook->getNextHook() != source->getBodyHook() ) {
slaveHooks.push_back( masterHook->getNextHook() );
cdebug_log(145,0) << "* detach: "
<< (void*)masterHook->getNextHook()->getComponent()
<< " " << masterHook->getNextHook()->getComponent() << endl;
masterHook->getNextHook()->detach();
}
source->destroy();
masterHook = target->getBodyHook();
for ( size_t j=0 ; j < slaveHooks.size() ; j++ ) {
slaveHooks[j]->attach( masterHook );
}
cdebug_log(145,0) << (void*)target << " " << target << " setLayer: " << layer << endl;
target->setLayer( layer );
}
unsetFlags( EngineDestroyBaseSegment );
#endif
cdebug_tabw(145,-1);
DebugSession::close();
}
Added support for 2-Metal block routing in Anabatic & Katana. * New: In AnabaticEngine::invalidateRoutingPads() this method is a temporary workaround for a Hurricane problems. When an instance is moved, the RoutingPads that use it must be moved accordingly, but they are not invalidated so they stay in the wrong QuadTree. New method ::_resizeMatrix() to be called when the associated Cell is resized. * Bug: In AutoHorizontal::getConstraints() and AutoVertical::getConstraints(), the *target* constraints where never merged. * Change: In AutoHorizontal::getCells() and AutoVertical::getGCells(), now return a boolean to tell if it was ok (must not encounter a NULL GCell while progessing from source to target). * New: In Anabatic::Configuration and Anabatic:Session, create new methods: - getDHorizontalLayer() - getDhorizontalDepth() - getDHorizontalWidth() - getDHorizontalPitch() And so on for Vertical and Contact. They supply depth-independant informations about the H/V layers to build the initial detailed routing. The AutoSegment::create() methods have been modificated accordingly. * New: In Anabatic::GCell, add two new types "StdCellRow" and "ChannelRow" for implementing 2-Metal blocks. Rename the GCell::setXY() method in GCell::setSouthWestCorner(), move the contents of GCell::updateContactsPosition() into it and suppress it. WARNING: In case of a GCell shrink this may cause problems. But for now we only expand... New method GCell::getNetCount() to count the number of Net going though the GCell. * Change: In Anabatic::Edge, add specific support for capacity of 2-Metal routing channels. * Change: In Anabatic::Dijsktra various methods, replace the "gcell->isMatrix()" calls by "not gcell->isAnalog()". Add more check so that the methods pertaining to the analog routing (GRData) are not called in digital mode. * New: In Anabatic::Dijkstra::materialize(), add support for 2-Metal specific cases. That is, always break in case of vertical pass-through or U-turn. The global routing must always be broken in H-Channel. * New: In Anabatic::GCell & Anabatic::Edge, make use of the Session mechanism to ensure the revalidation. The "::revalidate()" method is then moved as "::materialize()" (overload of Go) and "::_invalidate()" becomes "::invalidate()" * Change: In LoadGlobalRouting, cosmetic rename of SortHkByX in SortHookByX. * New: In GCellTopology, added support for building 2-Metal topologies. * ForkStack is now an object attribute as many methods do need it. * To push segments/hook on the stack, a new method "push()" is available. Perform NULL and fromHook checking. Can also setup _southWestContact or _northEastContact if it is the "from" edge. * N/S/E/W edges are now vector as in digital channel mode there can be more than one. * Added build topological build methods: - doRp_2m_Access() RoutingPad stem access. - _do_2m_1G_1M1() North or south access. - _do_2m_2G_1M1() North AND south access. - _do_2m_xG() H-Channel routing. * New: In Anabatic::Matrix, new ::resize() function, as Cell can be resizeds. * New: In Anabatic::Vertex, new static method ::getValueString() for a friendly text rendering. * New: In Katana::DigitalDistance, support for channel routing. * Change: In KatanaEngine::digitalSetup() and KatanaEngine::runGlobalrouter(), for channel routing, calls to setupPowerRails() and protectRoutingPads() must be called after the core block has been fully dimensionned. ::runGlobalrouter() contains the code tasked with the grid creation and channel sizing. * New: In KatanaEngine: Added support for core block, for 2-Metal routing. May be expanded for over-the-cell routing in the future. Added methods : - isDigitalMode() - isAnalogMode() - isMixedMode() - isChannelMode() - getBlock() / addBlock() - setupChannelMode() - createChannel() * New: In Katana, new class Block to manage core blocks and perform channel routing. * New: In Katana::Session, new convenience method "isOpen()".
2017-08-18 16:56:23 -05:00
void AnabaticEngine::invalidateRoutingPads ()
{
// This a flaw in the Hurricane Session update mechanism
// and needs to be fixed in the future.
for ( Net* net : getCell()->getNets() ) {
for ( RoutingPad* rp : net->getRoutingPads() ) {
rp->invalidate( false );
}
}
}
void AnabaticEngine::updateDensity ()
{ for ( GCell* gcell : _gcells ) gcell->updateDensity(); }
size_t AnabaticEngine::checkGCellDensities ()
{
size_t saturateds = 0;
for ( GCell* gcell : _gcells ) saturateds += gcell->checkDensity();
return saturateds;
}
AutoSegment* AnabaticEngine::_lookup ( Segment* segment ) const
{
AutoSegmentLut::const_iterator it = _autoSegmentLut.find( segment );
if (it == _autoSegmentLut.end()) return NULL;
return (*it).second;
}
void AnabaticEngine::_link ( AutoSegment* autoSegment )
{
if (_state > EngineActive) return;
_autoSegmentLut[ autoSegment->base() ] = autoSegment;
}
void AnabaticEngine::_unlink ( AutoSegment* autoSegment )
{
if (_state > EngineDriving) return;
AutoSegmentLut::iterator it = _autoSegmentLut.find( autoSegment->base() );
if (it != _autoSegmentLut.end())
_autoSegmentLut.erase( it );
}
AutoContact* AnabaticEngine::_lookup ( Contact* contact ) const
{
AutoContactLut::const_iterator it = _autoContactLut.find( contact );
if (it == _autoContactLut.end()) {
return NULL;
}
return (*it).second;
}
void AnabaticEngine::_link ( AutoContact* autoContact )
{
if (_state > EngineActive) return;
_autoContactLut [ autoContact->base() ] = autoContact;
}
void AnabaticEngine::_unlink ( AutoContact* autoContact )
{
if ( _state > EngineActive ) return;
AutoContactLut::iterator it = _autoContactLut.find( autoContact->base() );
if (it != _autoContactLut.end())
_autoContactLut.erase( it );
}
void AnabaticEngine::_destroyAutoSegments ()
{
cdebug_log(145,0) << "Anabatic::_destroyAutoSegments ()" << endl;
size_t expandeds = 0;
for ( auto sasp : _autoSegmentLut ) {
expandeds++;
sasp.second->destroy();
}
if (_state == EngineDriving)
cmess2 << " - Expandeds := " << expandeds << endl;
_autoSegmentLut.clear();
}
void AnabaticEngine::_destroyAutoContacts ()
{
cdebug_log(145,0) << "Anabatic::_destroyAutoContacts ()" << endl;
for ( auto cacp : _autoContactLut ) cacp.second->destroy();
_autoContactLut.clear();
}
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
void AnabaticEngine::_check ( Net* net ) const
{
cdebug_log(149,1) << "Checking " << net << endl;
for ( Segment* segment : net->getComponents().getSubSet<Segment*>() ) {
AutoSegment* autoSegment = _lookup( segment );
cdebug_log(149,0) << autoSegment << endl;
if (autoSegment) {
AutoContact* autoContact = autoSegment->getAutoSource();
cdebug_log(149,0) << autoContact << endl;
if (autoContact) autoContact->checkTopology();
autoContact = autoSegment->getAutoTarget();
cdebug_log(149,0) << autoContact << endl;
if (autoContact) autoContact->checkTopology();
}
}
cdebug_tabw(149,-1);
}
bool AnabaticEngine::_check ( const char* message ) const
{
bool coherency = true;
if (message)
cerr << " o checking Anabatic DB (" << message << ")." << endl;
for ( auto element : _autoSegmentLut )
coherency = element.second->_check() and coherency;
for ( GCell* gcell : _gcells ) {
for ( AutoContact* contact : gcell->getContacts() )
contact->checkTopology();
}
if (message) cerr << " - completed." << endl;
return coherency;
}
Apaired segments building for symmetric routing (step 1). * Change: In Hurricane::BaseFlags, store flags in uint64_t instead of unsigned int because we start to need more than 32 different flags in some tools. * New: In ::getString() & ::getRecord() templates, add support for std::array<>. * Change: In CRL::ToolEngine, add support for timer (time & memory measurements) displaced from Katabatic. This way all ToolEngine can use this feature. The _postCreate() method display the memory just after ToolEngine allocation. * Change: In Etesian::EtesianEngine, make use of the ToolEngine builtin timer (remove the local one). Forgot to call the base class _postCreate() and _preDestroy(). * Change: In Anabatic::AnabaticEngine, make use of the ToolEngine builtin timer (remove the local one). * New: In Anabatic, new AutoSegments_Connecteds() collection. This Collection allows a deterministic walkthough *all* the AutoSegments connected either to source or target of one AutoSegment. * New: In Anabatic::AutoContactTerminal::isEndPoint() to check if an AutoContactTerminal is the *only one* anchored on a RoutingPad, thus being a true "end point" and not a kind of feed-through. * New: In Katana::KatanaEngine, added support for symmetric nets. Created new class DataSymmetric to store symmetric information of a net (mainly the paired AutoSegments). Added KatanaEngine::runSymmetricRouter(), for now only build the DataSymmetric informations. More to come... * Change: In Katana::GraphicKatanaEngine::_runTest(), now perform symmetric information building the non-symmetric routing.
2017-03-12 13:34:12 -05:00
void AnabaticEngine::printMeasures ( const string& tag ) const
{
Super::printMeasures();
// if (not tag.empty()) {
// addMeasure<double>( getCell(), tag+"T", getTimer().getCombTime () );
// addMeasure<size_t>( getCell(), tag+"S", (getTimer().getMemorySize() >> 20) );
// }
}
string AnabaticEngine::_getTypeName () const
{ return getString(_toolName); }
string AnabaticEngine::_getString () const
{
ostringstream os;
os << "<" << _toolName << " " << _cell->getName() << ">";
return os.str();
}
Record* AnabaticEngine::_getRecord () const
{
Record* record = Super::_getRecord();
record->add( getSlot("_configuration", _configuration) );
record->add( getSlot("_gcells" , &_gcells ) );
record->add( getSlot("_matrix" , &_matrix ) );
record->add( getSlot("_flags" , &_flags ) );
return record;
}
} // Anabatic namespace.