coriolis/hurricane/src/isobar/PyDataBase.cpp

167 lines
4.7 KiB
C++
Raw Normal View History

2008-03-06 10:46:43 -06:00
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2018, All Rights Reserved
2008-03-06 10:46:43 -06: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 |
// | =============================================================== |
// | C++ Module : "./PyDataBase.cpp" |
// +-----------------------------------------------------------------+
2008-03-06 10:46:43 -06:00
#include "hurricane/isobar/PyDataBase.h"
#include "hurricane/isobar/PyTechnology.h"
#include "hurricane/isobar/PyLibrary.h"
#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" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function)
2008-03-06 10:46:43 -06:00
// +=================================================================+
// | "PyDataBase" Python Module Code Part |
// +=================================================================+
2008-03-06 10:46:43 -06:00
#if defined(__PYTHON_MODULE__)
2008-03-06 10:46:43 -06:00
static PyObject* PyDataBase_create ( PyObject* ) {
cdebug_log(20,0) << "PyDataBase_create()" << endl;
DataBase* db = NULL;
HTRY
db = DataBase::create();
HCATCH
return PyDataBase_Link(db);
}
static PyObject* PyDataBase_getDB ( PyObject* ) {
cdebug_log(20,0) << "PyDataBase_getDB()" << endl;
2008-03-06 10:46:43 -06:00
DataBase* db = NULL;
HTRY
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
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 ) {
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 );
}
static PyObject* PyDataBase_getRootLibrary ( PyDataBase *self ) {
cdebug_log(20,0) << "PyDataBase_getRootLibrary ()" << endl;
2008-03-06 10:46:43 -06:00
Library* library = NULL;
2008-03-06 10:46:43 -06:00
HTRY
METHOD_HEAD ( "DataBase.getRootLibrary()" )
library = db->getRootLibrary ();
HCATCH
return PyLibrary_Link(library);
}
2008-03-06 10:46:43 -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 );
}
// 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[] =
{ { "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" }
, { "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" }
, { "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 */
};
DBoDeleteMethod(DataBase)
PyTypeObjectLinkPyType(DataBase)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyDataBase" Shared Library Code Part |
// +=================================================================+
2008-03-06 10:46:43 -06:00
// Link/Creation Method.
DBoLinkCreateMethod(DataBase)
PyTypeObjectDefinitions(DataBase)
2008-03-06 10:46:43 -06:00
#endif // End of Shared Library Code Part.
} // extern "C".
2008-03-06 10:46:43 -06:00
} // Isobar namespace.
2008-03-06 10:46:43 -06:00