coriolis/hurricane/src/isobar/PyReference.cpp

216 lines
6.9 KiB
C++
Raw Normal View History

// -*- 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
// | 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-03-06 10:46:43 -06:00
// | =============================================================== |
// | C++ Module : "./PyReference.cpp" |
// +-----------------------------------------------------------------+
2008-03-06 10:46:43 -06:00
#include "hurricane/isobar/PyReference.h"
#include "hurricane/isobar/PyPoint.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/isobar/PyNet.h"
#include "hurricane/isobar/PyBox.h"
#include "hurricane/Cell.h"
using namespace Hurricane;
2008-03-06 10:46:43 -06:00
namespace Isobar {
extern "C" {
2008-03-17 08:54:33 -05:00
#undef ACCESS_OBJECT
#undef ACCESS_CLASS
#define ACCESS_OBJECT _baseObject._object
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Reference,reference,function)
2008-03-06 10:46:43 -06:00
// x=================================================================x
// | "PyReference" Python Module Code Part |
// x=================================================================x
2008-03-17 08:54:33 -05:00
#if defined(__PYTHON_MODULE__)
2008-03-06 10:46:43 -06:00
// x-------------------------------------------------------------x
// | "PyReference" Attribute Methods |
// x-------------------------------------------------------------x
2008-03-17 08:54:33 -05:00
DBoDestroyAttribute(PyReference_destroy, PyReference)
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyReference_getName ()"
2008-03-06 10:46:43 -06:00
GetNameMethod(Reference, reference)
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
// Attribute Method : "PyReference_create ()"
PyObject* PyReference_create ( PyObject*, PyObject *args ) {
cdebug_log(20,0) << "PyReference_create()" << endl;
Reference* reference = NULL;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
HTRY
__cs.init ("Reference.create");
if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Reference.create"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
)) {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." );
return NULL;
}
if ( __cs.getObjectIds() == ":ent:string:int:int" )
reference = Reference::create ( PYCELL_O(arg0)
, Name(PyString_AsString(arg1))
Correction in plugins to support msxlib compatible pads. * New: In CRL Core, in helpers & alliance.conf, set and read a "PAD" variable to define the pad model name extension ("px" for "sxlib and "pxr" for vsxlib, this is provisional). * New: In CRL Core, in plugin.conf, add parameters to define the name of used for power & clock supply. We may remove the extention in the future (to be more coherent with the previous modification). * New: In Cumulus, in chip.Configuration.GaugeConf._rpAccess(), no longer place the accessing contact *at the center* of the RoutingPad. It works under sxlib because buffers & registers all have same size terminals. But this is not true under vsxlib, leading to misaligned contacts & wires. Now systematically place on the slice midlle track (maybe with one pitch above or below). This is still very weak as we do not check if the terminal reach were the contact is being put. Has to be strenthened in the future. * New: In Cumulus, in chip.Configuration.ChipConf, read the new clock & power pad parameters. * Change: In Isobar (and all other Python wrappers), uses PyLong instead of PyInt for DbU conversions. In PyHurricane argument converter, automatically check for both PyLong and then PyInt. * Change: In Cumulus, in chip.PadsCorona, more accurate error message in case of discrepency in global net connections (i.e. no net of the same name in instance model and instance model owner. * Change: In Kite, in BuildPowerRails, when looking up at the pads model name to find "pck_" or "pvddeck_", do not compare the extension part. But we still use hard-coded stem pad names, maybe we shouldn't. * Bug: In Katabatic, in GCellConfiguration::_do_xG_xM1_xM3(), there was a loop in the search of the best N/E initial RoutingPad. * Bug: In Kite, in KiteEngine::protectRoutingPads(), *do not* protect RoutingPads of fixed nets, they are already through the BuildPowerRails stage (and it's causing scary overlap warning messages). * Bug: In Cumulus, in ClockTree.HTreeNode.addLeaf(), do not create deep-plug when the core is flat (not sub-modules). All the new nets are at core level. * Bug: In Cumulus, in ChipPlugin.PlaceCore.doFloorplan(), ensure that the core is aligned on the GCell grid (i.e. the slice grid of the overall chip). * Bug: In Kite, in GCellTopology::_do_xG_xM1_xM3(), infinite loop while looking for the bigger N-E RoutingPad. Forgot to decrement the index...
2014-09-13 10:45:30 -05:00
, PyAny_AsLong(arg2)
, PyAny_AsLong(arg3) );
else if ( __cs.getObjectIds() == ":ent:name:point" )
reference = Reference::create ( PYCELL_O(arg0)
, Name(PyString_AsString(arg1))
, *PYPOINT_O(arg2) );
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." );
return NULL;
}
HCATCH
return PyReference_Link ( reference );
}
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyReference_getPoint ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyReference_getPoint ( PyReference *self )
2008-03-06 10:46:43 -06:00
{
cdebug_log(20,0) << "PyReference_getPoint()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Reference.getPoint()" )
2008-03-06 10:46:43 -06:00
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
2008-03-17 08:54:33 -05:00
pyPoint->_object = new Point ( reference->getPoint() );
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyReference_getBoundingBox ()"
static PyObject* PyReference_getBoundingBox( PyReference *self ) {
cdebug_log(20,0) << "PyReference_getBoundingBox()" << endl;
METHOD_HEAD ( "Reference.BoundingBox()" )
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (pyBox == NULL) { return NULL; }
HTRY
pyBox->_object = new Box ( reference->getBoundingBox() );
HCATCH
return ( (PyObject*)pyBox );
}
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-25 06:06:05 -05:00
// Attribute Method : "PyReference_translate ()"
2008-03-06 10:46:43 -06:00
2008-03-25 06:06:05 -05:00
static PyObject* PyReference_translate ( PyReference *self, PyObject* args ) {
cdebug_log(20,0) << "PyReference_translate ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-25 06:06:05 -05:00
METHOD_HEAD ( "Reference.translate()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
PyObject* arg1;
HTRY
2008-03-25 06:06:05 -05:00
if ( ! ParseTwoArg ( "Reference.translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
Correction in plugins to support msxlib compatible pads. * New: In CRL Core, in helpers & alliance.conf, set and read a "PAD" variable to define the pad model name extension ("px" for "sxlib and "pxr" for vsxlib, this is provisional). * New: In CRL Core, in plugin.conf, add parameters to define the name of used for power & clock supply. We may remove the extention in the future (to be more coherent with the previous modification). * New: In Cumulus, in chip.Configuration.GaugeConf._rpAccess(), no longer place the accessing contact *at the center* of the RoutingPad. It works under sxlib because buffers & registers all have same size terminals. But this is not true under vsxlib, leading to misaligned contacts & wires. Now systematically place on the slice midlle track (maybe with one pitch above or below). This is still very weak as we do not check if the terminal reach were the contact is being put. Has to be strenthened in the future. * New: In Cumulus, in chip.Configuration.ChipConf, read the new clock & power pad parameters. * Change: In Isobar (and all other Python wrappers), uses PyLong instead of PyInt for DbU conversions. In PyHurricane argument converter, automatically check for both PyLong and then PyInt. * Change: In Cumulus, in chip.PadsCorona, more accurate error message in case of discrepency in global net connections (i.e. no net of the same name in instance model and instance model owner. * Change: In Kite, in BuildPowerRails, when looking up at the pads model name to find "pck_" or "pvddeck_", do not compare the extension part. But we still use hard-coded stem pad names, maybe we shouldn't. * Bug: In Katabatic, in GCellConfiguration::_do_xG_xM1_xM3(), there was a loop in the search of the best N/E initial RoutingPad. * Bug: In Kite, in KiteEngine::protectRoutingPads(), *do not* protect RoutingPads of fixed nets, they are already through the BuildPowerRails stage (and it's causing scary overlap warning messages). * Bug: In Cumulus, in ClockTree.HTreeNode.addLeaf(), do not create deep-plug when the core is flat (not sub-modules). All the new nets are at core level. * Bug: In Cumulus, in ChipPlugin.PlaceCore.doFloorplan(), ensure that the core is aligned on the GCell grid (i.e. the slice grid of the overall chip). * Bug: In Kite, in GCellTopology::_do_xG_xM1_xM3(), infinite loop while looking for the bigger N-E RoutingPad. Forgot to decrement the index...
2014-09-13 10:45:30 -05:00
reference->translate ( PyAny_AsLong(arg0), PyAny_AsLong(arg1) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyReference Attribute Method table.
PyMethodDef PyReference_Methods[] =
{ { "create" , (PyCFunction)PyReference_create , METH_NOARGS|METH_STATIC
, "Create a new Reference." }
, { "destroy" , (PyCFunction)PyReference_destroy , METH_NOARGS
2008-03-17 08:54:33 -05:00
, "destroy associated hurricane object, the python object remains." }
, { "getName" , (PyCFunction)PyReference_getName , METH_NOARGS , "Returns the name of the reference." }
, { "getPoint" , (PyCFunction)PyReference_getPoint , METH_NOARGS , "Return the reference point." }
, { "getBoundingBox" , (PyCFunction)PyReference_getBoundingBox , METH_NOARGS , "Return the reference boundingBox." }
2008-03-25 06:06:05 -05:00
, { "translate" , (PyCFunction)PyReference_translate , METH_VARARGS, "Translate the reference of dx and dy." }
2008-03-06 10:46:43 -06:00
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyReference" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Reference)
PyTypeObjectLinkPyType(Reference)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyReference" Shared Library Code Part |
// x=================================================================x
2008-03-06 10:46:43 -06:00
// Link/Creation Method.
DBoLinkCreateMethod(Reference)
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
// PyReference Object Definitions.
PyTypeInheritedObjectDefinitions(Reference, Entity)
2008-03-06 10:46:43 -06:00
#endif // End of Shared Library Code Part.
2008-03-06 10:46:43 -06:00
} // End of extern "C".
} // End of Isobar namespace.