From 0743e3bbe44e4363d7e7f7f7ad86187867b1da16 Mon Sep 17 00:00:00 2001 From: Gabriel Gouvine Date: Sat, 10 Jun 2023 13:29:56 +0200 Subject: [PATCH] Introduce a new parameter to handle uniform density --- crlcore/python/technos/common/etesian.py | 2 + etesian/src/Configuration.cpp | 6 ++- etesian/src/EtesianEngine.cpp | 47 ++++++++++++++++-------- etesian/src/PyEtesianEngine.cpp | 3 ++ etesian/src/etesian/Configuration.h | 5 +++ etesian/src/etesian/EtesianEngine.h | 7 +++- 6 files changed, 52 insertions(+), 18 deletions(-) diff --git a/crlcore/python/technos/common/etesian.py b/crlcore/python/technos/common/etesian.py index 0ef454ab..c9fc6e16 100644 --- a/crlcore/python/technos/common/etesian.py +++ b/crlcore/python/technos/common/etesian.py @@ -20,6 +20,7 @@ param = Cfg.getParamDouble( 'etesian.aspectRatio' ) param.setDouble( 1.0 ) Cfg.getParamDouble ( 'etesian.spaceMargin' ).setPercentage( 0.05 ) +Cfg.getParamDouble ( 'etesian.spreadMargin' ).setPercentage( 0.05 ) Cfg.getParamBool ( 'etesian.uniformDensity' ).setBool ( False ) Cfg.getParamBool ( 'etesian.routingDriven' ).setBool ( False ) Cfg.getParamString ( 'etesian.feedNames' ).setString ( 'tie_x0,rowend_x0' ) @@ -45,6 +46,7 @@ layout.addTab ( 'Etesian', 'etesian' ) layout.addTitle ( 'Etesian', 'Placement area' ) layout.addParameter( 'Etesian', 'etesian.aspectRatio' , 'Aspect Ratio, X/Y (%)', 0 ) layout.addParameter( 'Etesian', 'etesian.spaceMargin' , 'Space Margin' , 1 ) +layout.addParameter( 'Etesian', 'etesian.spreadMargin' , 'Threshold before spreading', 1 ) layout.addRule ( 'Etesian' ) layout.addTitle ( 'Etesian', 'Etesian - Placer') layout.addParameter( 'Etesian', 'etesian.uniformDensity', 'Uniform density' , 0 ) diff --git a/etesian/src/Configuration.cpp b/etesian/src/Configuration.cpp index 0dc03f5e..caff18bc 100644 --- a/etesian/src/Configuration.cpp +++ b/etesian/src/Configuration.cpp @@ -60,6 +60,7 @@ namespace Etesian { , _spreadingConf ( Cfg::getParamBool ("etesian.uniformDensity" , false )->asBool()? ForceUniform : MaxDensity ) , _routingDriven ( Cfg::getParamBool ("etesian.routingDriven" , false )->asBool()) , _spaceMargin ( Cfg::getParamPercentage("etesian.spaceMargin" , 5.0)->asDouble() ) + , _spreadMargin ( Cfg::getParamPercentage("etesian.spreadMargin" , 5.0)->asDouble() ) , _aspectRatio ( Cfg::getParamPercentage("etesian.aspectRatio" ,100.0)->asDouble() ) , _tieName ( Cfg::getParamString ("etesian.tieName" ,"tie_x0" )->asString() ) , _feedNames ( Cfg::getParamString ("etesian.feedNames" ,"tie_x0,rowend_x0")->asString() ) @@ -107,6 +108,7 @@ namespace Etesian { , _updateConf ( other._updateConf ) , _spreadingConf ( other._spreadingConf ) , _spaceMargin ( other._spaceMargin ) + , _spreadMargin ( other._spreadMargin ) , _aspectRatio ( other._aspectRatio ) , _tieName ( other._tieName ) , _feedNames ( other._feedNames ) @@ -141,6 +143,7 @@ namespace Etesian { cmess1 << Dots::asInt (" - Spreading Conf" ,_spreadingConf ) << endl; cmess1 << Dots::asBool (" - Routing driven" ,_routingDriven ) << endl; cmess1 << Dots::asPercentage(" - Space Margin" ,_spaceMargin ) << endl; + cmess1 << Dots::asPercentage(" - Spread Margin" ,_spreadMargin ) << endl; cmess1 << Dots::asPercentage(" - Aspect Ratio" ,_aspectRatio ) << endl; cmess1 << Dots::asString (" - Bloat model" ,_bloat ) << endl; cmess1 << Dots::asString (" - Antenna gate Max. WL" ,DbU::getValueString(_antennaGateMaxWL )) << endl; @@ -172,8 +175,9 @@ namespace Etesian { record->add ( getSlot( "_updateConf" , (int)_updateConf ) ); record->add ( getSlot( "_spreadingConf" , (int)_spreadingConf ) ); record->add ( getSlot( "_spaceMargin" , _spaceMargin ) ); + record->add ( getSlot( "_spreadMargin" , _spreadMargin ) ); record->add ( getSlot( "_aspectRatio" , _aspectRatio ) ); - record->add ( getSlot( "_tieName" , _tieName ) ); + record->add ( getSlot( "_tieName" , _tieName ) ); record->add ( getSlot( "_feedNames" , _feedNames ) ); record->add ( getSlot( "_diodeName" , _diodeName ) ); record->add ( getSlot( "_spareBufferName" , _spareBufferName ) ); diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index e917055f..ecaee7ed 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -539,7 +539,7 @@ namespace Etesian { if (masterCell->getAbutmentBox().getHeight() != getSliceHeight()) { cmess2 << " - Using as block: " << occurrence.getCompactString() << "." << endl; - + // TODO: block instances and multi-row cells are manageable in Coloquinte now cerr << Error( "EtesianEngine::setDefaultAb(): Block instances are not managed, \"%s\"." , getString(instance->getName()).c_str() ) << endl; } @@ -710,8 +710,6 @@ namespace Etesian { DbU::Unit sliceHeight = getSliceHeight(); bool isFlexLib = (getGauge()->getName() == "FlexLib"); - // TODO: Density densityConf = getSpreadingConf(); - CRL::Histogram stdCellSizes ( 0.0, 1.0, 2 ); stdCellSizes.setTitle ( "Width" , 0 ); stdCellSizes.setColor ( "green" , 0 ); @@ -872,27 +870,26 @@ namespace Etesian { } } + double spaceMargin = getSpaceMargin(); + double spreadMargin = getSpreadMargin(); + Density densityConf = getSpreadingConf(); + double bloatFactor = 1.0; + if (densityConf == Density::ForceUniform) { + bloatFactor += std::max(spaceMargin - spreadMargin, 0.0); + cmess1 << " - Cells inflated by " << bloatFactor << endl; + } + for ( Occurrence occurrence : getCell()->getTerminalNetlistInstanceOccurrences(getBlockInstance()) ) { if (instanceId >= instancesNb) { + // This will be an error ++instanceId; continue; } + _checkNotAFeed(occurrence); Instance* instance = static_cast(occurrence.getEntity()); Cell* masterCell = instance->getMasterCell(); - if (CatalogExtension::isFeed(masterCell)) { - string feedName = getString( instance->getName() ); - if ( (feedName.substr(0,11) != "spare_feed_") - or (not instance->isFixed())) { - string instanceName = occurrence.getCompactString(); - // Remove the enclosing brackets... - instanceName.erase( 0, 1 ); - instanceName.erase( instanceName.size()-1 ); - throw Error( "EtesianEngine::toColoquinte(): Feed instance \"%s\" found." - , instanceName.c_str() ); - } - } stdCellSizes.addSample( (float)(masterCell->getAbutmentBox().getWidth() / hpitch), 0 ); Box instanceAb = _bloatCells.getAb( occurrence ); @@ -913,6 +910,9 @@ namespace Etesian { if (isFlexLib and not instance->isFixed() and (masterName == "buf_x8")) ++xsize; + // Take bloat into account to compute the size + xsize *= bloatFactor; + cellX[instanceId] = xpos; cellY[instanceId] = ypos; cellWidth[instanceId] = xsize; @@ -1336,6 +1336,23 @@ namespace Etesian { return os.str(); } + void EtesianEngine::_checkNotAFeed( Occurrence occurrence ) const { + Instance* instance = static_cast(occurrence.getEntity()); + Cell* masterCell = instance->getMasterCell(); + if (CatalogExtension::isFeed(masterCell)) { + string feedName = getString( instance->getName() ); + if ( (feedName.substr(0,11) != "spare_feed_") + or (not instance->isFixed())) { + string instanceName = occurrence.getCompactString(); + // Remove the enclosing brackets... + instanceName.erase( 0, 1 ); + instanceName.erase( instanceName.size()-1 ); + throw Error( "EtesianEngine::toColoquinte(): Feed instance \"%s\" found." + , instanceName.c_str() ); + } + } + } + string EtesianEngine::_getTypeName () const { return "Etesian::EtesianEngine"; } diff --git a/etesian/src/PyEtesianEngine.cpp b/etesian/src/PyEtesianEngine.cpp index f51d0e98..62710be6 100644 --- a/etesian/src/PyEtesianEngine.cpp +++ b/etesian/src/PyEtesianEngine.cpp @@ -81,6 +81,7 @@ extern "C" { DirectSetLongAttribute (PyEtesianEngine_setFixedAbHeight,setFixedAbHeight,PyEtesianEngine,EtesianEngine) DirectSetLongAttribute (PyEtesianEngine_setFixedAbWidth ,setFixedAbWidth ,PyEtesianEngine,EtesianEngine) DirectSetDoubleAttribute (PyEtesianEngine_setSpaceMargin ,setSpaceMargin ,PyEtesianEngine,EtesianEngine) + DirectSetDoubleAttribute (PyEtesianEngine_setSpreadMargin ,setSpreadMargin ,PyEtesianEngine,EtesianEngine) DirectSetDoubleAttribute (PyEtesianEngine_setAspectRatio ,setAspectRatio ,PyEtesianEngine,EtesianEngine) DirectGetLongAttribute (PyEtesianEngine_getFixedAbHeight,getFixedAbHeight,PyEtesianEngine,EtesianEngine) DirectGetLongAttribute (PyEtesianEngine_getFixedAbWidth ,getFixedAbWidth ,PyEtesianEngine,EtesianEngine) @@ -273,6 +274,8 @@ extern "C" { , "Use this width when computing the size of the default abutment box (disable aspect ratio)." } , { "setSpaceMargin" , (PyCFunction)PyEtesianEngine_setSpaceMargin , METH_VARARGS , "Override the configuration space margin parameter value." } + , { "setSpreadMargin" , (PyCFunction)PyEtesianEngine_setSpreadMargin , METH_VARARGS + , "Override the configuration spread margin parameter value." } , { "setAspectRatio" , (PyCFunction)PyEtesianEngine_setAspectRatio , METH_VARARGS , "Override the configuration aspect ratio parameter value." } , { "resetPlacement" , (PyCFunction)PyEtesianEngine_resetPlacement , METH_NOARGS diff --git a/etesian/src/etesian/Configuration.h b/etesian/src/etesian/Configuration.h index 1df1b992..047cf160 100644 --- a/etesian/src/etesian/Configuration.h +++ b/etesian/src/etesian/Configuration.h @@ -66,6 +66,7 @@ namespace Etesian { inline Density getSpreadingConf () const; inline bool getRoutingDriven () const; inline double getSpaceMargin () const; + inline double getSpreadMargin () const; inline double getAspectRatio () const; inline string getTieName () const; inline string getFeedNames () const; @@ -76,6 +77,7 @@ namespace Etesian { inline DbU::Unit getAntennaGateMaxWL () const; inline DbU::Unit getAntennaDiodeMaxWL () const; inline void setSpaceMargin ( double ); + inline void setSpreadMargin ( double ); inline void setAspectRatio ( double ); void print ( Cell* ) const; Record* _getRecord () const; @@ -90,6 +92,7 @@ namespace Etesian { Density _spreadingConf; bool _routingDriven; double _spaceMargin; + double _spreadMargin; double _aspectRatio; string _tieName; string _feedNames; @@ -112,6 +115,7 @@ namespace Etesian { inline Density Configuration::getSpreadingConf () const { return _spreadingConf; } inline bool Configuration::getRoutingDriven () const { return _routingDriven; } inline double Configuration::getSpaceMargin () const { return _spaceMargin; } + inline double Configuration::getSpreadMargin () const { return _spreadMargin; } inline double Configuration::getAspectRatio () const { return _aspectRatio; } inline string Configuration::getTieName () const { return _tieName; } inline string Configuration::getFeedNames () const { return _feedNames; } @@ -122,6 +126,7 @@ namespace Etesian { inline DbU::Unit Configuration::getAntennaGateMaxWL () const { return _antennaGateMaxWL; } inline DbU::Unit Configuration::getAntennaDiodeMaxWL () const { return _antennaDiodeMaxWL; } inline void Configuration::setSpaceMargin ( double margin ) { _spaceMargin = margin; } + inline void Configuration::setSpreadMargin ( double margin ) { _spreadMargin = margin; } inline void Configuration::setAspectRatio ( double ratio ) { _aspectRatio = ratio; } diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index 22533497..85d484b6 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -92,6 +92,7 @@ namespace Etesian { inline GraphicUpdate getUpdateConf () const; inline Density getSpreadingConf () const; inline double getSpaceMargin () const; + inline double getSpreadMargin () const; inline double getAspectRatio () const; inline DbU::Unit getAntennaGateMaxWL () const; inline DbU::Unit getAntennaDiodeMaxWL () const; @@ -112,6 +113,7 @@ namespace Etesian { inline void setFixedAbHeight ( DbU::Unit ); inline void setFixedAbWidth ( DbU::Unit ); inline void setSpaceMargin ( double ); + inline void setSpreadMargin ( double ); inline void setAspectRatio ( double ); void setDefaultAb (); void adjustSliceHeight (); @@ -189,8 +191,7 @@ namespace Etesian { Instance* _createDiode ( Cell* ); void _updatePlacement ( const coloquinte::PlacementSolution*, uint32_t flags=0 ); void _coloquinteCallback(coloquinte::PlacementStep step); - void _progressReport1 ( string label ) const; - void _progressReport2 ( string label ) const; + void _checkNotAFeed ( Occurrence occurrence ) const; }; @@ -209,6 +210,7 @@ namespace Etesian { inline GraphicUpdate EtesianEngine::getUpdateConf () const { return getConfiguration()->getUpdateConf(); } inline Density EtesianEngine::getSpreadingConf () const { return getConfiguration()->getSpreadingConf(); } inline double EtesianEngine::getSpaceMargin () const { return getConfiguration()->getSpaceMargin(); } + inline double EtesianEngine::getSpreadMargin () const { return getConfiguration()->getSpreadMargin(); } inline double EtesianEngine::getAspectRatio () const { return getConfiguration()->getAspectRatio(); } inline DbU::Unit EtesianEngine::getAntennaGateMaxWL () const { return getConfiguration()->getAntennaGateMaxWL(); } inline DbU::Unit EtesianEngine::getAntennaDiodeMaxWL () const { return getConfiguration()->getAntennaDiodeMaxWL(); } @@ -224,6 +226,7 @@ namespace Etesian { inline void EtesianEngine::setFixedAbHeight ( DbU::Unit abHeight ) { _fixedAbHeight = abHeight; } inline void EtesianEngine::setFixedAbWidth ( DbU::Unit abWidth ) { _fixedAbWidth = abWidth; } inline void EtesianEngine::setSpaceMargin ( double margin ) { getConfiguration()->setSpaceMargin(margin); } + inline void EtesianEngine::setSpreadMargin ( double margin ) { getConfiguration()->setSpreadMargin(margin); } inline void EtesianEngine::setAspectRatio ( double ratio ) { getConfiguration()->setAspectRatio(ratio); } inline DbU::Unit EtesianEngine::toDbU ( int64_t v ) const { return v*getSliceStep(); } inline uint32_t EtesianEngine::_getNewDiodeId () { return _diodeCount++; }