crlcore: Add Python bindings for LEF export
Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
parent
0d7deafe81
commit
e1c5366fef
|
@ -50,6 +50,7 @@
|
|||
PyGds.cpp
|
||||
PyLefImport.cpp
|
||||
PyDefImport.cpp
|
||||
PyLefExport.cpp
|
||||
)
|
||||
set( pyIncludes crlcore/PySystem.h
|
||||
crlcore/PyBanner.h
|
||||
|
@ -72,6 +73,7 @@
|
|||
crlcore/PyGds.h
|
||||
crlcore/PyLefImport.h
|
||||
crlcore/PyDefImport.h
|
||||
crlcore/PyLefExport.h
|
||||
)
|
||||
# target_link_libraries ( crlcore ${HURRICANE_PYTHON_NEW_LIBRARIES}
|
||||
# ${HURRICANE_PYTHON_LIBRARIES}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "crlcore/PyBlif.h"
|
||||
#include "crlcore/PyGds.h"
|
||||
#include "crlcore/PyLefImport.h"
|
||||
#include "crlcore/PyLefExport.h"
|
||||
#include "crlcore/PyDefImport.h"
|
||||
#include "crlcore/VhdlEntity.h"
|
||||
|
||||
|
@ -146,6 +147,7 @@ extern "C" {
|
|||
PyGds_LinkPyType ();
|
||||
PyLefImport_LinkPyType ();
|
||||
PyDefImport_LinkPyType ();
|
||||
PyLefExport_LinkPyType ();
|
||||
|
||||
PYTYPE_READY ( System );
|
||||
PYTYPE_READY ( Banner );
|
||||
|
@ -169,7 +171,8 @@ extern "C" {
|
|||
PYTYPE_READY ( Gds );
|
||||
PYTYPE_READY ( LefImport );
|
||||
PYTYPE_READY ( DefImport );
|
||||
|
||||
PYTYPE_READY ( LefExport );
|
||||
|
||||
// Identifier string can take up to 10 characters.
|
||||
__cs.addType ( "alcLib" , &PyTypeAllianceLibrary , "<AllianceLibrary>" , false );
|
||||
__cs.addType ( "alcEnv" , &PyTypeEnvironment , "<Environment>" , false );
|
||||
|
@ -229,6 +232,8 @@ extern "C" {
|
|||
PyModule_AddObject ( module, "LefImport", (PyObject*)&PyTypeLefImport );
|
||||
Py_INCREF ( &PyTypeDefImport );
|
||||
PyModule_AddObject ( module, "DefImport", (PyObject*)&PyTypeDefImport );
|
||||
Py_INCREF ( &PyTypeLefExport );
|
||||
PyModule_AddObject ( module, "LefExport", (PyObject*)&PyTypeLefExport );
|
||||
|
||||
PyCatalog_postModuleInit ();
|
||||
PyEnvironment_postModuleInit ();
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2017-2018, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyLefExport.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "crlcore/PyLefExport.h"
|
||||
#include "hurricane/isobar/PyLibrary.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::hex;
|
||||
using std::string;
|
||||
using std::ostringstream;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::Exception;
|
||||
using Hurricane::Bug;
|
||||
using Hurricane::Error;
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::Library;
|
||||
using Isobar::ProxyProperty;
|
||||
using Isobar::ProxyError;
|
||||
using Isobar::ConstructorError;
|
||||
using Isobar::HurricaneError;
|
||||
using Isobar::HurricaneWarning;
|
||||
using Isobar::getPyHash;
|
||||
using Isobar::ParseOneArg;
|
||||
using Isobar::ParseTwoArg;
|
||||
using Isobar::__cs;
|
||||
using Isobar::PyTypeLibrary;
|
||||
using Isobar::PyLibrary;
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyLefExport" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
|
||||
static PyObject* PyLefExport_drive ( PyObject*, PyObject* args )
|
||||
{
|
||||
cdebug_log(30,0) << "PyLefExport_drive()" << endl;
|
||||
|
||||
PyLibrary* pyLibrary = NULL;
|
||||
|
||||
HTRY
|
||||
unsigned int flags = 0;
|
||||
|
||||
if (PyArg_ParseTuple( args, "O!I:LefExport.drive", &PyTypeLibrary, &pyLibrary, &flags)) {
|
||||
LefExport::drive( PYLIBRARY_O(pyLibrary) , flags );
|
||||
} else {
|
||||
PyErr_SetString ( ConstructorError, "LefExport.drive(): Bad type or bad number of parameters." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
|
||||
|
||||
PyMethodDef PyLefExport_Methods[] =
|
||||
{ { "drive" , (PyCFunction)PyLefExport_drive , METH_VARARGS|METH_STATIC
|
||||
, "Save a complete Cadence LEF library." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
NoObjectDeleteMethod(LefExport)
|
||||
PyTypeObjectLinkPyTypeWithoutObject(LefExport,LefExport)
|
||||
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyLefExport" Shared Library Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
// Type Definition.
|
||||
PyTypeObjectDefinitionsOfModule(CRL,LefExport)
|
||||
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
} // extern "C".
|
||||
|
||||
} // CRL namespace.
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2017-2018, All Rights Reserved
|
||||
//
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./crlcore/PyLefExport.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef CRL_PY_LEF_EXPORT_H
|
||||
#define CRL_PY_LEF_EXPORT_H
|
||||
|
||||
#include "hurricane/isobar/PyHurricane.h"
|
||||
#include "crlcore/LefExport.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Python Object : "PyLefExport".
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} PyLefExport;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyCRL.ccp".
|
||||
|
||||
extern PyTypeObject PyTypeLefExport;
|
||||
extern PyMethodDef PyLefExport_Methods[];
|
||||
|
||||
extern void PyLefExport_LinkPyType();
|
||||
|
||||
|
||||
#define IsPyLefExport(v) ( (v)->ob_type == &PyTypeLefExport )
|
||||
#define PY_LEFEXPORT(v) ( (PyLefExport*)(v) )
|
||||
|
||||
|
||||
} // extern "C".
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
#endif // CRL_PY_LEF_EXPORT_H
|
Loading…
Reference in New Issue