coriolis/bora/src/PyDSlicingNode.cpp

153 lines
5.2 KiB
C++
Raw Normal View History

Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2018, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | B o r a - A n a l o g S l i c i n g T r e e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./bora/PyDSlicingNode.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/analog/PyDevice.h"
#include "crlcore/PyRoutingGauge.h"
#include "bora/PyDSlicingNode.h"
namespace Bora {
using namespace Hurricane;
using namespace Isobar;
using CRL::PyRoutingGauge;
using CRL::PyTypeRoutingGauge;
using CRL::RoutingGauge;
using Analog::Device;
extern "C" {
#undef ACCESS_OBJECT
#undef ACCESS_CLASS
#define ACCESS_OBJECT _baseObject._object
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DSlicingNode,node,function)
// +=================================================================+
// | "PyDSlicingNode" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
// +-------------------------------------------------------------+
// | "PyDSlicingNode" Attribute Methods |
// +-------------------------------------------------------------+
static PyObject* PyDSlicingNode_create ( PyObject* , PyObject* args )
{
PyObject* pyInstance = NULL;
PyObject* pyCell = NULL;
PyObject* pyRoutingGauge = NULL;
double start = 0.0;
double step = 0.0;
double count = 0.0;
DSlicingNode* node = NULL;
HTRY
if (not PyArg_ParseTuple( args,"SOddd|O:DSlicingNode.create"
, &pyInstance
, &pyCell
, &start
, &step
, &count
, &pyRoutingGauge ) ) {
PyErr_SetString ( ConstructorError, "DSlicingNode.create(): Invalid/bad number of parameters ." );
return NULL;
}
if (not IsPyCell(pyCell)) {
PyErr_SetString( ConstructorError, "DSlicingNode.create(): First argument *must* be of type Cell." );
return NULL;
}
if (pyRoutingGauge and not IsPyRoutingGauge(pyRoutingGauge)) {
PyErr_SetString( ConstructorError, "DSlicingNode.create(): Fifth argument *must* be of type RoutingGauge." );
return NULL;
}
Cell* cell = PYCELL_O( pyCell );
Instance* instance = cell->getInstance( PyString_AsString(pyInstance) );
//Device* device = dynamic_cast<Device*>( instance->getMasterCell() );
RoutingGauge* rg = (pyRoutingGauge) ? PYROUTINGGAUGE_O(pyRoutingGauge) : NULL;
node = DSlicingNode::create( NodeSets::create( instance->getMasterCell(), start, step, count, rg )
, UnknownAlignment
, instance );
HCATCH
return PyDSlicingNode_NEW(node);
}
DirectGetIntAttribute(PyDSlicingNode_getNFing,getNFing,PyDSlicingNode,DSlicingNode)
DirectSetIntAttribute(PyDSlicingNode_setNFing,setNFing,PyDSlicingNode,DSlicingNode)
// Standart Destroy (Attribute).
// ---------------------------------------------------------------
// PyDSlicingNode Attribute Method table.
PyMethodDef PyDSlicingNode_Methods[] =
{ { "create" , (PyCFunction)PyDSlicingNode_create , METH_VARARGS|METH_STATIC
, "Create a new DSlicingNode." }
, { "getNFing" , (PyCFunction)PyDSlicingNode_getNFing , METH_NOARGS , "To be documented." }
, { "setNFing" , (PyCFunction)PyDSlicingNode_setNFing , METH_VARARGS, "To be documented." }
, { NULL, NULL, 0, NULL } /* sentinel */
};
// +-------------------------------------------------------------+
// | "PyDSlicingNode" Object Methods |
// +-------------------------------------------------------------+
PythonOnlyDeleteMethod(DSlicingNode)
PyTypeObjectLinkPyType(DSlicingNode)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyDSlicingNode" Shared Library Code Part |
// +=================================================================+
extern PyObject* PyDSlicingNode_NEW ( DSlicingNode* node )
{
if (not node) Py_RETURN_NONE;
PyDSlicingNode* pyNode = NULL;
HTRY
pyNode = PyObject_NEW( PyDSlicingNode, &PyTypeDSlicingNode );
if (not pyNode) return NULL;
pyNode->ACCESS_OBJECT = node;
HCATCH
return (PyObject*)pyNode;
}
PyTypeInheritedObjectDefinitions(DSlicingNode, SlicingNode)
#endif // End of Shared Library Code Part.
} // extern "C".
} // Bora namespace.