coriolis/knik/src/MatrixVertex.cpp

449 lines
18 KiB
C++
Raw Normal View History

#include <algorithm>
Migration towards Python3, first stage: still based on C-Macros. * New: Python/C++ API level: * Write a new C++/template wrapper to get rid of boost::python * The int & long Python type are now merged. So a C/C++ level, it became "PyLong_X" (remove "PyInt_X") and at Python code level, it became "int" (remove "long"). * Change: VLSISAPD finally defunct. * Configuration is now integrated as a Hurricane component, makes use of the new C++/template wrapper. * vlsisapd is now defunct. Keep it in the source for now as some remaining non essential code may have to be ported in the future. * Note: Python code (copy of the migration howto): * New print function syntax print(). * Changed "dict.has_key(k)" for "k" in dict. * Changed "except Exception, e" for "except Exception as e". * The division "/" is now the floating point division, even if both operand are integers. So 3/2 now gives 1.5 and no longer 1. The integer division is now "//" : 1 = 3//2. So have to carefully review the code to update. Most of the time we want to use "//". We must never change to float for long that, in fact, represents DbU (exposed as Python int type). * execfile() must be replaced by exec(open("file").read()). * iter().__next__() becomes iter(x).__next__(). * __getslice__() has been removed, integrated to __getitem__(). * The formating used for str(type(o)) has changed, so In Stratus, have to update them ("<class 'MyClass'>" instead of "MyClass"). * the "types" module no longer supply values for default types like str (types.StringType) or list (types.StringType). Must use "isinstance()" where they were occuring. * Remove the 'L' to indicate "long integer" (like "12L"), now all Python integer are long. * Change in bootstrap: * Ported Coriolis builder (ccb) to Python3. * Ported Coriolis socInstaller.py to Python3. * Note: In PyQt4+Python3, QVariant no longer exists. Use None or directly convert using the python syntax: bool(x), int(x), ... By default, it is a string (str). * Note: PyQt4 bindings & Python3 under SL7. * In order to compile user's must upgrade to my own rebuild of PyQt 4 & 5 bindings 4.19.21-1.el7.soc. * Bug: In cumulus/plugins.block.htree.HTree.splitNet(), set the root buffer of the H-Tree to the original signal (mainly: top clock). Strangely, it was only done when working in full chip mode.
2021-09-19 12:41:24 -05:00
#include "hurricane/configuration/Configuration.h"
#include "hurricane/Cell.h"
#include "hurricane/Box.h"
#include "crlcore/AllianceFramework.h"
#include "crlcore/CellGauge.h"
#include "knik/Graph.h"
#include "knik/MatrixVertex.h"
#include "knik/KnikEngine.h"
namespace Knik {
using namespace std;
using namespace CRL;
MatrixVertex::MatrixVertex ( Graph* routingGraph )
// ***********************************************
: _xInit(false)
, _yInit(false)
, _xRegular(false)
, _yRegular(false)
, _nbXTiles(0)
, _nbYTiles(0)
, _tileWidth(0)
, _tileHeight(0)
, _boundingBox(0,0,1,1)
, _routingGraph(routingGraph)
{
}
MatrixVertex* MatrixVertex::create ( Graph* routingGraph )
// *******************************************************
{
MatrixVertex* matrixVertex = new MatrixVertex(routingGraph);
return matrixVertex;
}
MatrixVertex::~MatrixVertex()
// **************************
{
}
void MatrixVertex::destroy()
// ************************
{
_preDestroy();
delete ( this );
}
void MatrixVertex::_preDestroy()
// ****************************
{
}
//void MatrixVertex::createXRegular ( RoutingGrid* routingGrid )
//// ***********************************************************
//{
//
// if ( _xInit )
// throw Error ("MatrixVertex::createXRegular(): cannot initialize X vector twice.");
// _lowerLeftX = routingGrid->getLowerLeftX();
// _nbXTiles = routingGrid->getNbXTiles();
// _tileWidth = routingGrid->getTileWidth();
// _xRegular = true;
// _xInit = true;
//
// if ( _xInit && _yInit )
// createMatrix();
//}
//void MatrixVertex::createYRegular ( RoutingGrid* routingGrid )
//// ***********************************************************
//{
// if ( _yInit )
// throw Error ("MatrixVertex::createYRegular(): cannot initialize Y vector twice.");
// _boundingBox.getYMin() = routingGrid->getLowerLeftY();
// _nbYTiles = routingGrid->getNbYTiles();
// _tileHeight = routingGrid->getTileHeight();
// _yRegular = true;
// _yInit = true;
//
// if ( _xInit && _yInit )
// createMatrix();
//}
Vertex* MatrixVertex::createRegularMatrix ( RoutingGrid* routingGrid )
// *******************************************************************
{
if ( _xInit || _yInit )
throw Error ("MatrixVertex::createRegularMatrix(): cannot initialize matrix twice.");
_boundingBox = routingGrid->getBoundingBox();
_nbXTiles = routingGrid->getNbXTiles();
_nbYTiles = routingGrid->getNbYTiles();
_tileWidth = routingGrid->getTileWidth();
_tileHeight = routingGrid->getTileHeight();
_xInit = true; // XXX Nécessaire pour les fonctions comme getLineIndex
_yInit = true;
_xRegular = true; // XXX Nécessaire pour les fonctions comme getLineIndex
_yRegular = true;
DbU::Unit halfWidth = _tileWidth / 2;
DbU::Unit halfHeight = _tileHeight / 2;
// On cree les vecteurs de vertex en meme temps que les vertex et aussi les edges !
for ( unsigned j = 0 ; j < _nbYTiles ; j++ ) {
vector<Vertex*> vect;
for ( unsigned i = 0 ; i < _nbXTiles ; i++ ) {
Point position ( _boundingBox.getXMin()+(i*_tileWidth)+halfWidth, _boundingBox.getYMin()+(j*_tileHeight)+halfHeight );
// on cree le vertex
Vertex* vertex = _routingGraph->createVertex ( position, halfWidth, halfHeight );
assert ( vertex );
// on l'ajoute dans la matrice
vect.push_back ( vertex );
// si i > 0 alors on peut creer une edge horizontale entre matrix[i-1][j] et matrix[i][j] c'est a dire vect[i-1] et vect[i]
if ( i > 0 ) {
Vertex* from = vect[i-1];
assert(from);
Vertex* to = vect[i];
assert(to);
_routingGraph->createHEdge ( from, to );
}
// si j > 0 alors on peut creer une edge verticale entre matrix[i][j-1] et matrix[i][j] c'est a dire _matrix[j-1][i] et vect[i]
if ( j > 0 ) { // _matrix est un vecteur de vecteur represantant les lignes -> _matrix[ligne][colonne]
Vertex* from = _matrix[j-1][i];
assert(from);
Vertex* to = vect[i];
assert(to);
_routingGraph->createVEdge ( from, to );
}
}
_matrix.push_back ( vect );
}
return _matrix[0][0];
}
Vertex* MatrixVertex::createRegularMatrix ()
// *****************************************
{
if ( _xInit || _yInit )
throw Error ("MatrixVertex::createRegularMatrix(): cannot initialize matrix twice.");
Upgrade of Katana detailed router to support Arlet 6502. * Change: In Hurricane::SharedName, replace the incremental Id by a hash key. This is to ensure better deterministic properties. Between use cases, additional strings may have to be allocated, shitfing the ids. Even if hash can be duplicated, we should be able to ensure that the absolute order in map table should be preserved. Supplemental strings are inserted in a way that keep the previous order. * Change: In CRL/etc/symbolic/cmos/kite.conf, add "katabatic.routingGauge" default parameter value ("sxlib"). * Change: In CRL/etc/common/technology.conf, define minimal spacing for symbolic layers too (added for METAL4 only for now). * Change: In CRL::Histogram, extend support to dynamically sized histograms. Add a text pretty print with table and pseudo-curve. * Change: In Cumulus/plugins/ClockTreePlugin, create blockage under the block corona corners so the global router do not draw wire under them. This was creating deadlock for the detailed router. When the abutment has to be computed, directly use Etesian to do it instead of duplicating the computation in the Python plugin. * New: In Etesian, as Coloquinte seems reluctant to evenly spread the standard cells, we trick it by making them bigger during the placement stage. Furthermore, we do not not uniformely increase the size of the cells but create a "bloating profile" based on cell size, cell name or it's density of terminals. Currently only two profiles are defined, "disabled" which does nothing and "nsxlib" targeted on 4 metal layer technologies (aka AMS 350nm, c35b4). * Bug: In Knik::MatrixVertex, load the default routing gauge using the configuration parameter "katabatic.routingGauge" as the default one may not be the first registered one. * New: In AnabaticEngine::setupNetDatas(), build a dynamic historgram of the nets terminal numbers. * Bug: In Anabatic::AutoContact::Invalidate(), always invalidate the contact cache when topology is invalidated. In case of multiple invalidations, if the first did not invalidate the cache, later one that may need it where not allowed to do so. The end result was correct nonetheless, but it did generate annoying error messages. * Bug: In Anabatic::AutoContactTurn::updateTopology(), bad computation of the contact's depth when delta == 2. * Bug: In Anabatic::Gcell::getCapacity(), was always returning the west edge capacity, even for the westermost GCell, should be the east edge in that case. * New: In Anabatic::AutoSegment, introduce a new measure "distance to terminal". This is the minimal number of segments separating the current one from the nearest RoutingPad. This replace the previous "strong terminal" and "weak terminal" flags. This distance is used by Katana to sort the events, we route the segments *from* the RoutingPads *outward*. The idea being that if we cannot event connect to the RoutingPad, there is no points continuing as thoses segments are the more constraineds. This gives an order close to the simple ascending metals but with better results. * New: In Anabatic::AutoSegment, introduce a new flag "Unbreakable", disable dogleg making on those segments. mainly intended for local segments directly connecteds to RoutingPads (distance == 0). * New: In Anabatic::AutoSegment, more aggressive reducing of segments. Now the only case where a segment cannot be reduced is when it is one horizontal branch in a HTee or a vertical on a VTee. Check if, when not accounted the source & target VIAs are still connex, if so, allow reducing. * New: In Anabatic::AutoContact, new state flags CntVDogleg & CntHDogleg mainly to prevent making doglegs twice on a turn contact. This is to limit over-fragmentation. If one dogleg doesn't solve the problem, making a second one will make things worse only... * Bug: In Anabatic::Configuration::selectRpcomponent(), we were choosing the component with the *smallest* span instead of the *bigger* one. * New: In Anabatic::GCell, introduce a new flag "GoStraight" to tell that no turn go be made inside those GCells. Mainly used underneath a block corona. * New: In AnabaticEngine::layerAssign(), new GCellRps & RpsInRow to manage GCells with too many terminals. Slacken at least one RoutingPad access when there is more than 8 RoutingPad in the GCell (slacken or change a vertical METAL2 (non-preferred) into a METAL3). * Change: In Anabatic::NetBuilderHV, allow the use of terminal connection in non-preferred direction. That is, vertical METAL2 directly connected to the RoutingPad (then a horizontal METAL2). This alllows for short dogleg without clutering the METAL3 layer (critical for AMS c35b4). Done in NetBuilderHV::doRp_Access(), with a new UseNonPref flag. Perform some other tweaking on METAL1 access topologies, to also minimize METAL3 use. * New: In AnabaticEngine::computeNetConstraints(), also compute the distance to RoutingPad for segments. Set the Unbreakable flag, based on the distance and segment length (local, short global or long global). New local function "propagateDistanceFromRp()". * Change: In AnabaticEngine.h, the sorting class for NetData, SparsityOrder, is modificated so net with a degree superior to 10 are sorted first, whatever their sparsity. This is to work in tandem with GlobalRouting. * New: In Katana::TrackSegmentNonPref, introduce a class to manage segment in non-preferred routing direction. Mostly intended for small METAL2 vertical directly connected to RoutingPad. Modifications to manage this new variant all through Katana. * Change: In Katana::GlobalRoute, DigitalDistance honor the GoStraight flag of the GCell. Do not make bend inside thoses GCells. * Change: In KatanaEngine::runGlobalRouter(), high degree nets (>= 10) are routed first and whitout the global routing estimation. There should be few of them so they wont create saturations and we want them as straight as possible. Detour are for long be-points. Set the saerch halo to one GCell in the initial routing stage (before ripup). * Bug: In KatanaEngine & NegociateWindow, call _computeCagedconstraints() inside NegociateWindow::run(), as segments are inserted into tracks only at that point so we cannot make the computation earlier. * Change: In Katana::Manipulator::repackPerpandiculars(), add a flag to select whether to replace the perpandiculars *after* or *before* the current segment. * Change: In Katana::NegociateWindow::NegociateOverlapCost(), when the segment is fully enclosed inside a global, the longest overlap cost is set to the shortest global hoverhang (before or after). When the cost is for a global, set an infinite cost if the overlapping segment has a RP distance less or equal to 1 (this is an access segment). * Bug: In Katana::PowerRailsPlane::Rail::doLayout(), correct computation of the segments extension cap. * New: In Katana::QueryPowerRails::addToPowerRail(), add support for Pad. * Change: In Katana/PreProcess::protectCagedTerminals(), apply the contraints to any turn connected to the first segment of the RoutingPad so the perpandicular constraints got propagated to the perpandicular segment... * Change: In RoutingEvent, cache the "distance to RP" value. * Change: In RoutingEvent::Key::compare(), sort *first* on distance to RoutingPad, then layer depth. If both distance to RoutingPad is null, then sort on segment length. * Change: In RoutingEvent::_processRepair(), try a repack perpandicular with perpandiculars first (then with perpandicular last, then give up). * Change: In SegmentFsm::bindToTrack() and moveToTrack(), set an axis hint when creating the insertion event. * Change: In SegmentFsm::_slackenStrap(), add a step through slacken between minimize and maximum slack (wihch directly end up in unimplemented). * Change: In Session::_addInsertEvent(), add an axis parameter needed when the axis of the segment is not the one of the track (case of wide segments or non-preferred direction). * Bug: In Track::_preDestroy(), bad management of the TrackElement reference count. Destroy the segment only when reaching zero... * Bug: In Track::expandFreeIneterval(), forgotten to manage case when there is a set of overlaping segments at the "end" of the track, the EndIsTrackMax was not set. * Change: In TrackCost::Compare, increase the cost when an overlaping segment is at it's ripup limit. We should try *not* to rip it up if we can. Add a dedicated flag "AtRipupLimit". * Change: In TrackElement, add proxies for isUnbreakable(), new function updateTrackSpan(). * New: In TrackFixedSegment CTOR, when a supply wire of METAL2 or above is found, make the underlying GCells "GoStraight". * New: In TrackElement::canDogleg(GCell*), check for already done perpandicular dogleg on source/target (reject if so).
2019-07-28 16:20:00 -05:00
string gaugeName = Cfg::getParamString("katabatic.routingGauge","sxlib")->asString();
Cell* cell = _routingGraph->getCell();
Upgrade of Katana detailed router to support Arlet 6502. * Change: In Hurricane::SharedName, replace the incremental Id by a hash key. This is to ensure better deterministic properties. Between use cases, additional strings may have to be allocated, shitfing the ids. Even if hash can be duplicated, we should be able to ensure that the absolute order in map table should be preserved. Supplemental strings are inserted in a way that keep the previous order. * Change: In CRL/etc/symbolic/cmos/kite.conf, add "katabatic.routingGauge" default parameter value ("sxlib"). * Change: In CRL/etc/common/technology.conf, define minimal spacing for symbolic layers too (added for METAL4 only for now). * Change: In CRL::Histogram, extend support to dynamically sized histograms. Add a text pretty print with table and pseudo-curve. * Change: In Cumulus/plugins/ClockTreePlugin, create blockage under the block corona corners so the global router do not draw wire under them. This was creating deadlock for the detailed router. When the abutment has to be computed, directly use Etesian to do it instead of duplicating the computation in the Python plugin. * New: In Etesian, as Coloquinte seems reluctant to evenly spread the standard cells, we trick it by making them bigger during the placement stage. Furthermore, we do not not uniformely increase the size of the cells but create a "bloating profile" based on cell size, cell name or it's density of terminals. Currently only two profiles are defined, "disabled" which does nothing and "nsxlib" targeted on 4 metal layer technologies (aka AMS 350nm, c35b4). * Bug: In Knik::MatrixVertex, load the default routing gauge using the configuration parameter "katabatic.routingGauge" as the default one may not be the first registered one. * New: In AnabaticEngine::setupNetDatas(), build a dynamic historgram of the nets terminal numbers. * Bug: In Anabatic::AutoContact::Invalidate(), always invalidate the contact cache when topology is invalidated. In case of multiple invalidations, if the first did not invalidate the cache, later one that may need it where not allowed to do so. The end result was correct nonetheless, but it did generate annoying error messages. * Bug: In Anabatic::AutoContactTurn::updateTopology(), bad computation of the contact's depth when delta == 2. * Bug: In Anabatic::Gcell::getCapacity(), was always returning the west edge capacity, even for the westermost GCell, should be the east edge in that case. * New: In Anabatic::AutoSegment, introduce a new measure "distance to terminal". This is the minimal number of segments separating the current one from the nearest RoutingPad. This replace the previous "strong terminal" and "weak terminal" flags. This distance is used by Katana to sort the events, we route the segments *from* the RoutingPads *outward*. The idea being that if we cannot event connect to the RoutingPad, there is no points continuing as thoses segments are the more constraineds. This gives an order close to the simple ascending metals but with better results. * New: In Anabatic::AutoSegment, introduce a new flag "Unbreakable", disable dogleg making on those segments. mainly intended for local segments directly connecteds to RoutingPads (distance == 0). * New: In Anabatic::AutoSegment, more aggressive reducing of segments. Now the only case where a segment cannot be reduced is when it is one horizontal branch in a HTee or a vertical on a VTee. Check if, when not accounted the source & target VIAs are still connex, if so, allow reducing. * New: In Anabatic::AutoContact, new state flags CntVDogleg & CntHDogleg mainly to prevent making doglegs twice on a turn contact. This is to limit over-fragmentation. If one dogleg doesn't solve the problem, making a second one will make things worse only... * Bug: In Anabatic::Configuration::selectRpcomponent(), we were choosing the component with the *smallest* span instead of the *bigger* one. * New: In Anabatic::GCell, introduce a new flag "GoStraight" to tell that no turn go be made inside those GCells. Mainly used underneath a block corona. * New: In AnabaticEngine::layerAssign(), new GCellRps & RpsInRow to manage GCells with too many terminals. Slacken at least one RoutingPad access when there is more than 8 RoutingPad in the GCell (slacken or change a vertical METAL2 (non-preferred) into a METAL3). * Change: In Anabatic::NetBuilderHV, allow the use of terminal connection in non-preferred direction. That is, vertical METAL2 directly connected to the RoutingPad (then a horizontal METAL2). This alllows for short dogleg without clutering the METAL3 layer (critical for AMS c35b4). Done in NetBuilderHV::doRp_Access(), with a new UseNonPref flag. Perform some other tweaking on METAL1 access topologies, to also minimize METAL3 use. * New: In AnabaticEngine::computeNetConstraints(), also compute the distance to RoutingPad for segments. Set the Unbreakable flag, based on the distance and segment length (local, short global or long global). New local function "propagateDistanceFromRp()". * Change: In AnabaticEngine.h, the sorting class for NetData, SparsityOrder, is modificated so net with a degree superior to 10 are sorted first, whatever their sparsity. This is to work in tandem with GlobalRouting. * New: In Katana::TrackSegmentNonPref, introduce a class to manage segment in non-preferred routing direction. Mostly intended for small METAL2 vertical directly connected to RoutingPad. Modifications to manage this new variant all through Katana. * Change: In Katana::GlobalRoute, DigitalDistance honor the GoStraight flag of the GCell. Do not make bend inside thoses GCells. * Change: In KatanaEngine::runGlobalRouter(), high degree nets (>= 10) are routed first and whitout the global routing estimation. There should be few of them so they wont create saturations and we want them as straight as possible. Detour are for long be-points. Set the saerch halo to one GCell in the initial routing stage (before ripup). * Bug: In KatanaEngine & NegociateWindow, call _computeCagedconstraints() inside NegociateWindow::run(), as segments are inserted into tracks only at that point so we cannot make the computation earlier. * Change: In Katana::Manipulator::repackPerpandiculars(), add a flag to select whether to replace the perpandiculars *after* or *before* the current segment. * Change: In Katana::NegociateWindow::NegociateOverlapCost(), when the segment is fully enclosed inside a global, the longest overlap cost is set to the shortest global hoverhang (before or after). When the cost is for a global, set an infinite cost if the overlapping segment has a RP distance less or equal to 1 (this is an access segment). * Bug: In Katana::PowerRailsPlane::Rail::doLayout(), correct computation of the segments extension cap. * New: In Katana::QueryPowerRails::addToPowerRail(), add support for Pad. * Change: In Katana/PreProcess::protectCagedTerminals(), apply the contraints to any turn connected to the first segment of the RoutingPad so the perpandicular constraints got propagated to the perpandicular segment... * Change: In RoutingEvent, cache the "distance to RP" value. * Change: In RoutingEvent::Key::compare(), sort *first* on distance to RoutingPad, then layer depth. If both distance to RoutingPad is null, then sort on segment length. * Change: In RoutingEvent::_processRepair(), try a repack perpandicular with perpandiculars first (then with perpandicular last, then give up). * Change: In SegmentFsm::bindToTrack() and moveToTrack(), set an axis hint when creating the insertion event. * Change: In SegmentFsm::_slackenStrap(), add a step through slacken between minimize and maximum slack (wihch directly end up in unimplemented). * Change: In Session::_addInsertEvent(), add an axis parameter needed when the axis of the segment is not the one of the track (case of wide segments or non-preferred direction). * Bug: In Track::_preDestroy(), bad management of the TrackElement reference count. Destroy the segment only when reaching zero... * Bug: In Track::expandFreeIneterval(), forgotten to manage case when there is a set of overlaping segments at the "end" of the track, the EndIsTrackMax was not set. * Change: In TrackCost::Compare, increase the cost when an overlaping segment is at it's ripup limit. We should try *not* to rip it up if we can. Add a dedicated flag "AtRipupLimit". * Change: In TrackElement, add proxies for isUnbreakable(), new function updateTrackSpan(). * New: In TrackFixedSegment CTOR, when a supply wire of METAL2 or above is found, make the underlying GCells "GoStraight". * New: In TrackElement::canDogleg(GCell*), check for already done perpandicular dogleg on source/target (reject if so).
2019-07-28 16:20:00 -05:00
DbU::Unit sliceHeight = AllianceFramework::get()->getCellGauge(gaugeName)->getSliceHeight();
DbU::Unit cellWidth = cell->getAbutmentBox().getWidth();
DbU::Unit cellHeight = cell->getAbutmentBox().getHeight();
_boundingBox = cell->getAbutmentBox();
_nbXTiles = (unsigned int)ceil(float(cellWidth) / float(sliceHeight));
_nbYTiles = (unsigned int)ceil(float(cellHeight) / float(sliceHeight));
_tileWidth = sliceHeight;
_tileHeight = sliceHeight;
DbU::Unit _latestTileWidth = cellWidth - ((_nbXTiles - 1) * _tileWidth);
DbU::Unit _latestTileHeight = cellHeight - ((_nbYTiles - 1) * _tileHeight);
_xInit = true; // XXX Nécessaire pour les fonctions comme getLineIndex
_yInit = true;
_xRegular = true; // XXX Nécessaire pour les fonctions comme getLineIndex
_yRegular = true;
// cerr << "Resume :" << endl
// << " - this : " << (void*)this << endl
// << " - cellWidth : " << cellWidth << endl
// << " - cellHeight : " << cellHeight << endl
// << " - boundingBox : " << _boundingBox << endl
// << " - nbXTiles : " << _nbXTiles << endl
// << " - nbYTiles : " << _nbYTiles << endl
// << " - tileWidth : " << _tileWidth << endl
// << " - tileHieght : " << _tileHeight << endl
// << " - latestTileWidth : " << _latestTileWidth << endl
// << " - latestTileHeight : " << _latestTileHeight << endl;
// On cree les vecteurs de vertex en meme temps que les vertex et aussi les edges !
size_t hreserved = KnikEngine::get( cell )->getHEdgeReservedLocal();
size_t vreserved = KnikEngine::get( cell )->getVEdgeReservedLocal();
for ( unsigned j = 0 ; j < _nbYTiles ; j++ ) {
vector<Vertex*> vect;
for ( unsigned i = 0 ; i < _nbXTiles ; i++ ) {
DbU::Unit halfWidth = (i == _nbXTiles - 1)?_latestTileWidth/2:_tileWidth/2;
DbU::Unit halfHeight = (j == _nbYTiles - 1)?_latestTileHeight/2:_tileHeight/2;
Point position ( _boundingBox.getXMin()+(i*_tileWidth)+halfWidth, _boundingBox.getYMin()+(j*_tileHeight)+halfHeight );
// on cree le vertex
Vertex* vertex = _routingGraph->createVertex ( position, halfWidth, halfHeight );
assert ( vertex );
//cerr << ". .. " << vertex << endl;
// on l'ajoute dans la matrice
vect.push_back ( vertex );
// si i > 0 alors on peut creer une edge horizontale entre matrix[i-1][j] et matrix[i][j] c'est a dire vect[i-1] et vect[i]
if ( i > 0 ) {
Vertex* from = vect[i-1];
assert(from);
Vertex* to = vect[i];
assert(to);
_routingGraph->createHEdge ( from, to, hreserved );
}
// si j > 0 alors on peut creer une edge verticale entre matrix[i][j-1] et matrix[i][j] c'est a dire _matrix[j-1][i] et vect[i]
if ( j > 0 ) { // _matrix est un vecteur de vecteur represantant les lignes -> _matrix[ligne][colonne]
Vertex* from = _matrix[j-1][i];
assert(from);
Vertex* to = vect[i];
assert(to);
_routingGraph->createVEdge ( from, to, vreserved );
}
}
_matrix.push_back ( vect );
}
//cerr << "---------------------------" << endl;
//print();
return _matrix[0][0];
}
//void MatrixVertex::createXIrregular ( NimbusEngine* nimbus )
//// *********************************************************
//{
// if ( _xInit )
// throw Error ("MatrixVertex::createXIrregular(): cannot initialize X vector twice.");
// GCell* gcell = nimbus->getGrid()->getLowerLeftCorner ( nimbus->getDepth() );
// assert(gcell);
// unsigned index = 0;
// _columnsIndexes.push_back ( pair<DbU::Unit,unsigned>(gcell->getXMin(),index++) );
// while ( gcell ) {
// //if ( gcell->getRightFence() ) pour la dernière gcell, on veut récupérer la fence virtuelle de droite
// _columnsIndexes.push_back ( pair<DbU::Unit,unsigned>(gcell->getXMax(),index++) );
// gcell = gcell->getRightOfMe();
// }
// _nbXTiles = index-1;
// //assert ( is_sorted(vertiCutLines.begin(), vertiCutLines.end()) );
// //for ( unsigned i = 0 ; i < vertiCutLines.size() ; i++ )
// // _columnsIndexes.push_back ( pair<DbU::Unit,unsigned> (vertiCutLines[i], i) );
// assert ( is_sorted(_columnsIndexes.begin(), _columnsIndexes.end(), IndexComp()) );
// //_nbXTiles = _columnsIndexes.size()-1;
// _xRegular = false;
// _xInit = true;
//
// if ( _xInit && _yInit )
// createMatrix();
//}
//void MatrixVertex::createYIrregular ( NimbusEngine* nimbus )
//// *********************************************************
//{
// if ( _yInit )
// throw Error ("MatrixVertex::createYIrregular(): cannot initialize Y vector twice.");
//
// GCell* gcell = nimbus->getGrid()->getLowerLeftCorner ( nimbus->getDepth() );
// assert(gcell);
// unsigned index = 0;
// _linesIndexes.push_back ( pair<DbU::Unit,unsigned>(gcell->getYMin(),index++) );
// while ( gcell ) {
// _linesIndexes.push_back ( pair<DbU::Unit,unsigned>(gcell->getYMax(),index++) );
// gcell = gcell->getUpOfMe();
// }
// assert ( is_sorted(_linesIndexes.begin(), _linesIndexes.end(), IndexComp()) );
// _nbYTiles = index-1;
// _yRegular = false;
// _yInit = true;
//
// if ( _xInit && _yInit )
// createMatrix();
//}
//void MatrixVertex::createMatrix()
//// ******************************
//{
// assert ( _xInit && _yInit );
// for ( unsigned j = 0 ; j < _nbYTiles ; j++ ) {
// vector<Vertex*> vect;
// for ( unsigned i = 0 ; i < _nbXTiles ; i++ ) {
// Vertex* vertex (NULL);
// vect.push_back ( vertex );
// }
// _matrix.push_back ( vect );
// }
//}
void MatrixVertex::setVertex ( pair<unsigned int,unsigned int> indexes, Vertex* vertex )
// *************************************************************************************
{
_matrix[indexes.second][indexes.first] = vertex;
}
void MatrixVertex::setVertex ( Point point, Vertex* vertex )
// *********************************************************
{
pair<unsigned int,unsigned int> indexes = getIJ ( point );
setVertex ( indexes, vertex );
}
unsigned int MatrixVertex::getLineIndex ( DbU::Unit y )
// ***********************************************
{
assert(_yInit );
if ( _yRegular ) {
// cerr << "y:" << DbU::getValueString(y-_boundingBox.getYMin()) << "/" << DbU::getValueString(_tileHeight)
// << "=" << (DbU::getLambda(y-_boundingBox.getYMin())/_tileHeight)
// << "<=>" << (unsigned int)floor((y-_boundingBox.getYMin())/_tileHeight) << endl;
if ( (y < _boundingBox.getYMin()) or (y > _boundingBox.getYMax()) )
throw Error ("MatrixVertex::getLineIndex(): search value (%s) is out of bounds [%s,%s]."
,DbU::getValueString(y).c_str()
,DbU::getValueString(_boundingBox.getYMin()).c_str()
,DbU::getValueString(_boundingBox.getYMax()).c_str());
unsigned int index = (unsigned int)floor((y-_boundingBox.getYMin())/_tileHeight);
if ( y == _boundingBox.getYMax() ) --index;
return index;
}
assert(is_sorted(_linesIndexes.begin(), _linesIndexes.end()));
if ( _linesIndexes.empty() )
throw Error ( "MatrixVertex::getLineIndex(): Indexes map is empty." );
pair<pairIterator,pairIterator> result = equal_range (_linesIndexes.begin(), _linesIndexes.end()
, pair<DbU::Unit,unsigned>(y,0), MatrixVertex::IndexComp());
if ( result.second == _linesIndexes.begin() )
throw Error ("MatrixVertex::getLineIndex(): search value (%s) is lower than lowest bound (%s)."
,DbU::getValueString(y).c_str()
,DbU::getValueString((*_linesIndexes.begin()).first).c_str());
if ( result.second == _linesIndexes.end() )
throw Error ("MatrixVertex::getLineIndex(): search value (%s) is upper than uppest bound (%s)."
,DbU::getValueString(y).c_str()
,DbU::getValueString((*_linesIndexes.rbegin()).first).c_str());
return ((*result.second).second-1);
}
unsigned int MatrixVertex::getColumnIndex ( DbU::Unit x )
// *************************************************
{
assert(_xInit );
if ( _xRegular ) {
// cerr << "x:" << DbU::getValueString(x-DbU::lambda(_boundingBox.getXMin())) << "/" << _tileWidth << "=" << (DbU::getLambda(x-DbU::lambda(_lowerLeftX))/_tileWidth)
// << "<=>" << (unsigned int)floor(DbU::getLambda(x-DbU::lambda(_boundingBox.getXMin()))/_tileWidth) << endl;
if ( (x < _boundingBox.getXMin()) or (x > _boundingBox.getXMax()) )
throw Error ("MatrixVertex::getColumnIndex(): search value (%s) is out of bounds [%s,%s]."
,DbU::getValueString(x).c_str()
,DbU::getValueString(_boundingBox.getXMin()).c_str()
,DbU::getValueString(_boundingBox.getXMax()).c_str());
unsigned int index = (unsigned int)floor((x-_boundingBox.getXMin())/_tileWidth);
if ( x == _boundingBox.getXMax() ) --index;
return index;
}
assert(is_sorted(_columnsIndexes.begin(),_columnsIndexes.end()));
if ( _columnsIndexes.empty() )
throw Error ( "MatrixVertex::getColumnIndex(): Indexes map is empty." );
pair<pairIterator,pairIterator> result = equal_range (_columnsIndexes.begin(), _columnsIndexes.end()
, pair<DbU::Unit,unsigned>(x,0), MatrixVertex::IndexComp());
if ( result.second == _columnsIndexes.begin() )
throw Error ("MatrixVertex::getColumnIndex(): search value is lower than lowest bound.");
if ( result.second == _columnsIndexes.end() )
throw Error ("MatrixVertex::getColumnIndex(): search value is upper than uppest bound.");
return ((*result.second).second-1);
}
pair<unsigned int,unsigned int> MatrixVertex::getIJ ( DbU::Unit x, DbU::Unit y )
// *******************************************************************
{
return pair<unsigned int,unsigned int> (getColumnIndex(x),getLineIndex(y));
}
pair<unsigned int,unsigned int> MatrixVertex::getIJ ( const Point& point )
// ***********************************************************************
{
return pair<unsigned int,unsigned int> (getColumnIndex(point.getX()),getLineIndex(point.getY()));
}
Vertex* MatrixVertex::getVertex ( pair<unsigned int,unsigned int> indexes )
// ************************************************************************
{
return _matrix[indexes.second][indexes.first];
}
Vertex* MatrixVertex::getVertex ( Point point )
// ********************************************
{
pair<unsigned int,unsigned int> indexes = getIJ ( point );
Added support for "same layer" dogleg. Big fix for pad routing. * Change: In Knik, in Vertex, add a "blocked" flag to signal disabled vertexes in the grid (must not be used by the global router). Modificate the Graph::getVertex() method so that when a vertex is geometrically queried, if is a blocked one, return a non-blocked neighbor. This mechanism is introduced to, at last, prevent the global router to go *under* the pad in case of a commplete chip. * New: In Katabatic, in AutoSegment, a new state has been added: "reduced". A reduced segment is in the same layer as it's perpandiculars. To be reduced, a segments has to be connected on source & target to AutoContactTurn, both of the perpandiculars must be of the same layer (below or above) and it's length must not exceed one pitch in the perpandicular direction. To reduce an AutoSegment, call ::reduce() and to revert the state, call ::raise(). Two associated predicates are associated: ::canReduce() and ::mustRaise(). Note: No two adjacent segments can be reduced at the same time. * Bug: In Katabatic, in GCellTopology, add a new method ::doRp_AccessPad() to connect to the pads. Create wiring, fixed and non managed by Katabatic, to connect the pad connector layer to the lowest routing layers (depth 1 & 2). The former implementation was sometimes leading to gaps (sheared contact) that *must not* occurs during the building stage. Remark: This bug did put under the light the fact that the initial wiring must be created without gaps. Gaps are closed by making doglegs on contacts. But this mechanism could only work when the database if fully initialised (the cache is up to date). Otherwise various problems arise, in the canonization process for example. * New: In Katabatic, in AutoContactTerminal::getNativeConstraintBox(), when anchored on a RoutingPad, now take account the potential rotation of the Path's transformation. Here again, for the chip's pads. * New: In Kite, support for reduced AutoSegment. TrackSegment associateds to reduced AutoSegment are *not* inserted into track to become effectively invisibles. When a segment becomes reduced, a TrackEvent is generated to remove it. Conversely when it is raised a RoutingEvent is created/rescheduled to insert it. All this is mostly managed inside the Session::revalidate() method. * New: In Kite, in KiteEngine::createGlobalGraph(), in case of a chip, mark all global routing vertexes (Knik) that are under a pad, as blockeds. * Bug: In Cumulus, in PadsCorona.Side.getAxis(), inversion between X and Y coordinate of the chip size. Did not show until a non-square chip was routed (i.e. our MIPS R3000). * Change: In Stratus1, in st_placement.py add the ClockBuffer class for backward compatibility with the MIPS32 bench. Have to review this functionnality coming from the deprecated placeAndroute.py. In st_instance.py, no longer creates the Plug ring of a Net. In my opinion it just clutter the display until the P&R is called. Can re-enable later as an option (in Unicorn). * Change: In Unicorn, in cgt.py, more reliable way of loading then running user supplied scripts. Borrowed from alliance-checker-toolkit doChip.py .
2015-08-16 16:29:28 -05:00
Vertex* vertex = getVertex ( indexes );
cdebug_log(139,0) << "MatrixVertex::getVertex(): " << vertex << endl;
Added support for "same layer" dogleg. Big fix for pad routing. * Change: In Knik, in Vertex, add a "blocked" flag to signal disabled vertexes in the grid (must not be used by the global router). Modificate the Graph::getVertex() method so that when a vertex is geometrically queried, if is a blocked one, return a non-blocked neighbor. This mechanism is introduced to, at last, prevent the global router to go *under* the pad in case of a commplete chip. * New: In Katabatic, in AutoSegment, a new state has been added: "reduced". A reduced segment is in the same layer as it's perpandiculars. To be reduced, a segments has to be connected on source & target to AutoContactTurn, both of the perpandiculars must be of the same layer (below or above) and it's length must not exceed one pitch in the perpandicular direction. To reduce an AutoSegment, call ::reduce() and to revert the state, call ::raise(). Two associated predicates are associated: ::canReduce() and ::mustRaise(). Note: No two adjacent segments can be reduced at the same time. * Bug: In Katabatic, in GCellTopology, add a new method ::doRp_AccessPad() to connect to the pads. Create wiring, fixed and non managed by Katabatic, to connect the pad connector layer to the lowest routing layers (depth 1 & 2). The former implementation was sometimes leading to gaps (sheared contact) that *must not* occurs during the building stage. Remark: This bug did put under the light the fact that the initial wiring must be created without gaps. Gaps are closed by making doglegs on contacts. But this mechanism could only work when the database if fully initialised (the cache is up to date). Otherwise various problems arise, in the canonization process for example. * New: In Katabatic, in AutoContactTerminal::getNativeConstraintBox(), when anchored on a RoutingPad, now take account the potential rotation of the Path's transformation. Here again, for the chip's pads. * New: In Kite, support for reduced AutoSegment. TrackSegment associateds to reduced AutoSegment are *not* inserted into track to become effectively invisibles. When a segment becomes reduced, a TrackEvent is generated to remove it. Conversely when it is raised a RoutingEvent is created/rescheduled to insert it. All this is mostly managed inside the Session::revalidate() method. * New: In Kite, in KiteEngine::createGlobalGraph(), in case of a chip, mark all global routing vertexes (Knik) that are under a pad, as blockeds. * Bug: In Cumulus, in PadsCorona.Side.getAxis(), inversion between X and Y coordinate of the chip size. Did not show until a non-square chip was routed (i.e. our MIPS R3000). * Change: In Stratus1, in st_placement.py add the ClockBuffer class for backward compatibility with the MIPS32 bench. Have to review this functionnality coming from the deprecated placeAndroute.py. In st_instance.py, no longer creates the Plug ring of a Net. In my opinion it just clutter the display until the P&R is called. Can re-enable later as an option (in Unicorn). * Change: In Unicorn, in cgt.py, more reliable way of loading then running user supplied scripts. Borrowed from alliance-checker-toolkit doChip.py .
2015-08-16 16:29:28 -05:00
if (vertex and vertex->isBlocked()) {
cdebug_log(139,0) << "Vertex is blocked, looking for neighbor." << endl;
Added support for "same layer" dogleg. Big fix for pad routing. * Change: In Knik, in Vertex, add a "blocked" flag to signal disabled vertexes in the grid (must not be used by the global router). Modificate the Graph::getVertex() method so that when a vertex is geometrically queried, if is a blocked one, return a non-blocked neighbor. This mechanism is introduced to, at last, prevent the global router to go *under* the pad in case of a commplete chip. * New: In Katabatic, in AutoSegment, a new state has been added: "reduced". A reduced segment is in the same layer as it's perpandiculars. To be reduced, a segments has to be connected on source & target to AutoContactTurn, both of the perpandiculars must be of the same layer (below or above) and it's length must not exceed one pitch in the perpandicular direction. To reduce an AutoSegment, call ::reduce() and to revert the state, call ::raise(). Two associated predicates are associated: ::canReduce() and ::mustRaise(). Note: No two adjacent segments can be reduced at the same time. * Bug: In Katabatic, in GCellTopology, add a new method ::doRp_AccessPad() to connect to the pads. Create wiring, fixed and non managed by Katabatic, to connect the pad connector layer to the lowest routing layers (depth 1 & 2). The former implementation was sometimes leading to gaps (sheared contact) that *must not* occurs during the building stage. Remark: This bug did put under the light the fact that the initial wiring must be created without gaps. Gaps are closed by making doglegs on contacts. But this mechanism could only work when the database if fully initialised (the cache is up to date). Otherwise various problems arise, in the canonization process for example. * New: In Katabatic, in AutoContactTerminal::getNativeConstraintBox(), when anchored on a RoutingPad, now take account the potential rotation of the Path's transformation. Here again, for the chip's pads. * New: In Kite, support for reduced AutoSegment. TrackSegment associateds to reduced AutoSegment are *not* inserted into track to become effectively invisibles. When a segment becomes reduced, a TrackEvent is generated to remove it. Conversely when it is raised a RoutingEvent is created/rescheduled to insert it. All this is mostly managed inside the Session::revalidate() method. * New: In Kite, in KiteEngine::createGlobalGraph(), in case of a chip, mark all global routing vertexes (Knik) that are under a pad, as blockeds. * Bug: In Cumulus, in PadsCorona.Side.getAxis(), inversion between X and Y coordinate of the chip size. Did not show until a non-square chip was routed (i.e. our MIPS R3000). * Change: In Stratus1, in st_placement.py add the ClockBuffer class for backward compatibility with the MIPS32 bench. Have to review this functionnality coming from the deprecated placeAndroute.py. In st_instance.py, no longer creates the Plug ring of a Net. In my opinion it just clutter the display until the P&R is called. Can re-enable later as an option (in Unicorn). * Change: In Unicorn, in cgt.py, more reliable way of loading then running user supplied scripts. Borrowed from alliance-checker-toolkit doChip.py .
2015-08-16 16:29:28 -05:00
Vertex* neighbor = NULL;
for ( size_t i=0; i<4 ; ++i ) {
neighbor = vertex->getFirstEdges(i)->getOpposite( vertex );
if (neighbor and not neighbor->isBlocked())
return neighbor;
}
}
if (not vertex) {
cerr << Error( "MatrixVertex::getVertex(Point): On %s,\n"
" blocked and it's neighbors are also blocked (vertex unreachable)."
, getString(vertex).c_str() ) << endl;
}
return vertex;
}
Vertex* MatrixVertex::getVertex ( DbU::Unit x, DbU::Unit y )
// *********************************************************
{
pair<unsigned int,unsigned int> indexes = getIJ ( x, y );
return getVertex ( indexes );
}
Vertex* MatrixVertex::getVertexFromIndexes ( unsigned lineIdx, unsigned columnIdx )
// ********************************************************************************
{
return _matrix[lineIdx][columnIdx];
}
void MatrixVertex::print()
// ***********************
{
//cerr << "\'_linesIndexes\';" << endl;
//for ( unsigned i = 0 ; i < _linesIndexes.size() ; ) {
// cerr << "\'<" << _linesIndexes[i].first << "," << _linesIndexes[i].second << ">\'";
// if ( ++i %10 )
// cerr << ",";
// else
// cerr << ";" << endl;
//}
//cerr << ";" << endl;
//cerr << "\'_columnsIndexes\';" << endl;
//for ( unsigned i = 0 ; i < _columnsIndexes.size() ; ) {
// cerr << "\'<" << _columnsIndexes[i].first << "," << _columnsIndexes[i].second << ">\'";
// if ( ++i %10 )
// cerr << ",";
// else
// cerr << ";" << endl;
//}
//cerr << ";" << endl;
for ( unsigned j = 0 ; j < _nbYTiles ; j++ )
for ( unsigned i = 0 ; i < _nbXTiles ; i++ )
cerr << i << "," << j << " " << _matrix[j][i] << endl;
}
} // end namespace