From 7a7a3b9f1bab98b398534dfcdcd131665806a2bc Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 1 Feb 2021 16:36:26 +0100 Subject: [PATCH] GoStraight & GCell density sorting bugs. * Bug: In Anabatic::GCell::updateDensity(), the GoStraight flag is now set in this function when the density of blockage is above 40%. (should be parametrized in the future). This is linked with the Katabatic TrackFixedsegment bug. * Bug: In Anabatic::GCell::Key::Compare, the densities of the GCell where sorted in the *wrong* order, that is *less denser first*. This was making the layer assignment working on it's head. WTF, how did it ever work. Also sort on global saturation. --- anabatic/src/GCell.cpp | 17 ++++++++++++----- anabatic/src/LayerAssign.cpp | 1 + anabatic/src/anabatic/GCell.h | 28 ++++++++++++++++------------ 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 17e5a8f6..b668f5a7 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -1329,7 +1329,7 @@ namespace Anabatic { _blockages[depth] += length; _flags |= Flags::Invalidated; - cdebug_log(149,0) << "GCell:addBlockage() " << this << " " + cdebug_log(149,0) << "GCell::addBlockage() " << this << " " << depth << ":" << DbU::getValueString(_blockages[depth]) << endl; } @@ -1507,7 +1507,14 @@ namespace Anabatic { } // Add the blockages. - for ( size_t i=0 ; i<_depth ; i++ ) uLengths2[i] += _blockages[i]; + for ( size_t i=0 ; i<_depth ; i++ ) { + uLengths2[i] += _blockages[i]; + if (not i) continue; + if ((float)(_blockages[i] * Session::getPitch(i)) > 0.40*(float)(width*height)) { + flags() |= Flags::GoStraight; + //cerr << "| Set GoStraight on " << this << endl; + } + } // Compute the number of non pass-through tracks. if (not processeds.empty()) { @@ -1756,7 +1763,7 @@ namespace Anabatic { bool GCell::stepNetDesaturate ( size_t depth, set& globalNets, GCell::Set& invalidateds ) { - cdebug_log(9000,0) << "Deter| GCell::stepNetDesaturate() depth:" << depth << endl; + cdebug_log(149,0) << "GCell::stepNetDesaturate() depth:" << depth << endl; cdebug_log(9000,0) << "Deter| " << this << endl; updateDensity(); @@ -1778,7 +1785,7 @@ namespace Anabatic { if (segmentDepth < depth) continue; if (segmentDepth > depth) break; - cdebug_log(9000,0) << "Deter| Move up " << (*isegment) << endl; + cdebug_log(149,0) << "Move up " << (*isegment) << endl; if (getAnabatic()->moveUpNetTrunk(*isegment,globalNets,invalidateds)) return true; @@ -1843,7 +1850,7 @@ namespace Anabatic { ostringstream s; const Layer* layer = rg->getRoutingLayer(depth)->getBlockageLayer(); s << "_blockages[" << depth << ":" << ((layer) ? layer->getName() : "None") << "]"; - record->add( getSlot ( s.str(), &_blockages[depth] ) ); + record->add( DbU::getValueSlot( s.str(), &_blockages[depth] ) ); } for ( size_t depth=0 ; depth<_depth ; ++depth ) { diff --git a/anabatic/src/LayerAssign.cpp b/anabatic/src/LayerAssign.cpp index 8a5ab596..569c1e0d 100644 --- a/anabatic/src/LayerAssign.cpp +++ b/anabatic/src/LayerAssign.cpp @@ -335,6 +335,7 @@ namespace Anabatic { cmess1 << " o Desaturate layer " << Session::getRoutingGauge()->getRoutingLayer(depth)->getName() << endl; + cdebug_log(149,0) << "Session::getSaturateRatio()=" << Session::getSaturateRatio() << endl; GCellKeyQueue queue; GCell::Set invalidateds; diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index 2495d6d1..92812651 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -114,13 +114,14 @@ namespace Anabatic { public: class Key { public: - inline Key ( const GCell*, size_t depth ); - inline ~Key (); - inline float getDensity () const; - inline const GCell* getGCell () const; - inline bool isActive () const; - inline void update ( size_t depth ); - friend bool operator< ( const Key&, const Key& ); + inline Key ( const GCell*, size_t depth ); + inline ~Key (); + inline float getDensity () const; + inline const GCell* getGCell () const; + inline bool isActive () const; + inline bool isSaturated () const; + inline void update ( size_t depth ); + friend bool operator< ( const Key&, const Key& ); public: class Compare { public: @@ -506,10 +507,11 @@ namespace Anabatic { inline GCell::Key::~Key () { if (isActive()) _gcell->clearClonedKey(); } - inline float GCell::Key::getDensity () const { return _density; } - inline const GCell* GCell::Key::getGCell () const { return _gcell; } - inline void GCell::Key::update ( size_t depth ) { _density=_gcell->getWDensity(depth); } - inline bool GCell::Key::isActive () const { return (this == _gcell->getLastClonedKey()); } + inline float GCell::Key::getDensity () const { return _density; } + inline const GCell* GCell::Key::getGCell () const { return _gcell; } + inline void GCell::Key::update ( size_t depth ) { _density=_gcell->getWDensity(depth); } + inline bool GCell::Key::isActive () const { return (this == _gcell->getLastClonedKey()); } + inline bool GCell::Key::isSaturated () const { return _gcell->isSaturated(); } inline bool operator< ( const GCell::Key& lhs, const GCell::Key& rhs ) { @@ -521,8 +523,10 @@ namespace Anabatic { inline bool GCell::Key::Compare::operator() ( const GCell::Key* lhs, const GCell::Key* rhs ) { + //if (lhs->isSaturated() xor rhs->isSaturated()) return lhs->isSaturated(); + float difference = lhs->_density - rhs->_density; - if (difference != 0.0) return (difference > 0.0); + if (difference != 0.0) return (difference < 0.0); return lhs->_gcell->getId() < rhs->_gcell->getId(); }