Enable Etesian to compute AB of fixed width.

* New: In EtesianEngine::setDefaultAb(), add computation of AB when
    using fixed width (fixed height) was already available.
      Add attribute management for the fixed width along with a
    Python export.
This commit is contained in:
Jean-Paul Chaput 2020-08-02 18:15:15 +02:00
parent 5498ad9ecb
commit d6b90a70ab
3 changed files with 29 additions and 6 deletions

View File

@ -268,6 +268,7 @@ namespace Etesian {
, _yspinSlice0 (0)
, _sliceHeight (0)
, _fixedAbHeight(0)
, _fixedAbWidth (0)
{
}
@ -408,11 +409,15 @@ namespace Etesian {
}
double rows = 0.0;
//setFixedAbHeight( 0 );
double columns = 0.0;
if (not getFixedAbWidth()) {
if (getFixedAbHeight()) rows = getFixedAbHeight() / getSliceHeight();
else rows = std::ceil( sqrt( gcellLength/aspectRatio ) );
double columns = std::ceil( gcellLength / rows );
columns = std::ceil( gcellLength / rows );
} else {
columns = getFixedAbWidth() / getSliceHeight();
rows = std::ceil( gcellLength / columns );
}
UpdateSession::open();
for ( auto occurrence : feedOccurrences ) {
@ -435,6 +440,10 @@ namespace Etesian {
<< "% aspect ratio:" << (aspectRatio*100.0)
<< "% g-length:" << (cellLength/DbU::toLambda(getSliceHeight()))
<< ")" << endl;
if (getFixedAbHeight())
cmess1 << " - Fixed AB height: " << DbU::getValueString(getFixedAbHeight()) << endl;
if (getFixedAbWidth())
cmess1 << " - Fixed AB width: " << DbU::getValueString(getFixedAbWidth()) << endl;
cmess1 << " - Bloat space margin: "
<< setprecision(4) << (bloatMargin*100.0) << "%." << endl;
cmess1 << " - " << getCell()->getAbutmentBox() << endl;

View File

@ -70,8 +70,11 @@ extern "C" {
DirectVoidMethod(EtesianEngine,etesian,setDefaultAb)
DirectVoidMethod(EtesianEngine,etesian,resetPlacement)
DirectSetLongAttribute (PyEtesianEngine_setFixedAbHeight,setFixedAbHeight,PyEtesianEngine,EtesianEngine)
DirectSetLongAttribute (PyEtesianEngine_setFixedAbWidth ,setFixedAbWidth ,PyEtesianEngine,EtesianEngine)
DirectSetDoubleAttribute(PyEtesianEngine_setSpaceMargin ,setSpaceMargin ,PyEtesianEngine,EtesianEngine)
DirectSetDoubleAttribute(PyEtesianEngine_setAspectRatio ,setAspectRatio ,PyEtesianEngine,EtesianEngine)
DirectGetLongAttribute (PyEtesianEngine_getFixedAbHeight,getFixedAbHeight,PyEtesianEngine,EtesianEngine)
DirectGetLongAttribute (PyEtesianEngine_getFixedAbWidth ,getFixedAbWidth ,PyEtesianEngine,EtesianEngine)
static PyObject* PyEtesianEngine_get ( PyObject*, PyObject* args )
@ -203,6 +206,10 @@ extern "C" {
, "Returns the Etesian engine attached to the Cell, None if there isn't." }
, { "create" , (PyCFunction)PyEtesianEngine_create , METH_VARARGS|METH_STATIC
, "Create an Etesian engine on this cell." }
, { "getFixedAbHeight" , (PyCFunction)PyEtesianEngine_getFixedAbHeight , METH_NOARGS
, "Returns the forced abutment box height." }
, { "getFixedAbWidth" , (PyCFunction)PyEtesianEngine_getFixedAbWidth , METH_NOARGS
, "Returns the forced abutment box width." }
, { "setViewer" , (PyCFunction)PyEtesianEngine_setViewer , METH_VARARGS
, "Associate a Viewer to this EtesianEngine." }
, { "selectBloat" , (PyCFunction)PyEtesianEngine_selectBloat , METH_VARARGS
@ -213,6 +220,8 @@ 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)." }
, { "setFixedAbWidth" , (PyCFunction)PyEtesianEngine_setFixedAbWidth , METH_VARARGS
, "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." }
, { "setAspectRatio" , (PyCFunction)PyEtesianEngine_setAspectRatio , METH_VARARGS

View File

@ -68,6 +68,7 @@ namespace Etesian {
inline DbU::Unit getSliceHeight () const;
inline DbU::Unit getSliceStep () const;
inline DbU::Unit getFixedAbHeight () const;
inline DbU::Unit getFixedAbWidth () const;
inline Effort getPlaceEffort () const;
inline GraphicUpdate getUpdateConf () const;
inline Density getSpreadingConf () const;
@ -80,6 +81,7 @@ namespace Etesian {
inline Instance* getBlockInstance () const;
inline void setBlock ( Instance* );
inline void setFixedAbHeight ( DbU::Unit );
inline void setFixedAbWidth ( DbU::Unit );
inline void setSpaceMargin ( double );
inline void setAspectRatio ( double );
void setDefaultAb ();
@ -121,6 +123,7 @@ namespace Etesian {
size_t _yspinSlice0;
DbU::Unit _sliceHeight;
DbU::Unit _fixedAbHeight;
DbU::Unit _fixedAbWidth;
protected:
// Constructors & Destructors.
@ -148,6 +151,7 @@ namespace Etesian {
inline DbU::Unit EtesianEngine::getSliceHeight () const { return _sliceHeight; }
inline DbU::Unit EtesianEngine::getSliceStep () const { return getCellGauge()->getSliceStep(); }
inline DbU::Unit EtesianEngine::getFixedAbHeight () const { return _fixedAbHeight; }
inline DbU::Unit EtesianEngine::getFixedAbWidth () const { return _fixedAbWidth; }
inline Effort EtesianEngine::getPlaceEffort () const { return getConfiguration()->getPlaceEffort(); }
inline GraphicUpdate EtesianEngine::getUpdateConf () const { return getConfiguration()->getUpdateConf(); }
inline Density EtesianEngine::getSpreadingConf () const { return getConfiguration()->getSpreadingConf(); }
@ -161,6 +165,7 @@ 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::setFixedAbWidth ( DbU::Unit abWidth ) { _fixedAbWidth = abWidth; }
inline void EtesianEngine::setSpaceMargin ( double margin ) { getConfiguration()->setSpaceMargin(margin); }
inline void EtesianEngine::setAspectRatio ( double ratio ) { getConfiguration()->setAspectRatio(ratio); }