From b0ae6be65208c3c30de5105a212ee76eccdbb778 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 27 Dec 2020 12:21:14 +0100 Subject: [PATCH] Export Cell::flattenNets() & revlevant Cell flags. --- etesian/src/EtesianEngine.cpp | 8 +++- hurricane/src/hurricane/Plug.cpp | 2 +- hurricane/src/isobar/PyCell.cpp | 46 +++++++++++++++++++ hurricane/src/isobar/PyHurricane.cpp | 1 + .../src/isobar/hurricane/isobar/PyCell.h | 13 ++---- 5 files changed, 59 insertions(+), 11 deletions(-) diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index 6fd8a41b..32120a88 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -646,6 +646,9 @@ namespace Etesian { _cellsToIds.insert( make_pair(getString(instance->getName()),instanceId) ); _idsToInsts.push_back( instance ); + // cerr << "FIXED id=" << instanceId + // << " " << instance << " size:(" << xsize << " " << ysize + // << ") pos:(" << xpos << " " << ypos << ")" << endl; ++instanceId; dots.dot(); } @@ -710,8 +713,9 @@ namespace Etesian { |coloquinte::YFlippable; } else { instances[instanceId].attributes = 0; - //cerr << "FIXED: " << instance << " size:(" << xsize << " " << ysize - // << ") pos:(" << xpos << " " << ypos << ")" << endl; + // cerr << "FIXED id=" << instanceId + // << " " << instance << " size:(" << xsize << " " << ysize + // << ") pos:(" << xpos << " " << ypos << ")" << endl; } _cellsToIds.insert( make_pair(instanceName,instanceId) ); diff --git a/hurricane/src/hurricane/Plug.cpp b/hurricane/src/hurricane/Plug.cpp index 147e6569..9fd814fe 100644 --- a/hurricane/src/hurricane/Plug.cpp +++ b/hurricane/src/hurricane/Plug.cpp @@ -137,7 +137,7 @@ void Plug::setNet(Net* net) if (net != getNet()) { if (net and (getCell() != net->getCell())) throw Error( "Plug::setNet(): Can't set Net of plug %s to %s\n" - "Net belong to %s instead of %s." + "Net belong to %s while plug belong to of %s." , getString(this).c_str() , getString(net).c_str() , getString(net->getCell()).c_str() diff --git a/hurricane/src/isobar/PyCell.cpp b/hurricane/src/isobar/PyCell.cpp index 81726393..df3aecdb 100644 --- a/hurricane/src/isobar/PyCell.cpp +++ b/hurricane/src/isobar/PyCell.cpp @@ -708,6 +708,39 @@ extern "C" { } + static PyObject* PyCell_flattenNets ( PyCell* self, PyObject *args ) + { + cdebug_log(20,0) << "PyCell_flattenNets()" << endl; + + Instance* instance = NULL; + PyObject* arg0 = NULL; + PyObject* arg1 = NULL; + + HTRY + METHOD_HEAD ( "Cell.flattenNets()" ) + __cs.init( "Cell.flattenNets" ); + if (not PyArg_ParseTuple(args,"O&O&:Cell.flattenNets" + ,Converter,&arg0 + ,Converter,&arg1 + )) { + PyErr_SetString( ConstructorError, "Cell.flattenNets(): Takes exactly two parameters." ); + return NULL; + } + + if (arg0 == Py_None) { + cell->flattenNets( NULL, PyInt_AsLong(arg1) ); + } else if (__cs.getObjectIds() == ":ent:int") { + cell->flattenNets( PYINSTANCE_O(arg0), PyInt_AsLong(arg1) ); + } else { + string message = "Cell.flattenNets(): Bad type of parameter(s), \"" + __cs.getObjectIds() + "\"."; + PyErr_SetString( ConstructorError, message.c_str() ); + return NULL; + } + HCATCH + Py_RETURN_NONE; + } + + // --------------------------------------------------------------- // Attribute Method : "PyCell_destroyPhysical ()" @@ -778,6 +811,7 @@ extern "C" { , { "setRouted" , (PyCFunction)PyCell_setRouted , METH_VARARGS, "Sets the cell routed status." } , { "uniquify" , (PyCFunction)PyCell_uniquify , METH_VARARGS, "Uniquify the Cell and it's instances up to ." } , { "getClone" , (PyCFunction)PyCell_getClone , METH_NOARGS , "Return a copy of the Cell (placement only)." } + , { "flattenNets" , (PyCFunction)PyCell_flattenNets , METH_VARARGS, "Perform a virtual flatten, possibly limited to one instance." } , { "destroyPhysical" , (PyCFunction)PyCell_destroyPhysical , METH_NOARGS , "Destroy all physical components, including DeepNets (vflatten)." } , { "destroy" , (PyCFunction)PyCell_destroy , METH_NOARGS , "Destroy associated hurricane object The python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ @@ -804,6 +838,18 @@ extern "C" { PyTypeInheritedObjectDefinitions(Cell, Entity) + extern void PyCell_postModuleInit () + { + PyObject* constant; + + LoadObjectConstant(PyTypeCell.tp_dict,Cell::Flags::NoFlags ,"Flags_NoFlags"); + LoadObjectConstant(PyTypeCell.tp_dict,Cell::Flags::BuildRings ,"Flags_BuildRings"); + LoadObjectConstant(PyTypeCell.tp_dict,Cell::Flags::BuildClockRings ,"Flags_BuildClockRings"); + LoadObjectConstant(PyTypeCell.tp_dict,Cell::Flags::BuildSupplyRings,"Flags_BuildSupplyRings"); + LoadObjectConstant(PyTypeCell.tp_dict,Cell::Flags::NoClockFlatten ,"Flags_NoClockFlatten"); + } + + #endif // End of Shared Library Code Part. diff --git a/hurricane/src/isobar/PyHurricane.cpp b/hurricane/src/isobar/PyHurricane.cpp index 4166dbbe..8a7b0706 100644 --- a/hurricane/src/isobar/PyHurricane.cpp +++ b/hurricane/src/isobar/PyHurricane.cpp @@ -872,6 +872,7 @@ extern "C" { PyRoutingPad_postModuleInit(); PyNet_postModuleInit(); PyNetRoutingState_postModuleInit(); + PyCell_postModuleInit(); PyInstance_postModuleInit(); PyQuery_postModuleInit(); diff --git a/hurricane/src/isobar/hurricane/isobar/PyCell.h b/hurricane/src/isobar/hurricane/isobar/PyCell.h index 928fa5b5..7f49612d 100644 --- a/hurricane/src/isobar/hurricane/isobar/PyCell.h +++ b/hurricane/src/isobar/hurricane/isobar/PyCell.h @@ -1,7 +1,7 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC 2006-2018, All Rights Reserved +// Copyright (c) UPMC 2006-2020, All Rights Reserved // // +-----------------------------------------------------------------+ // | C O R I O L I S | @@ -14,9 +14,7 @@ // +-----------------------------------------------------------------+ -#ifndef PY_CELL_H -#define PY_CELL_H - +#pragma once #include "hurricane/isobar/PyEntity.h" #include "hurricane/Cell.h" @@ -40,8 +38,9 @@ namespace Isobar { extern PyTypeObject PyTypeCell; extern PyMethodDef PyCell_Methods[]; - extern PyObject* PyCell_Link ( Hurricane::Cell* object ); - extern void PyCell_LinkPyType (); + extern PyObject* PyCell_Link ( Hurricane::Cell* object ); + extern void PyCell_LinkPyType (); + extern void PyCell_postModuleInit (); #define IsPyCell(v) ((v)->ob_type == &PyTypeCell) @@ -52,5 +51,3 @@ namespace Isobar { } // extern "C". } // Isobar namespace. - -#endif // PY_CELL_H