coriolis/hurricane/src/isobar/PyMaterial.cpp

211 lines
7.3 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Clément <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
//
// +-----------------------------------------------------------------+
// | 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@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyMaterial.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyTechnology.h"
#include "hurricane/isobar/PyMaterial.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(BasicLayer::Material,material,function)
// +=================================================================+
// | "PyMaterial" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
// +-------------------------------------------------------------+
// | "PyMaterial" Attribute Methods |
// +-------------------------------------------------------------+
static PyObject* PyMaterial_new ( PyTypeObject* type, PyObject* args, PyObject* kwds )
{
cdebug_log(20,0) << "PyMaterial_new()" << endl;
BasicLayer::Material* material = NULL;
PyMaterial* pyMaterial = (PyMaterial*)type->tp_alloc(type,0);
HTRY
if ( pyMaterial ) {
int code = 0;
if (PyArg_ParseTuple(args,"i:BasicLayer.Material.new", &code)) {
BasicLayer::Material::Code enumCode;
if (code <= (int)BasicLayer::Material::other) enumCode = (BasicLayer::Material::Code)code;
else {
PyErr_SetString(ConstructorError,"BasicLayer::Material(): Invalid code value.");
return NULL;
}
material = new BasicLayer::Material(enumCode);
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for BasicLayer.Material()." );
return NULL;
}
pyMaterial->_object = material;
}
HCATCH
return (PyObject*)pyMaterial;
}
PyObject* PyMaterial_getCode ( PyMaterial* self )
{
cdebug_log(20,0) << "PyMaterial_getCode()" << endl;
int code = 0;
HTRY
METHOD_HEAD("Material.getCode()")
code = (int)material->getCode();
HCATCH
return Py_BuildValue("i",code);
}
// ---------------------------------------------------------------
// PyMaterial Attribute Method table.
PyMethodDef PyMaterial_Methods[] =
{ { "getCode" , (PyCFunction)PyMaterial_getCode, METH_NOARGS
, "Returns the numerical code of the material (enum)." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// +-------------------------------------------------------------+
// | "PyMaterial" Object Methods |
// +-------------------------------------------------------------+
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
static int PyMaterial_Cmp ( PyMaterial *self, PyObject* other )
{
if (not IsPyMaterial(other) ) return -1;
PyMaterial* otherPyObject = (PyMaterial *)other;
if (self->_object->getCode() == otherPyObject->_object->getCode()) return 0;
if (self->_object->getCode() < otherPyObject->_object->getCode()) return -1;
return 1;
}
DirectHashMethod (PyMaterial_Hash , PyMaterial)
DirectReprMethod (PyMaterial_Repr , PyMaterial, BasicLayer::Material)
DirectStrMethod (PyMaterial_Str , PyMaterial, BasicLayer::Material)
DirectDeleteMethod(PyMaterial_DeAlloc, PyMaterial)
extern void PyMaterial_LinkPyType() {
cdebug_log(20,0) << "PyMaterial_LinkType()" << endl;
PyTypeMaterial.tp_new = PyMaterial_new;
PyTypeMaterial.tp_dealloc = (destructor) PyMaterial_DeAlloc;
PyTypeMaterial.tp_repr = (reprfunc) PyMaterial_Repr;
PyTypeMaterial.tp_str = (reprfunc) PyMaterial_Str;
PyTypeMaterial.tp_compare = (cmpfunc) PyMaterial_Cmp;
PyTypeMaterial.tp_hash = (hashfunc) PyMaterial_Hash;
PyTypeMaterial.tp_methods = PyMaterial_Methods;
}
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyMaterial" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
PyObject* PyMaterial_Link ( BasicLayer::Material* object ) {
if ( object == NULL ) Py_RETURN_NONE;
PyMaterial* pyObject = NULL;
HTRY
pyObject = PyObject_NEW(PyMaterial, &PyTypeMaterial);
if (pyObject == NULL) return NULL;
pyObject->ACCESS_OBJECT = object;
HCATCH
return (PyObject*)pyObject;
}
extern void PyMaterial_postModuleInit ()
{
PyObject* constant;
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::nWell ,"nWell" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::pWell ,"pWell" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::nImplant,"nImplant");
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::pImplant,"pImplant");
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::active ,"active" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::poly ,"poly" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::cut ,"cut" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::metal ,"metal" );
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::blockage,"blockage");
LoadObjectConstant(PyTypeMaterial.tp_dict,BasicLayer::Material::other ,"other" );
}
PyTypeObjectDefinitions(Material)
#endif // End of Shared Library Code Part.
} // extern "C".
} // Isobar namespace.