From 1ccb9c340fad6d492a8a438a5d5b46c02de55f2c Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 16 Jun 2020 21:39:10 +0200 Subject: [PATCH] Add setters for space margin and aspect ratio in Etesian. * Change: In EtesianEngine, add setters for space margin and aspect ratio. Export them in Python. --- etesian/src/EtesianEngine.cpp | 5 ++--- etesian/src/PyEtesianEngine.cpp | 8 +++++++- etesian/src/etesian/Configuration.h | 4 ++++ etesian/src/etesian/EtesianEngine.h | 15 +++++++-------- etesian/src/etesian/PyEtesianEngine.h | 10 +++------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index 1875f304..48d8867c 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -548,9 +548,8 @@ namespace Etesian { topTransformation.applyOn( topAb ); size_t instancesNb = getCell()->getTerminalNetlistInstanceOccurrences(getBlockInstance()).getSize(); - if (not instancesNb) { - cerr << Error( "EtesianEngine::toColoquinte(): No instance to place. We're gonna crash..." ) << endl; - } + if (not instancesNb) + throw Error( "EtesianEngine::toColoquinte(): No instance to place." ); // Coloquinte circuit description data-structures. // One dummy fixed instance at the end diff --git a/etesian/src/PyEtesianEngine.cpp b/etesian/src/PyEtesianEngine.cpp index 150e6578..57be780d 100644 --- a/etesian/src/PyEtesianEngine.cpp +++ b/etesian/src/PyEtesianEngine.cpp @@ -69,7 +69,9 @@ extern "C" { DirectVoidMethod(EtesianEngine,etesian,setDefaultAb) DirectVoidMethod(EtesianEngine,etesian,resetPlacement) - DirectSetLongAttribute(PyEtesianEngine_setFixedAbHeight,setFixedAbHeight,PyEtesianEngine,EtesianEngine) + DirectSetLongAttribute (PyEtesianEngine_setFixedAbHeight,setFixedAbHeight,PyEtesianEngine,EtesianEngine) + DirectSetDoubleAttribute(PyEtesianEngine_setSpaceMargin ,setSpaceMargin ,PyEtesianEngine,EtesianEngine) + DirectSetDoubleAttribute(PyEtesianEngine_setAspectRatio ,setAspectRatio ,PyEtesianEngine,EtesianEngine) static PyObject* PyEtesianEngine_get ( PyObject*, PyObject* args ) @@ -211,6 +213,10 @@ extern "C" { , "Compute and set the abutment box using the aspect ratio and the space margin." } , { "setFixedAbHeight" , (PyCFunction)PyEtesianEngine_setFixedAbHeight , METH_VARARGS , "Use this height 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." } + , { "setAspectRatio" , (PyCFunction)PyEtesianEngine_setAspectRatio , METH_VARARGS + , "Override the configuration aspect ratio parameter value." } , { "resetPlacement" , (PyCFunction)PyEtesianEngine_resetPlacement , METH_NOARGS , "Compute and set the abutment box using the aspect ratio and the space margin." } , { "place" , (PyCFunction)PyEtesianEngine_place , METH_NOARGS diff --git a/etesian/src/etesian/Configuration.h b/etesian/src/etesian/Configuration.h index a36c21b9..67749b58 100644 --- a/etesian/src/etesian/Configuration.h +++ b/etesian/src/etesian/Configuration.h @@ -74,6 +74,8 @@ namespace Etesian { inline double getAspectRatio () const; inline string getFeedNames () const; inline string getBloat () const; + inline void setSpaceMargin ( double ); + inline void setAspectRatio ( double ); void print ( Cell* ) const; Record* _getRecord () const; string _getString () const; @@ -106,6 +108,8 @@ namespace Etesian { inline double Configuration::getAspectRatio () const { return _aspectRatio; } inline string Configuration::getFeedNames () const { return _feedNames; } inline string Configuration::getBloat () const { return _bloat; } + inline void Configuration::setSpaceMargin ( double margin ) { _spaceMargin = margin; } + inline void Configuration::setAspectRatio ( double ratio ) { _aspectRatio = ratio; } } // Etesian namespace. diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index 1f45cf09..6fde1097 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -1,22 +1,20 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2014-2018, All Rights Reserved +// Copyright (c) SU 2014-2020, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | E t e s i a n - A n a l y t i c P l a c e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./etesian/EtesianEngine.h" | // +-----------------------------------------------------------------+ -#ifndef ETESIAN_ETESIAN_ENGINE_H -#define ETESIAN_ETESIAN_ENGINE_H - +#pragma once #include #include #include "coloquinte/circuit.hxx" @@ -82,6 +80,8 @@ namespace Etesian { inline Instance* getBlockInstance () const; inline void setBlock ( Instance* ); inline void setFixedAbHeight ( DbU::Unit ); + inline void setSpaceMargin ( double ); + inline void setAspectRatio ( double ); void setDefaultAb (); void adjustSliceHeight (); void resetPlacement (); @@ -161,6 +161,8 @@ namespace Etesian { inline Instance* EtesianEngine::getBlockInstance () const { return _block; } inline void EtesianEngine::setBlock ( Instance* block ) { _block = block; _placed = _block->getMasterCell()->isPlaced(); } inline void EtesianEngine::setFixedAbHeight ( DbU::Unit abHeight ) { _fixedAbHeight = abHeight; } + inline void EtesianEngine::setSpaceMargin ( double margin ) { getConfiguration()->setSpaceMargin(margin); } + inline void EtesianEngine::setAspectRatio ( double ratio ) { getConfiguration()->setAspectRatio(ratio); } // Variables. extern const char* missingEtesian; @@ -170,6 +172,3 @@ namespace Etesian { INSPECTOR_P_SUPPORT(Etesian::EtesianEngine); - - -#endif // ETESIAN_ETESIAN_ENGINE_H diff --git a/etesian/src/etesian/PyEtesianEngine.h b/etesian/src/etesian/PyEtesianEngine.h index 00823ca7..e1ef67ac 100644 --- a/etesian/src/etesian/PyEtesianEngine.h +++ b/etesian/src/etesian/PyEtesianEngine.h @@ -2,22 +2,20 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2014-2018, All Rights Reserved +// Copyright (c) SU/LIP6 2014-2020, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | // | E t e s i a n - A n a l y t i c P l a c e r | // | | // | Author : Jean-Paul CHAPUT | -// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | // | C++ Header : "./etesian/PyEtesianEngine.cpp" | // +-----------------------------------------------------------------+ -#ifndef PY_ETESIAN_ENGINE_H -#define PY_ETESIAN_ENGINE_H - +#pragma once #include "hurricane/isobar/PyHurricane.h" #include "crlcore/PyToolEngine.h" #include "etesian/EtesianEngine.h" @@ -55,5 +53,3 @@ extern "C" { } // extern "C". } // Etesian namespace. - -#endif // PY_ETESIAN_ENGINE_H