2008-03-06 10:46:43 -06:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
2013-04-17 11:14:41 -05:00
|
|
|
// This file is part of the Coriolis Software.
|
2018-01-06 10:55:44 -06:00
|
|
|
// Copyright (c) UPMC 2008-2018, All Rights Reserved
|
2008-03-06 10:46:43 -06:00
|
|
|
//
|
2013-04-17 11:14:41 -05:00
|
|
|
// +-----------------------------------------------------------------+
|
2008-03-06 10:46:43 -06:00
|
|
|
// | C O R I O L I S |
|
|
|
|
// | I s o b a r - Hurricane / Python Interface |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
|
|
|
// | =============================================================== |
|
2008-10-12 08:37:33 -05:00
|
|
|
// | C++ Module : "./PyDataBase.cpp" |
|
2013-04-17 11:14:41 -05:00
|
|
|
// +-----------------------------------------------------------------+
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2008-05-21 17:46:29 -05:00
|
|
|
#include "hurricane/isobar/PyDataBase.h"
|
|
|
|
#include "hurricane/isobar/PyTechnology.h"
|
2013-04-17 11:14:41 -05:00
|
|
|
#include "hurricane/isobar/PyLibrary.h"
|
2017-11-17 03:54:19 -06:00
|
|
|
#include "hurricane/isobar/PyCell.h"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
|
|
|
namespace Isobar {
|
|
|
|
|
2008-03-28 04:48:47 -05:00
|
|
|
using namespace Hurricane;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
2008-10-12 08:37:33 -05:00
|
|
|
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
// +=================================================================+
|
|
|
|
// | "PyDataBase" Python Module Code Part |
|
|
|
|
// +=================================================================+
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
#if defined(__PYTHON_MODULE__)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
static PyObject* PyDataBase_create ( PyObject* ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyDataBase_create()" << endl;
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
|
|
|
|
DataBase* db = NULL;
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
db = DataBase::create();
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return PyDataBase_Link(db);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject* PyDataBase_getDB ( PyObject* ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyDataBase_getDB()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
DataBase* db = NULL;
|
|
|
|
|
|
|
|
HTRY
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
db = DataBase::getDB();
|
|
|
|
if (db == NULL)
|
Migrating the initialisation system to be completely Python-like.
* New: In bootstrap/coriolisEnv.py, add the "etc" directory to the
PYTHONPATH as initialization are now Python modules.
* New: In Hurricane/analogic, first groundwork for the integration of
PIP/MIM/MOM multi-capacitors. Add C++ and Python interface for the
allocation matrix and the list of capacities values.
* Change: In Hurricane::RegularLayer, add a layer parameter to the
constructor so the association between the RegularLayer and it's
BasicLayer can readily be done.
* Change: In Hurricane::Layer, add a new getCut() accessor to get the
cut layer in ViaLayer.
* Change: In Hurricane::DataBase::get(), the Python wrapper should no
longer consider an error if the data-base has not been created yet.
Just return None.
* Bug: In Isobar::PyLayer::getEnclosure() wrapper, if the overall
enclosure is requested, pass the right parameter to the C++ function.
* Change: In AllianceFramework, make public _bindLibraries() and export
it to the Python interface.
* Change: In AllianceFramework::create(), do not longer call bindLibraries().
This now must be done explicitely and afterwards.
* Change: In AllianceFramework::createLibrary() and
Environement::addSYSTEM_LIBRARY(), minor bug corrections that I don't
recall.
* Change: In SearchPath::prepend(), set the selected index to zero and
return it.
* Change: In CRL::System CTOR, add "etc" to the PYTHONPATH as the
configuration files are now organized as Python modules.
* New: In PyCRL, export the CRL::System singleton, it's creation is no
longer triggered by the one of AllianceFramework.
* New: In CRL/etc/, convert most of the configuration files into the
Python module format. For now, keep the old ".conf", but that are no
longer used.
For the real technologies, we cannot keep the directory name as
"180" or "45" as it not allowed by Python syntax, so we create "node180"
or "node45" instead.
Most of the helpers and coriolisInit.py are no longer used now.
To be removed in future commits after being sure that everything
works...
* Bug: In AutoSegment::makeDogleg(AutoContact*), the layer of the contacts
where badly computed when one end of the original segment was attached
to a non-preferred direction segment (mostly on terminal contacts).
Now use the new AutoContact::updateLayer() method.
* Bug: In Dijkstra::load(), limit symetric search area only if the net
is a symmetric one !
* Change: In Katana/python/katanaInit.py, comply with the new initialisation
scheme.
* Change: In Unicorn/cgt.py, comply to the new inititalization scheme.
* Change: In cumulus various Python scripts remove the call to
helpers.staticInitialization() as they are not needed now (we run in
only *one* interpreter, so we correctly share all init).
In plugins/__init__.py, read the new NDA directory variable.
* Bug: In cumulus/plugins/Chip.doCoronafloorplan(), self.railsNb was not
correctly managed when there was no clock.
* Change: In cumulus/plugins/Configuration.coronaContactArray(), compute
the viaPitch from the technology instead of the hard-coded 4.0 lambdas.
In Configuration.loadConfiguration(), read the "ioring.py" from
the new user's settings module.
* Bug: In stratus.dpgen_ADSB2F, gives coordinates translated into DbU to
the XY functions.
In st_model.Save(), use the VstUseConcat flag to get correct VST files.
In st_net.hur_net(), when a net is POWER/GROUND or CLOCK also make it
global.
* Change: In Oroshi/python/WIP_Transistor.py, encapsulate the generator
inside a try/except block to get prettier error (and stop at the first).
2019-10-28 12:09:14 -05:00
|
|
|
//PyErr_SetString( HurricaneError, "DataBase.getDB(): DataBase has not been created yet" );
|
|
|
|
Py_RETURN_NONE;
|
2008-03-06 10:46:43 -06:00
|
|
|
HCATCH
|
|
|
|
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
return PyDataBase_Link( db );
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
PyObject* PyDataBase_getTechnology ( PyDataBase* self ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyDataBase_getTechnology()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
Technology* techno = NULL;
|
|
|
|
|
|
|
|
HTRY
|
2008-03-17 08:54:33 -05:00
|
|
|
METHOD_HEAD("DataBase.getTechnology()")
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
techno = db->getTechnology ();
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
if ( techno == NULL )
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return PyTechnology_Link ( techno );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
static PyObject* PyDataBase_getRootLibrary ( PyDataBase *self ) {
|
2016-06-11 14:56:12 -05:00
|
|
|
cdebug_log(20,0) << "PyDataBase_getRootLibrary ()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
Library* library = NULL;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
HTRY
|
|
|
|
METHOD_HEAD ( "DataBase.getRootLibrary()" )
|
|
|
|
library = db->getRootLibrary ();
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return PyLibrary_Link(library);
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2017-11-17 03:54:19 -06:00
|
|
|
|
|
|
|
static PyObject* PyDataBase_getCell ( PyDataBase* self, PyObject* args ) {
|
|
|
|
cdebug_log(20,0) << "PyDataBase_getCell ()" << endl;
|
|
|
|
|
|
|
|
Cell* cell = NULL;
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
METHOD_HEAD("DataBase.getCell()")
|
|
|
|
char* name = NULL;
|
|
|
|
if (PyArg_ParseTuple(args,"s:DataBase.getCell", &name)) {
|
|
|
|
cell = db->getCell( name );
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for DataBase.getCell." );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return PyCell_Link( cell );
|
|
|
|
}
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
|
|
|
|
// Standart Accessors (Attributes).
|
|
|
|
// Standart Destroy (Attribute).
|
|
|
|
DBoDestroyAttribute(PyDataBase_destroy,PyDataBase)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// PyDataBase Attribute Method table.
|
|
|
|
|
|
|
|
PyMethodDef PyDataBase_Methods[] =
|
Make the Python interface closely mirroring the C++ one.
* Change: In Isobar, the Python interface was not exactly mirroring the
C++ one, now it is the case. The Python code should look likes almost
exactly like the C++ one, the only differences remaining being due
to the languages respective syntaxes. Note that in the case of
constructor functions, it leads to a slightly longer notation in
Python that it could have been (mimic the ".create()" static
member). Main modifications:
1. Mirror the static constructor syntax with create():
Cell( ... ) ==> Cell.create( ... )
2. Correct hierarchy for constants in Instance, Net, Pin
& Transformation. For example:
Hurricane.PlacementStatusFIXED
==> Hurricane.Instance.PlacementStatus.FIXED
Hurricane.OrientationID
==> Hurricane.Transformation.Orientation.ID
Hurricane.TypeLOGICAL ==> Hurricane.Net.Type.LOGICAL
Hurricane.DirectionIN ==> Hurricane.Net.Direction.IN
* Change: In CRL Core, correction to match the improved Python API
in the configutation helpers.
* Change: In Cumulus, correction to match the improved Python API.
* Change: In Stratus, correction to match the improved Python API.
* Change: In Documenation, update for the new Python interface
(both user's guide & examples).
* Note: We must port those changes into Chams for it to continue
to run.
* Change: In Documenation, update the Python script support part.
2014-06-28 10:37:59 -05:00
|
|
|
{ { "create" , (PyCFunction)PyDataBase_create , METH_NOARGS|METH_STATIC
|
|
|
|
, "Create the DataBase (only the first call created it)" }
|
|
|
|
, { "getDB" , (PyCFunction)PyDataBase_getDB , METH_NOARGS|METH_STATIC
|
|
|
|
, "Get the DataBase" }
|
2017-11-17 03:54:19 -06:00
|
|
|
, { "getTechnology" , (PyCFunction)PyDataBase_getTechnology , METH_NOARGS , "Return the Technology" }
|
|
|
|
, { "getRootLibrary", (PyCFunction)PyDataBase_getRootLibrary, METH_NOARGS , "Return the root library" }
|
|
|
|
, { "getCell" , (PyCFunction)PyDataBase_getCell , METH_VARARGS, "Return a Cell" }
|
2013-04-17 11:14:41 -05:00
|
|
|
, { "destroy" , (PyCFunction)PyDataBase_destroy , METH_NOARGS
|
|
|
|
, "Destroy associated hurricane object The python object remains." }
|
2008-03-06 10:46:43 -06:00
|
|
|
, {NULL, NULL, 0, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-09-30 10:11:49 -05:00
|
|
|
DBoDeleteMethod(DataBase)
|
|
|
|
PyTypeObjectLinkPyType(DataBase)
|
|
|
|
|
|
|
|
#else // End of Python Module Code Part.
|
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
// +=================================================================+
|
2009-09-30 10:11:49 -05:00
|
|
|
// | "PyDataBase" Shared Library Code Part |
|
2013-04-17 11:14:41 -05:00
|
|
|
// +=================================================================+
|
2009-09-30 10:11:49 -05:00
|
|
|
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
// Link/Creation Method.
|
2008-10-12 08:37:33 -05:00
|
|
|
DBoLinkCreateMethod(DataBase)
|
|
|
|
PyTypeObjectDefinitions(DataBase)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
#endif // End of Shared Library Code Part.
|
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
} // extern "C".
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2013-04-17 11:14:41 -05:00
|
|
|
} // Isobar namespace.
|
2008-03-06 10:46:43 -06:00
|
|
|
|