Adjust Katana event sort. CMake detection of Python 2.7 only.

* Change: In all top CMakeLists.txt, force the use of Python 2.7 as
    we do not compile against 3.x flavors. Do not use the "EXACT"
    flags as it will not recognize 2.7.x versions.
* Change: In Katana::RoutingEvent::Key::Compare(), preliminary
    experiments shows that the best sorting order is:
      - Lower layer first (i.e. M2 -> M3 -> M4 -> ... )
      - Longer segments first.
      The later seems to be counter-intuitive. Guess is that placing
    the small ones first generate a more important fragmentation of
    the big ones. They are placed too early and are difficult to move
    afterwards.
      Another feature to test is *not* inserting pushed left/right
    segments if they are not *already* routed.
* Change: In PyKatanaEngine.runNegociate() now takes a flag argument,
    provided through the new PyKatanaFlags exported object.
    (doChip.py must be changed accordingly)
This commit is contained in:
Jean-Paul Chaput 2017-05-11 17:26:56 +02:00
parent bf7e2fdd2d
commit c44c6b13f3
23 changed files with 263 additions and 32 deletions

View File

@ -21,7 +21,7 @@
setup_qt()
find_package(LibXml2 REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)

View File

@ -12,7 +12,7 @@
set_lib_link_mode()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -16,7 +16,7 @@
setup_qt()
find_package(LibXml2 REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 EXACT REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(AXEP REQUIRED)
find_package(VLSISAPD REQUIRED)

View File

@ -16,7 +16,7 @@
set_lib_link_mode()
setup_boost(program_options python regex)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -21,7 +21,7 @@
find_package(BZip2 REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(Libexecinfo REQUIRED)

View File

@ -0,0 +1,42 @@
# -*- mode: CMAKE explicit-buffer-name: "CMakeLists.txt<hurricane>" -*-
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(HURRICANE)
option(BUILD_DOC "Build the documentation (doxygen)" OFF)
cmake_minimum_required(VERSION 2.8.9)
list(INSERT CMAKE_MODULE_PATH 0 "${DESTDIR}$ENV{CORIOLIS_TOP}/share/cmake/Modules")
find_package(Bootstrap REQUIRED)
setup_project_paths(CORIOLIS)
list(INSERT CMAKE_MODULE_PATH 0 "${HURRICANE_SOURCE_DIR}/cmake_modules/")
set_cmake_policies()
set_lib_link_mode()
setup_boost(program_options regex)
setup_qt()
find_package(LibXml2 REQUIRED)
find_package(BZip2 REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(Libexecinfo REQUIRED)
find_package(Libbfd)
add_subdirectory(src)
add_subdirectory(cmake_modules)
#add_subdirectory(tests)
if(BUILD_DOC)
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_subdirectory(doc)
endif()
endif()
#enable_testing()
#add_test(HurricaneTest ${PROJECT_BINARY_DIR}/tests/htest)

View File

@ -17,7 +17,7 @@
find_package(LibXml2 REQUIRED)
set(QT_USE_QTXML "true")
find_package(Qt4 REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -17,7 +17,7 @@
setup_boost(program_options filesystem python regex)
setup_qt()
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -36,6 +36,7 @@
)
set( pyIncludes katana/PyKatanaEngine.h
katana/PyGraphicKatanaEngine.h
katana/PyKatanaFlags.h
)
set( mocIncludes katana/GraphicKatanaEngine.h )
set( cpps Constants.cpp
@ -73,6 +74,7 @@
set( pyCpps PyKatana.cpp
PyKatanaEngine.cpp
PyGraphicKatanaEngine.cpp
PyKatanaFlags.cpp
)
qtX_wrap_cpp( mocCpps ${mocIncludes} )

View File

@ -17,6 +17,7 @@
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyCell.h"
#include "katana/PyKatanaFlags.h"
#include "katana/PyKatanaEngine.h"
#include "katana/PyGraphicKatanaEngine.h"
@ -67,9 +68,11 @@ extern "C" {
DL_EXPORT(void) initKatana () {
cdebug_log(40,0) << "initKatana()" << endl;
PyKatanaFlags_LinkPyType();
PyKatanaEngine_LinkPyType();
PyGraphicKatanaEngine_LinkPyType();
PYTYPE_READY ( KatanaFlags );
PYTYPE_READY_SUB( KatanaEngine , ToolEngine );
PYTYPE_READY_SUB( GraphicKatanaEngine, GraphicTool );
@ -85,12 +88,15 @@ extern "C" {
PyModule_AddObject( module, "KatanaEngine", (PyObject*)&PyTypeKatanaEngine );
Py_INCREF( &PyTypeGraphicKatanaEngine );
PyModule_AddObject( module, "GraphicKatanaEngine", (PyObject*)&PyTypeGraphicKatanaEngine );
Py_INCREF( &PyTypeKatanaFlags );
PyModule_AddObject( module, "Flags", (PyObject*)&PyTypeKatanaFlags );
// PyObject* dictionnary = PyModule_GetDict( module );
// PyObject* constant;
// LoadObjectConstant( dictionnary, KtBuildGlobalRouting, "KtBuildGlobalRouting" );
// LoadObjectConstant( dictionnary, KtLoadGlobalRouting , "KtLoadGlobalRouting" );
PyKatanaEngine_postModuleInit();
}

View File

@ -19,6 +19,7 @@
#include "hurricane/viewer/ExceptionWidget.h"
#include "hurricane/Cell.h"
#include "katana/PyKatanaEngine.h"
#include "katana/PyKatanaFlags.h"
#include <functional>
# undef ACCESS_OBJECT
@ -264,19 +265,26 @@ extern "C" {
}
static PyObject* PyKatanaEngine_runNegociate ( PyKatanaEngine* self )
static PyObject* PyKatanaEngine_runNegociate ( PyKatanaEngine* self, PyObject* args )
{
cdebug_log(40,0) << "PyKatanaEngine_runNegociate()" << endl;
unsigned int flags = 0;
HTRY
METHOD_HEAD("KatanaEngine.runNegociate()")
if (katana->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::runNegociate,katana,0) )) {
PyErr_SetString( HurricaneError, "EtesianEngine::runNegociate() has thrown an exception (C++)." );
METHOD_HEAD("KatanaEngine.runNegociate()")
if (PyArg_ParseTuple(args,"I:KatanaEngine.runNegociate", &flags)) {
if (katana->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&KatanaEngine::runNegociate,katana,flags) )) {
PyErr_SetString( HurricaneError, "EtesianEngine::runNegociate() has thrown an exception (C++)." );
return NULL;
}
} else {
katana->runNegociate( flags );
}
} else {
PyErr_SetString( ConstructorError, "KatanaEngine.runNegociate(): Invalid number/bad type of parameter." );
return NULL;
}
} else {
katana->runNegociate();
}
HCATCH
Py_RETURN_NONE;
}
@ -313,7 +321,7 @@ extern "C" {
, "Run the layer assigment stage." }
, { "runNegociatePreRouted", (PyCFunction)PyKatanaEngine_runNegociatePreRouted, METH_NOARGS
, "Run the negociation stage for pre-routed of the detailed router." }
, { "runNegociate" , (PyCFunction)PyKatanaEngine_runNegociate , METH_NOARGS
, { "runNegociate" , (PyCFunction)PyKatanaEngine_runNegociate , METH_VARARGS
, "Run the negociation stage of the detailed router." }
, { "finalizeLayout" , (PyCFunction)PyKatanaEngine_finalizeLayout , METH_NOARGS
, "Revert to a pure Hurricane database, remove router's additionnal data structures." }
@ -342,6 +350,14 @@ extern "C" {
DBoLinkCreateMethod(KatanaEngine)
extern void PyKatanaEngine_postModuleInit ()
{
PyKatanaFlags_postModuleInit();
PyDict_SetItemString( PyTypeKatanaEngine.tp_dict, "Flags", (PyObject*)&PyTypeKatanaFlags );
}
#endif // Shared Library Code Part.
} // extern "C".

View File

@ -0,0 +1,107 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2017-2017, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyKatanaFlags.cpp" |
// +-----------------------------------------------------------------+
#include "katana/PyKatanaFlags.h"
namespace Katana {
using std::cerr;
using std::endl;
using std::hex;
using std::ostringstream;
using Hurricane::tab;
using Hurricane::Error;
using Hurricane::Warning;
using Isobar::ProxyProperty;
using Isobar::ProxyError;
using Isobar::ConstructorError;
using Isobar::HurricaneError;
using Isobar::HurricaneWarning;
using Isobar::ParseOneArg;
using Isobar::ParseTwoArg;
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Flags,flags,function)
// +=================================================================+
// | "PyKatanaFlags" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
// Standart Accessors (Attributes).
// Standart Destroy (Attribute).
// DBoDestroyAttribute(PyKatanaFlags_destroy,PyKatanaFlags)
PyMethodDef PyKatanaFlags_Methods[] =
{ {NULL, NULL, 0, NULL} /* sentinel */
};
PythonOnlyDeleteMethod(KatanaFlags)
DirectReprMethod(PyKatanaFlags_Repr, PyKatanaFlags, Katana::Flags)
DirectStrMethod (PyKatanaFlags_Str, PyKatanaFlags, Katana::Flags)
DirectCmpMethod (PyKatanaFlags_Cmp, IsPyKatanaFlags, PyKatanaFlags)
DirectHashMethod(PyKatanaFlags_Hash, PyKatanaFlags)
extern void PyKatanaFlags_LinkPyType() {
cdebug_log(20,0) << "PyKatanaFlags_LinkType()" << endl;
PyTypeKatanaFlags.tp_dealloc = (destructor) PyKatanaFlags_DeAlloc;
PyTypeKatanaFlags.tp_compare = (cmpfunc) PyKatanaFlags_Cmp;
PyTypeKatanaFlags.tp_repr = (reprfunc) PyKatanaFlags_Repr;
PyTypeKatanaFlags.tp_str = (reprfunc) PyKatanaFlags_Str;
PyTypeKatanaFlags.tp_hash = (hashfunc) PyKatanaFlags_Hash;
PyTypeKatanaFlags.tp_methods = PyKatanaFlags_Methods;
}
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyKatanaFlags" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
PyTypeObjectDefinitions(KatanaFlags)
extern void PyKatanaFlags_postModuleInit ()
{
PyObject* constant;
LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::NoFlags ,"NoFlags" );
LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::SlowMotion ,"SlowMotion" );
LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::PreRoutedStage,"PreRoutedStage");
LoadObjectConstant(PyTypeKatanaFlags.tp_dict,Katana::Flags::SymmetricStage,"SymmetricStage");
}
#endif // Shared Library Code Part.
} // extern "C".
} // Katana namespace.

View File

@ -82,9 +82,11 @@ namespace Katana {
// Process all M2 (terminal access) before any others.
//if ((lhs._layerDepth == 1) and (rhs._layerDepth != 1)) return false;
//if ((lhs._layerDepth != 1) and (rhs._layerDepth == 1)) return true;
if (lhs._layerDepth > rhs._layerDepth) return true;
if (lhs._layerDepth < rhs._layerDepth) return false;
if (lhs._priority > rhs._priority) return true;
if (lhs._priority < rhs._priority) return false;
if (lhs._priority > rhs._priority) return false;
if (lhs._priority < rhs._priority) return true;
if (lhs._length > rhs._length) return false;
if (lhs._length < rhs._length) return true;

View File

@ -41,8 +41,9 @@ extern "C" {
extern PyTypeObject PyTypeKatanaEngine;
extern PyMethodDef PyKatanaEngine_Methods[];
extern PyObject* PyKatanaEngine_Link ( Katana::KatanaEngine* );
extern void PyKatanaEngine_LinkPyType ();
extern PyObject* PyKatanaEngine_Link ( Katana::KatanaEngine* );
extern void PyKatanaEngine_LinkPyType ();
extern void PyKatanaEngine_postModuleInit ();
#define IsPyKatanaEngine(v) ( (v)->ob_type == &PyTypeKatanaEngine )

View File

@ -0,0 +1,59 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2017-2017, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K i t e - D e t a i l e d R o u t e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./katana/PyKatanaFlags.h" |
// +-----------------------------------------------------------------+
#ifndef PY_KATANA_FLAGS_H
#define PY_KATANA_FLAGS_H
#include "hurricane/isobar/PyHurricane.h"
#include "katana/Constants.h"
namespace Katana {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyTransformation".
typedef struct {
PyObject_HEAD
Katana::Flags* _object;
} PyKatanaFlags;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeKatanaFlags;
extern PyMethodDef PyKatanaFlags_Methods[];
extern PyObject* PyKatanaFlags_Link ( Katana::Flags* );
extern void PyKatanaFlags_LinkPyType ();
extern void PyKatanaFlags_postModuleInit ();
# define IsPyKatanaFlags(v) ( (v)->ob_type == &PyTypeKatanaFlags )
# define PYKATANAFLAGS(v) ( (PyKatanaFlags*)(v) )
# define PYKATANAFLAGS_O(v) ( PYKATANAFLAGS(v)->_object )
} // extern "C".
} // Katana namespace.
#endif // PY_KATANA_FLAGS_H

View File

@ -18,7 +18,7 @@
setup_qt()
find_package(LibXml2 REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(LEFDEF REQUIRED)

View File

@ -15,7 +15,7 @@
setup_boost(program_options filesystem regex python)
setup_qt()
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -14,7 +14,7 @@
set_lib_link_mode()
setup_boost()
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -14,7 +14,7 @@
setup_boost(program_options filesystem python regex)
setup_qt()
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -17,7 +17,7 @@
set_lib_link_mode()
setup_sysconfdir("${CMAKE_INSTALL_PREFIX}")
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(VLSISAPD REQUIRED)
find_package(HURRICANE REQUIRED)

View File

@ -17,7 +17,7 @@
find_package(Libbfd)
find_package(LibXml2 REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(COLOQUINTE)

View File

@ -16,7 +16,7 @@
find_package(LibXml2 REQUIRED)
find_package(PythonSitePackages REQUIRED)
find_package(PythonLibs REQUIRED)
find_package(PythonLibs 2.7 REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(Doxygen)

View File

@ -13,11 +13,7 @@
static double floatToken;
static std::string nameToken;
#ifndef FLEX_BETA
int Liberty_lineno = 1;
#else
extern int Liberty_lineno;
#endif