From 8d7ad312c99d452d234d9f2567a50406efe61791 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 16 Nov 2012 12:54:58 +0000 Subject: [PATCH] * All Tools: - A complete sweep of cleanup to suppress allmost all compiler warnings. * ./unicorn: - New: Added Python support. - New: No binary is generated. Instead a Python script is supplied. --- unicorn/CMakeLists.txt | 10 +- unicorn/src/CMakeLists.txt | 27 ++- unicorn/src/CgtMain.cpp | 11 +- unicorn/src/OpenCellDialog.cpp | 14 +- unicorn/src/PyUnicorn.cpp | 83 +++++++++ unicorn/src/PyUnicornGui.cpp | 162 ++++++++++++++++++ unicorn/src/UnicornGui.cpp | 31 ++-- unicorn/src/cgt.py | 241 +++++++++++++++++++++++++++ unicorn/src/unicorn/OpenCellDialog.h | 14 +- unicorn/src/unicorn/PyUnicornGui.h | 57 +++++++ unicorn/src/unicorn/UnicornGui.h | 21 +-- 11 files changed, 613 insertions(+), 58 deletions(-) create mode 100644 unicorn/src/PyUnicorn.cpp create mode 100644 unicorn/src/PyUnicornGui.cpp create mode 100755 unicorn/src/cgt.py create mode 100644 unicorn/src/unicorn/PyUnicornGui.h diff --git a/unicorn/CMakeLists.txt b/unicorn/CMakeLists.txt index 1d0c3989..b5660d56 100644 --- a/unicorn/CMakeLists.txt +++ b/unicorn/CMakeLists.txt @@ -17,6 +17,7 @@ set(QT_USE_QTXML "true") find_package(Qt4 REQUIRED) find_package(PythonLibs REQUIRED) + find_package(PythonSitePackages REQUIRED) find_package(LEFDEF REQUIRED) find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) @@ -27,7 +28,12 @@ find_package(KNIK REQUIRED) find_package(KATABATIC REQUIRED) find_package(KITE REQUIRED) - #find_package(EQUINOX REQUIRED) - #find_package(SOLSTICE REQUIRED) +#find_package(EQUINOX REQUIRED) +#find_package(SOLSTICE REQUIRED) add_subdirectory(src) + + if(BUILD_DOC) + find_package(Doxygen REQUIRED) + add_subdirectory(doc) + endif(BUILD_DOC) diff --git a/unicorn/src/CMakeLists.txt b/unicorn/src/CMakeLists.txt index f3dad970..ac4e7187 100644 --- a/unicorn/src/CMakeLists.txt +++ b/unicorn/src/CMakeLists.txt @@ -11,7 +11,7 @@ ${LEFDEF_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} ) - add_definitions ( -DSYS_CONF_DIR=\\"${SYS_CONF_DIR}\\" ) + add_definitions ( -DSYS_CONF_DIR="${SYS_CONF_DIR}" ) set ( mocincludes unicorn/UnicornGui.h unicorn/OpenCellDialog.h @@ -19,18 +19,23 @@ unicorn/ImportCellDialog.h unicorn/ExportCellDialog.h ) + set ( pyIncludes unicorn/PyUnicornGui.h + ) set ( cpps OpenCellDialog.cpp SaveCellDialog.cpp ImportCellDialog.cpp ExportCellDialog.cpp UnicornGui.cpp ) + set ( pyCpps PyUnicorn.cpp + PyUnicornGui.cpp + ) set ( cgtcpp CgtMain.cpp ) qt4_wrap_cpp ( MOCcpps ${mocincludes} ) qt4_add_resources ( RCC_SRCS Unicorn.qrc ) - add_library ( unicorn ${cpps} ${MOCcpps} ) + add_library ( unicorn ${cpps} ${MOCcpps} ${pyCpps} ) set_target_properties ( unicorn PROPERTIES VERSION 1.0 SOVERSION 1 ) target_link_libraries ( unicorn ${SOLSTICE_GRAPHICAL_LIBRARIES} ${SOLSTICE_LIBRARIES} @@ -65,9 +70,21 @@ -lutil ${LIBXML2_LIBRARIES} ) + add_library ( pyUnicorn MODULE ${pyCpps} ) + target_link_libraries ( pyUnicorn unicorn ) + set_target_properties ( pyUnicorn PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -D__PYTHON_MODULE__=1" + PREFIX "" + OUTPUT_NAME "Unicorn" + ) + add_executable ( cgt ${cgtcpp} ) target_link_libraries ( cgt unicorn ) - install ( TARGETS unicorn DESTINATION lib${LIB_SUFFIX} ) - install ( TARGETS cgt DESTINATION bin ) - install ( FILES ${mocincludes} DESTINATION include/coriolis2/unicorn ) + set_target_properties ( cgt PROPERTIES OUTPUT_NAME "cgt-cpp" ) + + install ( TARGETS unicorn DESTINATION lib${LIB_SUFFIX} ) + install ( TARGETS pyUnicorn DESTINATION ${PYTHON_SITE_PACKAGES} ) + install ( TARGETS cgt DESTINATION bin ) + install ( PROGRAMS cgt.py DESTINATION bin RENAME cgt ) + install ( FILES ${mocincludes} + ${pyIncludes} DESTINATION include/coriolis2/unicorn ) diff --git a/unicorn/src/CgtMain.cpp b/unicorn/src/CgtMain.cpp index 7b23b15c..f46707d5 100644 --- a/unicorn/src/CgtMain.cpp +++ b/unicorn/src/CgtMain.cpp @@ -23,6 +23,7 @@ // +-----------------------------------------------------------------+ +#include #include #include using namespace std; @@ -296,7 +297,7 @@ int main ( int argc, char *argv[] ) cout << " Prof. Ident. ............................ Iowa State University" << endl; cout << " URL ........................ http://home.eng.iastate.edu/~cnchu" << endl; cout << endl; - cmess2 << af->getPrint() << endl; + //cmess2 << af->getPrint() << endl; if ( arguments.count("stratus-script") ) { string scriptName = arguments["stratus-script"].as(); @@ -378,22 +379,22 @@ int main ( int argc, char *argv[] ) MaukaEngine* mauka = NULL; nimbus = NimbusEngine::create ( cell ); - if ( showConf ) nimbus->getConfiguration()->print( cell ); + if ( showConf ) nimbus->printConfiguration(); if ( annealingPlace ) { Cfg::getParamPercentage("mauka.standardAnnealing")->setBool ( true ); } if ( quadriPlace ) { - metis = MetisEngine ::create ( cell ); - if ( showConf ) metis->getConfiguration()->print( cell ); + metis = MetisEngine::create ( cell ); + if ( showConf ) metis->printConfiguration(); MetisEngine::doQuadriPart ( cell ); MaukaEngine::regroupOverloadedGCells ( cell ); } mauka = MaukaEngine::create ( cell ); - if ( showConf ) mauka->getConfiguration()->print( cell ); + if ( showConf ) mauka->printConfiguration(); mauka->Run (); } diff --git a/unicorn/src/OpenCellDialog.cpp b/unicorn/src/OpenCellDialog.cpp index 30f1029d..ce29b205 100644 --- a/unicorn/src/OpenCellDialog.cpp +++ b/unicorn/src/OpenCellDialog.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | @@ -17,10 +12,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./OpenCellDialog.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/unicorn/src/PyUnicorn.cpp b/unicorn/src/PyUnicorn.cpp new file mode 100644 index 00000000..8ead1986 --- /dev/null +++ b/unicorn/src/PyUnicorn.cpp @@ -0,0 +1,83 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | U n i c o r n - M a i n G U I | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyUnicorn.cpp" | +// +-----------------------------------------------------------------+ + + +#include "unicorn/PyUnicornGui.h" + + +namespace Unicorn { + + using std::cerr; + using std::endl; + using Hurricane::tab; + using Hurricane::in_trace; + using Hurricane::CellViewer; + using Hurricane::PyTypeCellViewer; + using Isobar::__cs; + + +#if !defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyUnicorn" Shared Library Code Part | +// +=================================================================+ + + +# else // End of PyHurricane Shared Library Code Part. + + +// +=================================================================+ +// | "PyUnicorn" Python Module Code Part | +// +=================================================================+ + + +extern "C" { + + + static PyMethodDef PyUnicorn_Methods[] = + { {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + + + // --------------------------------------------------------------- + // Module Initialization : "initUnicorn ()" + + DL_EXPORT(void) initUnicorn () { + trace << "initUnicorn()" << endl; + + PyUnicornGui_LinkPyType (); + + PYTYPE_READY_SUB ( UnicornGui, CellViewer ); + + PyObject* module = Py_InitModule ( "Unicorn", PyUnicorn_Methods ); + if ( module == NULL ) { + cerr << "[ERROR]\n" + << " Failed to initialize Unicorn module." << endl; + return; + } + + Py_INCREF ( &PyTypeUnicornGui ); + PyModule_AddObject ( module, "UnicornGui", (PyObject*)&PyTypeUnicornGui ); + } + + +} // End of extern "C". + +#endif // Python Module Code Part. + +} // Unicorn namespace. diff --git a/unicorn/src/PyUnicornGui.cpp b/unicorn/src/PyUnicornGui.cpp new file mode 100644 index 00000000..9dbca8d5 --- /dev/null +++ b/unicorn/src/PyUnicornGui.cpp @@ -0,0 +1,162 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | U n i c o r n - M a i n G U I | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./PyUnicornGui.cpp" | +// +-----------------------------------------------------------------+ + + +#include "unicorn/PyUnicornGui.h" +#include "hurricane/viewer/CellWidget.h" +#include "crlcore/PyBanner.h" +#include "crlcore/PyGraphicToolEngine.h" + + +#undef ACCESS_OBJECT +#undef ACCESS_CLASS +#define ACCESS_OBJECT _baseObject._object +#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject) +#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(UnicornGui,gui,function) + + +namespace Unicorn { + +using namespace Hurricane; +using namespace Isobar; +using namespace CRL; + +extern "C" { + + +#if defined(__PYTHON_MODULE__) + +// +=================================================================+ +// | "PyUnicornGui" Python Module Code Part | +// +=================================================================+ + + static PyObject* PyUnicornGui_create ( PyObject*, PyObject* args ) + { + trace << "PyUnicornGui_create()" << endl; + + UnicornGui* gui = NULL; + PyUnicornGui* pyGui = NULL; + + HTRY + gui = UnicornGui::create(); + + pyGui = PyObject_NEW ( PyUnicornGui, &PyTypeUnicornGui ); + if ( pyGui == NULL ) { + gui->destroy(); + return NULL; + } + + pyGui->ACCESS_OBJECT = gui; + HCATCH + + return (PyObject*)pyGui; + } + + + static PyObject* PyUnicornGui_registerTool ( PyUnicornGui* self, PyObject* args ) + { + trace << "PyUnicornGui_registerTool()" << endl; + + HTRY + METHOD_HEAD("UnicornGui.registerTool()") + PyObject* pyGraphicTool = NULL; + + if (PyArg_ParseTuple(args, "O:UnicornGui.registerTool()", &pyGraphicTool)) { + if (not PyObject_IsInstance(pyGraphicTool, (PyObject*)&PyTypeGraphicTool)) { + PyErr_SetString ( ConstructorError, "UnicornGui.registerTool(): Argument is not of type GraphicTool." ); + return NULL; + } + gui->registerTool( PY_GRAPHIC_TOOL_O(pyGraphicTool) ); + } else { + PyErr_SetString ( ConstructorError, "Bad parameters given to UnicornGui.registerTool()." ); + return NULL; + } + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyUnicornGui_show ( PyUnicornGui* self ) + { + trace << "PyUnicornGui_show()" << endl; + + HTRY + METHOD_HEAD("UnicornGui.show()") + gui->show(); + HCATCH + + Py_RETURN_NONE; + } + + + static PyObject* PyUnicornGui_getBanner ( PyUnicornGui* self ) + { + trace << "PyUnicornGui_getBanner()" << endl; + + Banner* banner = NULL; + + HTRY + METHOD_HEAD("UnicornGui.getBanner()") + banner = &gui->getBanner(); + HCATCH + + return PyBanner_Link(banner); + } + + + // Standart Destroy (Attribute). + DirectDestroyAttribute(PyUnicornGui_destroy, PyUnicornGui) + + + // --------------------------------------------------------------- + // PyUnicornGui Attribute Method table. + + PyMethodDef PyUnicornGui_Methods[] = + { { "create" , (PyCFunction)PyUnicornGui_create , METH_NOARGS|METH_STATIC + , "Creates a new Unicorn GUI." } + , { "getBanner" , (PyCFunction)PyUnicornGui_getBanner , METH_NOARGS + , "Returns the tool's banner." } + , { "registerTool" , (PyCFunction)PyUnicornGui_registerTool , METH_VARARGS + , "Register a new Graphic tool in the Unicorn GUI." } + , { "show" , (PyCFunction)PyUnicornGui_show , METH_NOARGS + , "Perform the Qt show on the GUI." } + , { "destroy" , (PyCFunction)PyUnicornGui_destroy , METH_NOARGS + , "Destroy the C++ Unicorn GUI object. The python object remains." } + , {NULL, NULL, 0, NULL} /* sentinel */ + }; + + + PythonOnlyDeleteMethod(UnicornGui) + PyTypeObjectLinkPyType(UnicornGui) + + +#else // End of Python Module Code Part. + + +// +=================================================================+ +// | "PyUnicornGui" Shared Library Code Part | +// +=================================================================+ + + + PyTypeInheritedObjectDefinitions(UnicornGui, CellViewer) + + +# endif // End of Shared Library Code Part. + +} // extern "C". + +} // Unicorn namespace. diff --git a/unicorn/src/UnicornGui.cpp b/unicorn/src/UnicornGui.cpp index 9a75efeb..979f5ab0 100644 --- a/unicorn/src/UnicornGui.cpp +++ b/unicorn/src/UnicornGui.cpp @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Module : "./UnicornGui.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Module : "./UnicornGui.cpp" | +// +-----------------------------------------------------------------+ #include @@ -263,4 +255,19 @@ namespace Unicorn { } + string UnicornGui::_getString () const + { + ostringstream s; + s << "getName()); + else s << "No_Cell_Loaded"; + s << ">"; + return s.str(); + } + + } // End of Unicorn namespace. + + +//INSPECTOR_P_SUPPORT(Unicorn::UnicornGui) diff --git a/unicorn/src/cgt.py b/unicorn/src/cgt.py new file mode 100755 index 00000000..41d56610 --- /dev/null +++ b/unicorn/src/cgt.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python + +try: + import sys + import os.path + import optparse + import Cfg + import Hurricane + import Viewer + import CRL + import Nimbus + import Metis + import Mauka + import Katabatic + import Kite + import Unicorn +except ImportError, e: + module = str(e).split()[-1] + + print '[ERROR] The <%s> python module or symbol cannot be loaded.' % module + print ' Please check the integrity of the package.' + sys.exit(1) +except Exception, e: + print '[ERROR] A strange exception occurred while loading the basic Coriolis/Python' + print ' modules. Something may be wrong at Python/C API level.\n' + print ' %s' % e + sys.exit(2) + + +def setCgtBanner ( banner ): + banner.setName('cgt') + banner.setPurpose('Coriolis Graphical Tool') + return banner + + +def credits (): + s = '' + s += ' Tool Credits\n' + s += ' Hurricane .................... Remy Escassut & Christian Masson\n' + s += ' Nimbus - Infrastructure .......................... Hugo Clement\n' + s += ' Mauka - Placer ........................... Christophe Alexandre\n' + s += ' Knik - Global Router ............................ Damien Dupuis\n' + s += ' Kite - Detailed Router ....................... Jean-Paul Chaput\n\n' + + s += ' hMETIS software credits (used by Mauka)\n' + s += ' Author ........................................ Georges Karypis\n' + s += ' Prof. Ident. .......................... University of Minnesota\n' + s += ' URL .......................... http://glaros.dtc.umn.edu/gkhome\n\n' + + s += ' FLUTE software credits (used by Knik)\n' + s += ' Author ........................................ Chris C. N. CHU\n' + s += ' Prof. Ident. ............................ Iowa State University\n' + s += ' URL ........................ http://home.eng.iastate.edu/~cnchu\n\n' + return s + + +def runStratusScript ( scriptPath, editor ): + try: + script = __import__(scriptPath) + except Exception, e: + print '[ERROR] An exception occured while loading the Stratus script module:' + print ' <%s>\n' % (scriptPath) + print ' You should check for simple python errors in this module.' + print ' Error was:' + print ' %s\n' % e + print ' Trying to continue anyway...' + return + + if not hasattr(script,'StratusScript'): + print '[ERROR] Stratus Script module has no function StratusScript().' + print ' <%s>' % scriptPath + return + + script.StratusScript(editor) + + return + + +if __name__ == '__main__': + + try: + usage = str(setCgtBanner(CRL.Banner())) + usage += '\ncgt [options]' + + parser = optparse.OptionParser(usage) + parser.add_option( '-c', '--cell' , type='string' , dest='cell' , help='The name of the cell to load, whithout extension.') + parser.add_option( '--acm-sigda-89' , type='string' , dest='acmSigdaName' , help='An ACM/SIGDA 89 bench name to load, whithout extension.') + parser.add_option( '--stratus-script', type='string' , dest='stratusScript' , help='Run a Stratus script.') + parser.add_option( '-v', '--verbose' , action='store_true', dest='verbose' , help='First level of verbosity.') + parser.add_option( '-V', '--very-verbose' , action='store_true', dest='veryVerbose' , help='Second level of verbosity.') + parser.add_option( '-i', '--info' , action='store_true', dest='info' , help='Display lots of informational messages.') + parser.add_option( '--show-conf' , action='store_true', dest='showConf' , help='Display Kite configuration.') + parser.add_option( '-D', '--core-dump' , action='store_true', dest='coreDump' , help='Enable core-dump when a crash occurs.') + parser.add_option( '-L', '--log-mode' , action='store_true', dest='logMode' , help='Disable ANSI escape sequences in console output.') + parser.add_option( '-t', '--text' , action='store_true', dest='textMode' , help='Run in command line mode.') + parser.add_option( '-m', '--margin' , type='float' , dest='margin' , help='Percentage of free area to add to the minimal placement area.') + parser.add_option( '-Q', '--quadri-place' , action='store_true', dest='quadPlace' , help='Performs a quadri-partitionnement as first placement stage.') + parser.add_option( '-P', '--annealing' , action='store_true', dest='annealingPlace', help='Place using simulated annealing.') + parser.add_option( '--min-psize' , type='int' , dest='minPSize' , help='Sets the size of a leaf partition (quadripartition stage).') + parser.add_option( '-G', '--global-route' , action='store_true', dest='globalRoute' , help='Run the global router (Knik).') + parser.add_option( '-g', '--load-global' , action='store_true', dest='loadGlobal' , help='Reload a global routing from disk.') + parser.add_option( '--save-global' , action='store_true', dest='saveGlobal' , help='Save the global routing solution.') + parser.add_option( '-e', '--edge' , type='float' , dest='edgeCapacity' , help='The egde density ratio applied on global router\'s edges.') + parser.add_option( '--events-limit' , type='int' , dest='eventsLimit' , help='The maximum number of iterations (events) that the router is allowed to perform.') + parser.add_option( '-R', '--detail-route' , action='store_true', dest='detailRoute' , help='Run the detailed router (Kite).') + parser.add_option( '-M', '--dump-measures' , action='store_true', dest='dumpMeasures' , help='Dump some statistical measurements on the disk.') + parser.add_option( '-s', '--save-design' , type='string' , dest='saveDesign' , help='Save the routed design.') + (options, args) = parser.parse_args() + args.insert(0, 'cgt') + + + #Hurricane.trace(True) + Cfg.Configuration.pushDefaultPriority(Cfg.Parameter.Priority.CommandLine) + + if options.coreDump: Cfg.getParamBool ('misc.catchCore' ).setBool(False) + if options.verbose: Cfg.getParamBool ('misc.verboseLevel1').setBool(True) + if options.veryVerbose: Cfg.getParamBool ('misc.verboseLevel2').setBool(True) + if options.info: Cfg.getParamBool ('misc.info' ).setBool(True) + if options.logMode: Cfg.getParamBool ('misc.logMode' ).setBool(True) + if options.showConf: Cfg.getParamBool ('misc.showConf' ).setBool(True) + if options.margin: Cfg.getParamPercentage('nimbus.spaceMargin').setPercentage(options.margin) + if options.minPSize: Cfg.getParamInt ('metis.numberOfInstancesStopCriterion').setInt(options.minPSize) + if options.edgeCapacity: Cfg.getParamPercentage('kite.edgeCapacity' ).setPercentage(options.edgeCapacity) + if options.eventsLimit: Cfg.getParamInt ('kite.eventsLimit' ).setInt(options.eventsLimit) + + quadPlace = options.quadPlace + annealingPlace = options.annealingPlace + loadGlobal = options.loadGlobal + saveGlobal = options.saveGlobal + globalRoute = options.globalRoute + detailRoute = options.detailRoute + + Cfg.Configuration.popDefaultPriority() + + af = CRL.AllianceFramework.get() + + cell = None + if options.acmSigdaName: + cell = CRL.AcmSigda.load(options.acmSigdaName) + elif options.cell: + cell = af.getCell(options.cell, CRL.Catalog.State.Views) + else: + quadPlace = False + annealingPlace = False + loadGlobal = False + saveGlobal = False + globalRoute = False + detailRoute = False + + if not options.textMode: + # Run in graphic mode. + ha = Viewer.HApplication.create(args) + Viewer.Graphics.enable() + + unicorn = Unicorn.UnicornGui.create() + unicorn.setApplicationName ('cgt') + unicorn.registerTool (Mauka.GraphicMaukaEngine.grab()) + unicorn.registerTool (Kite.GraphicKiteEngine.grab()) + unicorn.setAnonNetSelectable(False) + unicorn.setLayerVisible ("grid" , False); + unicorn.setLayerVisible ("text.instance" , False); + unicorn.setLayerVisible ("text.component", False); + + if options.stratusScript: + runStratusScript(options.stratusScript,unicorn) + + setCgtBanner(unicorn.getBanner()) + print unicorn.getBanner() + print credits() + + if cell: unicorn.setCell(cell) + unicorn.show() + ha.qtExec() + else: + # Run in command line mode. + kiteSuccess = False + + if quadPlace or annealingPlace: + loadGlobal = False + globalRoute = True + if quadPlace and annealingPlace: + annealingPlace = False + + runMaukaTool = quadPlace or annealingPlace + + if runMaukaTool: + nimbus = Nimbus.NimbusEngine.create(cell) + if options.showConf: nimbus.printConfiguration() + + if annealingPlace: + Cfg.getParamPercentage('mauka.standardAnnealing').setBool(True); + + if quadPlace: + metis = Metis.MetisEngine.create(cell) + if options.showConf: metis.printConfiguration() + + Metis.MetisEngine.doQuadriPart(cell) + Mauka.MaukaEngine.regroupOverloadedGCells(cell) + + mauka = Mauka.MaukaEngine.create(cell) + if options.showConf: mauka.printConfiguration() + + mauka.run() + + if detailRoute and not (loadGlobal or globalRoute): globalRoute = True + runKiteTool = loadGlobal or globalRoute or detailRoute + + if runKiteTool: + if loadGlobal: globalFlags = Kite.LoadGlobalSolution + else: globalFlags = Kite.BuildGlobalSolution + + routingNets = [] + kite = Kite.KiteEngine.create(cell) + if options.showConf: kite.printConfiguration() + + kite.runGlobalRouter(globalFlags) + if saveGlobal: kite.saveGlobalSolution() + + if detailRoute: + kite.loadGlobalRouting( Katabatic.LoadGrByNet, routingNets ) + kite.layerAssign ( Katabatic.NoNetLayerAssign ) + kite.runNegociate () + kiteSuccess = kite.getToolSuccess() + kite.finalizeLayout() + if options.dumpMeasures: + kite.dumpMeasures() + kite.destroy() + + if options.saveDesign: + views = CRL.Catalog.State.Physical + if options.saveDesign != cell.getName(): + cell.setName(options.saveDesign) + views |= CRL.Catalog.State.Logical + af.saveCell(cell, views) + + sys.exit(kiteSuccess) + + except Exception, e: + print e + + sys.exit(0) diff --git a/unicorn/src/unicorn/OpenCellDialog.h b/unicorn/src/unicorn/OpenCellDialog.h index fd6b4f19..620cfdfd 100644 --- a/unicorn/src/unicorn/OpenCellDialog.h +++ b/unicorn/src/unicorn/OpenCellDialog.h @@ -4,23 +4,15 @@ // This file is part of the Coriolis Software. // Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./OpenCellDialog.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./unicorn/OpenCellDialog.h" | +// +-----------------------------------------------------------------+ #ifndef __UNICORN_OPEN_CELL_DIALOG_H__ diff --git a/unicorn/src/unicorn/PyUnicornGui.h b/unicorn/src/unicorn/PyUnicornGui.h new file mode 100644 index 00000000..289f8dd0 --- /dev/null +++ b/unicorn/src/unicorn/PyUnicornGui.h @@ -0,0 +1,57 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2012-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | U n i c o r n - M a i n G U I | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./unicorn/PyUnicornGui.h" | +// +-----------------------------------------------------------------+ + + +#ifndef __UNICORN_PY_UNICORN_GUI_H__ +#define __UNICORN_PY_UNICORN_GUI_H__ + +#include "hurricane/isobar/PyHurricane.h" +#include "hurricane/viewer/PyCellViewer.h" +#include "unicorn/UnicornGui.h" + + +namespace Unicorn { + + using Hurricane::PyCellViewer; + + extern "C" { + +// ------------------------------------------------------------------- +// Python Object : "PyUnicornGui". + + typedef struct { + PyCellViewer _baseObject; + } PyUnicornGui; + + +// ------------------------------------------------------------------- +// Functions & Types exported to "PyHurricane.ccp". + + extern PyTypeObject PyTypeUnicornGui; + extern PyMethodDef PyUnicornGui_Methods[]; + extern void PyUnicornGui_LinkPyType (); + + +#define IsPyUnicornGui(v) ( (v)->ob_type == &PyTypeUnicornGui ) +#define PY_UNICORN_GUI(v) ( (PyUnicornGui*)(v) ) +#define PY_UNICORN_GUI_O(v) ( PY_UNICORN_GUI(v)->_baseObject._object ) + + +} // extern "C". + +} // Unicorn namespace. + +#endif // __UNICORN_PY_UNICORN_GUI_H__ diff --git a/unicorn/src/unicorn/UnicornGui.h b/unicorn/src/unicorn/UnicornGui.h index c97902a8..041dfb89 100644 --- a/unicorn/src/unicorn/UnicornGui.h +++ b/unicorn/src/unicorn/UnicornGui.h @@ -2,25 +2,17 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | U n i c o r n - M a i n G U I | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | -// | C++ Header : "./UnicornGui.h" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// | C++ Header : "./unicorn/UnicornGui.h" | +// +-----------------------------------------------------------------+ @@ -61,6 +53,7 @@ namespace Unicorn { static inline Banner& getBanner (); virtual Cell* getCellFromDb ( const char* name ); void registerTool ( GraphicTool* ); + virtual std::string _getString () const; public slots: void openCell (); void saveCell (); @@ -85,5 +78,9 @@ namespace Unicorn { } // End of Unicorn namespace. +GETSTRING_POINTER_SUPPORT(Unicorn::UnicornGui) +IOSTREAM_POINTER_SUPPORT(Unicorn::UnicornGui) + + #endif // __UNICORN_UNICORN__