2013-04-27 11:02:00 -05:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
2014-06-09 17:17:41 -05:00
|
|
|
// Copyright (c) UPMC 2008-2014, All Rights Reserved
|
2013-04-27 11:02:00 -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 |
|
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./PyBox.cpp" |
|
2013-04-27 11:02:00 -05:00
|
|
|
// +-----------------------------------------------------------------+
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2008-05-21 17:46:29 -05:00
|
|
|
#include "hurricane/isobar/PyPoint.h"
|
|
|
|
#include "hurricane/isobar/PyBox.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(Box,box,function)
|
|
|
|
|
|
|
|
|
2013-04-27 11:02:00 -05:00
|
|
|
// +=================================================================+
|
2008-03-06 10:46:43 -06:00
|
|
|
// | "PyBox" Python Module Code Part |
|
2013-04-27 11:02:00 -05:00
|
|
|
// +=================================================================+
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
#if defined(__PYTHON_MODULE__)
|
|
|
|
|
|
|
|
|
|
|
|
// Standart Accessors (Attributes).
|
2008-03-17 08:54:33 -05:00
|
|
|
DirectGetLongAttribute(PyBox_getXMin ,getXMin ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getYMin ,getYMin ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getXMax ,getXMax ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getYMax ,getYMax ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getXCenter ,getXCenter ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getYCenter ,getYCenter ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getWidth ,getWidth ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getHalfWidth ,getHalfWidth ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getHeight ,getHeight ,PyBox,Box)
|
|
|
|
DirectGetLongAttribute(PyBox_getHalfHeight,getHalfHeight,PyBox,Box)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
|
|
|
// Standart Predicates (Attributes).
|
2008-03-25 06:06:05 -05:00
|
|
|
DirectGetBoolAttribute(PyBox_isEmpty ,isEmpty ,PyBox,Box)
|
|
|
|
DirectGetBoolAttribute(PyBox_isFlat ,isFlat ,PyBox,Box)
|
|
|
|
DirectGetBoolAttribute(PyBox_isPonctual,isPonctual,PyBox,Box)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
// Standart Destroy (Attribute).
|
|
|
|
DirectDestroyAttribute(PyBox_destroy, PyBox)
|
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
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// Class Method : "PyBox_NEW ()"
|
|
|
|
|
|
|
|
static PyObject* PyBox_NEW (PyObject *module, PyObject *args) {
|
|
|
|
trace << "PyBox_NEW()" << endl;
|
|
|
|
|
|
|
|
Box* box = NULL;
|
|
|
|
PyBox* pyBox = NULL;
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
PyObject* arg0;
|
|
|
|
PyObject* arg1;
|
|
|
|
PyObject* arg2;
|
|
|
|
PyObject* arg3;
|
|
|
|
__cs.init ("Box.Box");
|
|
|
|
|
|
|
|
if (! PyArg_ParseTuple(args,"|O&O&O&O&:Box.Box",
|
|
|
|
Converter, &arg0,
|
|
|
|
Converter, &arg1,
|
|
|
|
Converter, &arg2,
|
|
|
|
Converter, &arg3)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (__cs.getObjectIds() == NO_ARG) { box = new Box (); }
|
|
|
|
else if ( __cs.getObjectIds() == POINT_ARG ) { box = new Box ( *PYPOINT_O(arg0) ); }
|
|
|
|
else if ( __cs.getObjectIds() == BOX_ARG ) { box = new Box ( *PYBOX_O(arg0) ); }
|
|
|
|
else if ( __cs.getObjectIds() == POINTS2_ARG ) { box = new Box ( *PYPOINT_O(arg0) , *PYPOINT_O(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
|
|
|
else if ( __cs.getObjectIds() == INTS2_ARG ) { box = new Box ( PyAny_AsLong(arg0) , PyAny_AsLong(arg1) ); }
|
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
|
|
|
else if ( __cs.getObjectIds() == INTS4_ARG ) {
|
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
|
|
|
box = new Box ( PyAny_AsLong(arg0), PyAny_AsLong(arg1), PyAny_AsLong(arg2) , PyAny_AsLong(arg3) );
|
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
|
|
|
} else {
|
|
|
|
PyErr_SetString(ConstructorError, "invalid number of parameters for Box constructor." );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pyBox = PyObject_NEW(PyBox, &PyTypeBox);
|
|
|
|
if (pyBox == NULL) return NULL;
|
|
|
|
|
|
|
|
pyBox->_object = box;
|
|
|
|
HCATCH
|
|
|
|
|
|
|
|
return ( (PyObject*)pyBox );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int PyBox_Init ( PyBox* self, PyObject* args, PyObject* kwargs )
|
|
|
|
{
|
|
|
|
trace << "PyBox_Init(): " << (void*)self << endl;
|
|
|
|
return 0;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
static PyObject* PyBox_getCenter ( PyBox *self ) {
|
|
|
|
trace << "PyBox_getCenter()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
METHOD_HEAD ( "Box.Center()" )
|
|
|
|
|
|
|
|
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
|
|
|
|
if (pyPoint == NULL) { return NULL; }
|
|
|
|
|
|
|
|
HTRY
|
|
|
|
pyPoint->_object = new Point ( box->getCenter() );
|
|
|
|
HCATCH
|
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
return (PyObject*)pyPoint;
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_getUnion ( PyBox *self, PyObject* args ) {
|
2008-03-17 08:54:33 -05:00
|
|
|
trace << "PyBox_getUnion()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
METHOD_HEAD ( "Box.getUnion()" )
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
PyBox* otherPyBox;
|
2008-12-11 09:25:17 -06:00
|
|
|
if (PyArg_ParseTuple(args,"O!:Box.getUnion", &PyTypeBox, &otherPyBox)) {
|
|
|
|
PyBox* unionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
|
|
|
if (unionPyBox == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
HTRY
|
|
|
|
unionPyBox->_object = new Box ( box->getUnion(*PYBOX_O(otherPyBox)));
|
|
|
|
HCATCH
|
|
|
|
return (PyObject*)unionPyBox;
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.getUnion.");
|
|
|
|
}
|
|
|
|
return NULL;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-17 08:54:33 -05:00
|
|
|
// Attribute Method : "PyBox_getIntersection ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_getIntersection ( PyBox *self, PyObject* args ) {
|
2008-03-17 08:54:33 -05:00
|
|
|
trace << "PyBox_getIntersection()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-03-17 08:54:33 -05:00
|
|
|
METHOD_HEAD ( "Box.getIntersection()" )
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
PyBox* otherPyBox;
|
2008-12-11 09:25:17 -06:00
|
|
|
if (PyArg_ParseTuple(args,"O!:Box.getIntersection", &PyTypeBox, &otherPyBox)) {
|
|
|
|
PyBox* intersectionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
|
|
|
if (intersectionPyBox == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
HTRY
|
|
|
|
intersectionPyBox->_object = new Box(box->getIntersection(*PYBOX_O(otherPyBox)));
|
|
|
|
HCATCH
|
|
|
|
return (PyObject*)intersectionPyBox;
|
|
|
|
} else {
|
|
|
|
PyErr_SetString(ConstructorError, "invalid number of parameters for Box.getIntersection.");
|
|
|
|
}
|
|
|
|
return NULL;
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_contains ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_contains ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_contains ()" << endl;
|
2008-12-12 07:16:47 -06:00
|
|
|
|
|
|
|
METHOD_HEAD ( "Box.contains()" )
|
|
|
|
|
|
|
|
PyObject* arg0;
|
|
|
|
PyObject* arg1;
|
2008-12-11 09:25:17 -06:00
|
|
|
bool result = false;
|
2008-12-12 07:16:47 -06:00
|
|
|
|
2008-03-06 10:46:43 -06:00
|
|
|
HTRY
|
|
|
|
|
2008-12-12 07:16:47 -06:00
|
|
|
__cs.init ("Box.contains");
|
|
|
|
if ( ! PyArg_ParseTuple(args,"|O&O&:Box.contains",Converter,&arg0,Converter,&arg1) )
|
|
|
|
return NULL;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-12 07:16:47 -06:00
|
|
|
if ( __cs.getObjectIds() == BOX_ARG ) { result = box->contains ( *PYBOX_O(arg0) ); }
|
|
|
|
else if ( __cs.getObjectIds() == POINT_ARG ) { result = box->contains ( *PYPOINT_O(arg0) ); }
|
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
|
|
|
else if ( __cs.getObjectIds() == INTS2_ARG ) { result = box->contains ( PyAny_AsLong(arg0)
|
|
|
|
, PyAny_AsLong(arg1) ); }
|
2008-12-12 07:16:47 -06:00
|
|
|
else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.contains constructor." );
|
2008-12-11 09:25:17 -06:00
|
|
|
return NULL;
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
HCATCH
|
2008-12-11 09:25:17 -06:00
|
|
|
if (result) {
|
|
|
|
Py_RETURN_TRUE;
|
|
|
|
} else {
|
|
|
|
Py_RETURN_FALSE;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_intersect ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_intersect ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_intersect ()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
bool result = false;
|
|
|
|
HTRY
|
|
|
|
PyBox* pyBox = NULL;
|
2008-03-25 06:06:05 -05:00
|
|
|
METHOD_HEAD ( "Box.intersect()" )
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
if (PyArg_ParseTuple(args,"O!:Box.intersects", &PyTypeBox, &pyBox)) {
|
|
|
|
result = box->intersect(*PYBOX_O(pyBox));
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.intersect." );
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
HCATCH
|
2008-12-11 09:25:17 -06:00
|
|
|
if (result) {
|
|
|
|
Py_RETURN_TRUE;
|
|
|
|
} else {
|
|
|
|
Py_RETURN_FALSE;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_isConstrainedBy ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_isConstrainedBy ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_isConstrainedBy ()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
bool result = false;
|
2008-03-06 10:46:43 -06:00
|
|
|
HTRY
|
2008-12-11 09:25:17 -06:00
|
|
|
PyBox* pyBox = NULL;
|
|
|
|
METHOD_HEAD("Box.isConstrainedBy()")
|
|
|
|
|
|
|
|
if (PyArg_ParseTuple(args,"O!:Box.isConstrainedBy", &PyTypeBox, &pyBox)) {
|
|
|
|
result = box->isConstrainedBy(*PYBOX_O(pyBox));
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.isConstrainedBy.");
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
HCATCH
|
|
|
|
if (result) {
|
|
|
|
Py_RETURN_TRUE;
|
|
|
|
} else {
|
|
|
|
Py_RETURN_FALSE;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_makeEmpty ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_makeEmpty ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_makeEmpty ()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
HTRY
|
2008-03-25 06:06:05 -05:00
|
|
|
METHOD_HEAD ( "Box.makeEmpty()" )
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
box->makeEmpty ();
|
|
|
|
HCATCH
|
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
Py_INCREF ( self ); //FIXME ??
|
|
|
|
return (PyObject*)self;
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_inflate ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-12 07:16:47 -06:00
|
|
|
static PyObject* PyBox_inflate ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_inflate ()" << endl;
|
2008-12-12 07:16:47 -06:00
|
|
|
|
|
|
|
METHOD_HEAD ( "Box.inflate()" )
|
|
|
|
|
|
|
|
PyObject* arg0;
|
|
|
|
PyObject* arg1;
|
2011-05-30 06:22:02 -05:00
|
|
|
PyObject* arg2;
|
|
|
|
PyObject* arg3;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
HTRY
|
2008-12-12 07:16:47 -06:00
|
|
|
|
|
|
|
__cs.init ("Box.inflate");
|
2011-05-30 06:22:02 -05:00
|
|
|
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.inflate",Converter,&arg0,Converter,&arg1,Converter,&arg2,Converter,&arg3) )
|
2008-12-12 07:16:47 -06:00
|
|
|
return ( NULL );
|
|
|
|
|
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
|
|
|
if ( __cs.getObjectIds() == INT_ARG ) { box->inflate ( PyAny_AsLong(arg0) ); }
|
|
|
|
else if ( __cs.getObjectIds() == INTS2_ARG ) { box->inflate ( PyAny_AsLong(arg0)
|
|
|
|
, PyAny_AsLong(arg1) ); }
|
|
|
|
else if ( __cs.getObjectIds() == INTS4_ARG ) { box->inflate ( PyAny_AsLong(arg0)
|
|
|
|
, PyAny_AsLong(arg1)
|
|
|
|
, PyAny_AsLong(arg2)
|
|
|
|
, PyAny_AsLong(arg3) ); }
|
2008-12-12 07:16:47 -06:00
|
|
|
else {
|
2008-03-25 06:06:05 -05:00
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.inflate()" );
|
2008-12-12 07:16:47 -06:00
|
|
|
return ( NULL );
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
2008-12-12 07:16:47 -06:00
|
|
|
|
2008-03-06 10:46:43 -06:00
|
|
|
HCATCH
|
|
|
|
|
2008-12-12 07:16:47 -06:00
|
|
|
Py_INCREF ( self );
|
|
|
|
return ( (PyObject*)self );
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_merge ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_merge ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "Box_merge()" << endl;
|
2008-12-12 07:16:47 -06:00
|
|
|
|
2008-03-25 06:06:05 -05:00
|
|
|
METHOD_HEAD ( "Box.merge()" )
|
2008-12-12 07:16:47 -06:00
|
|
|
|
|
|
|
PyObject* arg0;
|
|
|
|
PyObject* arg1;
|
|
|
|
PyObject* arg2;
|
|
|
|
PyObject* arg3;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
HTRY
|
2008-12-12 07:16:47 -06:00
|
|
|
|
|
|
|
__cs.init ("Box.merge");
|
|
|
|
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.merge",Converter,&arg0,Converter,&arg1,Converter,&arg2,Converter,&arg3) )
|
|
|
|
return ( NULL );
|
|
|
|
|
|
|
|
if ( __cs.getObjectIds() == POINT_ARG ) { box->merge ( *PYPOINT_O(arg0) ); }
|
|
|
|
else if ( __cs.getObjectIds() == BOX_ARG ) { box->merge ( *PYBOX_O(arg0) ); }
|
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
|
|
|
else if ( __cs.getObjectIds() == INTS2_ARG ) { box->merge ( PyAny_AsLong(arg0)
|
|
|
|
, PyAny_AsLong(arg1) ); }
|
|
|
|
else if ( __cs.getObjectIds() == INTS4_ARG ) { box->merge ( PyAny_AsLong(arg0)
|
|
|
|
, PyAny_AsLong(arg1)
|
|
|
|
, PyAny_AsLong(arg2)
|
|
|
|
, PyAny_AsLong(arg3) ); }
|
2008-12-12 07:16:47 -06:00
|
|
|
else {
|
2008-03-25 06:06:05 -05:00
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.merge()" );
|
2008-12-12 07:16:47 -06:00
|
|
|
return ( NULL );
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
2008-12-12 07:16:47 -06:00
|
|
|
|
2008-03-06 10:46:43 -06:00
|
|
|
HCATCH
|
|
|
|
|
|
|
|
Py_INCREF ( self );
|
2008-12-12 07:16:47 -06:00
|
|
|
return ( (PyObject*)self );
|
2008-03-06 10:46:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
2008-03-25 06:06:05 -05:00
|
|
|
// Attribute Method : "PyBox_translate ()"
|
2008-03-06 10:46:43 -06:00
|
|
|
|
2008-12-11 09:25:17 -06:00
|
|
|
static PyObject* PyBox_translate ( PyBox *self, PyObject* args ) {
|
2008-03-25 06:06:05 -05:00
|
|
|
trace << "PyBox_translate ()" << endl;
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
HTRY
|
2008-12-11 09:25:17 -06:00
|
|
|
METHOD_HEAD ( "Box.translate()" )
|
|
|
|
DbU::Unit dx=0, dy=0;
|
|
|
|
if (PyArg_ParseTuple(args,"ll:Box.translate", &dx, &dy)) {
|
|
|
|
box->translate(dx, dy);
|
|
|
|
} else {
|
|
|
|
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.translate()" );
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-03-06 10:46:43 -06:00
|
|
|
HCATCH
|
2008-12-11 09:25:17 -06:00
|
|
|
|
2008-03-06 10:46:43 -06:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// PyBox Attribute Method table.
|
|
|
|
|
|
|
|
PyMethodDef PyBox_Methods[] =
|
2008-03-17 08:54:33 -05:00
|
|
|
{ { "getXMin" , (PyCFunction)PyBox_getXMin , METH_NOARGS , "Return the XMin value." }
|
|
|
|
, { "getYMin" , (PyCFunction)PyBox_getYMin , METH_NOARGS , "Return the YMin value." }
|
|
|
|
, { "getXMax" , (PyCFunction)PyBox_getXMax , METH_NOARGS , "Return the XMax value." }
|
|
|
|
, { "getYMax" , (PyCFunction)PyBox_getYMax , METH_NOARGS , "Return the YMax value." }
|
|
|
|
, { "getXCenter" , (PyCFunction)PyBox_getXCenter , METH_NOARGS , "Return the X box center value." }
|
|
|
|
, { "getYCenter" , (PyCFunction)PyBox_getYCenter , METH_NOARGS , "Return the Y box center value." }
|
|
|
|
, { "getCenter" , (PyCFunction)PyBox_getCenter , METH_NOARGS , "Return the box center Point." }
|
|
|
|
, { "getWidth" , (PyCFunction)PyBox_getWidth , METH_NOARGS , "Return the box width." }
|
|
|
|
, { "getHalfWidth" , (PyCFunction)PyBox_getHalfWidth , METH_NOARGS , "Return the box half width." }
|
|
|
|
, { "getHeight" , (PyCFunction)PyBox_getHeight , METH_NOARGS , "Return the box height." }
|
|
|
|
, { "getHalfHeight" , (PyCFunction)PyBox_getHalfHeight , METH_NOARGS , "Return the box half height." }
|
|
|
|
, { "getUnion" , (PyCFunction)PyBox_getUnion , METH_VARARGS, "Return the smallest enclosing box." }
|
|
|
|
, { "getIntersection", (PyCFunction)PyBox_getIntersection, METH_VARARGS, "Return the overlapping area." }
|
2008-03-25 06:06:05 -05:00
|
|
|
, { "isEmpty" , (PyCFunction)PyBox_isEmpty , METH_NOARGS , "Return true if the box is empty." }
|
|
|
|
, { "isFlat" , (PyCFunction)PyBox_isFlat , METH_NOARGS , "Return true if the box is flat." }
|
|
|
|
, { "isPonctual" , (PyCFunction)PyBox_isPonctual , METH_NOARGS , "Return true if the box reduced to a point." }
|
|
|
|
, { "contains" , (PyCFunction)PyBox_contains , METH_VARARGS, "Return true if the box contains the argument." }
|
|
|
|
, { "intersect" , (PyCFunction)PyBox_intersect , METH_VARARGS, "Return true if two boxes overlap." }
|
|
|
|
, { "isConstrainedBy", (PyCFunction)PyBox_isConstrainedBy, METH_VARARGS, "Return true if the argment box is included and share at least a side." }
|
|
|
|
, { "makeEmpty" , (PyCFunction)PyBox_makeEmpty , METH_NOARGS , "Transform the box in an empty one." }
|
|
|
|
, { "inflate" , (PyCFunction)PyBox_inflate , METH_VARARGS, "Expand the box to contains the arguments." }
|
|
|
|
, { "merge" , (PyCFunction)PyBox_merge , METH_VARARGS, "Expand or contract the box to contains the arguments." }
|
|
|
|
, { "translate" , (PyCFunction)PyBox_translate , METH_VARARGS, "translate the box od dx ans dy." }
|
2008-03-17 08:54:33 -05:00
|
|
|
, { "destroy" , (PyCFunction)PyBox_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
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
// | "PyBox" Object Methods |
|
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
|
|
|
|
|
|
|
|
DirectDeleteMethod(PyBox_DeAlloc,PyBox)
|
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
|
|
|
PyTypeObjectLinkPyTypeNewInit(Box)
|
|
|
|
//PyTypeObjectLinkPyType(Box)
|
2009-09-30 10:11:49 -05:00
|
|
|
|
|
|
|
#else // End of Python Module Code Part.
|
|
|
|
|
|
|
|
|
|
|
|
// x=================================================================x
|
|
|
|
// | "PyBox" Shared Library Code Part |
|
|
|
|
// x=================================================================x
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// PyBox Object Definitions.
|
|
|
|
|
2008-10-12 08:37:33 -05:00
|
|
|
PyTypeObjectDefinitions(Box)
|
2008-03-06 10:46:43 -06:00
|
|
|
|
|
|
|
# endif // End of Shared Library Code Part.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // End of extern "C".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // End of Isobar namespace.
|
|
|
|
|