Complete Python support.

* New: In PyAnabatic, export the various Engine constants.
* Change: In Katana, in TrackElement and derived classes, add a getSegment()
    method for easier access to the underlying Hurricane segment.
* New: In PyKatanaEngine, export the loadGlobalRouting method which was
    missing (for use by Unicorn/cgt).
This commit is contained in:
Jean-Paul Chaput 2016-08-27 16:02:22 +02:00
parent 0a488d16af
commit ebc4a0cdbf
8 changed files with 44 additions and 2 deletions

View File

@ -82,6 +82,15 @@ extern "C" {
PyModule_AddObject( module, "AnabaticEngine", (PyObject*)&PyTypeAnabaticEngine ); PyModule_AddObject( module, "AnabaticEngine", (PyObject*)&PyTypeAnabaticEngine );
Py_INCREF( &PyTypeGraphicAnabaticEngine ); Py_INCREF( &PyTypeGraphicAnabaticEngine );
PyModule_AddObject( module, "GraphicAnabaticEngine", (PyObject*)&PyTypeGraphicAnabaticEngine ); PyModule_AddObject( module, "GraphicAnabaticEngine", (PyObject*)&PyTypeGraphicAnabaticEngine );
PyObject* dictionnary = PyModule_GetDict(module);
PyObject* constant;
LoadObjectConstant( dictionnary,EngineLoadGrByNet ,"EngineLoadGrByNet" );
LoadObjectConstant( dictionnary,EngineLoadGrByGCell ,"EngineLoadGrByGCell" );
LoadObjectConstant( dictionnary,EngineLayerAssignByLength,"EngineLayerAssignByLength" );
LoadObjectConstant( dictionnary,EngineLayerAssignByTrunk ,"EngineLayerAssignByTrunk" );
LoadObjectConstant( dictionnary,EngineNoNetLayerAssign ,"EngineNoNetLayerAssign" );
} }

View File

@ -284,7 +284,7 @@ namespace Katana {
continue; continue;
} }
Segment* segment = element->base()->base(); Segment* segment = element->getSegment();
Flags side = Flags::EastSide; Flags side = Flags::EastSide;
DbU::Unit axis = segment->getY(); DbU::Unit axis = segment->getY();
if (track->getDirection() == Flags::Vertical) { if (track->getDirection() == Flags::Vertical) {

View File

@ -173,6 +173,32 @@ extern "C" {
} }
PyObject* PyKatanaEngine_loadGlobalRouting ( PyKatanaEngine* self, PyObject* args )
{
cdebug_log(40,0) << "PyKatanaEngine_loadGlobalRouting()" << endl;
HTRY
METHOD_HEAD("KatanaEngine.loadGlobalRouting()")
unsigned int flags = 0;
if (PyArg_ParseTuple(args,"I:KatanaEngine.loadGlobalRouting", &flags)) {
if (katana->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::loadGlobalRouting,katana,flags) )) {
PyErr_SetString( HurricaneError, "KatanaEngine::loadGlobalrouting() has thrown an exception (C++)." );
return NULL;
}
} else {
katana->loadGlobalRouting(flags);
}
} else {
PyErr_SetString(ConstructorError, "KatanaEngine.loadGlobalRouting(): Invalid number/bad type of parameter.");
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
PyObject* PyKatanaEngine_layerAssign ( PyKatanaEngine* self, PyObject* args ) PyObject* PyKatanaEngine_layerAssign ( PyKatanaEngine* self, PyObject* args )
{ {
cdebug_log(40,0) << "PyKatanaEngine_layerAssign()" << endl; cdebug_log(40,0) << "PyKatanaEngine_layerAssign()" << endl;
@ -265,6 +291,8 @@ extern "C" {
, "Returns True if the detailed routing has been successful." } , "Returns True if the detailed routing has been successful." }
, { "runGlobalRouter" , (PyCFunction)PyKatanaEngine_runGlobalRouter , METH_VARARGS , { "runGlobalRouter" , (PyCFunction)PyKatanaEngine_runGlobalRouter , METH_VARARGS
, "Run the global router (Knik)." } , "Run the global router (Knik)." }
, { "loadGlobalRouting" , (PyCFunction)PyKatanaEngine_loadGlobalRouting , METH_VARARGS
, "Load global routing into the detailed router." }
, { "layerAssign" , (PyCFunction)PyKatanaEngine_layerAssign , METH_VARARGS , { "layerAssign" , (PyCFunction)PyKatanaEngine_layerAssign , METH_VARARGS
, "Run the layer assigment stage." } , "Run the layer assigment stage." }
, { "runNegociatePreRouted", (PyCFunction)PyKatanaEngine_runNegociatePreRouted, METH_NOARGS , { "runNegociatePreRouted", (PyCFunction)PyKatanaEngine_runNegociatePreRouted, METH_NOARGS

View File

@ -131,6 +131,7 @@ namespace Katana {
AutoSegment* TrackFixedSegment::base () const { return NULL; } AutoSegment* TrackFixedSegment::base () const { return NULL; }
Segment* TrackFixedSegment::getSegment () const { return _segment; }
DbU::Unit TrackFixedSegment::getAxis () const { return getTrack()->getAxis(); } DbU::Unit TrackFixedSegment::getAxis () const { return getTrack()->getAxis(); }
bool TrackFixedSegment::isHorizontal () const { return getTrack()->isHorizontal(); } bool TrackFixedSegment::isHorizontal () const { return getTrack()->isHorizontal(); }
bool TrackFixedSegment::isVertical () const { return getTrack()->isVertical(); } bool TrackFixedSegment::isVertical () const { return getTrack()->isVertical(); }

View File

@ -145,6 +145,7 @@ namespace Katana {
// Formerly Inline Functions. // Formerly Inline Functions.
// Wrappeds. // Wrappeds.
AutoSegment* TrackSegment::base () const { return _base; } AutoSegment* TrackSegment::base () const { return _base; }
Segment* TrackSegment::getSegment () const { return _base->base(); }
bool TrackSegment::isFixed () const { return _base->isFixed(); } bool TrackSegment::isFixed () const { return _base->isFixed(); }
bool TrackSegment::isHorizontal () const { return _base->isHorizontal(); } bool TrackSegment::isHorizontal () const { return _base->isHorizontal(); }
bool TrackSegment::isVertical () const { return _base->isVertical(); } bool TrackSegment::isVertical () const { return _base->isVertical(); }

View File

@ -89,6 +89,7 @@ namespace Katana {
public: public:
void destroy (); void destroy ();
virtual AutoSegment* base () const; virtual AutoSegment* base () const;
virtual Segment* getSegment () const = 0;
// Wrapped AutoSegment Functions (when applicable). // Wrapped AutoSegment Functions (when applicable).
virtual bool isFixed () const; virtual bool isFixed () const;
virtual bool isHorizontal () const = 0; virtual bool isHorizontal () const = 0;

View File

@ -10,7 +10,7 @@
// | Author : Jean-Paul CHAPUT | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./katana/TrackFixedSegment.h" | // | C++ Header : "./katana/TrackFixedSegment.h" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
@ -41,6 +41,7 @@ namespace Katana {
static TrackElement* create ( Katana::Track* track , Segment* segment ); static TrackElement* create ( Katana::Track* track , Segment* segment );
public: public:
virtual AutoSegment* base () const; virtual AutoSegment* base () const;
virtual Segment* getSegment () const;
virtual bool isHorizontal () const; virtual bool isHorizontal () const;
virtual bool isVertical () const; virtual bool isVertical () const;
virtual bool isFixed () const; virtual bool isFixed () const;

View File

@ -56,6 +56,7 @@ namespace Katana {
public: public:
// Wrapped AutoSegment Functions (when applicable). // Wrapped AutoSegment Functions (when applicable).
virtual AutoSegment* base () const; virtual AutoSegment* base () const;
virtual Segment* getSegment () const;
virtual bool isFixed () const; virtual bool isFixed () const;
virtual bool isHorizontal () const; virtual bool isHorizontal () const;
virtual bool isVertical () const; virtual bool isVertical () const;