coriolis/hurricane/src/isobar/PyHyperNet.cpp

166 lines
5.3 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 2007-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 : Damien DUPUIS |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
2008-03-06 10:46:43 -06:00
// | =============================================================== |
// | C++ Module : "./PyHyperNet.cpp" |
// +-----------------------------------------------------------------+
2008-03-06 10:46:43 -06:00
#include "hurricane/isobar/PyHyperNet.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/isobar/PyOccurrence.h"
2008-10-17 12:27:20 -05:00
#include "hurricane/isobar/PyOccurrenceCollection.h"
2008-03-28 04:48:47 -05:00
using namespace Hurricane;
2008-03-06 10:46:43 -06:00
namespace Isobar {
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(HyperNet,hyperNet,function)
2008-03-06 10:46:43 -06:00
// +=================================================================+
// | "PyHyperNet" Python Module Code Part |
// +=================================================================+
2008-03-06 10:46:43 -06:00
#if defined(__PYTHON_MODULE__)
2008-03-06 10:46:43 -06:00
// Standart Predicates (Attributes).
2008-03-19 05:02:56 -05:00
DirectGetBoolAttribute(PyHyperNet_isValid ,isValid ,PyHyperNet,HyperNet)
2008-03-06 10:46:43 -06:00
// Standart Delete (Attribute).
2008-03-17 08:54:33 -05:00
DirectDestroyAttribute(PyHyperNet_destroy, PyHyperNet)
2008-03-06 10:46:43 -06:00
static PyObject* PyHyperNet_create ( PyObject*, PyObject *args ) {
cdebug_log(20,0) << "PyHyperNet_create()" << endl;
HyperNet* hyperNet = NULL;
PyObject* arg0;
if (! ParseOneArg ( "HyperNet.create()", args, ":occur", &arg0 )) {
PyErr_SetString(ConstructorError, "invalid number of parameters for HyperNet constructor." );
return ( NULL );
}
hyperNet = new HyperNet ( *PYOCCURRENCE_O(arg0) );
PyHyperNet* pyHyperNet;
pyHyperNet = PyObject_NEW(PyHyperNet, &PyTypeHyperNet);
if (pyHyperNet == NULL) return NULL;
HTRY
pyHyperNet->_object = hyperNet;
HCATCH
return ( (PyObject*)pyHyperNet );
}
static PyObject* PyHyperNet_getNetOccurrences(PyHyperNet *self)
{
cdebug_log(20,0) << "PyHyperNet_getNetOccurrences()" << endl;
METHOD_HEAD ( "HyperNet.getNetOccurrences()" )
PyOccurrenceCollection* pyOccurrenceCollection = NULL;
HTRY
Occurrences* occurrences = new Occurrences(hyperNet->getNetOccurrences());
pyOccurrenceCollection = PyObject_NEW(PyOccurrenceCollection, &PyTypeOccurrenceCollection);
if (pyOccurrenceCollection == NULL) {
return NULL;
}
2008-03-06 10:46:43 -06:00
pyOccurrenceCollection->_object = occurrences;
HCATCH
return (PyObject*)pyOccurrenceCollection;
}
2008-03-06 10:46:43 -06:00
Clarify semantic of flatten Collections (walkthrough). In the Cell/Instance hierarchy, the "terminal" and "leaf cell" concepts where not clearly defined and partially overlapping. Now, "Terminal" is the refer to the physical hierarchy (layout) and "TerminalNetlist" to the logical hierarchy (netlist). The logical hierarchy can be less deep than the physical one thanks to a Cell dedicated cell flags. Collections related to the physical hierarchy keep their old names, the one related to the logical hierarchy are renamed from "Leaf" to "TerminalNetlist". The name "Leaf" was too ambiguous (leaf for *what* hierarchy). * Change: In Hurricane::Device, set the "TerminalNetlist" flag once and for all. No need set it in all the derived classes again. * New: In Hurricane::MultiCapacitor, added new parameter "dummy" to create dummies around the capacity matrix. * Change: In Hurricane::Cell, remove "Leaf" related methods, replace them by "TerminalNetlist" one, especially Collections. Now we have two clear sets of Collections to walkthough the layout or the netlist. Change the "Terminal" flag into "TerminalNetlist". * Change: In Hurricane::CellCollections, rename "Leaf" into "TerminalNetlist" collections and apply the new semantic to the locators. * Change: In Hurricane::DataBase, Leaf to TerminalInstance renaming. * Change: In Hurricane::DeepNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::HyperNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::Instance, Leaf to TerminalInstance renaming. * Change: In Hurricane::Viewer::HierarchyInformations, Leaf to TerminalInstance renaming. * Change: In CRL::AllianceFramework, Leaf to TerminalInstance renaming. * Change: In CRL::Catalog, Leaf to TerminalInstance renaming. * Change: In CRL::ApParser, Leaf to TerminalInstance renaming. * Change: In EtesianEngine::AddFeeds, Leaf to TerminalInstance renaming. * Bug: In EtesianEngine::resetPlacement, move there the loop over non terminal netlist instances to flag fully placed sub-blocks as terminal for the netlist. Only then remove the feed cells from unplaced instances. Previously, the feed cells where stripped even from already placed instances. * Change: In Katana, Leaf to TerminalInstance renaming. * Bug: In Bora::PyDSlicingNode, allow the range parameter to be the Python None object when we do not want to pass one but need to have it as positional parameter. * Change: In Cumulus/clocktree/ClockTree.py, Leaf to TerminalInstance renaming.
2020-03-10 06:10:53 -05:00
static PyObject* PyHyperNet_getTerminalNetlistPlugOccurrences(PyHyperNet *self)
2008-03-06 10:46:43 -06:00
{
Clarify semantic of flatten Collections (walkthrough). In the Cell/Instance hierarchy, the "terminal" and "leaf cell" concepts where not clearly defined and partially overlapping. Now, "Terminal" is the refer to the physical hierarchy (layout) and "TerminalNetlist" to the logical hierarchy (netlist). The logical hierarchy can be less deep than the physical one thanks to a Cell dedicated cell flags. Collections related to the physical hierarchy keep their old names, the one related to the logical hierarchy are renamed from "Leaf" to "TerminalNetlist". The name "Leaf" was too ambiguous (leaf for *what* hierarchy). * Change: In Hurricane::Device, set the "TerminalNetlist" flag once and for all. No need set it in all the derived classes again. * New: In Hurricane::MultiCapacitor, added new parameter "dummy" to create dummies around the capacity matrix. * Change: In Hurricane::Cell, remove "Leaf" related methods, replace them by "TerminalNetlist" one, especially Collections. Now we have two clear sets of Collections to walkthough the layout or the netlist. Change the "Terminal" flag into "TerminalNetlist". * Change: In Hurricane::CellCollections, rename "Leaf" into "TerminalNetlist" collections and apply the new semantic to the locators. * Change: In Hurricane::DataBase, Leaf to TerminalInstance renaming. * Change: In Hurricane::DeepNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::HyperNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::Instance, Leaf to TerminalInstance renaming. * Change: In Hurricane::Viewer::HierarchyInformations, Leaf to TerminalInstance renaming. * Change: In CRL::AllianceFramework, Leaf to TerminalInstance renaming. * Change: In CRL::Catalog, Leaf to TerminalInstance renaming. * Change: In CRL::ApParser, Leaf to TerminalInstance renaming. * Change: In EtesianEngine::AddFeeds, Leaf to TerminalInstance renaming. * Bug: In EtesianEngine::resetPlacement, move there the loop over non terminal netlist instances to flag fully placed sub-blocks as terminal for the netlist. Only then remove the feed cells from unplaced instances. Previously, the feed cells where stripped even from already placed instances. * Change: In Katana, Leaf to TerminalInstance renaming. * Bug: In Bora::PyDSlicingNode, allow the range parameter to be the Python None object when we do not want to pass one but need to have it as positional parameter. * Change: In Cumulus/clocktree/ClockTree.py, Leaf to TerminalInstance renaming.
2020-03-10 06:10:53 -05:00
cdebug_log(20,0) << "PyHyperNet_getTerminalNetlistPlugOccurrences()" << endl;
2008-03-06 10:46:43 -06:00
Clarify semantic of flatten Collections (walkthrough). In the Cell/Instance hierarchy, the "terminal" and "leaf cell" concepts where not clearly defined and partially overlapping. Now, "Terminal" is the refer to the physical hierarchy (layout) and "TerminalNetlist" to the logical hierarchy (netlist). The logical hierarchy can be less deep than the physical one thanks to a Cell dedicated cell flags. Collections related to the physical hierarchy keep their old names, the one related to the logical hierarchy are renamed from "Leaf" to "TerminalNetlist". The name "Leaf" was too ambiguous (leaf for *what* hierarchy). * Change: In Hurricane::Device, set the "TerminalNetlist" flag once and for all. No need set it in all the derived classes again. * New: In Hurricane::MultiCapacitor, added new parameter "dummy" to create dummies around the capacity matrix. * Change: In Hurricane::Cell, remove "Leaf" related methods, replace them by "TerminalNetlist" one, especially Collections. Now we have two clear sets of Collections to walkthough the layout or the netlist. Change the "Terminal" flag into "TerminalNetlist". * Change: In Hurricane::CellCollections, rename "Leaf" into "TerminalNetlist" collections and apply the new semantic to the locators. * Change: In Hurricane::DataBase, Leaf to TerminalInstance renaming. * Change: In Hurricane::DeepNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::HyperNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::Instance, Leaf to TerminalInstance renaming. * Change: In Hurricane::Viewer::HierarchyInformations, Leaf to TerminalInstance renaming. * Change: In CRL::AllianceFramework, Leaf to TerminalInstance renaming. * Change: In CRL::Catalog, Leaf to TerminalInstance renaming. * Change: In CRL::ApParser, Leaf to TerminalInstance renaming. * Change: In EtesianEngine::AddFeeds, Leaf to TerminalInstance renaming. * Bug: In EtesianEngine::resetPlacement, move there the loop over non terminal netlist instances to flag fully placed sub-blocks as terminal for the netlist. Only then remove the feed cells from unplaced instances. Previously, the feed cells where stripped even from already placed instances. * Change: In Katana, Leaf to TerminalInstance renaming. * Bug: In Bora::PyDSlicingNode, allow the range parameter to be the Python None object when we do not want to pass one but need to have it as positional parameter. * Change: In Cumulus/clocktree/ClockTree.py, Leaf to TerminalInstance renaming.
2020-03-10 06:10:53 -05:00
METHOD_HEAD ( "HyperNet.getTerminalNetlistPlugOccurrences()" )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection* pyOccurrenceCollection = NULL;
2008-03-06 10:46:43 -06:00
HTRY
Clarify semantic of flatten Collections (walkthrough). In the Cell/Instance hierarchy, the "terminal" and "leaf cell" concepts where not clearly defined and partially overlapping. Now, "Terminal" is the refer to the physical hierarchy (layout) and "TerminalNetlist" to the logical hierarchy (netlist). The logical hierarchy can be less deep than the physical one thanks to a Cell dedicated cell flags. Collections related to the physical hierarchy keep their old names, the one related to the logical hierarchy are renamed from "Leaf" to "TerminalNetlist". The name "Leaf" was too ambiguous (leaf for *what* hierarchy). * Change: In Hurricane::Device, set the "TerminalNetlist" flag once and for all. No need set it in all the derived classes again. * New: In Hurricane::MultiCapacitor, added new parameter "dummy" to create dummies around the capacity matrix. * Change: In Hurricane::Cell, remove "Leaf" related methods, replace them by "TerminalNetlist" one, especially Collections. Now we have two clear sets of Collections to walkthough the layout or the netlist. Change the "Terminal" flag into "TerminalNetlist". * Change: In Hurricane::CellCollections, rename "Leaf" into "TerminalNetlist" collections and apply the new semantic to the locators. * Change: In Hurricane::DataBase, Leaf to TerminalInstance renaming. * Change: In Hurricane::DeepNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::HyperNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::Instance, Leaf to TerminalInstance renaming. * Change: In Hurricane::Viewer::HierarchyInformations, Leaf to TerminalInstance renaming. * Change: In CRL::AllianceFramework, Leaf to TerminalInstance renaming. * Change: In CRL::Catalog, Leaf to TerminalInstance renaming. * Change: In CRL::ApParser, Leaf to TerminalInstance renaming. * Change: In EtesianEngine::AddFeeds, Leaf to TerminalInstance renaming. * Bug: In EtesianEngine::resetPlacement, move there the loop over non terminal netlist instances to flag fully placed sub-blocks as terminal for the netlist. Only then remove the feed cells from unplaced instances. Previously, the feed cells where stripped even from already placed instances. * Change: In Katana, Leaf to TerminalInstance renaming. * Bug: In Bora::PyDSlicingNode, allow the range parameter to be the Python None object when we do not want to pass one but need to have it as positional parameter. * Change: In Cumulus/clocktree/ClockTree.py, Leaf to TerminalInstance renaming.
2020-03-10 06:10:53 -05:00
Occurrences* occurrences = new Occurrences(hyperNet->getTerminalNetlistPlugOccurrences());
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW(PyOccurrenceCollection, &PyTypeOccurrenceCollection);
if (pyOccurrenceCollection == NULL) {
return NULL;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection->_object = occurrences;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-17 12:27:20 -05:00
return (PyObject*)pyOccurrenceCollection;
2008-03-06 10:46:43 -06:00
}
2008-03-17 08:54:33 -05:00
static PyObject* PyHyperNet_getCell ( PyHyperNet *self )
2008-03-06 10:46:43 -06:00
{
cdebug_log(20,0) << "PyHyperNet_getCell ()" << endl;
2008-03-06 10:46:43 -06:00
Cell* cell = NULL;
HTRY
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "HyperNet.getCell()" )
cell = hyperNet->getCell ();
2008-03-06 10:46:43 -06:00
HCATCH
return PyCell_Link ( cell );
}
PyMethodDef PyHyperNet_Methods[] =
{ { "create" , (PyCFunction)PyHyperNet_create , METH_VARARGS|METH_STATIC
, "Create a new HyperNet." }
, { "getCell" , (PyCFunction)PyHyperNet_getCell , METH_NOARGS , "Returns the hyperNet cell." }
, { "isValid" , (PyCFunction)PyHyperNet_isValid , METH_NOARGS , "Returns trus if the HyperNet isValid." }
, { "getNetOccurrences" , (PyCFunction)PyHyperNet_getNetOccurrences , METH_NOARGS
, "Returns the collection of Net occurrences" }
Clarify semantic of flatten Collections (walkthrough). In the Cell/Instance hierarchy, the "terminal" and "leaf cell" concepts where not clearly defined and partially overlapping. Now, "Terminal" is the refer to the physical hierarchy (layout) and "TerminalNetlist" to the logical hierarchy (netlist). The logical hierarchy can be less deep than the physical one thanks to a Cell dedicated cell flags. Collections related to the physical hierarchy keep their old names, the one related to the logical hierarchy are renamed from "Leaf" to "TerminalNetlist". The name "Leaf" was too ambiguous (leaf for *what* hierarchy). * Change: In Hurricane::Device, set the "TerminalNetlist" flag once and for all. No need set it in all the derived classes again. * New: In Hurricane::MultiCapacitor, added new parameter "dummy" to create dummies around the capacity matrix. * Change: In Hurricane::Cell, remove "Leaf" related methods, replace them by "TerminalNetlist" one, especially Collections. Now we have two clear sets of Collections to walkthough the layout or the netlist. Change the "Terminal" flag into "TerminalNetlist". * Change: In Hurricane::CellCollections, rename "Leaf" into "TerminalNetlist" collections and apply the new semantic to the locators. * Change: In Hurricane::DataBase, Leaf to TerminalInstance renaming. * Change: In Hurricane::DeepNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::HyperNet, Leaf to TerminalInstance renaming. * Change: In Hurricane::Instance, Leaf to TerminalInstance renaming. * Change: In Hurricane::Viewer::HierarchyInformations, Leaf to TerminalInstance renaming. * Change: In CRL::AllianceFramework, Leaf to TerminalInstance renaming. * Change: In CRL::Catalog, Leaf to TerminalInstance renaming. * Change: In CRL::ApParser, Leaf to TerminalInstance renaming. * Change: In EtesianEngine::AddFeeds, Leaf to TerminalInstance renaming. * Bug: In EtesianEngine::resetPlacement, move there the loop over non terminal netlist instances to flag fully placed sub-blocks as terminal for the netlist. Only then remove the feed cells from unplaced instances. Previously, the feed cells where stripped even from already placed instances. * Change: In Katana, Leaf to TerminalInstance renaming. * Bug: In Bora::PyDSlicingNode, allow the range parameter to be the Python None object when we do not want to pass one but need to have it as positional parameter. * Change: In Cumulus/clocktree/ClockTree.py, Leaf to TerminalInstance renaming.
2020-03-10 06:10:53 -05:00
, { "getTerminalNetlistPlugOccurrences", (PyCFunction)PyHyperNet_getTerminalNetlistPlugOccurrences, METH_NOARGS
, "Returns the collection of leaf occurrences" }
, { "destroy" , (PyCFunction)PyHyperNet_destroy , METH_NOARGS
, "Destroy associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
2008-03-06 10:46:43 -06:00
};
DirectDeleteMethod(PyHyperNet_DeAlloc,PyHyperNet)
PyTypeObjectLinkPyType(HyperNet)
#else // Python Module Code Part.
// +=================================================================+
// | "PyHyperNet" Shared Library Code Part |
// +=================================================================+
2008-03-06 10:46:43 -06:00
PyTypeObjectDefinitions(HyperNet)
2008-03-06 10:46:43 -06:00
#endif // Shared Library Code Part.
2008-03-06 10:46:43 -06:00
} // extern "C".
2008-03-06 10:46:43 -06:00
} // Isobar namespace.