From a4ad671739c6db657e07843b99492ff1733a7c1c Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 21 Dec 2021 16:13:31 +0100 Subject: [PATCH] Fix too naive obstacle detection on non-prefered metal2 wires. * Fix: In Manipulator::avoidBlockage(), the dedicated function to check if there is an obstacle in the way of a non-prefered routing wire (done for metal2 connecting to terminals only) was too naive. We were checking the tracks for obstacles crossing exactly the axis of the segment. And for near-miss this is not enough. Now check on the whole x-span to be used by the segment. Code borrowed and simplified from Track::addOverlapcost(). * Change: In Manipulator::moveUp(), the default value for the extra reservation allowing a long wire to move up need to be customized for Flexlib/StdCellLib (allow successful routing of ChipFlow/MPW4). Add two new configuration parameters to katana: * "katana.longWireUpThresold1" : the length, expressed in number of *slice height* above which a global wire is considered a *long* wire (not close interconnect). * "katana.longWireUpReserve1" : the extra number of free tracks that must remains free in the up layer after the move up, in each GCell traversed by the wire. Expressed in number of tracks, but can be non-integer (float, for instance: 1.5). --- katana/src/Configuration.cpp | 36 ++++++++++------ katana/src/GraphicKatanaEngine.cpp | 3 +- katana/src/Manipulator.cpp | 57 ++++++++++++++++++------- katana/src/NegociateWindow.cpp | 2 +- katana/src/Track.cpp | 2 +- katana/src/katana/Configuration.h | 6 +++ katana/src/katana/Manipulator.h | 8 ++-- katana/src/katana/TrackElement.h | 6 +-- katana/src/katana/TrackSegmentNonPref.h | 6 +-- 9 files changed, 80 insertions(+), 46 deletions(-) diff --git a/katana/src/Configuration.cpp b/katana/src/Configuration.cpp index 53e0361e..84074fe4 100644 --- a/katana/src/Configuration.cpp +++ b/katana/src/Configuration.cpp @@ -40,21 +40,23 @@ namespace Katana { Configuration::Configuration () : Anabatic::Configuration() , _postEventCb () - , _searchHalo (Cfg::getParamInt ("katana.searchHalo" , 1)->asInt()) - , _hTracksReservedLocal(Cfg::getParamInt ("katana.hTracksReservedLocal", 3)->asInt()) - , _vTracksReservedLocal(Cfg::getParamInt ("katana.vTracksReservedLocal", 3)->asInt()) - , _termSatReservedLocal(Cfg::getParamInt ("katana.termSatReservedLocal", 9)->asInt()) - , _hTracksReservedMin (Cfg::getParamInt ("katana.hTracksReservedMin" , 1)->asInt()) - , _vTracksReservedMin (Cfg::getParamInt ("katana.vTracksReservedMin" , 1)->asInt()) - , _termSatThreshold (Cfg::getParamInt ("katana.termSatThreshold" , 8)->asInt()) + , _searchHalo (Cfg::getParamInt ("katana.searchHalo" , 1)->asInt()) + , _longWireUpThreshold1(Cfg::getParamInt ("katana.longWireUpThreshold1" , 60)->asInt()) + , _longWireUpReserve1 (Cfg::getParamDouble("katana.longWireUpReserve1" , 1.0)->asDouble()) + , _hTracksReservedLocal(Cfg::getParamInt ("katana.hTracksReservedLocal" , 3)->asInt()) + , _vTracksReservedLocal(Cfg::getParamInt ("katana.vTracksReservedLocal" , 3)->asInt()) + , _termSatReservedLocal(Cfg::getParamInt ("katana.termSatReservedLocal" , 9)->asInt()) + , _hTracksReservedMin (Cfg::getParamInt ("katana.hTracksReservedMin" , 1)->asInt()) + , _vTracksReservedMin (Cfg::getParamInt ("katana.vTracksReservedMin" , 1)->asInt()) + , _termSatThreshold (Cfg::getParamInt ("katana.termSatThreshold" , 8)->asInt()) , _ripupLimits () - , _ripupCost (Cfg::getParamInt ("katana.ripupCost" , 3)->asInt()) - , _eventsLimit (Cfg::getParamInt ("katana.eventsLimit" ,4000000)->asInt()) - , _bloatOverloadAdd (Cfg::getParamInt ("katana.bloatOverloadAdd" , 4)->asInt()) - , _trackFill (Cfg::getParamInt ("katana.trackFill" , 0)->asInt()) + , _ripupCost (Cfg::getParamInt ("katana.ripupCost" , 3)->asInt()) + , _eventsLimit (Cfg::getParamInt ("katana.eventsLimit" ,4000000)->asInt()) + , _bloatOverloadAdd (Cfg::getParamInt ("katana.bloatOverloadAdd" , 4)->asInt()) + , _trackFill (Cfg::getParamInt ("katana.trackFill" , 0)->asInt()) , _flags (0) - , _profileEventCosts (Cfg::getParamBool("katana.profileEventCosts" ,false )->asBool()) - , _runRealignStage (Cfg::getParamBool("katana.runRealignStage" ,true )->asBool()) + , _profileEventCosts (Cfg::getParamBool ("katana.profileEventCosts" ,false )->asBool()) + , _runRealignStage (Cfg::getParamBool ("katana.runRealignStage" ,true )->asBool()) { _ripupLimits[StrapRipupLimit] = Cfg::getParamInt("katana.strapRipupLimit" ,16)->asInt(); _ripupLimits[LocalRipupLimit] = Cfg::getParamInt("katana.localRipupLimit" , 7)->asInt(); @@ -90,6 +92,8 @@ namespace Katana { : Anabatic::Configuration(*other.base()) , _postEventCb (other._postEventCb) , _searchHalo (other._searchHalo) + , _longWireUpThreshold1(other._longWireUpThreshold1) + , _longWireUpReserve1 (other._longWireUpReserve1) , _hTracksReservedLocal(other._hTracksReservedLocal) , _vTracksReservedLocal(other._vTracksReservedLocal) , _termSatReservedLocal(other._termSatReservedLocal) @@ -180,6 +184,8 @@ namespace Katana { cout << Dots::asBool (" - Use GR density estimate" ,useGlobalEstimate()) << endl; cout << Dots::asBool (" - Use static bloat profile" ,useStaticBloatProfile()) << endl; cout << Dots::asDouble(" - GCell saturate ratio (LA)" ,getSaturateRatio()) << endl; + cout << Dots::asUInt (" - Long wire threshold1 for move up" ,_longWireUpThreshold1) << endl; + cout << Dots::asDouble(" - Long wire reserved1 for move up" ,_longWireUpReserve1) << endl; cout << Dots::asUInt (" - Edge min H reserved local" ,_hTracksReservedMin) << endl; cout << Dots::asUInt (" - Edge min V reserved local" ,_vTracksReservedMin) << endl; cout << Dots::asUInt (" - Edge max H reserved local" ,_hTracksReservedLocal) << endl; @@ -217,8 +223,12 @@ namespace Katana { Record* record = Super::_getRecord(); if ( record ) { record->add ( getSlot("_searchHalo" ,_searchHalo ) ); + record->add ( getSlot("_longWireUpThreshold1" ,_longWireUpThreshold1 ) ); + record->add ( getSlot("_longWireUpReserved1" ,_longWireUpReserve1 ) ); record->add ( getSlot("_hTracksReservedLocal" ,_hTracksReservedLocal ) ); record->add ( getSlot("_vTracksReservedLocal" ,_vTracksReservedLocal ) ); + record->add ( getSlot("_hTracksReservedMin" ,_hTracksReservedMin ) ); + record->add ( getSlot("_vTracksReservedMin" ,_vTracksReservedMin ) ); record->add ( getSlot("_ripupCost" ,_ripupCost ) ); record->add ( getSlot("_eventsLimit" ,_eventsLimit ) ); diff --git a/katana/src/GraphicKatanaEngine.cpp b/katana/src/GraphicKatanaEngine.cpp index a55d6b70..fefac854 100644 --- a/katana/src/GraphicKatanaEngine.cpp +++ b/katana/src/GraphicKatanaEngine.cpp @@ -187,9 +187,10 @@ namespace Katana { if (fontHeight > ((edge->isHorizontal()) ? pixelBb.height() : pixelBb.width()) + 4) return; //QString text = QString("%1/%2").arg(edge->getRealOccupancy()).arg(edge->getCapacity()); - QString text = QString("%1/%2 %3") + QString text = QString("%1/%2[-%3] %4") .arg( edgeOccupancy ) .arg( edge->getCapacity() ) + .arg( edge->getReservedCapacity() ) .arg( edge->getHistoricCost() ); QColor color ( (occupancy > 170) ? Qt::black : Qt::white ); painter.setPen (DisplayStyle::darken(color,widget->getDarkening())); diff --git a/katana/src/Manipulator.cpp b/katana/src/Manipulator.cpp index 412f0145..a39ba820 100644 --- a/katana/src/Manipulator.cpp +++ b/katana/src/Manipulator.cpp @@ -106,6 +106,10 @@ namespace Katana { { DebugSession::close(); } + uint32_t Manipulator::getLongWireUpThreshold1 () const { return Session::getConfiguration()->getLongWireUpThreshold1(); } + double Manipulator::getLongWireUpReserve1 () const { return Session::getConfiguration()->getLongWireUpReserve1(); } + + bool Manipulator::canRipup ( uint32_t flags ) const { if (_data) { @@ -1183,7 +1187,7 @@ namespace Katana { float reserve = 1.0; //float reserve = 0.5; if (_segment->base() and (_segment->base()->getRpDistance() > 2)) reserve = 1.0; - if (_segment->getLength() > 60*getPitch()) reserve = 1.0; + if (_segment->getLength() > getLongWireUpThreshold1()*getPitch()) reserve = getLongWireUpReserve1(); if (_segment->isFixed()) return false; if (not (flags & AllowLocalMoveUp)) { @@ -1697,8 +1701,9 @@ namespace Katana { return false; } - AutoContact* terminal = _segment->base()->getAutoSource(); - AutoContact* turn = _segment->base()->getAutoTarget(); + RoutingPlane* plane = Session::getKatanaEngine()->getRoutingPlaneByLayer(_segment->getLayer()); + AutoContact* terminal = _segment->base()->getAutoSource(); + AutoContact* turn = _segment->base()->getAutoTarget(); if (not terminal->isTerminal()) std::swap( terminal, turn ); @@ -1710,30 +1715,52 @@ namespace Katana { return false; } + Interval xspan ( terminal->getX() ); + xspan.inflate( ( plane->getLayerGauge()->getPWireWidth() + + plane->getLayerGauge()->getPitch() + - plane->getLayerGauge()->getWireWidth()) / 2 ); + Box termConstraints ( terminal->getConstraintBox() ); Box turnConstraints ( turn ->getConstraintBox() ); Interval axisRange = terminal->getUConstraints( Flags::Vertical ); + axisRange.inflate( plane->getLayerGauge()->getPitch() ); + cdebug_log(159,0) << "Axis range (UConstraints) " << axisRange << endl; size_t offset = Track::npos; size_t minBlockage = Track::npos; size_t maxBlockage = Track::npos; - RoutingPlane* plane = Session::getKatanaEngine()->getRoutingPlaneByLayer(_segment->getLayer()); for ( Track* track : Tracks_Range::get(plane,axisRange) ) { if (offset == Track::npos) offset = track->getIndex(); - TrackElement* element = track->getSegment( terminal->getX() ); - if (element and (element->isBlockage() or element->isFixed())) { - if (track->getIndex() == offset) { - minBlockage = track->getIndex(); - continue; + cdebug_log(159,0) << "| track=" << track << endl; + Interval freeInterval = track->getFreeInterval( xspan.getCenter(), _segment->getNet() ); + if (freeInterval.contains(xspan)) continue; + + size_t begin = Track::npos; + size_t end = Track::npos; + track->getOverlapBounds( xspan, begin, end ); + if (begin == Track::npos) continue; + + for ( bool trackDone=false ; not trackDone and (begin < end) ; begin++ ) { + TrackElement* element = track->getSegment( begin ); + if (element->getNet() == _segment->getNet()) continue; + if (xspan.getIntersection( element->getCanonicalInterval() ).getSize() == 0) continue; + if (element->isBlockage() or element->isFixed()) { + trackDone = true; + if (track->getIndex() == offset) { + minBlockage = track->getIndex(); + continue; + } + if ((minBlockage != Track::npos) and (minBlockage+1 == track->getIndex())) { + minBlockage = track->getIndex(); + continue; + } + maxBlockage = track->getIndex(); } - if ((minBlockage != Track::npos) and (minBlockage+1 == track->getIndex())) { - minBlockage = track->getIndex(); - continue; - } - maxBlockage = track->getIndex(); - break; } + if (maxBlockage != Track::npos) break; } + cdebug_log(159,0) << "minBlockage=" << minBlockage << endl; + cdebug_log(159,0) << "maxBlockage=" << maxBlockage << endl; Interval nonBlocked ( (minBlockage == Track::npos) ? terminal->getGCell()->getYMin() : plane->getTrackByIndex(minBlockage)->getAxis() , (maxBlockage == Track::npos) ? terminal->getGCell()->getYMax() diff --git a/katana/src/NegociateWindow.cpp b/katana/src/NegociateWindow.cpp index 39ab5efe..231bbb1e 100644 --- a/katana/src/NegociateWindow.cpp +++ b/katana/src/NegociateWindow.cpp @@ -639,7 +639,7 @@ namespace Katana { // _pack( count, false ); //} - // if (RoutingEvent::getProcesseds() == 330332) { + // if (RoutingEvent::getProcesseds() == 65092) { // UpdateSession::close(); // Breakpoint::stop( 0, "Overlap has happened" ); // UpdateSession::open(); diff --git a/katana/src/Track.cpp b/katana/src/Track.cpp index 7c631d59..1d5802ed 100644 --- a/katana/src/Track.cpp +++ b/katana/src/Track.cpp @@ -415,7 +415,7 @@ namespace Katana { void Track::getBeginIndex ( DbU::Unit position, size_t& begin, uint32_t& state ) const { cdebug_log(155,0) << "Track::getBeginIndex(): @" << DbU::getValueString(position) - << "begin=" << begin << endl; + << " begin=" << begin << endl; if (_segments.empty()) { state = EmptyTrack; begin = 0; diff --git a/katana/src/katana/Configuration.h b/katana/src/katana/Configuration.h index 22e50028..88694041 100644 --- a/katana/src/katana/Configuration.h +++ b/katana/src/katana/Configuration.h @@ -75,6 +75,8 @@ namespace Katana { uint32_t getRipupLimit ( uint32_t type ) const; inline uint32_t getSearchHalo () const; inline uint32_t getBloatOverloadAdd () const; + inline uint32_t getLongWireUpThreshold1 () const; + inline double getLongWireUpReserve1 () const; inline uint32_t getHTracksReservedLocal () const; inline uint32_t getVTracksReservedLocal () const; inline uint32_t getTermSatReservedLocal () const; @@ -103,6 +105,8 @@ namespace Katana { // Attributes. PostEventCb_t _postEventCb; uint32_t _searchHalo; + uint32_t _longWireUpThreshold1; + double _longWireUpReserve1; uint32_t _hTracksReservedLocal; uint32_t _vTracksReservedLocal; uint32_t _termSatReservedLocal; @@ -131,6 +135,8 @@ namespace Katana { inline uint32_t Configuration::getSearchHalo () const { return _searchHalo; } inline uint32_t Configuration::getRipupCost () const { return _ripupCost; } inline uint32_t Configuration::getBloatOverloadAdd () const { return _bloatOverloadAdd; } + inline uint32_t Configuration::getLongWireUpThreshold1 () const { return _longWireUpThreshold1; } + inline double Configuration::getLongWireUpReserve1 () const { return _longWireUpReserve1; } inline uint32_t Configuration::getHTracksReservedLocal () const { return _hTracksReservedLocal; } inline uint32_t Configuration::getVTracksReservedLocal () const { return _vTracksReservedLocal; } inline uint32_t Configuration::getTermSatReservedLocal () const { return _termSatReservedLocal; } diff --git a/katana/src/katana/Manipulator.h b/katana/src/katana/Manipulator.h index 57026168..f15385f2 100644 --- a/katana/src/katana/Manipulator.h +++ b/katana/src/katana/Manipulator.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_MANIPULATOR_H -#define KATANA_MANIPULATOR_H - +#pragma once #include "hurricane/DbU.h" #include "anabatic/Constants.h" @@ -53,6 +51,8 @@ namespace Katana { public: Manipulator ( TrackElement*, SegmentFsm& ); ~Manipulator (); + uint32_t getLongWireUpThreshold1 () const; + double getLongWireUpReserve1 () const; inline TrackElement* getSegment () const; inline DataNegociate* getData () const; inline RoutingEvent* getEvent () const; @@ -112,5 +112,3 @@ namespace Katana { } // Katana namespace. - -#endif // KATANA_MANIPULATOR_H diff --git a/katana/src/katana/TrackElement.h b/katana/src/katana/TrackElement.h index 74dbbde5..33f4e539 100644 --- a/katana/src/katana/TrackElement.h +++ b/katana/src/katana/TrackElement.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_TRACK_ELEMENT_H -#define KATANA_TRACK_ELEMENT_H - +#pragma once #include #include #include @@ -295,5 +293,3 @@ namespace Katana { INSPECTOR_P_SUPPORT(Katana::TrackElement); - -#endif diff --git a/katana/src/katana/TrackSegmentNonPref.h b/katana/src/katana/TrackSegmentNonPref.h index 3313acd0..3c1e76ac 100644 --- a/katana/src/katana/TrackSegmentNonPref.h +++ b/katana/src/katana/TrackSegmentNonPref.h @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef KATANA_TRACK_SEGMENT_NON_PREF_H -#define KATANA_TRACK_SEGMENT_NON_PREF_H - +#pragma once #include #include #include "katana/TrackSegment.h" @@ -72,5 +70,3 @@ namespace Katana { INSPECTOR_P_SUPPORT(Katana::TrackSegmentNonPref); - -#endif // KATANA_TRACK_SEGMENT_WIDE_H