From e51ff95337f4ca909a745c71ad385622e24f316e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 26 Nov 2017 20:31:38 +0100 Subject: [PATCH] Support for non-square routing pitch. Allow loading of "foreign" cells. * New: In CRL Core, AllianceFramework::getCell(), adds a new Catalog::State flags to request the loading of a "foreign" cell. That is, a Cell which is *not* in the Alliance libraries, but in *any* library starting from the root library. This is a temporary hack to allow the Blif parser to run. * New: In CRL Core, RoutingGauge::getHorizontalGauge() and RoutingGauge::getVerticalGauge() to avoid relying on either metal names or depth to know the vertical and horizontal default routing informations. They return the metal layers gauges *closests* to the substrate which are likely to have the lesser pitch. * New: In CRL Core, BlifParser, new configuration parameters: "etesian.cell.zero" & "etesian.cell.one" to figure out what are the tielow and tiehigh cells (instead of having the ones from sxlib hardwired). * New: In Etesian, add support for non-square routing pitchs, that is, the lowest vertical and horizontal pitches are not equal. Needs to work with two pitches (H & V) instead of one. The Configuration associated class now also provides the RoutingGauge (not only the CellGauge). Use a new Configuration setting "etesian.feedNames" to set up the names of the filler cells. This a string of comma separated cell names. * New: In Anabatic, Session::_getNearestGridPoint(), use the new non-square grid scheme. --- anabatic/src/Session.cpp | 4 +- crlcore/python/coriolisInit.py | 7 +- crlcore/src/ccore/AllianceFramework.cpp | 4 + crlcore/src/ccore/RoutingGauge.cpp | 21 ++++- crlcore/src/ccore/blif/BlifParser.cpp | 20 +++-- crlcore/src/ccore/crlcore/Catalog.h | 1 + crlcore/src/ccore/crlcore/RoutingGauge.h | 93 ++++++++++---------- crlcore/src/ccore/lefdef/LefImport.cpp | 2 +- crlcore/src/pyCRL/PyRoutingGauge.cpp | 58 ++++++++++--- etesian/src/AddFeeds.cpp | 2 +- etesian/src/Configuration.cpp | 49 ++++++----- etesian/src/EtesianEngine.cpp | 92 ++++++++++++-------- etesian/src/FeedCells.cpp | 2 +- etesian/src/etesian/Configuration.h | 12 ++- etesian/src/etesian/EtesianEngine.h | 105 ++++++++++++----------- 15 files changed, 288 insertions(+), 184 deletions(-) diff --git a/anabatic/src/Session.cpp b/anabatic/src/Session.cpp index 9e996b53..06852819 100644 --- a/anabatic/src/Session.cpp +++ b/anabatic/src/Session.cpp @@ -341,7 +341,7 @@ namespace Anabatic { { Box ab = _anabatic->getCell()->getAbutmentBox(); - RoutingLayerGauge* lg = _routingGauge->getLayerGauge( 1 ); + RoutingLayerGauge* lg = _routingGauge->getVerticalGauge(); DbU::Unit x = lg->getTrackPosition( ab.getXMin() , lg->getTrackIndex( ab.getXMin() , ab.getXMax() @@ -350,7 +350,7 @@ namespace Anabatic { if (x < constraint.getXMin()) x += lg->getPitch(); if (x > constraint.getXMax()) x -= lg->getPitch(); - lg = _routingGauge->getLayerGauge( 2 ); + lg = _routingGauge->getHorizontalGauge(); DbU::Unit y = lg->getTrackPosition( ab.getYMin() , lg->getTrackIndex( ab.getYMin() , ab.getYMax() diff --git a/crlcore/python/coriolisInit.py b/crlcore/python/coriolisInit.py index c5cc34d4..14ea3af0 100644 --- a/crlcore/python/coriolisInit.py +++ b/crlcore/python/coriolisInit.py @@ -130,12 +130,7 @@ def coriolisConfigure(): print ' - Loading \"%s\".' % helpers.truncPath(confFile) execfile(confFile,moduleGlobals) except Exception, e: - print '[ERROR] An exception occured while loading the configuration file:' - print ' <%s>\n' % (confFile) - print ' You should check for simple python errors in this file.' - print ' Error was:' - print ' %s\n' % e - print ' Trying to continue anyway...' + helpers.showPythonTrace( confFile, e ) for symbol, loader, loaderFlags in confHelpers: if moduleGlobals.has_key(symbol): diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index 65ec28b8..11ec56fe 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -411,6 +411,10 @@ namespace CRL { if ( state->getCell() ) state->getCell()->destroy (); _catalog.deleteState ( name ); + // Last resort, search through all Hurricane libraries. + if (mode & Catalog::State::Foreign) + return DataBase::getDB()->getCell( name ); + return NULL; } diff --git a/crlcore/src/ccore/RoutingGauge.cpp b/crlcore/src/ccore/RoutingGauge.cpp index e664f396..f863c460 100644 --- a/crlcore/src/ccore/RoutingGauge.cpp +++ b/crlcore/src/ccore/RoutingGauge.cpp @@ -29,7 +29,6 @@ namespace { - const char* dupLayerGauge = "RoutingGauge::AddLayerGauge() :\n\n" " Attempt to re-define layer gauge %s in routing gauge %s.\n"; @@ -118,6 +117,26 @@ namespace CRL { } + RoutingLayerGauge* RoutingGauge::getHorizontalGauge () const + { + for ( RoutingLayerGauge* gauge : _layerGauges ) { + if ( (gauge->getType() != Constant::LayerGaugeType::PinOnly) and gauge->isHorizontal() ) + return gauge; + } + return NULL; + } + + + RoutingLayerGauge* RoutingGauge::getVerticalGauge () const + { + for ( RoutingLayerGauge* gauge : _layerGauges ) { + if ( (gauge->getType() != Constant::LayerGaugeType::PinOnly) and gauge->isVertical() ) + return gauge; + } + return NULL; + } + + RoutingLayerGauge* RoutingGauge::getLayerGauge ( const Layer* layer ) const { for ( size_t i=0 ; i < _layerGauges.size() ; i++ ) { diff --git a/crlcore/src/ccore/blif/BlifParser.cpp b/crlcore/src/ccore/blif/BlifParser.cpp index e5ba5372..ea40f41c 100644 --- a/crlcore/src/ccore/blif/BlifParser.cpp +++ b/crlcore/src/ccore/blif/BlifParser.cpp @@ -24,6 +24,7 @@ #include using namespace std; +#include "vlsisapd/configuration/Configuration.h" #include "hurricane/Warning.h" #include "hurricane/Net.h" #include "hurricane/Cell.h" @@ -281,7 +282,7 @@ namespace { , _connections () , _model (NULL) { - Cell* cell = AllianceFramework::get()->getCell( modelName, Catalog::State::Views, 0 ); + Cell* cell = AllianceFramework::get()->getCell( modelName, Catalog::State::Views|Catalog::State::Foreign, 0 ); if (cell) { _model = Model::find( getString(cell->getName()) ); if (not _model) { @@ -474,9 +475,18 @@ namespace { { auto framework = AllianceFramework::get(); + static string zeroName = Cfg::getParamString("etesian.cell.zero","zero_x0")->asString(); + static string oneName = Cfg::getParamString("etesian.cell.one" , "one_x0")->asString(); + unsigned int supplyCount = 0; - Cell* zero = framework->getCell( "zero_x0", Catalog::State::Views ); - Cell* one = framework->getCell( "one_x0" , Catalog::State::Views); + Cell* zero = framework->getCell( zeroName, Catalog::State::Views|Catalog::State::Foreign ); + Cell* one = framework->getCell( oneName, Catalog::State::Views|Catalog::State::Foreign ); + + Net* masterNetZero = NULL; + for ( Net* net : zero->getNets() ) if (not net->isSupply()) { masterNetZero = net; break; } + + Net* masterNetOne = NULL; + for ( Net* net : one->getNets() ) if (not net->isSupply()) { masterNetOne = net; break; } for ( Subckt* subckt : _subckts ) { if(not subckt->getModel()) @@ -549,7 +559,7 @@ namespace { Instance* insOne = Instance::create( _cell, insName.str(), one ); Net* netOne = Net::create( _cell, insName.str() ); - insOne->getPlug( one->getNet("q") )->setNet( netOne ); + insOne->getPlug( masterNetOne )->setNet( netOne ); plug->setNet( netOne ); } @@ -559,7 +569,7 @@ namespace { Instance* insZero = Instance::create( _cell, insName.str(), zero ); Net* netZero = Net::create( _cell, insName.str() ); - insZero->getPlug( zero->getNet("nq") )->setNet( netZero ); + insZero->getPlug( masterNetZero )->setNet( netZero ); plug->setNet( netZero ); } } diff --git a/crlcore/src/ccore/crlcore/Catalog.h b/crlcore/src/ccore/crlcore/Catalog.h index 0aa32d6d..c6e2fdf7 100644 --- a/crlcore/src/ccore/crlcore/Catalog.h +++ b/crlcore/src/ccore/crlcore/Catalog.h @@ -84,6 +84,7 @@ namespace CRL { , Logical = 1 << 5 , Physical = 1 << 6 , InMemory = 1 << 7 + , Foreign = 1 << 8 , Views = Physical|Logical }; // Constructors. diff --git a/crlcore/src/ccore/crlcore/RoutingGauge.h b/crlcore/src/ccore/crlcore/RoutingGauge.h index 80e3d1b9..48a57b10 100644 --- a/crlcore/src/ccore/crlcore/RoutingGauge.h +++ b/crlcore/src/ccore/crlcore/RoutingGauge.h @@ -1,14 +1,14 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2016, All Rights Reserved +// Copyright (c) UPMC 2008-2016, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./crlcore/RoutingGauge.h" | // +-----------------------------------------------------------------+ @@ -17,9 +17,6 @@ #ifndef CRL_ROUTING_GAUGE_H #define CRL_ROUTING_GAUGE_H - -class QXmlSteamReader; - #include #include #include "hurricane/Name.h" @@ -54,37 +51,41 @@ namespace CRL { // Constants. static const size_t nlayerdepth; // Constructors & Destructors. - static RoutingGauge* create ( const char* name ); - virtual void destroy (); - // Accessors. - RoutingGauge* getClone () const; - inline const Name getName () const; - inline Technology* getTechnology () const; - inline size_t getDepth () const; - RoutingLayerGauge* getLayerGauge ( const Layer* ) const; - size_t getViaDepth ( const Layer* ) const; - size_t getLayerDepth ( const Layer* ) const; - unsigned int getLayerType ( const Layer* ) const; - unsigned int getLayerDirection ( const Layer* ) const; - RoutingLayerGauge* getLayerGauge ( size_t depth ) const; - inline unsigned int getLayerDirection ( size_t depth ) const; - inline unsigned int getLayerType ( size_t depth ) const; - inline DbU::Unit getLayerPitch ( size_t depth ) const; - inline DbU::Unit getLayerOffset ( size_t depth ) const; - inline DbU::Unit getLayerWireWidth ( size_t depth ) const; - inline DbU::Unit getViaWidth ( size_t depth ) const; - const Layer* getRoutingLayer ( size_t depth ) const; - Layer* getContactLayer ( size_t depth ) const; - const vector& - getLayerGauges () const; - // Methods. - void addLayerGauge ( RoutingLayerGauge* layerGauge ); - void checkConnexity () const; - // Hurricane Managment. - void toJson ( JsonWriter* ) const; - virtual Record* _getRecord ( Record* record=NULL ) const; - virtual string _getString () const; - virtual string _getTypeName () const; + static RoutingGauge* create ( const char* name ); + virtual void destroy (); + // Accessors. + RoutingGauge* getClone () const; + inline const Name getName () const; + inline Technology* getTechnology () const; + inline size_t getDepth () const; + inline DbU::Unit getHorizontalPitch () const; + inline DbU::Unit getVerticalPitch () const; + RoutingLayerGauge* getHorizontalGauge () const; + RoutingLayerGauge* getVerticalGauge () const; + RoutingLayerGauge* getLayerGauge ( const Layer* ) const; + size_t getViaDepth ( const Layer* ) const; + size_t getLayerDepth ( const Layer* ) const; + unsigned int getLayerType ( const Layer* ) const; + unsigned int getLayerDirection ( const Layer* ) const; + RoutingLayerGauge* getLayerGauge ( size_t depth ) const; + inline unsigned int getLayerDirection ( size_t depth ) const; + inline unsigned int getLayerType ( size_t depth ) const; + inline DbU::Unit getLayerPitch ( size_t depth ) const; + inline DbU::Unit getLayerOffset ( size_t depth ) const; + inline DbU::Unit getLayerWireWidth ( size_t depth ) const; + inline DbU::Unit getViaWidth ( size_t depth ) const; + const Layer* getRoutingLayer ( size_t depth ) const; + Layer* getContactLayer ( size_t depth ) const; + const vector& + getLayerGauges () const; + // Methods. + void addLayerGauge ( RoutingLayerGauge* layerGauge ); + void checkConnexity () const; + // Hurricane Managment. + void toJson ( JsonWriter* ) const; + virtual Record* _getRecord ( Record* record=NULL ) const; + virtual string _getString () const; + virtual string _getTypeName () const; protected: // Internal - Attributes. @@ -102,15 +103,17 @@ namespace CRL { }; - inline const Name RoutingGauge::getName () const { return _name; } - inline size_t RoutingGauge::getDepth () const { return _layerGauges.size(); } - inline Technology* RoutingGauge::getTechnology () const { return _technology; } - inline unsigned int RoutingGauge::getLayerType ( size_t depth ) const { return getLayerGauge(depth)->getType(); } - inline unsigned int RoutingGauge::getLayerDirection ( size_t depth ) const { return getLayerGauge(depth)->getDirection(); } - inline DbU::Unit RoutingGauge::getLayerPitch ( size_t depth ) const { return getLayerGauge(depth)->getPitch(); } - inline DbU::Unit RoutingGauge::getLayerOffset ( size_t depth ) const { return getLayerGauge(depth)->getOffset(); } - inline DbU::Unit RoutingGauge::getLayerWireWidth ( size_t depth ) const { return getLayerGauge(depth)->getWireWidth(); } - inline DbU::Unit RoutingGauge::getViaWidth ( size_t depth ) const { return getLayerGauge(depth)->getViaWidth(); } + inline const Name RoutingGauge::getName () const { return _name; } + inline size_t RoutingGauge::getDepth () const { return _layerGauges.size(); } + inline Technology* RoutingGauge::getTechnology () const { return _technology; } + inline DbU::Unit RoutingGauge::getHorizontalPitch () const { return getHorizontalGauge()->getPitch(); } + inline DbU::Unit RoutingGauge::getVerticalPitch () const { return getVerticalGauge ()->getPitch(); } + inline unsigned int RoutingGauge::getLayerType ( size_t depth ) const { return getLayerGauge(depth)->getType(); } + inline unsigned int RoutingGauge::getLayerDirection ( size_t depth ) const { return getLayerGauge(depth)->getDirection(); } + inline DbU::Unit RoutingGauge::getLayerPitch ( size_t depth ) const { return getLayerGauge(depth)->getPitch(); } + inline DbU::Unit RoutingGauge::getLayerOffset ( size_t depth ) const { return getLayerGauge(depth)->getOffset(); } + inline DbU::Unit RoutingGauge::getLayerWireWidth ( size_t depth ) const { return getLayerGauge(depth)->getWireWidth(); } + inline DbU::Unit RoutingGauge::getViaWidth ( size_t depth ) const { return getLayerGauge(depth)->getViaWidth(); } // ------------------------------------------------------------------- diff --git a/crlcore/src/ccore/lefdef/LefImport.cpp b/crlcore/src/ccore/lefdef/LefImport.cpp index 0f5fffe9..5afdb15d 100644 --- a/crlcore/src/ccore/lefdef/LefImport.cpp +++ b/crlcore/src/ccore/lefdef/LefImport.cpp @@ -573,7 +573,7 @@ namespace { if (parser->getCoreSiteX() != parser->getCellGauge()->getSliceStep()) cerr << Warning( "LefParser::parse(): CRL slice step discrepency %s while LEF is %s." , DbU::getValueString(parser->getCellGauge()->getSliceStep()).c_str() - , DbU::getValueString(parser->getCoreSiteY()).c_str() ) << endl; + , DbU::getValueString(parser->getCoreSiteX()).c_str() ) << endl; } return parser->getLibrary(); diff --git a/crlcore/src/pyCRL/PyRoutingGauge.cpp b/crlcore/src/pyCRL/PyRoutingGauge.cpp index f2a9050f..6075399a 100644 --- a/crlcore/src/pyCRL/PyRoutingGauge.cpp +++ b/crlcore/src/pyCRL/PyRoutingGauge.cpp @@ -8,7 +8,7 @@ // | Alliance / Hurricane Interface | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Module : "./PyRoutingGauge.cpp" | // +-----------------------------------------------------------------+ @@ -124,6 +124,34 @@ extern "C" { } + static PyObject* PyRoutingGauge_getHorizontalPitch ( PyRoutingGauge* self, PyObject* args ) + { + cdebug_log(30,0) << "PyRoutingGauge_getHorizontalPitch()" << endl; + + DbU::Unit pitch = 0; + HTRY + METHOD_HEAD("RoutingGauge.getHorizontalPitch()") + pitch = rg->getHorizontalPitch(); + HCATCH + + return Py_BuildValue("I",pitch); + } + + + static PyObject* PyRoutingGauge_getVerticalPitch ( PyRoutingGauge* self, PyObject* args ) + { + cdebug_log(30,0) << "PyRoutingGauge_getVerticalPitch()" << endl; + + DbU::Unit pitch = 0; + HTRY + METHOD_HEAD("RoutingGauge.getVerticalPitch()") + pitch = rg->getVerticalPitch(); + HCATCH + + return Py_BuildValue("I",pitch); + } + + static PyObject* PyRoutingGauge_getLayerDepth ( PyRoutingGauge* self, PyObject* args ) { cdebug_log(30,0) << "PyRoutingGauge_getLayerDepth()" << endl; @@ -336,29 +364,33 @@ extern "C" { PyMethodDef PyRoutingGauge_Methods[] = - { { "create" , (PyCFunction)PyRoutingGauge_create , METH_VARARGS|METH_STATIC + { { "create" , (PyCFunction)PyRoutingGauge_create , METH_VARARGS|METH_STATIC , "Create a new RoutingGauge." } - , { "getName" , (PyCFunction)PyRoutingGauge_getName , METH_NOARGS + , { "getName" , (PyCFunction)PyRoutingGauge_getName , METH_NOARGS , "Return the maximum depth of the RoutingGauge." } - , { "getTechnology" , (PyCFunction)PyRoutingGauge_getTechnology , METH_NOARGS + , { "getTechnology" , (PyCFunction)PyRoutingGauge_getTechnology , METH_NOARGS , "Return the Technology we are using." } - , { "getDepth" , (PyCFunction)PyRoutingGauge_getDepth , METH_NOARGS + , { "getDepth" , (PyCFunction)PyRoutingGauge_getDepth , METH_NOARGS , "Return the maximum depth of the RoutingGauge." } - , { "getLayerDepth" , (PyCFunction)PyRoutingGauge_getLayerDepth , METH_VARARGS + , { "getHorizontalPitch" , (PyCFunction)PyRoutingGauge_getHorizontalPitch, METH_NOARGS + , "Return the horizontal pitch of the metal closest to the substrate." } + , { "getVerticalPitch" , (PyCFunction)PyRoutingGauge_getVerticalPitch , METH_NOARGS + , "Return the vertical pitch of the metal closest to the substrate." } + , { "getLayerDepth" , (PyCFunction)PyRoutingGauge_getLayerDepth , METH_VARARGS , "Return the depth of the given layer." } - , { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS + , { "getLayerGauge" , (PyCFunction)PyRoutingGauge_getLayerGauge , METH_VARARGS , "Return the RoutingLayerGauge of the given layer/depth." } - , { "getLayerDirection" , (PyCFunction)PyRoutingGauge_getLayerDirection, METH_VARARGS + , { "getLayerDirection" , (PyCFunction)PyRoutingGauge_getLayerDirection , METH_VARARGS , "Return the direction of the given layer/depth." } - , { "getLayerPitch" , (PyCFunction)PyRoutingGauge_getLayerPitch , METH_VARARGS + , { "getLayerPitch" , (PyCFunction)PyRoutingGauge_getLayerPitch , METH_VARARGS , "Return the pitch of the given layer/depth." } - , { "getRoutingLayer" , (PyCFunction)PyRoutingGauge_getRoutingLayer , METH_VARARGS + , { "getRoutingLayer" , (PyCFunction)PyRoutingGauge_getRoutingLayer , METH_VARARGS , "Return the routing layer used for the requested depth." } - , { "getContactLayer" , (PyCFunction)PyRoutingGauge_getContactLayer , METH_VARARGS + , { "getContactLayer" , (PyCFunction)PyRoutingGauge_getContactLayer , METH_VARARGS , "Return the contact layer used for the requested depth." } - , { "getLayerGauges" , (PyCFunction)PyRoutingGauge_getLayerGauges , METH_NOARGS + , { "getLayerGauges" , (PyCFunction)PyRoutingGauge_getLayerGauges , METH_NOARGS , "Return the list of RoutingLayerGauge." } - , { "addLayerGauge" , (PyCFunction)PyRoutingGauge_addLayerGauge , METH_VARARGS + , { "addLayerGauge" , (PyCFunction)PyRoutingGauge_addLayerGauge , METH_VARARGS , "Adds a new RoutingLayerGauge to the RoutingGauge." } //, { "destroy" , (PyCFunction)PyRoutingGauge_destroy , METH_VARARGS // , "Destroy the associated hurricane object. The python object remains." } diff --git a/etesian/src/AddFeeds.cpp b/etesian/src/AddFeeds.cpp index 2aa5b93d..ac6d49df 100644 --- a/etesian/src/AddFeeds.cpp +++ b/etesian/src/AddFeeds.cpp @@ -199,7 +199,7 @@ namespace { if (xtie >= xmax) break; if (xtie+feedWidth > xmax) { // Feed is too big, try to find a smaller one. - int pitch = (int)((xmax-xtie) / getEtesian()->getPitch()); + int pitch = (int)((xmax-xtie) / getEtesian()->getVerticalPitch()); for ( ; pitch > 0 ; --pitch ) { feed = getEtesian()->getFeedCells().getFeed( pitch ); feedWidth = feed->getAbutmentBox().getWidth(); diff --git a/etesian/src/Configuration.cpp b/etesian/src/Configuration.cpp index c429a8af..3ef5f9e0 100644 --- a/etesian/src/Configuration.cpp +++ b/etesian/src/Configuration.cpp @@ -14,26 +14,23 @@ // +-----------------------------------------------------------------+ -#include -#include -#include - -#include "vlsisapd/configuration/Configuration.h" -#include "hurricane/Warning.h" -#include "hurricane/Technology.h" -#include "hurricane/DataBase.h" -#include "hurricane/Cell.h" -#include "crlcore/Utilities.h" -#include "crlcore/CellGauge.h" -#include "crlcore/AllianceFramework.h" -#include "etesian/Configuration.h" -#include "etesian/EtesianEngine.h" - +#include +#include +#include +#include "vlsisapd/configuration/Configuration.h" +#include "hurricane/Warning.h" +#include "hurricane/Technology.h" +#include "hurricane/DataBase.h" +#include "hurricane/Cell.h" +#include "crlcore/Utilities.h" +#include "crlcore/CellGauge.h" +#include "crlcore/AllianceFramework.h" +#include "etesian/Configuration.h" +#include "etesian/EtesianEngine.h" namespace Etesian { - using std::cout; using std::cerr; using std::endl; @@ -51,30 +48,37 @@ namespace Etesian { // ------------------------------------------------------------------- // Class : "Etesian::Configuration". - Configuration::Configuration ( const CellGauge* cg ) - : _cg ( NULL ) + Configuration::Configuration ( const RoutingGauge* rg, const CellGauge* cg ) + : _rg ( NULL ) + , _cg ( NULL ) , _placeEffort ( static_cast (Cfg::getParamEnumerate ("etesian.effort" , Standard )->asInt()) ) , _updateConf ( static_cast (Cfg::getParamEnumerate ("etesian.graphics" , LowerBound )->asInt()) ) , _spreadingConf( Cfg::getParamBool ("etesian.uniformDensity", false )->asBool()? ForceUniform : MaxDensity ) - , _routingDriven( Cfg::getParamBool ("etesian.routingDriven", false )->asBool()) + , _routingDriven( Cfg::getParamBool ("etesian.routingDriven" , false )->asBool()) , _spaceMargin ( Cfg::getParamPercentage("etesian.spaceMargin" , 5.0)->asDouble() ) , _aspectRatio ( Cfg::getParamPercentage("etesian.aspectRatio" ,100.0)->asDouble() ) + , _feedNames ( Cfg::getParamString ("etesian.feedNames" ,"tie_x0,rowend_x0")->asString() ) { - if ( cg == NULL ) cg = AllianceFramework::get()->getCellGauge(); + if (rg == NULL) rg = AllianceFramework::get()->getRoutingGauge(); + if (cg == NULL) cg = AllianceFramework::get()->getCellGauge(); + _rg = rg->getClone(); _cg = cg->getClone(); } Configuration::Configuration ( const Configuration& other ) - : _cg (NULL) + : _rg (NULL) + , _cg (NULL) , _placeEffort ( other._placeEffort ) , _updateConf ( other._updateConf ) , _spreadingConf( other._spreadingConf ) , _spaceMargin ( other._spaceMargin ) , _aspectRatio ( other._aspectRatio ) + , _feedNames ( other._feedNames ) { - if ( other._cg ) _cg = other._cg->getClone(); + if (other._rg) _rg = other._rg->getClone(); + if (other._cg) _cg = other._cg->getClone(); } @@ -118,6 +122,7 @@ namespace Etesian { Record* Configuration::_getRecord () const { Record* record = new Record ( _getString() ); + record->add ( getSlot( "_rg" , _rg ) ); record->add ( getSlot( "_cg" , _cg ) ); record->add ( getSlot( "_placeEffort" , (int)_placeEffort ) ); record->add ( getSlot( "_updateConf" , (int)_updateConf ) ); diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index a8f0a5cf..e9d6243d 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -27,6 +27,7 @@ #include "hurricane/Error.h" #include "hurricane/Warning.h" #include "hurricane/Breakpoint.h" +#include "hurricane/DataBase.h" #include "hurricane/Layer.h" #include "hurricane/Net.h" #include "hurricane/Pad.h" @@ -143,13 +144,14 @@ namespace { Transformation toTransformation ( point position - , point orientation - , Cell* model - , DbU::Unit pitch + , point orientation + , Cell* model + , DbU::Unit hpitch + , DbU::Unit vpitch ) { - DbU::Unit tx = position.x * pitch; - DbU::Unit ty = position.y * pitch; + DbU::Unit tx = position.x * vpitch; + DbU::Unit ty = position.y * hpitch; Box cellBox = model->getAbutmentBox(); Transformation::Orientation orient = Transformation::Orientation::ID; @@ -197,6 +199,7 @@ namespace Etesian { using Hurricane::Warning; using Hurricane::Breakpoint; using Hurricane::Box; + using Hurricane::DataBase; using Hurricane::Layer; using Hurricane::Cell; using Hurricane::Instance; @@ -269,10 +272,22 @@ namespace Etesian { cmess2 << " o ISPD benchmark <" << getCell()->getName() << ">, no feed cells will be added." << endl; } else { - // Ugly: Direct uses of Alliance Framework. - // Must change toward something in the settings. - _feedCells.useFeed( AllianceFramework::get()->getCell("tie_x0" ,Catalog::State::Views) ); - _feedCells.useFeed( AllianceFramework::get()->getCell("rowend_x0",Catalog::State::Views) ); + string feedNames = getConfiguration()->getFeedNames(); + char separator = ','; + + while ( not feedNames.empty() ) { + size_t cut = feedNames.find( separator ); + if (cut != string::npos) { + _feedCells.useFeed( DataBase::getDB()->getCell( feedNames.substr(0,cut) ) ); + feedNames = feedNames.substr( cut+1 ); + } else { + _feedCells.useFeed( AllianceFramework::get()->getCell( feedNames, Catalog::State::Views|Catalog::State::Foreign ) ); + feedNames.clear(); + } + } + + //_feedCells.useFeed( AllianceFramework::get()->getCell("tie_x0" ,Catalog::State::Views) ); + //_feedCells.useFeed( AllianceFramework::get()->getCell("rowend_x0",Catalog::State::Views) ); } } @@ -358,10 +373,14 @@ namespace Etesian { static_cast(ioccurrence.getEntity())->destroy(); } + DbU::Unit abWidth = rows*getSliceHeight(); + DbU::Unit adjust = abWidth % getVerticalPitch(); + if (adjust) abWidth += getVerticalPitch() - adjust; + getCell()->setAbutmentBox( Box( DbU::fromLambda(0) , DbU::fromLambda(0) - , columns*getSliceHeight() - , rows *getSliceHeight() + , abWidth + , rows*getSliceHeight() ) ); UpdateSession::close(); if (_viewer) _viewer->getCellWidget()->fitToContents(); @@ -419,9 +438,10 @@ namespace Etesian { resetPlacement(); - Dots dots ( cmess2, " ", 80, 1000 ); - AllianceFramework* af = AllianceFramework::get(); - DbU::Unit pitch = getPitch(); + Dots dots ( cmess2, " ", 80, 1000 ); + AllianceFramework* af = AllianceFramework::get(); + DbU::Unit hpitch = getHorizontalPitch(); + DbU::Unit vpitch = getVerticalPitch(); if (not cmess2.enabled()) dots.disable(); @@ -507,11 +527,11 @@ namespace Etesian { instanceTransf.applyOn( instanceAb ); // Upper rounded - int_t xsize = (instanceAb.getWidth () + pitch -1) / pitch; - int_t ysize = (instanceAb.getHeight() + pitch -1) / pitch; + int_t xsize = (instanceAb.getWidth () + vpitch -1) / vpitch; + int_t ysize = (instanceAb.getHeight() + hpitch -1) / hpitch; // Lower rounded - int_t xpos = instanceAb.getXMin() / pitch; - int_t ypos = instanceAb.getYMin() / pitch; + int_t xpos = instanceAb.getXMin() / vpitch; + int_t ypos = instanceAb.getYMin() / hpitch; instances[instanceId].size = point( xsize, ysize ); instances[instanceId].list_index = instanceId; @@ -562,8 +582,8 @@ namespace Etesian { string insName = extractInstanceName( rp ); Point offset = extractRpOffset ( rp ); - int_t xpin = offset.getX() / pitch; - int_t ypin = offset.getY() / pitch; + int_t xpin = offset.getX() / vpitch; + int_t ypin = offset.getY() / hpitch; auto iid = _cellsToIds.find( insName ); if (iid == _cellsToIds.end() ) { @@ -577,10 +597,10 @@ namespace Etesian { } dots.finish( Dots::Reset ); - _surface = box( (int_t)(getCell()->getAbutmentBox().getXMin() / pitch) - , (int_t)(getCell()->getAbutmentBox().getXMax() / pitch) - , (int_t)(getCell()->getAbutmentBox().getYMin() / pitch) - , (int_t)(getCell()->getAbutmentBox().getYMax() / pitch) + _surface = box( (int_t)(getCell()->getAbutmentBox().getXMin() / vpitch) + , (int_t)(getCell()->getAbutmentBox().getXMax() / vpitch) + , (int_t)(getCell()->getAbutmentBox().getYMin() / hpitch) + , (int_t)(getCell()->getAbutmentBox().getYMax() / hpitch) ); _circuit = netlist( instances, nets, pins ); _circuit.selfcheck(); @@ -646,7 +666,8 @@ namespace Etesian { * * artificially expand the areas given to coloquinte * * add placement dentity constraints */ - DbU::Unit pitch = getPitch(); + DbU::Unit hpitch = getHorizontalPitch(); + DbU::Unit vpitch = getVerticalPitch(); const float densityThreshold = 0.9; KiteEngine* routingEngine = KiteEngine::get( getCell() ); @@ -664,10 +685,10 @@ namespace Etesian { coloquinte::density_limit cur; cur.box_ = coloquinte::box( - gc->getX() / pitch, - gc->getXMax() / pitch, - gc->getY() / pitch, - gc->getYMax() / pitch + gc->getX() / vpitch, + gc->getXMax() / vpitch, + gc->getY() / hpitch, + gc->getYMax() / hpitch ); cur.density_ = densityThreshold/density; _densityLimits.push_back(cur); @@ -753,7 +774,7 @@ namespace Etesian { using namespace coloquinte::gp; using namespace coloquinte::dp; - int_t sliceHeight = getSliceHeight() / getPitch(); + int_t sliceHeight = getSliceHeight() / getHorizontalPitch(); roughLegalize(sliceHeight, options); for ( int i=0; igetLeafInstanceOccurrences() ) { + DbU::Unit hpitch = getHorizontalPitch(); + DbU::Unit vpitch = getVerticalPitch(); Point instancePosition; Instance* instance = static_cast(occurrence.getEntity()); string instanceName = occurrence.getCompactString(); @@ -997,7 +1020,8 @@ namespace Etesian { Transformation trans = toTransformation( position , placement.orientations_[(*iid).second] , instance->getMasterCell() - , getPitch() + , hpitch + , vpitch ); //cerr << "Setting <" << instanceName << " @" << instancePosition << endl; diff --git a/etesian/src/FeedCells.cpp b/etesian/src/FeedCells.cpp index 4aab2bac..23a77a56 100644 --- a/etesian/src/FeedCells.cpp +++ b/etesian/src/FeedCells.cpp @@ -36,7 +36,7 @@ namespace Etesian { { if ( cell == NULL ) return; - DbU::Unit pitch = _etesian->getPitch(); + DbU::Unit pitch = _etesian->getVerticalPitch(); if (cell->getAbutmentBox().getWidth() % pitch != 0) cerr << Warning( "FeedCells::addFeed(): <%s> has not a width (%s) multiple of pitch (%s)." diff --git a/etesian/src/etesian/Configuration.h b/etesian/src/etesian/Configuration.h index 886ef08c..baef4fc4 100644 --- a/etesian/src/etesian/Configuration.h +++ b/etesian/src/etesian/Configuration.h @@ -25,6 +25,7 @@ namespace Hurricane { class Cell; } +#include "crlcore/RoutingGauge.h" #include "crlcore/CellGauge.h" @@ -37,6 +38,7 @@ namespace Etesian { using Hurricane::DbU; using Hurricane::Cell; using CRL::CellGauge; + using CRL::RoutingGauge; // ------------------------------------------------------------------- @@ -58,23 +60,26 @@ namespace Etesian { class Configuration { public: // Constructor & Destructor. - Configuration ( const CellGauge* cg=NULL ); + Configuration ( const RoutingGauge* rg=NULL, const CellGauge* cg=NULL ); ~Configuration (); Configuration* clone () const; // Methods. + inline RoutingGauge* getGauge () const; inline CellGauge* getCellGauge () const; inline Effort getPlaceEffort () const; inline GraphicUpdate getUpdateConf () const; inline Density getSpreadingConf () const; - inline bool getRoutingDriven () const; + inline bool getRoutingDriven () const; inline double getSpaceMargin () const; inline double getAspectRatio () const; + inline string getFeedNames () const; void print ( Cell* ) const; Record* _getRecord () const; string _getString () const; string _getTypeName () const; protected: // Attributes. + RoutingGauge* _rg; CellGauge* _cg; Effort _placeEffort; GraphicUpdate _updateConf; @@ -82,12 +87,14 @@ namespace Etesian { bool _routingDriven; double _spaceMargin; double _aspectRatio; + string _feedNames; private: Configuration ( const Configuration& ); Configuration& operator= ( const Configuration& ); }; + inline RoutingGauge* Configuration::getGauge () const { return _rg; } inline CellGauge* Configuration::getCellGauge () const { return _cg; } inline Effort Configuration::getPlaceEffort () const { return _placeEffort; } inline GraphicUpdate Configuration::getUpdateConf () const { return _updateConf; } @@ -95,6 +102,7 @@ namespace Etesian { inline bool Configuration::getRoutingDriven () const { return _routingDriven; } inline double Configuration::getSpaceMargin () const { return _spaceMargin; } inline double Configuration::getAspectRatio () const { return _aspectRatio; } + inline string Configuration::getFeedNames () const { return _feedNames; } } // Etesian namespace. diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index b57758e3..66dc0063 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -55,45 +55,46 @@ namespace Etesian { public: typedef ToolEngine Super; public: - static const Name& staticGetName (); - static EtesianEngine* create ( Cell* ); - static EtesianEngine* get ( const Cell* ); - public: - virtual Configuration* getConfiguration (); - virtual const Configuration* getConfiguration () const; - virtual const Name& getName () const; - inline CellGauge* getCellGauge () const; - inline DbU::Unit getPitch () const; - inline DbU::Unit getSliceHeight () const; - inline Effort getPlaceEffort () const; - inline GraphicUpdate getUpdateConf () const; - inline Density getSpreadingConf () const; - inline bool getRoutingDriven () const; - inline double getSpaceMargin () const; - inline double getAspectRatio () const; - inline const FeedCells& getFeedCells () const; - inline Hurricane::CellViewer* getViewer () const; - inline void setViewer ( Hurricane::CellViewer* ); + static const Name& staticGetName (); + static EtesianEngine* create ( Cell* ); + static EtesianEngine* get ( const Cell* ); + public: + virtual Configuration* getConfiguration (); + virtual const Configuration* getConfiguration () const; + virtual const Name& getName () const; + inline RoutingGauge* getGauge () const; + inline CellGauge* getCellGauge () const; + inline DbU::Unit getHorizontalPitch () const; + inline DbU::Unit getVerticalPitch () const; + inline DbU::Unit getSliceHeight () const; + inline Effort getPlaceEffort () const; + inline GraphicUpdate getUpdateConf () const; + inline Density getSpreadingConf () const; + inline bool getRoutingDriven () const; + inline double getSpaceMargin () const; + inline double getAspectRatio () const; + inline const FeedCells& getFeedCells () const; + inline Hurricane::CellViewer* getViewer () const; + inline void setViewer ( Hurricane::CellViewer* ); - void setDefaultAb (); - void resetPlacement (); - void toColoquinte (); - - void preplace (); - void roughLegalize ( float minDisruption, unsigned options ); - void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 ); - void detailedPlace ( int iterations, int effort, unsigned options=0 ); - void feedRoutingBack (); - - void place (); - - inline void useFeed ( Cell* ); - size_t findYSpin (); - void addFeeds (); - virtual Record* _getRecord () const; - virtual std::string _getString () const; - virtual std::string _getTypeName () const; - + void setDefaultAb (); + void resetPlacement (); + void toColoquinte (); + + void preplace (); + void roughLegalize ( float minDisruption, unsigned options ); + void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 ); + void detailedPlace ( int iterations, int effort, unsigned options=0 ); + void feedRoutingBack (); + + void place (); + + inline void useFeed ( Cell* ); + size_t findYSpin (); + void addFeeds (); + virtual Record* _getRecord () const; + virtual std::string _getString () const; + virtual std::string _getTypeName () const; private: // Attributes. static Name _toolName; @@ -130,19 +131,21 @@ namespace Etesian { // Inline Functions. - inline void EtesianEngine::setViewer ( Hurricane::CellViewer* viewer ) { _viewer = viewer; } - inline Hurricane::CellViewer* EtesianEngine::getViewer () const { return _viewer; } - inline CellGauge* EtesianEngine::getCellGauge () const { return getConfiguration()->getCellGauge(); } - inline DbU::Unit EtesianEngine::getPitch () const { return getCellGauge()->getPitch(); } - inline DbU::Unit EtesianEngine::getSliceHeight () const { return getCellGauge()->getSliceHeight(); } - inline Effort EtesianEngine::getPlaceEffort () const { return getConfiguration()->getPlaceEffort(); } - inline GraphicUpdate EtesianEngine::getUpdateConf () const { return getConfiguration()->getUpdateConf(); } - inline Density EtesianEngine::getSpreadingConf () const { return getConfiguration()->getSpreadingConf(); } - inline bool EtesianEngine::getRoutingDriven () const { return getConfiguration()->getRoutingDriven(); } - inline double EtesianEngine::getSpaceMargin () const { return getConfiguration()->getSpaceMargin(); } - inline double EtesianEngine::getAspectRatio () const { return getConfiguration()->getAspectRatio(); } - inline void EtesianEngine::useFeed ( Cell* cell ) { _feedCells.useFeed(cell); } - inline const FeedCells& EtesianEngine::getFeedCells () const { return _feedCells; } + inline void EtesianEngine::setViewer ( Hurricane::CellViewer* viewer ) { _viewer = viewer; } + inline Hurricane::CellViewer* EtesianEngine::getViewer () const { return _viewer; } + inline RoutingGauge* EtesianEngine::getGauge () const { return getConfiguration()->getGauge(); } + inline CellGauge* EtesianEngine::getCellGauge () const { return getConfiguration()->getCellGauge(); } + inline DbU::Unit EtesianEngine::getHorizontalPitch () const { return getGauge()->getHorizontalPitch(); } + inline DbU::Unit EtesianEngine::getVerticalPitch () const { return getGauge()->getVerticalPitch(); } + inline DbU::Unit EtesianEngine::getSliceHeight () const { return getCellGauge()->getSliceHeight(); } + inline Effort EtesianEngine::getPlaceEffort () const { return getConfiguration()->getPlaceEffort(); } + inline GraphicUpdate EtesianEngine::getUpdateConf () const { return getConfiguration()->getUpdateConf(); } + inline Density EtesianEngine::getSpreadingConf () const { return getConfiguration()->getSpreadingConf(); } + inline bool EtesianEngine::getRoutingDriven () const { return getConfiguration()->getRoutingDriven(); } + inline double EtesianEngine::getSpaceMargin () const { return getConfiguration()->getSpaceMargin(); } + inline double EtesianEngine::getAspectRatio () const { return getConfiguration()->getAspectRatio(); } + inline void EtesianEngine::useFeed ( Cell* cell ) { _feedCells.useFeed(cell); } + inline const FeedCells& EtesianEngine::getFeedCells () const { return _feedCells; } // Variables.