From 3e825cc228a90238926078eee45bd07b12d149c5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 23 May 2017 00:20:31 +0200 Subject: [PATCH] Katana routing algorithm adjustements for analog routing. * Bug: In Hurricane::Interval, the ::getSize() method was returning a negative length when the Interval was empty. Now return zero. This was causing slight cost functions side effect when computing the overlap of a segment with another one belonging to the same net (i.e. shareDelta) * Bug: In Katana::AutoSegment::computeOptimal(), checks that the optimal position for the axis is indeed inside the GCell interval. * Bug: In Katana::DataSymmetric::getSymmetrical(Interval&), reverse the shrink applied to GCells sides. Interval are of the type [min:max[ so after symmetric transformation they become ]smax:smin]. Apply a correction so that they are [smax:smin[ and could be merged with the paired interval (the one without symmetry applied). * Bug: In katana::TrackCost::consolidate(), the overlap (now) always positive, and must be *substracted* to the "delta" (not *added*). * Bug: In Katana::_computeNetOptimals(), now skip the already processeds AutoSegments instead of re-processing them. * New: In Katana::AutoSegment::computeOptimal(), improved computation of the axis hint: - For analog net, propagate through the simple doglegs to find attractors. - Restrict the allowed interval to the union of GCell sides and segments constraints that are terminals. - Consider a local as "long" if it's length exceed 20 the P-pitch. (maybe make that a tool parameter). --- anabatic/src/AutoHorizontal.cpp | 8 ++-- anabatic/src/AutoSegment.cpp | 30 ++++++++------ anabatic/src/AutoSegments.cpp | 4 +- anabatic/src/LoadGlobalRouting.cpp | 42 ++++++++++---------- anabatic/src/NetOptimals.cpp | 12 +++--- anabatic/src/anabatic/AutoContact.h | 13 +----- anabatic/src/anabatic/AutoSegments.h | 4 +- hurricane/src/hurricane/Interval.cpp | 12 ------ hurricane/src/hurricane/hurricane/Commons.h | 10 +++++ hurricane/src/hurricane/hurricane/Interval.h | 6 +-- katana/src/RoutingEvent.cpp | 16 ++++---- katana/src/SegmentFsm.cpp | 10 +++-- katana/src/Track.cpp | 6 ++- katana/src/TrackCost.cpp | 18 ++++++--- katana/src/Tracks.cpp | 9 ++++- katana/src/katana/DataSymmetric.h | 10 +++-- 16 files changed, 112 insertions(+), 98 deletions(-) diff --git a/anabatic/src/AutoHorizontal.cpp b/anabatic/src/AutoHorizontal.cpp index 820b3167..c6807e23 100644 --- a/anabatic/src/AutoHorizontal.cpp +++ b/anabatic/src/AutoHorizontal.cpp @@ -145,26 +145,26 @@ namespace Anabatic { constraintMin = getNativeMin(); constraintMax = getNativeMax(); - cdebug_log(149,0) << "Native constraints: [" + cdebug_log(144,0) << "Native constraints: [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; constraintMin = std::max ( constraintMin, getAutoSource()->getCBYMin() ); constraintMax = std::min ( constraintMax, getAutoSource()->getCBYMax() ); - cdebug_log(149,0) << "Merge with source constraints: [" + cdebug_log(144,0) << "Merge with source constraints: [" << DbU::getValueString(getAutoSource()->getCBYMin()) << ":" << DbU::getValueString(getAutoSource()->getCBYMax()) << "]" << endl; constraintMin = std::max ( constraintMin, getUserConstraints().getVMin() ); constraintMax = std::min ( constraintMax, getUserConstraints().getVMax() ); - cdebug_log(149,0) << "Merge with user constraints: [" + cdebug_log(144,0) << "Merge with user constraints: [" << DbU::getValueString(getUserConstraints().getVMin()) << ":" << DbU::getValueString(getUserConstraints().getVMax()) << "]" << endl; - cdebug_log(149,0) << "Resulting constraints: " << " [" + cdebug_log(145,0) << "Resulting constraints: " << " [" << DbU::getValueString(constraintMin) << ":" << DbU::getValueString(constraintMax) << "]" << endl; diff --git a/anabatic/src/AutoSegment.cpp b/anabatic/src/AutoSegment.cpp index e8afa042..71e5cc80 100644 --- a/anabatic/src/AutoSegment.cpp +++ b/anabatic/src/AutoSegment.cpp @@ -634,17 +634,11 @@ namespace Anabatic { AutoSegments AutoSegment::getAligneds ( Flags flags ) - { - cdebug_log(145,0) << "AutoSegment::getAligneds() - flags:" << flags.asString(FlagsFunction) << endl; - return AutoSegments_Aligneds( this, flags ); - } + { return AutoSegments_Aligneds( this, flags ); } AutoSegments AutoSegment::getConnecteds ( Flags flags ) - { - cdebug_log(145,0) << "AutoSegment::getConnecteds() - flags:" << flags.asString(FlagsFunction) << endl; - return AutoSegments_Connecteds( this, flags ); - } + { return AutoSegments_Connecteds( this, flags ); } AutoSegments AutoSegment::getPerpandiculars ( Flags flags ) @@ -928,6 +922,8 @@ namespace Anabatic { vector aligneds; getConstraints( constraintMin, constraintMax ); + cdebug_log(145,0) << "Constraints: [" << DbU::getValueString(constraintMin) + << " " << DbU::getValueString(constraintMax) << "]" << endl; if (isUserDefined()) { optimalMin = optimalMax = getAxis(); @@ -941,7 +937,6 @@ namespace Anabatic { Flags flags = (isAnalog() ? Flags::WithDoglegs : Flags::NoFlags); Flags f2 = flags | Flags::WithSelf; - cdebug_log(145,0) << "Test | :" << flags.asString(FlagsFunction) << endl; getAligneds( Flags::WithSelf|flags ).fill( aligneds ); @@ -958,6 +953,12 @@ namespace Anabatic { gcellSide.intersection( gcell->getSide(direction,pitch) ); cdebug_log(145,0) << "| gcellSide:" << gcellSide << " (from " << gcell << ")" << endl; } + if (aligned->isStrongTerminal()) { + Interval terminalConstraints; + aligned->getConstraints( terminalConstraints ); + gcellSide.intersection( terminalConstraints ); + cdebug_log(145,0) << "| gcellSide:" << gcellSide << " (from " << aligned << ")" << endl; + } } minGCell = gcellSide.getVMin(); maxGCell = gcellSide.getVMax(); @@ -1025,7 +1026,7 @@ namespace Anabatic { if (terminalMin != terminalMax) attractors.addAttractor( terminalMax ); } - } else if (autoSegment->isLongLocal()) { + } else if (autoSegment->isLongLocal() or (autoSegment->getLength() > getPPitch()*20)) { cdebug_log(145,0) << "Used as long global attractor." << endl; DbU::Unit perpandMin = autoSegment->getSourceU(); @@ -1041,9 +1042,6 @@ namespace Anabatic { } if (attractors.getAttractorsCount()) { - cdebug_log(145,0) << "Lower Median " << DbU::getValueString(attractors.getLowerMedian()) << endl; - cdebug_log(145,0) << "Upper Median " << DbU::getValueString(attractors.getUpperMedian()) << endl; - optimalMin = attractors.getLowerMedian(); optimalMax = attractors.getUpperMedian(); } else { @@ -1053,6 +1051,12 @@ namespace Anabatic { optimalMax = (isHorizontal()) ? _gcell->getBoundingBox().getYMax() : _gcell->getBoundingBox().getXMax(); } + + setInBound( minGCell, maxGCell, optimalMin ); + setInBound( minGCell, maxGCell, optimalMax ); + + cdebug_log(145,0) << "optimalMin: " << DbU::getValueString(optimalMin) << endl; + cdebug_log(145,0) << "optimalMax: " << DbU::getValueString(optimalMax) << endl; } setInBound( constraintMin, constraintMax, optimalMin ); diff --git a/anabatic/src/AutoSegments.cpp b/anabatic/src/AutoSegments.cpp index 0bb8ad8c..a01ced8f 100644 --- a/anabatic/src/AutoSegments.cpp +++ b/anabatic/src/AutoSegments.cpp @@ -330,8 +330,6 @@ namespace Anabatic { { if (not _master) return; - cdebug_log(145,0) << "Flags:" << _flags.asString(FlagsFunction) << endl; - _flags |= (_master->isHorizontal()) ? Flags::Horizontal : Flags::Vertical; if (_flags & Flags::WithDoglegs) _flags |= Flags::WithPerpands; @@ -357,7 +355,7 @@ namespace Anabatic { void AutoSegments_Aligneds::Locator::progress () { - cdebug_log(145,0) << "AutoSegments_Aligneds::Locator::progress()" << endl; + cdebug_log(144,0) << "AutoSegments_Aligneds::Locator::progress()" << endl; while (not _stack.isEmpty()) { AutoContact* sourceContact = _stack.getAutoContact (); diff --git a/anabatic/src/LoadGlobalRouting.cpp b/anabatic/src/LoadGlobalRouting.cpp index fe4801bb..f73d92ee 100644 --- a/anabatic/src/LoadGlobalRouting.cpp +++ b/anabatic/src/LoadGlobalRouting.cpp @@ -1196,7 +1196,7 @@ namespace { , targetContact , static_cast( _fromHook->getComponent() ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (1)]: " << globalSegment << endl; } } cdebug_tabw(145,-1); @@ -2470,7 +2470,7 @@ namespace { , horizontalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (2)]: " << globalSegment << endl; } } // There are only 2 AutoContacts to create @@ -2506,7 +2506,7 @@ namespace { , horizontalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (3)]: " << globalSegment << endl; if (_fromHook->getComponent() == hooks[0]->getComponent()){ cdebug_log(145,0) << "Found from:" << hooks[0]->getComponent() << endl; @@ -2559,7 +2559,7 @@ namespace { , verticalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (4)]: " << globalSegment << endl; if (_fromHook->getComponent() == hooks[0]->getComponent()){ cdebug_log(145,0) << "Found from:" << hooks[0]->getComponent() << endl; @@ -2708,7 +2708,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (5)]: " << globalSegment << endl; } } // There are only 2 AutoContacts to create @@ -2747,7 +2747,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (6)]: " << globalSegment << endl; if (_fromHook->getComponent() == hooks[0]->getComponent()){ cdebug_log(145,0) << "Found from:" << hooks[0]->getComponent() << endl; @@ -2802,7 +2802,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (7)]: " << globalSegment << endl; if (_fromHook->getComponent() == hooks[0]->getComponent()){ cdebug_log(145,0) << "Found from:" << hooks[0]->getComponent() << endl; @@ -2957,7 +2957,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (8)]: " << globalSegment << endl; } else if ((_east != NULL) && (_west != NULL) ) { cdebug_log(145,0) << "Case EW" << endl; @@ -3008,7 +3008,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (9)]: " << globalSegment << endl; } else { cerr << Warning( "Something is wrong with the globals in this Strut. 5 " @@ -3057,7 +3057,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (10)]: " << globalSegment << endl; } else if ((_north != NULL) && (_south != NULL) && (_west != NULL)){ cdebug_log(145,0) << "Case NSW " << endl; @@ -3095,7 +3095,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (11)]: " << globalSegment << endl; } else if ((_east != NULL) && (_north != NULL) && (_west != NULL)){ @@ -3134,7 +3134,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (12)]: " << globalSegment << endl; } else if ((_east != NULL) && (_south != NULL) && (_west != NULL)){ cdebug_log(145,0) << "Case EWS " << endl; @@ -3172,7 +3172,7 @@ namespace { ) ); if (not globalSegment->isGlobal()) globalSegment->setFlags( SegLongLocal ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment << endl; + cdebug_log(145,0) << "[Create global segment (13)]: " << globalSegment << endl; } else { cerr << Warning( "Something is wrong with the globals in this Strut. 6" @@ -3228,8 +3228,8 @@ namespace { , verticalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment1 << endl; - cdebug_log(145,0) << "[Create global segment]: " << globalSegment2 << endl; + cdebug_log(145,0) << "[Create global segment (14.1)]: " << globalSegment1 << endl; + cdebug_log(145,0) << "[Create global segment (14.2)]: " << globalSegment2 << endl; } else if ( (_north->getComponent()->getX() > _south->getComponent()->getX() ) && (_east->getComponent ()->getY() < _west->getComponent ()->getY() ) @@ -3274,8 +3274,8 @@ namespace { , verticalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment1 << endl; - cdebug_log(145,0) << "[Create global segment]: " << globalSegment2 << endl; + cdebug_log(145,0) << "[Create global segment (15.1)]: " << globalSegment1 << endl; + cdebug_log(145,0) << "[Create global segment (15.2)]: " << globalSegment2 << endl; } else if ( (_north->getComponent()->getX() < _south->getComponent()->getX() ) && (_east->getComponent ()->getY() > _west->getComponent ()->getY() ) @@ -3320,8 +3320,8 @@ namespace { , verticalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment1 << endl; - cdebug_log(145,0) << "[Create global segment]: " << globalSegment2 << endl; + cdebug_log(145,0) << "[Create global segment (16.1)]: " << globalSegment1 << endl; + cdebug_log(145,0) << "[Create global segment (16.2)]: " << globalSegment2 << endl; } else { cdebug_log(145,0) << "(N.X > S.X) & (E.Y > W.Y)" << endl; @@ -3364,8 +3364,8 @@ namespace { , verticalWidth ) ); - cdebug_log(145,0) << "[Create global segment]: " << globalSegment1 << endl; - cdebug_log(145,0) << "[Create global segment]: " << globalSegment2 << endl; + cdebug_log(145,0) << "[Create global segment (17.1)]: " << globalSegment1 << endl; + cdebug_log(145,0) << "[Create global segment (17.2)]: " << globalSegment2 << endl; } } else { cerr << Warning( "Something is wrong with the number of globals in this Strut. 7" diff --git a/anabatic/src/NetOptimals.cpp b/anabatic/src/NetOptimals.cpp index df9f6301..18bf6375 100644 --- a/anabatic/src/NetOptimals.cpp +++ b/anabatic/src/NetOptimals.cpp @@ -37,20 +37,22 @@ namespace Anabatic { void AnabaticEngine::_computeNetOptimals ( Net* net ) { - DebugSession::open( net, 144, 150 ); + DebugSession::open( net, 145, 150 ); cdebug_log(149,0) << "Anabatic::_computeNetOptimals( " << net << " )" << endl; cdebug_tabw(145,1); vector segments; - forEach ( Segment*, segment, net->getSegments() ) { - AutoSegment* autoSegment = Session::lookup( *segment ); + for ( Segment* segment : net->getSegments() ) { + AutoSegment* autoSegment = Session::lookup( segment ); if (autoSegment) segments.push_back( autoSegment ); } sort( segments.begin(), segments.end(), AutoSegment::CompareId() ); set processeds; - for ( size_t i=0 ; icomputeOptimal( processeds ); + for ( AutoSegment* segment : segments ) { + if (processeds.find(segment) != processeds.end()) continue; + segment->computeOptimal( processeds ); + } cdebug_tabw(145,-1); DebugSession::close(); diff --git a/anabatic/src/anabatic/AutoContact.h b/anabatic/src/anabatic/AutoContact.h index ae817945..3797c772 100644 --- a/anabatic/src/anabatic/AutoContact.h +++ b/anabatic/src/anabatic/AutoContact.h @@ -31,6 +31,8 @@ namespace Anabatic { using std::cerr; using std::endl; + using Hurricane::order; + using Hurricane::setInBound; using Hurricane::tab; using Hurricane::Name; using Hurricane::Net; @@ -334,17 +336,6 @@ namespace Anabatic { // ------------------------------------------------------------------- // Helper Functions. - - templateinline void order ( Type& a, Type& b ) { if (a>b) std::swap(a,b); } - - inline DbU::Unit setInBound ( DbU::Unit lower, DbU::Unit upper, DbU::Unit& value ) - { - if ( lower > value ) value = lower; - if ( upper < value ) value = upper; - - return value; - } - inline size_t abssub ( size_t a, size_t b ) { return (a>b) ? a-b : b-a; } diff --git a/anabatic/src/anabatic/AutoSegments.h b/anabatic/src/anabatic/AutoSegments.h index 44a84447..979ad288 100644 --- a/anabatic/src/anabatic/AutoSegments.h +++ b/anabatic/src/anabatic/AutoSegments.h @@ -258,9 +258,7 @@ namespace Anabatic { : AutoSegmentHC() , _flags (flags) , _segment(segment) - { - cdebug_log(145,0) << "Flags:" << _flags.asString(FlagsFunction) << std::endl; - } + { } inline AutoSegments_Aligneds::AutoSegments_Aligneds ( const AutoSegments_Aligneds& autosegments ) diff --git a/hurricane/src/hurricane/Interval.cpp b/hurricane/src/hurricane/Interval.cpp index 073be0ae..86183d1c 100644 --- a/hurricane/src/hurricane/Interval.cpp +++ b/hurricane/src/hurricane/Interval.cpp @@ -93,18 +93,6 @@ Interval Interval::getIntersection(const Interval& interval) const return Interval(max(_vMin, interval._vMin), min(_vMax, interval._vMax)); } -bool Interval::isEmpty() const -// *************************** -{ - return (_vMax < _vMin); -} - -bool Interval::isPonctual() const -// ****************************** -{ - return (_vMax == _vMin); -} - bool Interval::contains(const DbU::Unit& v) const // ***************************************** { diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 035517b1..eafed47a 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -136,6 +136,16 @@ namespace Hurricane { inline float roundfp ( float value, float precision=100.0 ) { return roundf(value*precision)/precision; } + template inline void order ( Type& a, Type& b ) { if (a>b) std::swap(a,b); } + + template inline Type setInBound ( Type lower, Type upper, Type& value ) + { + if (value < lower) value = lower; + else if (value > upper) value = upper; + return value; + } + + } // End of Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Interval.h b/hurricane/src/hurricane/hurricane/Interval.h index 76b14f7a..3446124a 100644 --- a/hurricane/src/hurricane/hurricane/Interval.h +++ b/hurricane/src/hurricane/hurricane/Interval.h @@ -63,7 +63,7 @@ class Interval { public: DbU::Unit& getVMin() {return _vMin;}; public: DbU::Unit& getVMax() {return _vMax;}; public: DbU::Unit getCenter() const {return ((_vMin + _vMax) / 2);}; - public: DbU::Unit getSize() const {return (_vMax - _vMin);}; + public: DbU::Unit getSize() const {return (isEmpty() ? 0 : (_vMax - _vMin));}; public: DbU::Unit getHalfSize() const {return (getSize() / 2);}; public: Interval getUnion(const Interval& interval) const; public: Interval getIntersection(const Interval& interval) const; @@ -71,8 +71,8 @@ class Interval { // Predicates // ********** - public: bool isEmpty() const; - public: bool isPonctual() const; + public: bool isEmpty() const { return (_vMax < _vMin);}; + public: bool isPonctual() const { return (_vMax == _vMin);}; public: bool contains(const DbU::Unit& v) const; public: bool contains(const Interval& interval) const; public: bool intersect(const Interval& interval) const; diff --git a/katana/src/RoutingEvent.cpp b/katana/src/RoutingEvent.cpp index 2df4a67a..63a7d5c2 100644 --- a/katana/src/RoutingEvent.cpp +++ b/katana/src/RoutingEvent.cpp @@ -394,7 +394,7 @@ namespace Katana { #endif } - DebugSession::open( _segment->getNet(), 156, 160 ); + DebugSession::open( _segment->getNet(), 155, 160 ); cdebug_log(9000,0) << "Deter| Event " << getProcesseds() @@ -654,15 +654,17 @@ namespace Katana { } double length = DbU::toLambda(_segment->getLength()); + double slack = DbU::toLambda(_segment->base()->getSlack()); - // if (length > 200.0) length = 200.0 - std::log(length)*20.0; - // if (length < 0.0) length = 0.0; + //if (length > 200.0) length = 200.0 - std::log(length)*20.0; + //if (length < 0.0) length = 0.0; + //if (slack / DbU::toLambda(_segment->getPitch()) < 2.0) slack = 999.0; - _priority = (length + 1.0) * (DbU::toLambda(_segment->base()->getSlack()) + 1.0); + _priority = (length + 1.0) * (slack + 1.0); - // if (_priority > 10000.0) cerr << "_priority:" << _priority - // << " length:" << DbU::toLambda(_segment->getLength()) - // << " slack:" << DbU::toLambda(_segment->base()->getSlack()) << endl; + //if (_priority > 10000.0) cerr << "_priority:" << _priority + // << " length:" << DbU::toLambda(_segment->getLength()) + // << " slack:" << DbU::toLambda(_segment->base()->getSlack()) << endl; cdebug_log(159,0) << _segment << " has " << (int)_tracksNb << " choices " << perpandicular << endl; cdebug_tabw(159,-1); diff --git a/katana/src/SegmentFsm.cpp b/katana/src/SegmentFsm.cpp index 6288c3e5..08ebe923 100644 --- a/katana/src/SegmentFsm.cpp +++ b/katana/src/SegmentFsm.cpp @@ -515,6 +515,8 @@ namespace Katana { cdebug_log(159,0) << "* Perpandicular (master): " << perpandicular << endl; _constraint = _event1->getConstraints(); + cdebug_log(159,0) << "* Constraints: " << _constraint << " (" << _constraint.getVMin() << " " << _constraint.getVMax() << ")" << endl; + _optimal = _event1->getOptimal(); if (_event2) { if (_sameAxis) { @@ -529,12 +531,13 @@ namespace Katana { cdebug_log(159,0) << "* Perpandicular (slave): PP axis " << symData->getSymmetrical(_event2->getPerpandicularFree()) << endl; + cdebug_log(159,0) << "* Constraints: " << _constraint << " (" << _constraint.getVMin() << " " << _constraint.getVMax() << ")" << endl; } } - cdebug_log(159,0) << "Anabatic intervals:" << endl; - cdebug_log(159,0) << "* Optimal: " << _optimal << endl; - cdebug_log(159,0) << "* Constraints: " << _constraint << endl; + cdebug_log(159,0) << "Anabatic intervals:" << endl; + cdebug_log(159,0) << "* Optimal: " << _optimal << " (" << _optimal.getVMin() << " " << _optimal.getVMax() << ")" << endl; + cdebug_log(159,0) << "* Constraints: " << _constraint << " (" << _constraint.getVMin() << " " << _constraint.getVMax() << ")" << endl; cdebug_log(159,0) << "* Perpandicular: " << perpandicular << endl; cdebug_log(159,0) << "* AxisHint: " << DbU::getValueString(_event1->getAxisHint()) << endl; @@ -589,6 +592,7 @@ namespace Katana { _costs.back()[1].setAxisWeight ( _event2->getAxisWeight(track2->getAxis()) ); _costs.back()[1].incDeltaPerpand( _data2->getWiringDelta(track2->getAxis()) ); _costs.back()[0].merge( _costs.back()[1] ); + } if (segment1->isGlobal()) { diff --git a/katana/src/Track.cpp b/katana/src/Track.cpp index 62dc1d26..56487d26 100644 --- a/katana/src/Track.cpp +++ b/katana/src/Track.cpp @@ -273,7 +273,7 @@ namespace Katana { if (_segments[end]->getSourceU() >= interval.getVMax()) break; } - cdebug_log(155,0) << "Track::getOverlapBounds(): begin:" << begin << " end:" << end << endl; + cdebug_log(155,0) << "Track::getOverlapBounds(): begin:" << begin << " end:" << end << " AfterLastElement:" << (iState == AfterLastElement) << endl; } @@ -313,10 +313,12 @@ namespace Katana { for ( ; begin < end ; begin++ ) { Interval overlap = interval.getIntersection( _segments[begin]->getCanonicalInterval() ); if ( _segments[begin]->getNet() == net ) { + cdebug_log(155,0) << "overlap:" << overlap << " size:" << overlap.getSize() << endl; cost.incDeltaShared ( overlap.getSize() ); } - cdebug_log(155,0) << "| overlap: " << _segments[begin] << endl; _segments[begin]->incOverlapCost( net, cost ); + cdebug_log(155,0) << "| overlap: " << _segments[begin] << " cost:" << cost << endl; + if (cost.isInfinite()) break; } diff --git a/katana/src/TrackCost.cpp b/katana/src/TrackCost.cpp index 1ec1a559..57a04d86 100644 --- a/katana/src/TrackCost.cpp +++ b/katana/src/TrackCost.cpp @@ -160,10 +160,15 @@ namespace Katana { if ( lhs._terminals < rhs._terminals ) return true; if ( lhs._terminals > rhs._terminals ) return false; - if ( not (_flags & TrackCost::IgnoreSharedLength) - or (lhs._delta > 0) or (rhs._delta > 0) ) { - if ( lhs._delta < rhs._delta ) return true; - if ( lhs._delta > rhs._delta ) return false; + if (lhs._delta != rhs._delta) { + //cdebug_log(155,0) << "TrackCost::Compare() lhs._delta:" << lhs._delta << " rhs._delta:" << rhs._delta << endl; + if ( not (_flags & TrackCost::IgnoreSharedLength) or (lhs._delta > 0) or (rhs._delta > 0) ) { + //if ( (lhs._delta > 0) or (rhs._delta > 0) ) { + if (lhs._delta < rhs._delta) return true; + if (lhs._delta > rhs._delta) return false; + } + + return lhs._delta < rhs._delta; } #if 0 @@ -203,8 +208,10 @@ namespace Katana { void TrackCost::consolidate () { if ( not _infinite and not _hardOverlap ) { + cdebug_log(159,0) << "TrackCost::consolidate() " << _delta << " - " << _deltaShared << endl; //_deltaPerpand += - (_deltaShared << 1); _delta += - _deltaShared; + //_delta += _deltaShared; } } @@ -238,7 +245,8 @@ namespace Katana { s += string ( (_overlapGlobal )?"g":"-" ); s += string ( (_globalEnclosed)?"e":"-" ); s += " " + getString(_terminals); - s += "/" + DbU::getValueString(_delta); + s += "/" + /*DbU::getValueString(_delta)*/ getString(_delta); + s += "-" + /*DbU::getValueString(_deltaShared)*/ getString(_deltaShared); s += "/" + DbU::getValueString(_axisWeight); s += "/" + DbU::getValueString(_deltaPerpand); s += "/" + DbU::getValueString(_distanceToFixed); diff --git a/katana/src/Tracks.cpp b/katana/src/Tracks.cpp index a0469b35..30ed89c0 100644 --- a/katana/src/Tracks.cpp +++ b/katana/src/Tracks.cpp @@ -42,6 +42,8 @@ namespace Katana { cdebug_log(155,0) << "* Constraints: " << _constraints << endl; _track = routingPlane->getTrackByPosition ( _constraints.getVMin() ); + cdebug_log(155,0) << "* Nearest track: " << _track << endl;; + cdebug_log(155,0) << "* axis:" << _track->getAxis() << " vmin:" << _constraints.getVMin() << endl; if ( _track and (_track->getAxis() < _constraints.getVMin()) ) _track = _track->getNextTrack(); if ( _track and (_track->getAxis() > _constraints.getVMax()) ) _track = NULL; @@ -66,13 +68,16 @@ namespace Katana { Track* Tracks_Range::Locator::getElement () const - { return _track; } + { + cdebug_log(155,0) << "Tracks_Range::Locator::getElement() - " << _track << endl;; + return _track; + } void Tracks_Range::Locator::progress () { - if ( !_track ) return; + if (not _track) return; _track = _track->getNextTrack(); if ( _track and (_track->getAxis() > _constraints.getVMax()) ) _track = NULL; diff --git a/katana/src/katana/DataSymmetric.h b/katana/src/katana/DataSymmetric.h index 3f95a5a4..30d32d88 100644 --- a/katana/src/katana/DataSymmetric.h +++ b/katana/src/katana/DataSymmetric.h @@ -103,11 +103,13 @@ namespace Katana { inline Interval DataSymmetric::getSymmetrical ( const Interval& interval ) const { - DbU::Unit vmin = interval.getVMin(); - if ( (vmin != DbU::Min) and (vmin != DbU::Max) ) vmin = 2*getSymAxis() - vmin; + DbU::Unit delta = 0; + DbU::Unit vmin = interval.getVMin(); + DbU::Unit vmax = interval.getVMax(); - DbU::Unit vmax = interval.getVMax(); - if ( (vmax != DbU::Max) and (vmax != DbU::Max) ) vmax = 2*getSymAxis() - vmax; + if ( (vmin != DbU::Min) and (vmin != DbU::Max) ) delta = -1; + if ( (vmin != DbU::Min) and (vmin != DbU::Max) ) vmin = 2*getSymAxis() - vmin + delta; + if ( (vmax != DbU::Max) and (vmax != DbU::Max) ) vmax = 2*getSymAxis() - vmax + delta; return Interval( vmin, vmax ); }