diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index ccb0bc28..590830f6 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -30,6 +30,7 @@ #include "hurricane/DataBase.h" #include "hurricane/viewer/CellViewer.h" #include "hurricane/Technology.h" +#include "hurricane/NetRoutingProperty.h" namespace Anabatic { @@ -46,6 +47,38 @@ namespace Anabatic { using Hurricane::RoutingPad; using Hurricane::UpdateSession; using Hurricane::DebugSession; + using Hurricane::NetRoutingExtension; + + + +// ------------------------------------------------------------------- +// Class : "Anabatic::Symmetry". + + + Symmetry::Symmetry( unsigned int type, DbU::Unit value ) + { + if (type == sHorizontal) setAsH(); + else if (type == sVertical ) setAsV(); + + _value = value; + } + + + Symmetry::~Symmetry() {} + + + Symmetry* Symmetry::create( unsigned int type, DbU::Unit value ) + { + return new Symmetry( type, value ); + } + + + unsigned int Symmetry::getType() const + { + if (_flags & sHorizontal) return sHorizontal; + else if (_flags & sVertical ) return sVertical; + else return 0; + } @@ -130,13 +163,6 @@ namespace Anabatic { { return _stamp == getAnabatic()->getStamp(); } -/*void Vertex::setPathPoint( DbU::Unit x, DbU::Unit y ) - { - _xpath = x; - _ypath = y; - }*/ - - bool Vertex::hasRP( Net* net ) const { if (getGCell() != NULL ){ @@ -338,128 +364,10 @@ namespace Anabatic { return Point(x,y); } -/* - Point Vertex::getNextPathPoint( const Vertex* current, const Vertex* next ) - { - //cdebug_log(112,0) << "Point Dijkstra::getNextPathPoint( const Vertex* current, const Vertex* next )" << endl; - if ((current == NULL) || (next == NULL)){ - //cdebug_log(112,0) << "Error(Point Dijkstra::_getNextPathPoint( const Vertex*, const Vertex* )): Unvalid NULL argument."<< endl; - return Point(0,0); - } - - if (next->getGCell()->isMatrix()) return Point(next->getGCell()->getXCenter(), next->getGCell()->getYCenter()); - if (next->getGCell()->isDevice()) return next->getPathPoint(); - - - //cdebug_log(112,0) << "getBranchId() :" << current->getBranchId() << endl; - //cdebug_log(112,0) << "curr hasvalidstamp:" << current->hasValidStamp() << endl; - //cdebug_log(112,0) << "next hasvalidstamp:" << next->hasValidStamp() << endl; - //if ( ((current->getBranchId() != 0))||(current->getDistance() != 0)||(current->getGCell()->isDevice())){ - //cdebug_log(112,0) << "Case: distance > 0 OR isDevice" << endl; - if (current->isNorth(next)) { - //cdebug_log(112,0) << "North" << endl; - if ( current->getXPath() < next->getGCell()->getXMin() ) - return Point(next->getGCell()->getXMin(), next->getGCell()->getYMin()); - else if ( current->getXPath() > next->getGCell()->getXMax() ) - return Point(next->getGCell()->getXMax(), next->getGCell()->getYMin()); - else - return Point(current->getXPath(), next->getGCell()->getYMin()); - - } else if (current->isSouth(next)) { - //cdebug_log(112,0) << "South" << endl; - if ( current->getXPath() < next->getGCell()->getXMin() ) - return Point(next->getGCell()->getXMin(), next->getGCell()->getYMax()); - else if ( current->getXPath() > next->getGCell()->getXMax() ) - return Point(next->getGCell()->getXMax(), next->getGCell()->getYMax()); - else - return Point(current->getXPath(), next->getGCell()->getYMax()); - - } else if (current->isEast (next)) { - //cdebug_log(112,0) << "East" << endl; - if ( current->getYPath() < next->getGCell()->getYMin() ) - return Point(next->getGCell()->getXMin(), next->getGCell()->getYMin()); - else if ( current->getYPath() > next->getGCell()->getYMax() ) - return Point(next->getGCell()->getXMin(), next->getGCell()->getYMax()); - else - return Point(next->getGCell()->getXMin(), current->getYPath()); - - } else if (current->isWest (next)) { - //cdebug_log(112,0) << "West" << endl; - if ( current->getYPath() < next->getGCell()->getYMin() ) - return Point(next->getGCell()->getXMax(), next->getGCell()->getYMin()); - else if ( current->getYPath() > next->getGCell()->getYMax() ) - return Point(next->getGCell()->getXMax(), next->getGCell()->getYMax()); - else - return Point(next->getGCell()->getXMax(), current->getYPath()); - } else { - cdebug_log(112,0) << "Error(Point Vertex::_getNextPathPoint( const Vertex*, const Vertex* )): GCells are not next to each other." << endl; - return Point(0,0); - } - } else { - cdebug_log(112,0) << "Case: distance = 0 AND isNOTDevice" << endl; - if (current->isNorth(next)) { - cdebug_log(112,0) << "North" << endl; - return Point( ( std::max(current->getGCell()->getXMin() - , next->getGCell()->getXMin() - ) - + std::min(current->getGCell()->getXMax() - , next->getGCell()->getXMax() - ) - )/2 - , next->getGCell()->getYMin() - ); - } else if (current->isSouth(next)) { - cdebug_log(112,0) << "South" << endl; - return Point( ( std::max(current->getGCell()->getXMin() - , next->getGCell()->getXMin() ) - + std::min(current->getGCell()->getXMax() - , next->getGCell()->getXMax() ) - )/2 - , next->getGCell()->getYMax() - ); - } else if (current->isEast (next)) { - cdebug_log(112,0) << "East" << endl; - return Point( next->getGCell()->getXMin(), ( std::max(current->getGCell()->getYMin() - , next->getGCell()->getYMin() ) - + std::min(current->getGCell()->getYMax() - , next->getGCell()->getYMax() ) - )/2 - ); - } else if (current->isWest (next)) { - cdebug_log(112,0) << "West" << endl; - return Point( next->getGCell()->getXMin(), ( std::max(current->getGCell()->getYMin() - , next->getGCell()->getYMin() ) - + std::min(current->getGCell()->getYMax() - , next->getGCell()->getYMax() ) - )/2 - ); - } else { - cdebug_log(112,0) << "Error(Point Dijkstra::_getNextPathPoint( const Vertex*, const Vertex* )): GCells are not next to each other." << endl; - return Point(0,0); - } - } - }*/ - - -/*void Vertex::resetPathPoint( Point ponderedPoint ) - { - DbU::Unit x; - DbU::Unit y; - GCell* g = getGCell(); - - if (ponderedPoint.getX() < g->getXMin()) x = g->getXMin(); - else if (ponderedPoint.getX() > g->getXMax()) x = g->getXMax(); - else x = ponderedPoint.getX(); - if (ponderedPoint.getY() < g->getYMin()) y = g->getYMin(); - else if (ponderedPoint.getY() > g->getYMax()) y = g->getYMax(); - else y = ponderedPoint.getY(); - setPathPoint(x,y); - }*/ - Point Vertex::getPathPoint( const Vertex* next ) const { - //cdebug_log(112,0) << "Point Vertex::getPathPoint( const Vertex* next ) const" << endl; + //cdebug_log(112,0) << "Point Vertex::getPathPoint( const Vertex* next ) const:" << this << endl; GCell* gcurr = getGCell(); GCell* gnext = next->getGCell(); @@ -472,143 +380,152 @@ namespace Anabatic { if (isH()){ //cdebug_log(112,0) << "hinterval: " << DbU::getValueString(_interv->getAxis()) << endl; y = _interv->getAxis(); - if ((gnext->getXMax() < gcurr->getXMin())||(isWest (next))) { - x = _interv->getMin(); - } - else if ((gnext->getXMin() > gcurr->getXMax())||(isEast (next))) { - x = _interv->getMax(); - } - else { - x = (max(gnext->getXMin(), gcurr->getXMin())+min(gnext->getXMax(), gcurr->getXMax()))/2 ; - } + if ((gnext->getXMax() < _interv->getMin())||(isWest (next))) x = _interv->getMin(); + else if ((gnext->getXMin() > _interv->getMax())||(isEast (next))) x = _interv->getMax(); + else x = (max(gnext->getXMin(), _interv->getMin())+min(gnext->getXMax(), _interv->getMax()))/2; + } else if (isV()){ //cdebug_log(112,0) << "vinterval" << endl; x = _interv->getAxis(); - if ((gnext->getYMax() < gcurr->getYMin())||(isSouth(next))) y = _interv->getMin(); - else if ((gnext->getYMin() > gcurr->getYMax())||(isNorth(next))) y = _interv->getMax(); - else y = (max(gnext->getYMin(), gcurr->getYMin())+min(gnext->getYMax(), gcurr->getYMax()))/2 ; + if ((gnext->getYMax() < _interv->getMin())||(isSouth(next))) y = _interv->getMin(); + else if ((gnext->getYMin() > _interv->getMax())||(isNorth(next))) y = _interv->getMax(); + else y = (max(gnext->getYMin(), _interv->getMin())+min(gnext->getYMax(), _interv->getMax()))/2 ; } else { cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; return Point(0,0); } } else if (isH()) { - //cdebug_log(112,0) << "Case horizontal" << endl; + //cdebug_log(112,0) << "Case horizontal: " << isiSet() << endl; GCell* gprev = getFrom()->getOpposite(gcurr); Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); - - if (prev->isH()){ - //cdebug_log(112,0) << "prev is H" << endl; - if (isNorth(prev)){ - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = _intervfrom->getAxis(); - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = _intervfrom->getAxis(); - } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else if (prev->isV()){ - //cdebug_log(112,0) << "prev is V" << endl; - if (isNorth(prev)){ - //cdebug_log(112,0) << "1" << endl; - x = _intervfrom->getAxis(); - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - //cdebug_log(112,0) << "2" << endl; - x = _intervfrom->getAxis(); - y = gcurr->getYMin(); - } else if (isWest (prev)){ - //cdebug_log(112,0) << "3" << endl; - x = gcurr->getXMin(); - if ( _intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } - } else if (isEast (prev)){ - //cdebug_log(112,0) << "4" << endl; - x = gcurr->getXMax(); - if ( _intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } - } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - //cdebug_log(112,0) << "x: " << DbU::getValueString(x) << ", y:" << DbU::getValueString(y) << endl; + if (isiSet()){ + //cdebug_log(112,0) << "isiSet" << endl; + y = _interv->getAxis(); + if ((gnext->getXMax() < _interv->getMin())||(isWest (next))) x = _interv->getMin(); + else if ((gnext->getXMin() > _interv->getMax())||(isEast (next))) x = _interv->getMax(); + else x = (max(gnext->getXMin(), _interv->getMin())+min(gnext->getXMax(), _interv->getMax()))/2; } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); + if (prev->isH()){ + //cdebug_log(112,0) << "prev is H" << endl; + if (isNorth(prev)){ + x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; + y = gcurr->getYMax(); + } else if (isSouth(prev)){ + x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; + y = gcurr->getYMin(); + } else if (isWest (prev)){ + x = gcurr->getXMin(); + y = _intervfrom->getAxis(); + } else if (isEast (prev)){ + x = gcurr->getXMax(); + y = _intervfrom->getAxis(); + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } + } else if (prev->isV()){ + cdebug_log(112,0) << "prev is V" << endl; + if (isNorth(prev)){ + //cdebug_log(112,0) << "1" << endl; + x = _intervfrom->getAxis(); + y = gcurr->getYMax(); + } else if (isSouth(prev)){ + //cdebug_log(112,0) << "2" << endl; + x = _intervfrom->getAxis(); + y = gcurr->getYMin(); + } else if (isWest (prev)){ + //cdebug_log(112,0) << "3" << endl; + x = gcurr->getXMin(); + if ( _intervfrom->getMin() > gcurr->getYMax() ){ + y = gcurr->getYMax(); + } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ + y = gcurr->getYMin(); + } else { + y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; + } + } else if (isEast (prev)){ + //cdebug_log(112,0) << "4" << endl; + x = gcurr->getXMax(); + if ( _intervfrom->getMin() > gcurr->getYMax() ){ + y = gcurr->getYMax(); + } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ + y = gcurr->getYMin(); + } else { + y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; + } + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } + cdebug_log(112,0) << "x: " << DbU::getValueString(x) << ", y:" << DbU::getValueString(y) << endl; + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } } } else if (isV()) { - //cdebug_log(112,0) << "Case V" << endl; + //cdebug_log(112,0) << "Case V: " << isiSet() << endl; GCell* gprev = getFrom()->getOpposite(gcurr); Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); - - if (prev->isH()){ - //cdebug_log(112,0) << "prev is H" << endl; - if (isNorth(prev)){ - y = gcurr->getYMax(); - if ( _intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - } - } else if (isSouth(prev)){ - y = gcurr->getYMin(); - if ( _intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - } - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = _intervfrom->getAxis(); - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = _intervfrom->getAxis(); - } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else if (prev->isV()){ - //cdebug_log(112,0) << "prev is V" << endl; - if (isNorth(prev)){ - x = _intervfrom->getAxis(); - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = _intervfrom->getAxis(); - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } + if (isiSet()){ + //cdebug_log(112,0) << "isiSet" << endl; + x = _interv->getAxis(); + if ((gnext->getYMax() < _interv->getMin())||(isSouth(next))) y = _interv->getMin(); + else if ((gnext->getYMin() > _interv->getMax())||(isNorth(next))) y = _interv->getMax(); + else y = (max(gnext->getYMin(), _interv->getMin())+min(gnext->getYMax(), _interv->getMax()))/2 ; } else { - cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); + if (prev->isH()){ + //cdebug_log(112,0) << "prev is H" << endl; + if (isNorth(prev)){ + y = gcurr->getYMax(); + if ( _intervfrom->getMin() > gcurr->getXMax() ){ + x = gcurr->getXMax(); + } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ + x = gcurr->getXMin(); + } else { + x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; + } + } else if (isSouth(prev)){ + y = gcurr->getYMin(); + if ( _intervfrom->getMin() > gcurr->getXMax() ){ + x = gcurr->getXMax(); + } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ + x = gcurr->getXMin(); + } else { + x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; + } + } else if (isWest (prev)){ + x = gcurr->getXMin(); + y = _intervfrom->getAxis(); + } else if (isEast (prev)){ + x = gcurr->getXMax(); + y = _intervfrom->getAxis(); + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } + } else if (prev->isV()){ + //cdebug_log(112,0) << "prev is V" << endl; + if (isNorth(prev)){ + x = _intervfrom->getAxis(); + y = gcurr->getYMax(); + } else if (isSouth(prev)){ + x = _intervfrom->getAxis(); + y = gcurr->getYMin(); + } else if (isWest (prev)){ + x = gcurr->getXMin(); + y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; + } else if (isEast (prev)){ + x = gcurr->getXMax(); + y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } + } else { + cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + return Point(0,0); + } } } else { cdebug_log(112,0) << "Error(Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; @@ -642,15 +559,15 @@ namespace Anabatic { { Point pcurr = vcurr->getPathPoint(this); Point pnext = Vertex::getNextPathPoint2( vcurr, this ); - cdebug_log(112,0) << "void Vertex::setIntervals ( Vertex* vcurr )" << endl; + //cdebug_log(112,0) << "void Vertex::setIntervals ( Vertex* vcurr )" << endl; cdebug_log(112,0) << "Pcurrent : X:" << DbU::getValueString(pcurr.getX()) << ", Y:" << DbU::getValueString(pcurr.getY()) << endl; - cdebug_log(112,0) << "Pneighbour: X:" << DbU::getValueString(pnext.getX()) << ", Y:" << DbU::getValueString(pnext.getY()) << endl; + //cdebug_log(112,0) << "Pneighbour: X:" << DbU::getValueString(pnext.getX()) << ", Y:" << DbU::getValueString(pnext.getY()) << endl; DbU::Unit min, max, axis; if (vcurr->isH()){ - cdebug_log(112,0) << "case vcurr: Horizontal" << endl; + //cdebug_log(112,0) << "case vcurr: Horizontal" << endl; if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - cdebug_log(112,0) << "case set" << endl; + //cdebug_log(112,0) << "case set" << endl; if (vcurr->getIMin() > pnext.getX()) { min = pnext.getX(); max = vcurr->getIMax(); @@ -665,7 +582,7 @@ namespace Anabatic { axis = vcurr->getIAxis(); } } else { - cdebug_log(112,0) << "case not set" << endl; + //cdebug_log(112,0) << "case not set" << endl; axis = pcurr.getY(); if (pcurr.getX() < pnext.getX()){ min = pcurr.getX(); @@ -677,10 +594,10 @@ namespace Anabatic { } } else if (vcurr->isV()){ - cdebug_log(112,0) << "case vcurr: Vertical" << endl; + //cdebug_log(112,0) << "case vcurr: Vertical" << endl; if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - cdebug_log(112,0) << "case set" << endl; + //cdebug_log(112,0) << "case set" << endl; if (vcurr->getIMin() > pnext.getY()) { min = pnext.getY(); max = vcurr->getIMax(); @@ -695,7 +612,7 @@ namespace Anabatic { axis = vcurr->getIAxis(); } } else { - cdebug_log(112,0) << "case not set" << endl; + //cdebug_log(112,0) << "case not set" << endl; axis = pcurr.getX(); if (pcurr.getY() < pnext.getY()){ min = pcurr.getY(); @@ -748,6 +665,7 @@ namespace Anabatic { + (isSRestricted() ? "S" : "-") + (isERestricted() ? "E" : "-") + (isWRestricted() ? "W" : "-") + + " isiSet:" +(isiSet() ? "1" : "0") + ">"; return s; } @@ -826,7 +744,8 @@ namespace Anabatic { } } } - dist = dist/cpt; + if (cpt != 0) dist = dist/cpt; + else dist = Vertex::unreachable; return dist; } @@ -998,6 +917,7 @@ namespace Anabatic { , _searchAreaHalo(0) , _connectedsId (-1) , _queue () + , _flags (0) { const vector& gcells = _anabatic->getGCells(); for ( GCell* gcell : gcells ) { @@ -1045,9 +965,32 @@ namespace Anabatic { cdebug_log(112,1) << "Dijkstra::load() " << _net << endl; vector rps; + NetRoutingState* state = NetRoutingExtension::get( _net ); + + if (state){ + if (state->isSelfSym()){ + cdebug_log(112,0) << "Dijkstra::SELF SYMMETRY CASE " << _net << endl; + } + } + for ( Component* component : _net->getComponents() ) { RoutingPad* rp = dynamic_cast( component ); if (rp) { + if (state){ + if (state->isSelfSym()){ + if ( ( (state->isSymHorizontal())&&(rp->getBoundingBox().getYMin() > state->getSymAxis()) ) + ||( (state->isSymVertical() )&&(rp->getBoundingBox().getXMin() > state->getSymAxis()) ) + ){ + Point center = rp->getBoundingBox().getCenter(); + GCell* gcell = _anabatic->getGCellUnder( center ); + Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); + Contact* vcontact = seed->getGContact( _net ); + rp->getBodyHook()->detach(); + rp->getBodyHook()->attach( vcontact->getBodyHook() ); + continue; + } + } + } rps.push_back( rp ); cdebug_log(112,0) << "| " << rp << endl; continue; @@ -1057,8 +1000,24 @@ namespace Anabatic { for ( auto rp : rps ) { Point center = rp->getBoundingBox().getCenter(); GCell* gcell = _anabatic->getGCellUnder( center ); - - if (gcell->isDevice()){ + + if (state){ + if (state->isSymHorizontal()){ + _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() + , _net->getCell()->getAbutmentBox().getYMin() + , _net->getCell()->getAbutmentBox().getXMax() + , state->getSymAxis() + ) + ); + } else if (state->isSymVertical()){ + _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() + , _net->getCell()->getAbutmentBox().getYMin() + , state->getSymAxis() + , _net->getCell()->getAbutmentBox().getYMax() + ) + ); + } + } else if (gcell->isDevice()){ _searchArea.merge( _net->getCell()->getAbutmentBox() ); } @@ -1118,11 +1077,132 @@ namespace Anabatic { _searchArea.inflate( _searchAreaHalo ); cdebug_log(112,0) << "Search area: " << _searchArea << endl; + + setAxisTargets(); + cdebug_tabw(112,-1); DebugSession::close(); } + void Dijkstra::unsetAxisTargets () + { + NetRoutingState* state = NetRoutingExtension::get( _net ); + + if (state){ + if (state->isSelfSym()){ + Cell* cell = _anabatic->getCell(); + _queue.clear(); + GCell* gcell = NULL; + if (state->isSymVertical()){ + gcell = _anabatic->getGCellUnder( Point( state->getSymAxis() + , _anabatic->getCell()->getAbutmentBox().getYMin() + ) ); + } else if (state->isSymHorizontal()){ + gcell = _anabatic->getGCellUnder( Point( _anabatic->getCell()->getAbutmentBox().getXMin() + , state->getSymAxis() + ) ); + } + if (gcell) { + _queue.push(gcell->getObserver(GCell::Observable::Vertex)); + } + while ( not _queue.empty() ) { + Vertex* current = _queue.top(); + _queue.pop(); + if ( (state->isSymVertical() && (!current->isNRestricted()) && (!current->isSRestricted())) + ||(state->isSymHorizontal() && (!current->isERestricted()) && (!current->isWRestricted())) + ){ + current->unsetFlags(Vertex::AxisTarget); + } + + if (state->isSymVertical()){ + // check North + for ( Edge* edge : current->getGCell()->getNorthEdges() ) { + GCell* gnext = edge->getOpposite(current->getGCell()); + Vertex* vnext = gnext->getObserver(GCell::Observable::Vertex); + if ( (gnext->getXCenter() == state->getSymAxis()) + && (gnext->getYMin() <= cell->getAbutmentBox().getYMax()) + ) _queue.push( vnext ); + } + } else if (state->isSymHorizontal()){ + // check East + for ( Edge* edge : current->getGCell()->getNorthEdges() ) { + GCell* gnext = edge->getOpposite(current->getGCell()); + Vertex* vnext = gnext->getObserver(GCell::Observable::Vertex); + if ( (gnext->getXCenter() == state->getSymAxis()) + && (gnext->getXMin() <= cell->getAbutmentBox().getXMax()) + ) _queue.push( vnext ); + } + } + } + } + } + } + + + void Dijkstra::setAxisTargets () + { + NetRoutingState* state = NetRoutingExtension::get( _net ); + + if (state){ + if (state->isSelfSym()){ + Cell* cell = _anabatic->getCell(); + _queue.clear(); + GCell* gcell = NULL; + if (state->isSymVertical()){ + gcell = _anabatic->getGCellUnder( Point( state->getSymAxis() + , _anabatic->getCell()->getAbutmentBox().getYMin() + ) ); + } else if (state->isSymHorizontal()){ + gcell = _anabatic->getGCellUnder( Point( _anabatic->getCell()->getAbutmentBox().getXMin() + , state->getSymAxis() + ) ); + } + if (gcell) { + _queue.push(gcell->getObserver(GCell::Observable::Vertex)); + setFlags(Mode::AxisTarget); + cdebug_log(112,0) << "Find axis targets: " << endl; + } + while ( not _queue.empty() ) { + Vertex* current = _queue.top(); + _queue.pop(); + if ( (state->isSymVertical() && (!current->isNRestricted()) && (!current->isSRestricted())) + ||(state->isSymHorizontal() && (!current->isERestricted()) && (!current->isWRestricted())) + ){ + current->setDistance ( Vertex::unreached ); + current->setStamp ( _stamp ); + current->setConnexId( -1 ); + current->setAxisTarget(); + //cdebug_log(112,0) << "AxisTarget: " << current << endl; + } + + if (state->isSymVertical()){ + // check North + for ( Edge* edge : current->getGCell()->getNorthEdges() ) { + GCell* gnext = edge->getOpposite(current->getGCell()); + Vertex* vnext = gnext->getObserver(GCell::Observable::Vertex); + if ( (gnext->getXCenter() == state->getSymAxis()) + && (gnext->getYMin() <= cell->getAbutmentBox().getYMax()) + ) _queue.push( vnext ); + } + } else if (state->isSymHorizontal()){ + // check East + for ( Edge* edge : current->getGCell()->getNorthEdges() ) { + GCell* gnext = edge->getOpposite(current->getGCell()); + Vertex* vnext = gnext->getObserver(GCell::Observable::Vertex); + if ( (gnext->getXCenter() == state->getSymAxis()) + && (gnext->getXMin() <= cell->getAbutmentBox().getXMax()) + ) _queue.push( vnext ); + } + } + + } + + } + } + } + + void Dijkstra::_selectFirstSource () { if (_targets.empty()) { @@ -1212,10 +1292,15 @@ namespace Anabatic { Vertex* current = _queue.top(); cdebug_log(111,0) << endl; - cdebug_log(111,0) << "[Current Vertex]: " << current << endl; + cdebug_log(111,0) << "[Current Vertex]: " << current << ", current->getConnexId() == _connectedsId):" << (current->getConnexId() == _connectedsId)<< ", (current->getConnexId() < 0): " << current->getConnexId() << endl; _queue.pop(); - if ((current->getConnexId() == _connectedsId) or (current->getConnexId() < 0)) { + if ( current->isAxisTarget() + and needAxisTarget() + ){ + unsetFlags(Mode::AxisTarget); + } else if ((current->getConnexId() == _connectedsId) or (current->getConnexId() < 0)) { + for ( Edge* edge : current->getGCell()->getEdges() ) { if (edge == current->getFrom()) { cdebug_log(111,0) << "edge == current->getFrom()" << endl; @@ -1242,7 +1327,9 @@ namespace Anabatic { cdebug_log(111,0) << endl; } cdebug_log(111,0) << "| Edge " << edge << endl; - cdebug_log(111,0) << "+ Neighbor: " << vneighbor << endl; + cdebug_log(111,0) << "+ Neighbor: " << vneighbor; + if (vneighbor->getFrom() != NULL) {cdebug_log(111,0) << "| Neighbor getfrom:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl;} + else {cdebug_log(111,0) << endl;} DbU::Unit distance = _distanceCb( current, vneighbor, edge ); @@ -1300,14 +1387,13 @@ namespace Anabatic { vneighbor->setStamp ( _stamp ); vneighbor->setDegree ( 1 ); vneighbor->setRpCount ( 0 ); + vneighbor->unsetFlags(Vertex::AxisTarget); } } cdebug_log(111,0) << "Distance INF" << endl; vneighbor->setBranchId( current->getBranchId() ); vneighbor->setDistance( distance ); - //Point pathPoint = Vertex::getNextPathPoint( current, vneighbor ); - //vneighbor->setPathPoint( pathPoint.getX(), pathPoint.getY() ); vneighbor->setFrom ( edge ); _queue.push( vneighbor ); @@ -1329,6 +1415,11 @@ namespace Anabatic { cerr << Error( "Dijkstra::propagate(): %s has unreachable targets." , getString(_net).c_str() ) << endl; + + for ( Vertex* v : _targets ) { + cdebug_tabw(112, 0) << v << endl; + + } cdebug_tabw(112,-1); return false; @@ -1340,72 +1431,76 @@ namespace Anabatic { cdebug_log(112,1) << "Dijkstra::_traceback() " << _net << " branchId:" << _sources.size() << endl; int branchId = _sources.size(); - Point ponderedpoint = _getPonderedPoint(); _toSources( current, _connectedsId ); + bool isfirst = true; if (!current->getGCell()->isMatrix()){ GCell* gcurr = current->getGCell(); GCell* gprev = current->getFrom()->getOpposite(gcurr); Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); Point pentry = Vertex::getNextPathPoint2( vprev, current ); + cdebug_log(112,0) << "| " << current << " | " << endl; if (current->isH()){ if (pentry.getX() < current->getIMin()){ current->setInterv(pentry.getX(), current->getIMax(), current->getIAxis()); cdebug_log(112,0) << "[Interval update1]: min : " << DbU::getValueString(pentry.getX()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; } else if (pentry.getX() > current->getIMax()){ current->setInterv(current->getIMin(), pentry.getX(), current->getIAxis()); cdebug_log(112,0) << "[Interval update2]: min : " << DbU::getValueString(current->getIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getX()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getX()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; } } else if (current->isV()){ if (pentry.getY() < current->getIMin()){ current->setInterv(pentry.getY(), current->getIMax(), current->getIAxis()); cdebug_log(112,0) << "[Interval update3]: min : " << DbU::getValueString(pentry.getY()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; } else if (pentry.getY() > current->getIMax()){ current->setInterv(current->getIMin(), pentry.getY(), current->getIAxis()); cdebug_log(112,0) << "[Interval update4]: min : " << DbU::getValueString(current->getIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getY()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getY()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; } } + cdebug_log(112,0) << "isiSet: " << current->isiSet() << ", " << current << endl; + } else { + current = current->getPredecessor(); + isfirst = false; } - current = current->getPredecessor(); - while ( current ) { cdebug_log(112,0) << "| " << current << " | " << endl; - current->incDegree(); - if (current->getConnexId() == _connectedsId) break; + if (!isfirst){ + current->incDegree(); + if (current->getConnexId() == _connectedsId) break; - Edge* from = current->getFrom(); - if (not from) break; + Edge* from = current->getFrom(); + if (not from) break; + + current->setDistance( 0.0 ); + current->setConnexId( _connectedsId ); + current->setBranchId( branchId ); + _sources.insert( current ); + _queue.push( current ); + } else { + isfirst = false; + } - current->setDistance( 0.0 ); if (!current->getGCell()->isMatrix()){ - /*if (!current->getGCell()->isDevice()) { - current->resetPathPoint(ponderedpoint); - }*/ - if (current->getPredecessor() != NULL){ cdebug_log(112,0) << "[Interval update]: min : " << DbU::getValueString(current->getPIMin()); cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getPIMax()); cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getPIAxis()) << endl; current->getPredecessor()->setInterv(current->getPIMin(), current->getPIMax(), current->getPIAxis()); + cdebug_log(112,0) << "isiSet: " << current->getPredecessor()->isiSet() << ", " << current->getPredecessor() << endl; } } - - current->setConnexId( _connectedsId ); - current->setBranchId( branchId ); - _sources.insert( current ); - _queue.push( current ); current = current->getPredecessor(); } @@ -1420,14 +1515,15 @@ namespace Anabatic { if (_sources.size() < 2) { cdebug_tabw(112,-1); return; } + NetRoutingState* state = NetRoutingExtension::get( _net ); + for ( Vertex* startVertex : _sources ) { - cdebug_log(112,0) << "? " << startVertex << endl; - if (not startVertex->getFrom()) continue; if ( not startVertex->hasGContact(_net) and not startVertex->getRpCount() - and (startVertex->getDegree() < 3)) continue; + and (startVertex->getDegree() < 3) + and not startVertex->isAxisTarget() ) continue; Vertex* source = startVertex; while ( source ) { @@ -1476,6 +1572,7 @@ namespace Anabatic { Contact* targetContact = target->hasGContact( _net ); Segment* segment = NULL; + if (not targetContact) { if (target->getFrom()) targetContact = target->getGContact( _net ); else targetContact = target->breakGoThrough( _net ); @@ -1492,6 +1589,9 @@ namespace Anabatic { , DbU::fromLambda(2.0) ); for ( Edge* through : aligneds ) through->add( segment ); + if (state){ + if (state->isSymmetric()) _createSelfSymSeg ( segment ); + } } else { if (sourceContact->getY() > targetContact->getY()) std::swap( sourceContact, targetContact ); @@ -1503,10 +1603,13 @@ namespace Anabatic { , DbU::fromLambda(2.0) ); for ( Edge* through : aligneds ) through->add( segment ); + if (state){ + if (state->isSymmetric()) _createSelfSymSeg ( segment ); + } } - cdebug_log(112,0) << "| " << segment << endl; - cdebug_log(112,0) << "| " << "break (turn, branch or terminal)." << endl; + cdebug_log(112,0) << "|| " << segment << endl; + //cdebug_log(112,0) << "| " << "break (turn, branch or terminal)." << endl; source = (target->getFrom()) ? target : NULL; } } @@ -1546,12 +1649,11 @@ namespace Anabatic { << source << " _connectedsId:" << _connectedsId << endl; } - - - while ( not _targets.empty() and _propagate(enabledEdges) ); + while ( ((not _targets.empty()) || needAxisTarget()) and _propagate(enabledEdges) ); _queue.clear(); _materialize(); + unsetAxisTargets(); _anabatic->getNetData( _net )->setGlobalRouted( true ); @@ -1562,8 +1664,8 @@ namespace Anabatic { void Dijkstra::_toSources ( Vertex* source, int connexId ) { - cdebug_log(112,1) << "Dijkstra::_toSources() " << endl; - cdebug_log(112,0) << "* from: " << source << endl; + //cdebug_log(112,1) << "Dijkstra::_toSources() " << endl; + //cdebug_log(112,0) << "* from: " << source << endl; source->setConnexId( connexId ); source->setDistance( 0.0 ); @@ -1578,12 +1680,12 @@ namespace Anabatic { source = *stack.begin(); stack.erase( source ); - cdebug_log(112,0) << "| source:" << source << " stack.size():" << stack.size() << endl; + //cdebug_log(112,0) << "| source:" << source << " stack.size():" << stack.size() << endl; for ( Edge* edge : source->getGCell()->getEdges() ) { if (not edge->hasNet(_net)) { - cdebug_log(112,0) << " Not connected:" << edge - << " to:" << edge->getOpposite(source->getGCell()) << endl; + //cdebug_log(112,0) << " Not connected:" << edge + // << " to:" << edge->getOpposite(source->getGCell()) << endl; continue; } @@ -1656,4 +1758,100 @@ namespace Anabatic { } + void Dijkstra::_createSelfSymSeg ( Segment* segment ) + { + NetRoutingState* state = NetRoutingExtension::get( _net ); + if ((state != NULL)&&(segment!=NULL)){ + Horizontal* h = dynamic_cast(segment); + Vertical* v = dynamic_cast(segment); + Point sp, tp; + DbU::Unit axis; + Component* sourceContact = segment->getSource(); + Component* targetContact = segment->getTarget(); + if (h){ + if (state->isSymHorizontal()){ + sp = Point(sourceContact->getX(), state->getSymValue(sourceContact->getY()) ); + tp = Point(targetContact->getX(), state->getSymValue(targetContact->getY()) ); + axis = state->getSymValue(segment->getY()); + } else if (state->isSymVertical()){ + sp = Point( state->getSymValue(targetContact->getX()), targetContact->getY() ); + tp = Point( state->getSymValue(sourceContact->getX()), sourceContact->getY() ); + axis = segment->getY(); + } else { + cdebug_log(112,0) << "Dijkstra::_materialize(): Something is wrong here. " << endl; + return; + } + GCell* sgcell = _anabatic->getGCellUnder( sp ); + GCell* tgcell = _anabatic->getGCellUnder( tp ); + Vertex* svertex = sgcell->getObserver(GCell::Observable::Vertex); + Vertex* tvertex = tgcell->getObserver(GCell::Observable::Vertex); + Contact* sourceSym = NULL; + Contact* targetSym = NULL; + if (state->isSelfSym()){ + cdebug_log(112,0) << "isSelfSym" << endl; + sourceSym = svertex->getGContact( _net ); + targetSym = tvertex->getGContact( _net ); + } else if (state->isSymMaster()){ + cdebug_log(112,0) << "isSymPair: " << state->getSymNet() << endl; + sourceSym = svertex->getGContact( state->getSymNet() ); + targetSym = tvertex->getGContact( state->getSymNet() ); + } else { + cdebug_log(112,0) << "Dijkstra::_materialize(): Something is wrong with the symmetry. " << endl; + return; + } + + cdebug_log(112,0) << "sourceSym:" << sourceSym << endl; + cdebug_log(112,0) << "targetSym:" << targetSym << endl; + Segment* segment2 = Horizontal::create( sourceSym + , targetSym + , _anabatic->getConfiguration()->getGHorizontalLayer() + , axis + , DbU::fromLambda(2.0) + ); + cdebug_log(112,0) << "|| " << segment2 << endl; + } else if (v) { + if (state->isSymVertical()){ + sp = Point(state->getSymValue(sourceContact->getX()), sourceContact->getY() ); + tp = Point(state->getSymValue(targetContact->getX()), targetContact->getY() ); + axis = state->getSymValue(segment->getX()); + } else if (state->isSymHorizontal()){ + sp = Point( targetContact->getX(), state->getSymValue(targetContact->getY()) ); + tp = Point( sourceContact->getX(), state->getSymValue(sourceContact->getY()) ); + axis = segment->getX(); + } else { + cdebug_log(112,0) << "Dijkstra::_materialize(): Something is wrong here. " << endl; + return; + } + GCell* sgcell = _anabatic->getGCellUnder( sp ); + GCell* tgcell = _anabatic->getGCellUnder( tp ); + Vertex* svertex = sgcell->getObserver(GCell::Observable::Vertex); + Vertex* tvertex = tgcell->getObserver(GCell::Observable::Vertex); + Contact* sourceSym = NULL; + Contact* targetSym = NULL; + if (state->isSelfSym()){ + sourceSym = svertex->getGContact( _net ); + targetSym = tvertex->getGContact( _net ); + } else if (state->isSymMaster()){ + sourceSym = svertex->getGContact( state->getSymNet() ); + targetSym = tvertex->getGContact( state->getSymNet() ); + } else { + cdebug_log(112,0) << "Dijkstra::_materialize(): Something is wrong with the symmetry. " << endl; + return; + } + + cdebug_log(112,0) << "sourceSym:" << sourceSym << endl; + cdebug_log(112,0) << "targetSym:" << targetSym << endl; + Segment* segment2 = Vertical::create( sourceSym + , targetSym + , _anabatic->getConfiguration()->getGVerticalLayer() + , axis + , DbU::fromLambda(2.0) + ); + cdebug_log(112,0) << "|| " << segment2 << endl; + } + } + } + + + } // Anabatic namespace. diff --git a/anabatic/src/LoadGlobalRouting.cpp b/anabatic/src/LoadGlobalRouting.cpp index 38fdc6dc..92bfea85 100644 --- a/anabatic/src/LoadGlobalRouting.cpp +++ b/anabatic/src/LoadGlobalRouting.cpp @@ -2409,30 +2409,30 @@ namespace { if (i == 0){ if (h){ - cerr << "case i=0, h" << endl; + cdebug_log(145,0) << "case i=0, h" << endl; ac = AutoContactHTee::create( _gcell, _net, Session::getContactLayer(2) ); ac->setX(_gcell->getXMin()); ac->setY(_gcell->getYMin() + _gcell->getHeight()/2); firstH = true; } else if (v){ - cerr << "case i=0, v" << endl; + cdebug_log(145,0) << "case i=0, v" << endl; ac = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); ac->setX(v->getX()); ac->setY(_gcell->getYMin() + _gcell->getHeight()/2); } } else if (i == hooks.size()-1){ if (h){ - cerr << "case i=last, h" << endl; + cdebug_log(145,0) << "case i=last, h" << endl; ac = autoContacts[i-1]; } else if (v){ - cerr << "case i=last, v" << endl; + cdebug_log(145,0) << "case i=last, v" << endl; ac = AutoContactTurn::create( _gcell, _net, Session::getContactLayer(1) ); ac->setX(v->getX()); ac->setY(_gcell->getYMin() + _gcell->getHeight()/2); } } else { if ((i == 1)&&(firstH)){ - cerr << "case i=1, first was H" << endl; + cdebug_log(145,0) << "case i=1, first was H" << endl; ac = autoContacts[i-1]; if (v) ac->setX(v->getX()); else { @@ -2441,7 +2441,7 @@ namespace { << endl; } } else { - cerr << "case i=1, first was V" << endl; + cdebug_log(145,0) << "case i=1, first was V" << endl; ac = AutoContactHTee::create( _gcell, _net, Session::getContactLayer(2) ); ac->setX(v->getX()); ac->setY(_gcell->getYMin() + _gcell->getHeight()/2); @@ -2680,9 +2680,7 @@ namespace { } else { cdebug_log(145,0) << "case i=X, first was H"<< endl; ac = AutoContactVTee::create( _gcell, _net, Session::getContactLayer(1) ); - cerr << "1" << endl; ac->setX(_gcell->getXMin() + _gcell->getWidth()/2); - cerr << "2" << endl; ac->setY(h->getY()); } } @@ -2931,7 +2929,7 @@ namespace { forks.push( getSegmentOppositeHook( _south ), source ); targetContact = target; } else { - cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut." + cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut 1." , getString(_gcell).c_str() ) << endl; } @@ -2942,7 +2940,7 @@ namespace { } else if ( _south and (_fromHook != _south) ){ forks.push( getSegmentOppositeHook( _south ), target ); } else { - cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut." + cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut 2." , getString(_gcell).c_str() ) << endl; } @@ -2981,7 +2979,7 @@ namespace { forks.push( getSegmentOppositeHook( _west ), source ); targetContact = target; } else { - cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut." + cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut. 3" , getString(_gcell).c_str() ) << endl; } @@ -2993,7 +2991,7 @@ namespace { } else if ( _west and (_fromHook != _west) ){ forks.push( getSegmentOppositeHook( _west ), target ); } else { - cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut." + cerr << Warning( "Something is wrong with the globals and the fromHook in this Strut. 4" , getString(_gcell).c_str() ) << endl; } @@ -3013,7 +3011,7 @@ namespace { cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; } else { - cerr << Warning( "Something is wrong with the globals in this Strut." + cerr << Warning( "Something is wrong with the globals in this Strut. 5 " , getString(_gcell).c_str() ) << endl; } @@ -3064,10 +3062,8 @@ namespace { } else if ((_north != NULL) && (_south != NULL) && (_west != NULL)){ cdebug_log(145,0) << "Case NSW " << endl; xtee = AutoContactHTee::create( _gcell, _net, Session::getContactLayer(1) ); - cerr << "1" << endl; if (_north->getComponent()->getX() < _south->getComponent()->getX()){ - cerr << "2" << endl; xtee->setX(_north->getComponent()->getX()); turn->setX(_south->getComponent()->getX()); if ( _north and (_fromHook != _north) ) forks.push( getSegmentOppositeHook( _north ), xtee ); @@ -3076,7 +3072,6 @@ namespace { else targetContact = turn; } else { - cerr << "3" << endl; xtee->setX(_south->getComponent()->getX()); turn->setX(_north->getComponent()->getX()); if ( _north and (_fromHook != _north) ) forks.push( getSegmentOppositeHook( _north ), turn ); @@ -3084,7 +3079,6 @@ namespace { if ( _south and (_fromHook != _south) ) forks.push( getSegmentOppositeHook( _south ), xtee ); else targetContact = xtee; } - cerr << "4" << endl; turn->setY(_west->getComponent()->getY()); xtee->setY(_west->getComponent()->getY()); if ( _west and (_fromHook != _west) ) forks.push( getSegmentOppositeHook( _west ), xtee ); @@ -3181,7 +3175,7 @@ namespace { cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; } else { - cerr << Warning( "Something is wrong with the globals in this Strut." + cerr << Warning( "Something is wrong with the globals in this Strut. 6" , getString(_gcell).c_str() ) << endl; } @@ -3374,7 +3368,7 @@ namespace { cdebug_log(145,0) << "[Create global segment]: " << globalSegment2 << endl; } } else { - cerr << Warning( "Something is wrong with the number of globals in this Strut." + cerr << Warning( "Something is wrong with the number of globals in this Strut. 7" , getString(_gcell).c_str() ) << endl; } diff --git a/anabatic/src/anabatic/Dijkstra.h b/anabatic/src/anabatic/Dijkstra.h index 8a05fa7f..1b2cbe65 100644 --- a/anabatic/src/anabatic/Dijkstra.h +++ b/anabatic/src/anabatic/Dijkstra.h @@ -38,6 +38,43 @@ namespace Anabatic { class AnabaticEngine; +// ------------------------------------------------------------------- +// Class : "Anabatic::Symmetry". + + class Symmetry + { + public: + enum iFlag { None = 0 + , sHorizontal = (1<<0) + , sVertical = (1<<1) + , sCFound = (1<<2) + }; + private: + Symmetry(unsigned int, DbU::Unit); + ~Symmetry(); + public: + static Symmetry* create(unsigned int, DbU::Unit); + + public: + unsigned int getType () const; + inline DbU::Unit getValue() const; + inline bool isCFound() const; + inline void setAsH(); + inline void setAsV(); + inline void setFound(); + + private: + unsigned int _flags; + DbU::Unit _value; + }; + + inline void Symmetry::setAsH () { _flags = ((_flags & ~(0x3)) | sHorizontal); } + inline void Symmetry::setAsV () { _flags = ((_flags & ~(0x3)) | sVertical ); } + inline void Symmetry::setFound () { _flags |= sCFound; } + inline DbU::Unit Symmetry::getValue () const { return _value; } + inline bool Symmetry::isCFound () const { return _flags & sCFound; } + + // ------------------------------------------------------------------- // Class : "Anabatic::IntervalC". @@ -106,8 +143,9 @@ namespace Anabatic { enum FlagR { NoRestriction = 0 , NRestricted = (1<<0) , SRestricted = (1<<1) - , ERestricted = (1<<2) + , ERestricted = (1<<2) , WRestricted = (1<<3) + , AxisTarget = (1<<4) }; public: static DbU::Unit unreached; @@ -195,6 +233,10 @@ namespace Anabatic { inline void printInterval () const ; void setIntervals ( Vertex* ); void resetIntervals (); + inline void setFlags ( unsigned int ); + inline bool isAxisTarget () const; + inline void unsetFlags ( unsigned int ); + inline void setAxisTarget (); // Inspector support. @@ -286,10 +328,10 @@ namespace Anabatic { inline void Vertex::setRestricted () { _flags |= 0xF; } inline void Vertex::clearRestriction () { _flags &= ~(0xF); } - inline void Vertex::setNRestricted () { _flags |= 0x1; } - inline void Vertex::setSRestricted () { _flags |= 0x2; } - inline void Vertex::setERestricted () { _flags |= 0x4; } - inline void Vertex::setWRestricted () { _flags |= 0x8; } + inline void Vertex::setNRestricted () { _flags |= NRestricted; } + inline void Vertex::setSRestricted () { _flags |= SRestricted; } + inline void Vertex::setERestricted () { _flags |= ERestricted; } + inline void Vertex::setWRestricted () { _flags |= WRestricted; } inline unsigned int Vertex::getFlags () const { return _flags; } inline void Vertex::setIAxis ( DbU::Unit axis ) { _interv->setAxis(axis); } @@ -313,6 +355,9 @@ namespace Anabatic { inline void Vertex::setIRangeFrom( DbU::Unit min, DbU::Unit max ) { _intervfrom->setRange(min, max); } inline void Vertex::printInterval() const { _interv->print(); } + inline void Vertex::setAxisTarget() { _flags |= AxisTarget; } + inline bool Vertex::isAxisTarget () const { return (_flags & AxisTarget); } + inline void Vertex::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } // ------------------------------------------------------------------- // Class : "Anabatic::PriorityQueue". @@ -386,9 +431,10 @@ namespace Anabatic { // Mode sub-classe. class Mode : public Hurricane::BaseFlags { public: - enum Flag { NoMode = 0 - , Standart = (1<<0) - , Monotonic = (1<<1) + enum Flag { NoMode = 0 + , Standart = (1<<0) + , Monotonic = (1<<1) + , AxisTarget = (1<<2) }; public: inline Mode ( unsigned int flags=NoMode ); @@ -410,7 +456,7 @@ namespace Anabatic { template inline DistanceT* setDistance ( DistanceT ); inline void setSearchAreaHalo ( DbU::Unit ); - void load ( Net* ); + void load ( Net* net ); void run ( Mode mode=Mode::Standart ); private: Dijkstra ( const Dijkstra& ); @@ -427,6 +473,14 @@ namespace Anabatic { void _toSources ( Vertex*, int connexId ); void _getConnecteds ( Vertex*, VertexSet& ); void _checkEdges () const; + void _createSelfSymSeg ( Segment* ); + + inline void setAxisTarget (); + inline bool needAxisTarget () const; + inline void setFlags ( unsigned int ); + inline void unsetFlags ( unsigned int ); + void setAxisTargets (); + void unsetAxisTargets (); private: AnabaticEngine* _anabatic; vector _vertexes; @@ -440,6 +494,7 @@ namespace Anabatic { DbU::Unit _searchAreaHalo; int _connectedsId; PriorityQueue _queue; + unsigned int _flags; }; @@ -455,6 +510,9 @@ namespace Anabatic { template inline DistanceT* Dijkstra::setDistance ( DistanceT cb ) { _distanceCb = cb; return _distanceCb.target(); } + inline void Dijkstra::setFlags ( unsigned int mask ) { _flags |= mask; } + inline bool Dijkstra::needAxisTarget () const { return (_flags & Mode::AxisTarget); } + inline void Dijkstra::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } } // Anabatic namespace. diff --git a/hurricane/src/hurricane/NetRoutingProperty.cpp b/hurricane/src/hurricane/NetRoutingProperty.cpp index 7fcc1422..a067d706 100644 --- a/hurricane/src/hurricane/NetRoutingProperty.cpp +++ b/hurricane/src/hurricane/NetRoutingProperty.cpp @@ -28,6 +28,14 @@ namespace Hurricane { // ------------------------------------------------------------------- // Class : "NetRoutingState" + DbU::Unit NetRoutingState::getSymValue( DbU::Unit v ) const + { + if (v < _axis) { + return _axis + (_axis-v); + } else return _axis; + } + + string NetRoutingState::_getString () const { string s; diff --git a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h index 18bc6827..33aa3b6a 100644 --- a/hurricane/src/hurricane/hurricane/NetRoutingProperty.h +++ b/hurricane/src/hurricane/hurricane/NetRoutingProperty.h @@ -60,6 +60,7 @@ namespace Hurricane { inline bool isSymHorizontal () const; inline bool isSymVertical () const; inline bool isSymMaster () const; + inline bool isSymSlave () const; inline Net* getNet () const; inline Net* getSymNet () const; inline DbU::Unit getSymAxis () const; @@ -68,6 +69,8 @@ namespace Hurricane { inline void setSymAxis ( DbU::Unit ); inline void setFlags ( unsigned int mask ); inline void unsetFlags ( unsigned int mask ); + inline bool isSelfSym () const; + DbU::Unit getSymValue ( DbU::Unit ) const; std::string _getString () const; Record* _getRecord () const; private: @@ -102,7 +105,9 @@ namespace Hurricane { inline void NetRoutingState::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } inline void NetRoutingState::setNet ( Net* net ) { _net = net; } inline void NetRoutingState::setSymNet ( Net* symNet ) { _symNet = symNet; } - inline void NetRoutingState::setSymAxis ( DbU::Unit axis ) { _axis = axis; } + inline void NetRoutingState::setSymAxis ( DbU::Unit axis ) { _axis = axis; } + inline bool NetRoutingState::isSelfSym () const { return ( (_symNet == NULL) and (isSymmetric()) ); } + inline bool NetRoutingState::isSymSlave () const { return ( (_symNet != NULL) and (!isSymMaster()) ); } // -------------------------------------------------------------------