From ce00b37cbf2c2ba4ee22f08fe6895e3d0e34eb47 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 10 Sep 2016 18:49:48 +0200 Subject: [PATCH] Enable the display of GCells as a density map (and not boundaries). * Bug: In Anabatic::RawGCellsUnder, *again*, the north and east borders of the whole area *are* includeds (shut up disgraceful warning). * New: In Anabatic::GCell, add a display mode to select between boundary display (for analogic) and density display (for numeric). * Bug: In KatanaEngine::runGlobalRouter(), do not check if an Edge cannot be desatured when the vector or overloaded Edges is empty. (one less disgraceful warning) * New: In GraphicKatanaEngine::drawGCell(), support for drawing the GCells in density mode. Use the fire scale and the MaxDensity mode. Setup the GCell drawing mode in GraphicKatanaEngine::initGCell(). * Change: In GraphicKatanaEngine::drawEdge(), adjust the various thresholds for showing the Edge and its label. * New: In CRL Core, adds "anabatic.gcell.displayMode" to the set of Anabatic parameters. Adjust the showing threshold for GCells in "display.conf" so when the zoom level is low, we still can see the density map. --- anabatic/src/AnabaticEngine.cpp | 4 +-- anabatic/src/Configuration.cpp | 5 +++ anabatic/src/Edge.cpp | 14 ++++++--- anabatic/src/GCell.cpp | 17 +++++----- anabatic/src/LoadGlobalRouting.cpp | 2 +- anabatic/src/anabatic/GCell.h | 6 ++++ crlcore/etc/cmos/kite.conf | 4 +++ crlcore/etc/common/display.conf | 4 +-- crlcore/etc/common/kite.conf | 1 + katana/src/GlobalRoute.cpp | 7 +++-- katana/src/GraphicKatanaEngine.cpp | 50 ++++++++++++++++++------------ katana/src/KatanaEngine.cpp | 2 +- katana/src/PyKatanaEngine.cpp | 2 +- 13 files changed, 77 insertions(+), 41 deletions(-) diff --git a/anabatic/src/AnabaticEngine.cpp b/anabatic/src/AnabaticEngine.cpp index c1c0f50f..80fe8d3f 100644 --- a/anabatic/src/AnabaticEngine.cpp +++ b/anabatic/src/AnabaticEngine.cpp @@ -79,8 +79,8 @@ namespace Anabatic { Point sourcePosition = segment->getSourcePosition(); Point targetPosition = segment->getTargetPosition(); - if ( (sourcePosition.getX() >= gcellsArea.getXMax()) - or (sourcePosition.getY() >= gcellsArea.getYMax()) + if ( (sourcePosition.getX() > gcellsArea.getXMax()) + or (sourcePosition.getY() > gcellsArea.getYMax()) or (targetPosition.getX() <= gcellsArea.getXMin()) or (targetPosition.getY() <= gcellsArea.getYMin()) ) { cerr << Error( "RawGCellsUnder::RawGCellsUnder(): %s is completly outside the GCells area (ignored)." diff --git a/anabatic/src/Configuration.cpp b/anabatic/src/Configuration.cpp index 89dbded6..843e6922 100644 --- a/anabatic/src/Configuration.cpp +++ b/anabatic/src/Configuration.cpp @@ -30,6 +30,7 @@ #include "crlcore/RoutingLayerGauge.h" #include "crlcore/AllianceFramework.h" #include "anabatic/Configuration.h" +#include "anabatic/GCell.h" @@ -71,6 +72,8 @@ namespace Anabatic { , _edgeCostK (Cfg::getParamDouble("anabatic.edgeCostK",-10.0)->asDouble()) , _edgeHInc (Cfg::getParamDouble("anabatic.edgeHInc" , 1.5)->asDouble()) { + GCell::setDisplayMode( Cfg::getParamEnumerate("anabatic.gcell.displayMode", GCell::Boundary)->asInt() ); + if (cg == NULL) cg = AllianceFramework::get()->getCellGauge(); if (rg == NULL) rg = AllianceFramework::get()->getRoutingGauge(); _cg = cg->getClone(); @@ -122,6 +125,8 @@ namespace Anabatic { , _edgeCostK (other._edgeCostK) , _edgeHInc (other._edgeHInc) { + GCell::setDisplayMode( Cfg::getParamEnumerate("anabatic.gcell.displayMode", GCell::Boundary)->asInt() ); + if (other._cg) _cg = other._cg->getClone(); if (other._rg) _rg = other._rg->getClone(); } diff --git a/anabatic/src/Edge.cpp b/anabatic/src/Edge.cpp index 68b50c7a..5323bf4a 100644 --- a/anabatic/src/Edge.cpp +++ b/anabatic/src/Edge.cpp @@ -315,12 +315,16 @@ namespace Anabatic { string Edge::_getString () const { + Point center ( getSource()->getCenter() ); + string s = Super::_getString(); - s.insert( s.size()-1, " "+DbU::getValueString(_axis) ); - s.insert( s.size()-1, " "+getString(_realOccupancy) ); - s.insert( s.size()-1, "/"+getString(_capacity) ); - s.insert( s.size()-1, " h:"+getString(_historicCost) ); - s.insert( s.size()-1, " "+getString(_flags) ); + s.insert( s.size()-1, " S:["+DbU::getValueString(center.getX()) ); + s.insert( s.size()-1, " " +DbU::getValueString(center.getY()) ); + s.insert( s.size()-1, "] " +DbU::getValueString(_axis) ); + s.insert( s.size()-1, " " +getString(_realOccupancy) ); + s.insert( s.size()-1, "/" +getString(_capacity) ); + s.insert( s.size()-1, " h:" +getString(_historicCost) ); + s.insert( s.size()-1, " " +getString(_flags) ); return s; } diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index 8204a2b3..1189e8ce 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -17,6 +17,7 @@ #include #include "hurricane/Bug.h" #include "hurricane/Warning.h" +#include "hurricane/Breakpoint.h" #include "hurricane/Contact.h" #include "hurricane/RoutingPad.h" #include "hurricane/UpdateSession.h" @@ -270,7 +271,12 @@ namespace Anabatic { // ------------------------------------------------------------------- // Class : "Anabatic::GCell". - Name GCell::_extensionName = "Anabatic::GCell"; + Name GCell::_extensionName = "Anabatic::GCell"; + unsigned int GCell::_displayMode = GCell::Boundary; + + + unsigned int GCell::getDisplayMode () { return _displayMode; } + void GCell::setDisplayMode ( unsigned int mode ) { _displayMode = mode; } GCell::GCell ( AnabaticEngine* anabatic, DbU::Unit xmin, DbU::Unit ymin ) @@ -720,12 +726,9 @@ namespace Anabatic { { getAnabatic()->openSession(); - //const vector& gcells = getAnabatic()->getGCells(); - //size_t ibegin = gcells.size(); - DbU::Unit side = Session::getSliceHeight(); - - Interval hspan = getSide( Flags::Horizontal ); - Interval vspan = getSide( Flags::Vertical ); + DbU::Unit side = Session::getSliceHeight(); + Interval hspan = getSide( Flags::Horizontal ); + Interval vspan = getSide( Flags::Vertical ); if (hspan.getSize() < 3*side) { cerr << Error( "GCell::doGrid(): GCell is too narrow (dx:%s) to build a grid.\n" diff --git a/anabatic/src/LoadGlobalRouting.cpp b/anabatic/src/LoadGlobalRouting.cpp index 8f745bfe..6f457673 100644 --- a/anabatic/src/LoadGlobalRouting.cpp +++ b/anabatic/src/LoadGlobalRouting.cpp @@ -2222,7 +2222,7 @@ namespace Anabatic { void AnabaticEngine::_loadGrByNet () { - cmess1 << " o Loading Nets global routing from Knik." << endl; + cmess1 << " o Building detailed routing from global." << endl; //cmess1 << Dots::asDouble(" - Saturation",getMeasure(getCell(),"Sat.")->getData()) << endl; startMeasures(); diff --git a/anabatic/src/anabatic/GCell.h b/anabatic/src/anabatic/GCell.h index c44d785b..d436292e 100644 --- a/anabatic/src/anabatic/GCell.h +++ b/anabatic/src/anabatic/GCell.h @@ -75,6 +75,9 @@ namespace Anabatic { typedef std::set< GCell*, Entity::CompareById > Set; typedef std::vector Vector; public: + enum DisplayMode { Boundary = 1 + , Density = 2 + }; enum DensityMode { AverageHVDensity = 1 // Average between all densities. , AverageHDensity = 2 // Average between all H densities. , AverageVDensity = 3 // Average between all V densities. @@ -120,6 +123,8 @@ namespace Anabatic { float _density; }; public: + static unsigned int getDisplayMode (); + static void setDisplayMode ( unsigned int ); static Box getBorder ( const GCell*, const GCell* ); public: static GCell* create ( AnabaticEngine* ); @@ -266,6 +271,7 @@ namespace Anabatic { GCell& operator= ( const GCell& ); private: static Name _extensionName; + static unsigned int _displayMode; Observable _observable; AnabaticEngine* _anabatic; Flags _flags; diff --git a/crlcore/etc/cmos/kite.conf b/crlcore/etc/cmos/kite.conf index 46324526..f746b1e1 100644 --- a/crlcore/etc/cmos/kite.conf +++ b/crlcore/etc/cmos/kite.conf @@ -25,6 +25,10 @@ parametersTable = \ , ("anabatic.edgeWidth" ,TypeInt ,4 ) , ("anabatic.edgeCostH" ,TypeDouble ,9.0 ) , ("anabatic.edgeCostK" ,TypeDouble ,-10.0 ) + , ("anabatic.gcell.displayMode" ,TypeEnumerate ,1 + , { 'values':( ("Boundary" , 1) + , ("Density" , 2) ) } + ) ) diff --git a/crlcore/etc/common/display.conf b/crlcore/etc/common/display.conf index dfb06bc8..215131c8 100644 --- a/crlcore/etc/common/display.conf +++ b/crlcore/etc/common/display.conf @@ -85,7 +85,7 @@ stylesTable = \ , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) , (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'threshold':0.02*scale, 'border':4 }) - , (Drawing, 'Anabatic::GCell', { 'color':'255,0,0' , 'pattern':'0000000000000000', 'threshold':0.80*scale, 'border':4 }) + , (Drawing, 'Anabatic::GCell', { 'color':'255,0,0' , 'pattern':'0000000000000000', 'threshold':0.10*scale, 'border':4 }) ) # ---------------------------------------------------------------------- @@ -192,7 +192,7 @@ stylesTable = \ , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) , (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.02*scale }) - , (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.80*scale }) + , (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.10*scale }) ) # ---------------------------------------------------------------------- diff --git a/crlcore/etc/common/kite.conf b/crlcore/etc/common/kite.conf index b453e659..55435e07 100644 --- a/crlcore/etc/common/kite.conf +++ b/crlcore/etc/common/kite.conf @@ -8,6 +8,7 @@ layoutTable = \ , (TypeOption , "katabatic.saturateRp" , "Saturate RoutingPad" , 0, 1 ) , (TypeOption , "katabatic.globalLengthThreshold", "Global Length Threshold", 0, 1 ) , (TypeOption , "katabatic.topRoutingLayer" , "Top Routing Layer" , 0, 1 ) + , (TypeOption , "anabatic.gcell.displayMode" , "GCell Display Mode" , 1, 1 ) , (TypeRule ,) , (TypeTitle , "Kite - Detailed Router" ) , (TypeOption , "kite.hTracksReservedLocal", "Vert. Locally Reserved Tracks", 0 ) diff --git a/katana/src/GlobalRoute.cpp b/katana/src/GlobalRoute.cpp index 97bd4ba2..cee3fee5 100644 --- a/katana/src/GlobalRoute.cpp +++ b/katana/src/GlobalRoute.cpp @@ -172,10 +172,10 @@ namespace Katana { dijkstra->run(); ++netCount; } - cmess2 << left << setw(6) << netCount << right; + cmess2 << left << setw(6) << netCount; const vector& ovEdges = getOvEdges(); - cmess2 << " ovEdges:" << ovEdges.size(); + cmess2 << " ovEdges:" << setw(4) << ovEdges.size(); for ( Edge* edge : ovEdges ) computeNextHCost( edge, edgeHInc ); @@ -185,6 +185,7 @@ namespace Katana { Edge* edge = ovEdges[iEdge]; netCount += edge->ripup(); + if (ovEdges.empty()) break; if (ovEdges[iEdge] == edge) { cerr << Error( "AnabaticEngine::globalRoute(): Unable to ripup enough segments of edge:\n" " %s" @@ -196,7 +197,7 @@ namespace Katana { dijkstra->setSearchAreaHalo( Session::getSliceHeight()*3 ); - cmess2 << " ripup:" << netCount; + cmess2 << " ripup:" << setw(4) << netCount << right; stopMeasures(); cmess2 << " " << setw(10) << Timer::getStringTime (getTimer().getCombTime()) << " " << setw( 6) << Timer::getStringMemory(getTimer().getIncrease()) << endl; diff --git a/katana/src/GraphicKatanaEngine.cpp b/katana/src/GraphicKatanaEngine.cpp index 228b7bc4..5f4a70bb 100644 --- a/katana/src/GraphicKatanaEngine.cpp +++ b/katana/src/GraphicKatanaEngine.cpp @@ -66,6 +66,8 @@ namespace Katana { void GraphicKatanaEngine::initGCell ( CellWidget* widget ) { widget->getDrawingPlanes().setPen( Qt::NoPen ); + KatanaEngine* katana = KatanaEngine::get( widget->getCell() ); + if (katana) katana->setDensityMode( GCell::MaxDensity ); } @@ -83,28 +85,38 @@ namespace Katana { Box bb = gcell->getBoundingBox(); QRect pixelBb = widget->dbuToScreenRect(bb); - painter.setPen ( pen ); - painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) ); - painter.drawRect( pixelBb ); - if (gcell->isFlat()) return; - if (pixelBb.width() > 150) { - QString text = QString("id:%1").arg(gcell->getId()); - QFont font = Graphics::getFixedFont( QFont::Bold ); - painter.setFont(font); + if (GCell::getDisplayMode() == GCell::Density) { + unsigned int density = (unsigned int)( 255.0 * gcell->getDensity() ); + if (density > 255) density = 255; - pen.setWidth( 1 ); - painter.setPen( pen ); + painter.setBrush( Graphics::getColorScale( ColorScale::Fire ).getBrush( density, widget->getDarkening() ) ); + painter.drawRect( pixelBb ); + } else { + if (pixelBb.width() > 150) { + painter.setPen ( pen ); + painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) ); + painter.drawRect( pixelBb ); - painter.save (); - painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) ); - painter.drawRect (QRect( -75, -25, 150, 50 )); - painter.drawText (QRect( -75, -25, 150, 50 ) - , text - , QTextOption(Qt::AlignCenter) - ); - painter.restore (); + if (pixelBb.width() > 300) { + QString text = QString("id:%1").arg(gcell->getId()); + QFont font = Graphics::getFixedFont( QFont::Bold ); + painter.setFont(font); + + pen.setWidth( 1 ); + painter.setPen( pen ); + + painter.save (); + painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) ); + painter.drawRect (QRect( -75, -25, 150, 50 )); + painter.drawText (QRect( -75, -25, 150, 50 ) + , text + , QTextOption(Qt::AlignCenter) + ); + painter.restore (); + } + } } } @@ -341,7 +353,7 @@ namespace Katana { ); _viewer->addToMenu( "placeAndRoute.katana.stepByStep.globalRoute" , "Katana - &Global Route" - , "Run the Knik global router" + , "Run the Katana global router" , std::bind(&GraphicKatanaEngine::_globalRoute,this) ); _viewer->addToMenu( "placeAndRoute.katana.stepByStep.detailedRoute" diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index ab170196..21afd960 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -331,7 +331,7 @@ namespace Katana { // size_t vTracksReservedLocal = getVTracksReservedLocal(); // if (cparanoid.enabled()) { - // cparanoid << " o Post-checking Knik capacity overload h:" << hTracksReservedLocal + // cparanoid << " o Post-checking Katana capacity overload h:" << hTracksReservedLocal // << " v:." << vTracksReservedLocal << endl; // getGCellGrid()->checkEdgeOverflow( hTracksReservedLocal, vTracksReservedLocal ); // } diff --git a/katana/src/PyKatanaEngine.cpp b/katana/src/PyKatanaEngine.cpp index 93701877..8222a1da 100644 --- a/katana/src/PyKatanaEngine.cpp +++ b/katana/src/PyKatanaEngine.cpp @@ -312,7 +312,7 @@ extern "C" { , { "getToolSuccess" , (PyCFunction)PyKatanaEngine_getToolSuccess , METH_NOARGS , "Returns True if the detailed routing has been successful." } , { "runGlobalRouter" , (PyCFunction)PyKatanaEngine_runGlobalRouter , METH_VARARGS - , "Run the global router (Knik)." } + , "Run the global router (Katana)." } , { "loadGlobalRouting" , (PyCFunction)PyKatanaEngine_loadGlobalRouting , METH_VARARGS , "Load global routing into the detailed router." } , { "layerAssign" , (PyCFunction)PyKatanaEngine_layerAssign , METH_VARARGS