diff --git a/kite/src/BuildBlockages.cpp b/kite/src/BuildBlockages.cpp index aa234c5b..ca54bbf4 100644 --- a/kite/src/BuildBlockages.cpp +++ b/kite/src/BuildBlockages.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // diff --git a/kite/src/BuildPowerRails.cpp b/kite/src/BuildPowerRails.cpp index 0ce37594..173f9288 100644 --- a/kite/src/BuildPowerRails.cpp +++ b/kite/src/BuildPowerRails.cpp @@ -579,6 +579,7 @@ namespace Kite { forEach ( BasicLayer*, iLayer, technology->getBasicLayers() ) { if ( iLayer->getMaterial() != BasicLayer::Material::metal ) continue; + if ( _configuration.isGMetal(*iLayer) ) continue; cmess1 << " - PowerRails in " << iLayer->getName() << " ..." << endl; diff --git a/kite/src/Configuration.cpp b/kite/src/Configuration.cpp index fdaef9cf..bde4d0f6 100644 --- a/kite/src/Configuration.cpp +++ b/kite/src/Configuration.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -16,7 +16,7 @@ // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./Configuartion.cpp" | +// | C++ Module : "./Configuration.cpp" | // | *************************************************************** | // | U p d a t e s | // | | @@ -62,15 +62,16 @@ namespace Kite { , _base (base) , _postEventCb () , _edgeCapacityPercent(_defaultEdgeCapacity) - , _expandStep (0.30) + , _expandStep (0.40) , _ripupLimits () , _ripupCost (3) + , _eventsLimit (4000000) { _ripupLimits[BorderRipupLimit] = 26; _ripupLimits[StrapRipupLimit] = 16; _ripupLimits[LocalRipupLimit] = 7; - _ripupLimits[GlobalRipupLimit] = 7; - _ripupLimits[LongGlobalRipupLimit] = 7; + _ripupLimits[GlobalRipupLimit] = 5; + _ripupLimits[LongGlobalRipupLimit] = 5; } diff --git a/kite/src/GCell.cpp b/kite/src/GCell.cpp index 6ea3b84c..6f74b413 100644 --- a/kite/src/GCell.cpp +++ b/kite/src/GCell.cpp @@ -393,7 +393,7 @@ namespace Kite { Interval blockageSpan; autoSegment->getCanonical ( fixedSpan ); - fixedSpan.inflate ( Session::getExtensionCap() ); + fixedSpan.inflate ( Session::getExtensionCap()-1 ); track->getOverlapBounds ( fixedSpan, begin, end ); for ( ; (begin < end) ; begin++ ) { diff --git a/kite/src/GCellGrid.cpp b/kite/src/GCellGrid.cpp index 7635f74d..09c1c0f3 100644 --- a/kite/src/GCellGrid.cpp +++ b/kite/src/GCellGrid.cpp @@ -49,7 +49,7 @@ namespace Kite { GCellGrid::GCellGrid ( KiteEngine* kite ) - : Katabatic::Grid() + : Katabatic::Grid(kite->getCell()->getBoundingBox()) , _kite(kite) { } diff --git a/kite/src/KiteEngine.cpp b/kite/src/KiteEngine.cpp index ac8fbf67..a6f12092 100644 --- a/kite/src/KiteEngine.cpp +++ b/kite/src/KiteEngine.cpp @@ -488,15 +488,19 @@ namespace Kite { void KiteEngine::dumpMeasures ( ostream& out ) const { vector measuresLabels; - measuresLabels.push_back ( "Gates" ); - measuresLabels.push_back ( "GCells" ); - measuresLabels.push_back ( "loadT" ); - measuresLabels.push_back ( "loadS" ); + measuresLabels.push_back ( "Gates" ); + measuresLabels.push_back ( "GCells" ); + measuresLabels.push_back ( "knikT" ); + measuresLabels.push_back ( "knikS" ); + measuresLabels.push_back ( "loadT" ); + measuresLabels.push_back ( "loadS" ); + measuresLabels.push_back ( "Globals" ); + measuresLabels.push_back ( "Edges" ); measuresLabels.push_back ( "assignT" ); - measuresLabels.push_back ( "algoT" ); - measuresLabels.push_back ( "algoS" ); - measuresLabels.push_back ( "finT" ); - measuresLabels.push_back ( "Segs" ); + measuresLabels.push_back ( "algoT" ); + measuresLabels.push_back ( "algoS" ); + measuresLabels.push_back ( "finT" ); + measuresLabels.push_back ( "Segs" ); const MeasuresSet* measures = Measures::get(getCell()); diff --git a/kite/src/NegociateWindow.cpp b/kite/src/NegociateWindow.cpp index d7d6ee20..c576c9d4 100644 --- a/kite/src/NegociateWindow.cpp +++ b/kite/src/NegociateWindow.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -82,14 +82,15 @@ namespace { if ( data->getGCellOrder() >= Session::getOrder() ) { cost.mergeRipupCount ( data->getRipupCount() ); if ( segment->isLocal() ) { - cost.mergeDataState ( data->getState() ); + cost.mergeDataState ( data->getState() ); if ( data->getState() >= DataNegociate::LocalVsGlobal ) { ltrace(200) << "MaximumSlack/LocalVsGlobal for " << segment << endl; } } } - if ( /*(data->getGCellOrder() < Session::getOrder()) ||*/ segment->isFixed() ) { + if ( /*(data->getGCellOrder() < Session::getOrder()) ||*/ segment->isFixed() + or ((data->isRing() or data->isBorder()) and (data->getRipupCount() > 3)) ) { ltrace(200) << "Infinite cost from: " << segment << endl; cost.setFixed (); cost.setInfinite (); @@ -272,7 +273,7 @@ namespace Kite { unsigned int order = 0; for ( size_t i=0 ; i < gcells.size() ; i++ ) { - if ( !gcells[i]->isInRoutingSet() ) { + if ( not gcells[i]->isInRoutingSet() ) { Session::setOrder ( order ); GCellRoutingSet* rs = GCellRoutingSet::create ( gcells[i], _kite->getExpandStep() ); rs->expand ( grid ); @@ -336,6 +337,7 @@ namespace Kite { DataNegociate* data = segment->getDataNegociate (); data->resetRipupCount (); + data->resetStateCount (); data->setGCellOrder ( order ); if ( _ring[i].getOrder() == order ) { ltrace(200) << "Removing from ring: " << segment << endl; @@ -353,6 +355,8 @@ namespace Kite { ltrace(150) << "NegociateWindow::_negociate() - " << segments.size() << endl; ltracein(149); + unsigned long limit = _kite->getEventsLimit(); + _eventHistory.clear(); _eventQueue.load ( segments ); _loadRing (); @@ -375,7 +379,7 @@ namespace Kite { cmess2.flush(); } - if ( RoutingEvent::getProcesseds() >= /*10471*/ 4000000 ) setInterrupt ( true ); + if ( RoutingEvent::getProcesseds() >= limit ) setInterrupt ( true ); count++; #if ENABLE_STIFFNESS diff --git a/kite/src/RoutingEvent.cpp b/kite/src/RoutingEvent.cpp index 7d036998..d51a8205 100644 --- a/kite/src/RoutingEvent.cpp +++ b/kite/src/RoutingEvent.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -800,13 +800,14 @@ namespace { public: enum { ToRipupLimit=1, AllowExpand =2, NoExpand=4, PerpandicularsFirst=8, ToMoveUp=16 }; enum { LeftAxisHint=1, RightAxisHint=2 }; + enum { NoRingLimit=1 }; public: Manipulator ( TrackElement*, State& ); ~Manipulator (); inline TrackElement* getSegment () const; inline DataNegociate* getData () const; inline RoutingEvent* getEvent () const; - bool canRipup () const; + bool canRipup ( unsigned int flags=0 ) const; bool isCaged ( DbU::Unit ) const; bool ripup ( Interval overlap , unsigned int type @@ -1131,7 +1132,7 @@ namespace { Interval constraints; vector candidates; TrackElement* segment = _event->getSegment(); - bool canMoveUp = (segment->isLocal()) ? segment->canPivotUp() : segment->canMoveUp(); + bool canMoveUp = (segment->isLocal()) ? segment->canPivotUp(1.0) : segment->canMoveUp(1.0); unsigned int relaxFlags = (_data and (_data->getStateCount() < 2)) ? Manipulator::AllowExpand : Manipulator::NoExpand; @@ -1193,7 +1194,7 @@ namespace { if ( other->isGlobal() and (other->getDataNegociate()->getGCellOrder() == Session::getOrder()) - and other->canMoveUp() ) { + and other->canMoveUp(1.0) ) { ltrace(200) << "conflictSolve1() - One conflict, other move up" << endl; if ( (success = other->moveUp()) ) break; } @@ -1367,11 +1368,12 @@ namespace { { DebugSession::open ( segment->getNet(), 200 ); - bool success = false; - bool blocked = false; - bool repush = true; - DataNegociate* data = segment->getDataNegociate (); - unsigned int nextState = 0; + bool success = false; + bool blocked = false; + bool repush = true; + DataNegociate* data = segment->getDataNegociate (); + unsigned int nextState = data->getState(); + unsigned int actionFlags = SegmentAction::SelfInsert|SegmentAction::EventLevel5; ltrace(200) << "Slacken Topology for " << segment->getNet() << " " << segment << endl; @@ -1383,7 +1385,7 @@ namespace { if ( not (data->isBorder() or data->isRing()) ) { data->resetRipupCount (); } else { - if ( not Manipulator(segment,*this).canRipup() ) { + if ( not Manipulator(segment,*this).canRipup(Manipulator::NoRingLimit) ) { cerr << "[UNSOLVED] " << segment << " slacken topology not allowed for border/ring." << endl; ltraceout(200); DebugSession::close (); @@ -1394,7 +1396,7 @@ namespace { // Ring cases. if ( data->isBorder() ) { ltrace(200) << "Segment is Ripup only (border), bypass to Unimplemented." << endl; - if ( not Manipulator(segment,*this).canRipup () ) { + if ( not Manipulator(segment,*this).canRipup (Manipulator::NoRingLimit) ) { ltrace(200) << "Cannot ripup, bypass to Unimplemented." << endl; data->setState ( DataNegociate::Unimplemented ); } else { @@ -1421,6 +1423,7 @@ namespace { // Normal cases. if ( not blocked and not success ) { if ( segment->isStrap() ) { + ltrace(200) << "Strap segment FSM." << endl; switch ( data->getState() ) { case DataNegociate::RipupPerpandiculars: nextState = DataNegociate::Desalignate; @@ -1452,13 +1455,11 @@ namespace { } if ( not success and (nextState != DataNegociate::Unimplemented) ) { - // if ( segment->canRipple() ) - // success = Manipulator(segment,*this).ripple(); - // else success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit); } } else if ( segment->isLocal() ) { // Local TrackElement State Machine. + ltrace(200) << "Local segment FSM." << endl; switch ( data->getState() ) { case DataNegociate::RipupPerpandiculars: nextState = DataNegociate::Desalignate; @@ -1502,7 +1503,7 @@ namespace { } case DataNegociate::MaximumSlack: if ( segment->isSlackenStrap() ) { - if ( nextState < DataNegociate::MaximumSlack ) { + if ( (nextState < DataNegociate::MaximumSlack) or (data->getStateCount() < 2) ) { nextState = DataNegociate::MaximumSlack; success = conflictSolve1 (); if ( success ) break; @@ -1514,10 +1515,8 @@ namespace { } if ( not success and (nextState != DataNegociate::Unimplemented) ) { - // if ( segment->canRipple() ) - // success = Manipulator(segment,*this).ripple(); - // else - success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit); + if ( data->getStateCount() < 6 ) + success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit); } // Special case: all tracks are overlaping a blockage. @@ -1560,6 +1559,7 @@ namespace { } else { // Global TrackElement State Machine. switch ( data->getState() ) { + ltrace(200) << "Global segment FSM." << endl; case DataNegociate::RipupPerpandiculars: ltrace(200) << "Global, State: RipupPerpandiculars." << endl; nextState = DataNegociate::Desalignate; @@ -1603,7 +1603,8 @@ namespace { } if ( not success and (nextState != DataNegociate::Unimplemented) ) { - success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit); + if ( data->getStateCount() < 6 ) + success = Manipulator(segment,*this).ripupPerpandiculars(Manipulator::ToRipupLimit); } } } @@ -1612,11 +1613,10 @@ namespace { if ( success ) { if ( repush ) { - unsigned int flags = SegmentAction::SelfInsert|SegmentAction::EventLevel5; if ( not (data->isRing() or data->isBorder()) ) - flags |= SegmentAction::ResetRipup; + actionFlags |= SegmentAction::ResetRipup; - addAction ( segment, flags ); + addAction ( segment, actionFlags ); } } else { clearActions (); @@ -1664,11 +1664,19 @@ namespace { } - bool Manipulator::canRipup () const + bool Manipulator::canRipup ( unsigned int flags ) const { if ( _data ) { + if ( not _event or _event->isUnimplemented() ) return false; + unsigned int limit = Session::getKiteEngine()->getRipupLimit(_segment); - return (_data->getRipupCount() < limit) and _event and not _event->isUnimplemented(); + + if ( not ( flags & NoRingLimit ) + and (_data->isRing() or _data->isBorder()) + and not (_data->getRipupCount() < limit) ) + return false; + + return (_data->getRipupCount() < limit); } return false; @@ -1713,8 +1721,10 @@ namespace { ltrace(200) << "TrackElement:" << _data->getGCellOrder() << " < Session:" << Session::getOrder() << endl; + if ( not canRipup() ) return false; + if ( _segment->isFixed() ) return false; - if ( !_data ) return true; + if ( _data == NULL ) return true; if ( _segment->getTrack() ) { if ( _data->getGCellOrder() < Session::getOrder() ) { @@ -1764,6 +1774,8 @@ namespace { } placedPerpandiculars++; + + // Try to ripup the perpandicular itself. DataNegociate* data2 = perpandiculars[i]->getDataNegociate(); if ( data2->getGCellOrder() == Session::getOrder() ) { ltrace(200) << "| " << perpandiculars[i] << endl; @@ -1771,11 +1783,13 @@ namespace { if ( (flags & Manipulator::ToMoveUp) and (data2->getState() < DataNegociate::MoveUp) ) data2->setState ( DataNegociate::MoveUp ); - - Manipulator(perpandiculars[i],_S).ripup ( _event->getSegment()->getAxis(), perpandicularActionFlags ); - continue; + + if ( Manipulator(perpandiculars[i],_S).ripup(_event->getSegment()->getAxis() + ,perpandicularActionFlags) ) + continue; } + // Cannot ripup the perpandicular, try to ripup it's neigbors. size_t begin; size_t end; track->getOverlapBounds ( constraints, begin, end ); @@ -1796,8 +1810,14 @@ namespace { continue; } - ltrace(200) << " | Ripup: " << begin << " " << other << endl; - _S.addAction ( other, SegmentAction::OtherRipup ); + // Try to ripup conflicting neighbor. + if ( Manipulator(other,_S).canRipup() ) { + ltrace(200) << " | Ripup: " << begin << " " << other << endl; + _S.addAction ( other, SegmentAction::OtherRipup ); + } else { + ltrace(200) << "Aborted ripup of perpandiculars, blocked by border/ring." << endl; + return false; + } } } @@ -1808,7 +1828,7 @@ namespace { } if ( _segment->isLocal() and not placedPerpandiculars ) { - ltrace(200) << "No placed perpandiculars, tight native constraints." << endl; + ltrace(200) << "No placed perpandiculars, tight native constraints, place perpandiculars FIRST." << endl; for ( size_t i=0 ; i < perpandiculars.size() ; i++ ) { _S.addAction ( perpandiculars[i], perpandicularActionFlags|SegmentAction::EventLevel4 ); } @@ -1838,8 +1858,9 @@ namespace { ltrace(200) << "Manipulator::relax() of: " << _segment << " " << interval << endl; if ( _segment->isFixed() ) return false; - if ( !interval.intersect(_segment->getCanonicalInterval()) ) return false; - if ( !_data ) return false; + if ( not interval.intersect(_segment->getCanonicalInterval()) ) return false; + if ( not _data ) return false; + //if ( _data->isBorder() or _data->isRing() ) return false; if ( _segment->isTerminal() and (_segment->getLayer() == Session::getRoutingGauge()->getRoutingLayer(1)) ) { @@ -2323,7 +2344,8 @@ namespace { if ( not (shrinkLeft xor shrinkRight) ) { ltrace(200) << "- Hard overlap/enclosure/shrink " << segment2 << endl; - Manipulator(segment2,_S).ripup ( toFree, SegmentAction::OtherRipup ); + if ( not (success = Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) + continue; } canonicals.clear (); @@ -2344,11 +2366,13 @@ namespace { if ( shrinkRight xor shrinkLeft ) { if ( shrinkRight ) { - Manipulator(*isegment3,_S).ripup ( track->getAxis() - , SegmentAction::OtherPushAside - | SegmentAction::AxisHint - , toFree.getVMin() - DbU::lambda(1.0) - ); + if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() + , SegmentAction::OtherPushAside + | SegmentAction::AxisHint + , toFree.getVMin() - DbU::lambda(1.0) + )) ) + break; + if ( event3->getTracksFree() == 1 ) { ltrace(200) << "Potential left intrication with other perpandicular." << endl; if ( isegment3->getAxis() == segment2->getTargetU() - Session::getExtensionCap() ) { @@ -2358,11 +2382,12 @@ namespace { } } if ( shrinkLeft ) { - Manipulator(*isegment3,_S).ripup ( track->getAxis() - , SegmentAction::OtherPushAside - | SegmentAction::AxisHint - , toFree.getVMax() + DbU::lambda(1.0) - ); + if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() + , SegmentAction::OtherPushAside + | SegmentAction::AxisHint + , toFree.getVMax() + DbU::lambda(1.0) + )) ) + break; if ( event3->getTracksFree() == 1 ) { ltrace(200) << "Potential right intrication with other perpandicular." << endl; if ( isegment3->getAxis() == segment2->getSourceU() + Session::getExtensionCap() ) { @@ -2375,14 +2400,15 @@ namespace { // DbU::Unit axisHint // = (event3->getAxisHint() - toFree.getVMin() < toFree.getVMax() - event3->getAxisHint()) // ? (toFree.getVMin() - DbU::lambda(1.0)) : (toFree.getVMax() + DbU::lambda(1.0)); - Manipulator(*isegment3,_S).ripup - ( track->getAxis() - , SegmentAction::OtherRipup - | SegmentAction::EventLevel3 - //| SegmentAction::AxisHint, axisHint - ); + if ( not (success=Manipulator(*isegment3,_S).ripup ( track->getAxis() + , SegmentAction::OtherRipup + | SegmentAction::EventLevel3 + //| SegmentAction::AxisHint, axisHint + )) ) + break; } } + if ( not success ) break; } } @@ -2442,7 +2468,8 @@ namespace { success = Manipulator(segment2,_S).relax ( toFree ); } else { ltrace(200) << "- Forced ripup " << segment2 << endl; - Manipulator(segment2,_S).ripup ( toFree, SegmentAction::OtherRipup ); + if ( not (success=Manipulator(segment2,_S).ripup(toFree,SegmentAction::OtherRipup)) ) + continue; canonicals.clear (); forEach ( TrackElement*, isegment3 @@ -2453,7 +2480,8 @@ namespace { RoutingEvent* event3 = data3->getRoutingEvent(); if ( !event3 ) continue; - _S.addAction ( *isegment3, SegmentAction::OtherRipup ); + if ( Manipulator(*isegment3,_S).canRipup() ) + _S.addAction ( *isegment3, SegmentAction::OtherRipup ); } } } @@ -2669,8 +2697,8 @@ namespace { { ltrace(200) << "Manipulator::pivotUp() " << _segment << endl; - if ( _segment->isFixed () ) return false; - if ( not _segment->canMoveUp() ) return false; + if ( _segment->isFixed () ) return false; + if ( not _segment->canMoveUp(0.0) ) return false; _segment->moveUp (); return true; @@ -2682,8 +2710,8 @@ namespace { ltrace(200) << "Manipulator::moveUp() " << _segment << endl; if ( _segment->isFixed () ) return false; - if ( _segment->isLocal() and not _segment->canPivotUp() ) return false; - if ( not _segment->canMoveUp() ) return false; + if ( _segment->isLocal() and not _segment->canPivotUp(0.0) ) return false; + if ( not _segment->canMoveUp(0.5) ) return false; #if DISABLED ltrace(200) << "| Repack Tracks: " << endl; @@ -3306,7 +3334,8 @@ namespace Kite { if ( not isProcessed() ) { fork = this; ltrace(200) << "Reschedule/Self: " - << (void*)this << " -> " << (void*)fork << ":" << fork << endl; + << (void*)this << " -> " + << (void*)fork << ":" << eventLevel << ":" << fork << endl; } else { fork = clone(); fork->_processed = false; diff --git a/kite/src/TrackElement.cpp b/kite/src/TrackElement.cpp index 8dcae766..fa3d6192 100644 --- a/kite/src/TrackElement.cpp +++ b/kite/src/TrackElement.cpp @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -176,8 +176,8 @@ namespace Kite { bool TrackElement::canDesalignate () const { return false; } - bool TrackElement::canPivotUp () const { return false; }; - bool TrackElement::canMoveUp () const { return false; }; + bool TrackElement::canPivotUp ( float ) const { return false; }; + bool TrackElement::canMoveUp ( float ) const { return false; }; bool TrackElement::canDogLeg () { return false; }; bool TrackElement::canDogLeg ( Interval ) { return false; }; bool TrackElement::canDogLegAt ( GCell*, bool allowReuse ) { return false; }; diff --git a/kite/src/TrackFixedSegment.cpp b/kite/src/TrackFixedSegment.cpp index 3fb98c70..8c9caf1a 100644 --- a/kite/src/TrackFixedSegment.cpp +++ b/kite/src/TrackFixedSegment.cpp @@ -89,12 +89,15 @@ namespace Kite { if ( layer2 ) { DbU::Unit extention = layer2->getExtentionCap(); if ( track->getDirection() == Constant::Horizontal ) { - _sourceU = boundingBox.getXMin()-extention; - _targetU = boundingBox.getXMax()+extention; + Interval uside = track->getKiteEngine()->getGCellGrid()->getUSide ( Constant::Horizontal ); + + _sourceU = max ( boundingBox.getXMin()-extention, uside.getVMin()); + _targetU = min ( boundingBox.getXMax()+extention, uside.getVMax()); GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_sourceU,track->getAxis()) ); GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(_targetU,track->getAxis()) ); GCell* right = NULL; + if ( gcell ) { while ( gcell and (gcell != end) ) { right = gcell->getRight(); @@ -106,8 +109,10 @@ namespace Kite { } else cerr << Warning("TrackFixedSegment(): TrackFixedElement outside GCell grid.") << endl; } else { - _sourceU = boundingBox.getYMin()-extention; - _targetU = boundingBox.getYMax()+extention; + Interval uside = track->getKiteEngine()->getGCellGrid()->getUSide ( Constant::Vertical ); + + _sourceU = max ( boundingBox.getYMin()-extention, uside.getVMin()); + _targetU = min ( boundingBox.getYMax()+extention, uside.getVMax()); GCell* gcell = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_sourceU) ); GCell* end = track->getKiteEngine()->getGCellGrid()->getGCell ( Point(track->getAxis(),_targetU) ); diff --git a/kite/src/TrackSegment.cpp b/kite/src/TrackSegment.cpp index 59ccf8e7..f017dd9d 100644 --- a/kite/src/TrackSegment.cpp +++ b/kite/src/TrackSegment.cpp @@ -609,19 +609,19 @@ namespace Kite { } - bool TrackSegment::canPivotUp () const + bool TrackSegment::canPivotUp ( float reserve ) const { - return _base->canPivotUp(); + return _base->canPivotUp(reserve); } - bool TrackSegment::canMoveUp () const + bool TrackSegment::canMoveUp ( float reserve ) const { // if ( isLocal() /*and (hasSourceDogLeg() or hasTargetDogLeg())*/ ) { // return _base->canPivotUp(); // } - return _base->canMoveUp ( true ); + return _base->canMoveUp ( true, reserve ); } @@ -645,8 +645,11 @@ namespace Kite { vector segments; for ( size_t i=0 ; ireschedule ( 0 ); + TrackElement* segment = GCell::addTrackSegment(NULL,invalidateds[i],false); + segments.push_back ( segment ); + // if ( (segment->getTrack() == NULL) + // or (segment->getLayer() != segment->getTrack()->getLayer()) ) + segment->reschedule ( 0 ); } for ( size_t i=0 ; igetGCellOrder()) + " [" + ((_track) ? getString(_index) : "npos") + "] " - + ((isSlackened()) ? "S" : "-") - + ((_track ) ? "T" : "-") - + ((_canRipple ) ? "r" : "-") - + ((_sourceDogLeg) ? "s" : "-") - + ((_targetDogLeg) ? "t" : "-"); + + ((isSlackened() ) ? "S" : "-") + + ((_track ) ? "T" : "-") + + ((_canRipple ) ? "r" : "-") + + ((_data->isBorder()) ? "B" : "-") + + ((_data->isRing ()) ? "R" : "-") + + ((_sourceDogLeg ) ? "s" : "-") + + ((_targetDogLeg ) ? "t" : "-"); s1.insert ( s1.size()-1, s2 ); diff --git a/kite/src/kite/Configuration.h b/kite/src/kite/Configuration.h index 6809a5ec..a7842119 100644 --- a/kite/src/kite/Configuration.h +++ b/kite/src/kite/Configuration.h @@ -2,7 +2,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -78,10 +78,12 @@ namespace Kite { // Methods. inline Katabatic::Configuration* base (); inline PostEventCb_t& getPostEventCb (); + inline unsigned long getEventsLimit () const; inline float getExpandStep () const; inline unsigned int getRipupCost () const; unsigned int getRipupLimit ( unsigned int type ) const; inline float getEdgeCapacityPercent () const; + inline void setEventsLimit ( unsigned long ); inline void setExpandStep ( float ); inline void setRipupCost ( unsigned int ); void setRipupLimit ( unsigned int type, unsigned int limit ); @@ -101,6 +103,7 @@ namespace Kite { float _expandStep; unsigned int _ripupLimits[RipupLimitsTableSize]; unsigned int _ripupCost; + unsigned long _eventsLimit; private: Configuration ( const Configuration& ); Configuration& operator= ( const Configuration& ); @@ -110,12 +113,14 @@ namespace Kite { // Inline Functions. inline Katabatic::Configuration* Configuration::base () { return _base; } inline Configuration::PostEventCb_t& Configuration::getPostEventCb () { return _postEventCb; } + inline unsigned long Configuration::getEventsLimit () const { return _eventsLimit; } inline unsigned int Configuration::getRipupCost () const { return _ripupCost; } inline float Configuration::getExpandStep () const { return _expandStep; } inline float Configuration::getEdgeCapacityPercent () const { return _edgeCapacityPercent; } inline void Configuration::setRipupCost ( unsigned int cost ) { _ripupCost = cost; } inline void Configuration::setExpandStep ( float step ) { _expandStep = step; } inline void Configuration::setPostEventCb ( PostEventCb_t cb ) { _postEventCb = cb; } + inline void Configuration::setEventsLimit ( unsigned long limit ) { _eventsLimit = limit; } inline void Configuration::setEdgeCapacityPercent ( float percent ) { _edgeCapacityPercent = percent; } diff --git a/kite/src/kite/DataNegociate.h b/kite/src/kite/DataNegociate.h index 41cd11b7..45660684 100644 --- a/kite/src/kite/DataNegociate.h +++ b/kite/src/kite/DataNegociate.h @@ -105,6 +105,7 @@ namespace Kite { inline void incRipupCount (); inline void decRipupCount (); inline void resetRipupCount (); + inline void resetStateCount (); inline void invalidate ( bool withPerpandiculars=false, bool withConstraints=false ); void update (); static string getStateString ( DataNegociate* ); @@ -156,6 +157,7 @@ namespace Kite { inline void DataNegociate::incRipupCount () { _cost.incRipupCount(); } inline void DataNegociate::decRipupCount () { _cost.decRipupCount(); } inline void DataNegociate::resetRipupCount () { _cost.resetRipupCount(); } + inline void DataNegociate::resetStateCount () { _stateCount=0; } inline string DataNegociate::_getTypeName () const { return "DataNegociate"; } inline void DataNegociate::invalidate ( bool withPerpandiculars, bool withConstraints ) diff --git a/kite/src/kite/GCellGrid.h b/kite/src/kite/GCellGrid.h index dfff89dd..621a4791 100644 --- a/kite/src/kite/GCellGrid.h +++ b/kite/src/kite/GCellGrid.h @@ -54,6 +54,7 @@ namespace Kite { inline Katabatic::GCellGrid* base (); inline KiteEngine* getKite (); Cell* getCell () const; + inline Interval getUSide ( unsigned int ) const; inline bool checkEdgeSaturation ( float threshold ) const; void updateContacts ( bool openSession=true ); void updateDensity (); @@ -82,6 +83,9 @@ namespace Kite { inline Katabatic::GCellGrid* GCellGrid::base () { return _kite->base()->getGCellGrid(); } inline KiteEngine* GCellGrid::getKite () { return _kite; }; + inline Interval GCellGrid::getUSide ( unsigned int dir ) const + { return const_cast(this)->base()->getUSide(dir); } + inline bool GCellGrid::checkEdgeSaturation ( float threshold ) const { return const_cast(this)->base()->checkEdgeSaturation(threshold); } diff --git a/kite/src/kite/KiteEngine.h b/kite/src/kite/KiteEngine.h index 27f659d1..f7280619 100644 --- a/kite/src/kite/KiteEngine.h +++ b/kite/src/kite/KiteEngine.h @@ -86,6 +86,7 @@ namespace Kite { inline Net* getBlockageNet (); virtual Configuration* getConfiguration (); inline bool getToolSuccess () const; + inline unsigned long getEventsLimit () const; inline unsigned int getRipupLimit ( unsigned int type ) const; unsigned int getRipupLimit ( const TrackElement* ) const; inline unsigned int getRipupCost () const; @@ -104,6 +105,7 @@ namespace Kite { void dumpMeasures ( std::ostream& ) const; void dumpMeasures () const; inline void setPostEventCb ( Configuration::PostEventCb_t ); + inline void setEventLimit ( unsigned long ); inline void setMinimumWL ( double ); inline void setRipupLimit ( unsigned int, unsigned int type ); inline void setRipupCost ( unsigned int ); @@ -167,6 +169,7 @@ namespace Kite { inline Net* KiteEngine::getBlockageNet () { return _obstacleNet; } inline Configuration::PostEventCb_t& KiteEngine::getPostEventCb () { return _configuration.getPostEventCb(); } inline bool KiteEngine::getToolSuccess () const { return _toolSuccess; } + inline unsigned long KiteEngine::getEventsLimit () const { return _configuration.getEventsLimit(); } inline unsigned int KiteEngine::getRipupCost () const { return _configuration.getRipupCost(); } inline float KiteEngine::getExpandStep () const { return _configuration.getExpandStep(); } inline float KiteEngine::getEdgeCapacityPercent () const { return _configuration.getEdgeCapacityPercent(); } @@ -174,6 +177,7 @@ namespace Kite { inline GCellGrid* KiteEngine::getGCellGrid () const { return _kiteGrid; } inline NegociateWindow* KiteEngine::getNegociateWindow () { return _negociateWindow; } inline size_t KiteEngine::getRoutingPlanesSize () const { return _routingPlanes.size(); } + inline void KiteEngine::setEventLimit ( unsigned long limit ) { _configuration.setEventsLimit(limit); } inline void KiteEngine::setRipupLimit ( unsigned int limit, unsigned int type ) { _configuration.setRipupLimit(limit,type); } inline void KiteEngine::setRipupCost ( unsigned int cost ) { _configuration.setRipupCost(cost); } inline void KiteEngine::setExpandStep ( float step ) { _configuration.setExpandStep(step); } diff --git a/kite/src/kite/TrackElement.h b/kite/src/kite/TrackElement.h index 4f9449ac..23c5ae3c 100644 --- a/kite/src/kite/TrackElement.h +++ b/kite/src/kite/TrackElement.h @@ -3,7 +3,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // // =================================================================== // @@ -115,8 +115,8 @@ namespace Kite { virtual bool canDesalignate () const; virtual bool canGoOutsideGCell () const; virtual bool canSlacken () const; - virtual bool canPivotUp () const; - virtual bool canMoveUp () const; + virtual bool canPivotUp ( float reserve ) const; + virtual bool canMoveUp ( float reserve ) const; virtual bool canRipple () const; virtual bool hasSourceDogLeg () const; virtual bool hasTargetDogLeg () const; diff --git a/kite/src/kite/TrackSegment.h b/kite/src/kite/TrackSegment.h index e8277a47..efb9e0cd 100644 --- a/kite/src/kite/TrackSegment.h +++ b/kite/src/kite/TrackSegment.h @@ -78,8 +78,8 @@ namespace Kite { virtual bool canDesalignate () const; virtual bool canGoOutsideGCell () const; virtual bool canSlacken () const; - virtual bool canPivotUp () const; - virtual bool canMoveUp () const; + virtual bool canPivotUp ( float reserve ) const; + virtual bool canMoveUp ( float reserve ) const; virtual bool canRipple () const; virtual bool hasSourceDogLeg () const; virtual bool hasTargetDogLeg () const;