Create stub for Tramontana, reimplementation of the extractor/LVX.

This commit is contained in:
Jean-Paul Chaput 2023-03-16 15:06:11 +01:00
parent b7f6af8588
commit 090c13663e
14 changed files with 1207 additions and 6 deletions

View File

@ -24,8 +24,9 @@ projects = [
#, "knik"
#, "katabatic"
#, "kite"
, "equinox"
, "solstice"
#, "equinox"
#, "solstice"
, "tramontana"
, "oroshi"
, "bora"
, "karakaze"

View File

@ -64,7 +64,7 @@ class PnR ( FlowTask ):
else:
print( 'PnR.doTask() run in interactive CGT mode.' )
PnR.textMode = False
from .. import Etesian, Anabatic, Katana, Bora, Tutorial, Viewer, Unicorn
from .. import Etesian, Anabatic, Katana, Bora, Tramontana, Tutorial, Viewer, Unicorn
ShellEnv().export()
if self.script and not callable(self.script):
@ -80,8 +80,8 @@ class PnR ( FlowTask ):
unicorn = Unicorn.UnicornGui.create()
unicorn.setApplicationName ( 'cgt')
unicorn.registerTool ( Etesian.GraphicEtesianEngine.grab() )
#unicorn.registerTool ( Kite.GraphicKiteEngine.grab() )
unicorn.registerTool ( Katana.GraphicKatanaEngine.grab() )
unicorn.registerTool ( Tramontana.GraphicTramontanaEngine.grab() )
unicorn.registerTool ( Bora.GraphicBoraEngine.grab() )
unicorn.registerTool ( Tutorial.GraphicTutorialEngine.grab() )
#unicorn.setAnonNetSelectable(False)

29
tramontana/CMakeLists.txt Normal file
View File

@ -0,0 +1,29 @@
# -*- explicit-buffer-name: "CMakeLists.txt<tramontana>" -*-
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(TRAMONTANA)
set(ignoreVariables "${BUILD_DOC} ${CMAKE_INSTALL_DIR}")
option(BUILD_DOC "Build the documentation (doxygen)" OFF)
option(USE_LIBBFD "Link with BFD libraries to print stack traces" OFF)
cmake_minimum_required(VERSION 3.16)
list(INSERT CMAKE_MODULE_PATH 0 "${DESTDIR}$ENV{CORIOLIS_TOP}/share/cmake/Modules/")
find_package(Bootstrap REQUIRED)
setup_project_paths(CORIOLIS)
set_cmake_policies()
setup_boost()
setup_qt()
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development)
find_package(PythonSitePackages REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)
find_package(Doxygen)
add_subdirectory(src)
#add_subdirectory(cmake_modules)
#add_subdirectory(doc)

View File

@ -0,0 +1,59 @@
# -*- explicit-buffer-name: "CMakeLists.txt<tramontana/src>" -*-
# include( ${QT_USE_FILE} )
include_directories( ${TRAMONTANA_SOURCE_DIR}/src
${CORIOLIS_INCLUDE_DIR}
${HURRICANE_INCLUDE_DIR}
${CONFIGURATION_INCLUDE_DIR}
${QtX_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${Python_INCLUDE_DIRS}
)
set( includes tramontana/TramontanaEngine.h
tramontana/GraphicTramontanaEngine.h
)
set( pyIncludes tramontana/PyTramontanaEngine.h
tramontana/PyGraphicTramontanaEngine.h
)
set( mocIncludes tramontana/GraphicTramontanaEngine.h )
set( cpps TramontanaEngine.cpp
GraphicTramontanaEngine.cpp
)
set( pyCpps PyTramontana.cpp
PyTramontanaEngine.cpp
PyGraphicTramontanaEngine.cpp
)
qtX_wrap_cpp( mocCpps ${mocIncludes} )
set( depLibs ${CORIOLIS_PYTHON_LIBRARIES}
${CORIOLIS_LIBRARIES}
${HURRICANE_PYTHON_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}
${HURRICANE_LIBRARIES}
${CONFIGURATION_LIBRARY}
${UTILITIES_LIBRARY}
${LEFDEF_LIBRARIES}
${QtX_LIBRARIES}
${Boost_LIBRARIES}
${Python3_LIBRARIES}
-lutil
${LIBEXECINFO_LIBRARIES}
)
add_library( tramontana ${cpps} ${mocCpps} ${pyCpps} )
set_target_properties( tramontana PROPERTIES VERSION 1.0 SOVERSION 1 )
target_link_libraries( tramontana ${depLibs} )
add_python_module( "${pyCpps}"
"${pyIncludes}"
"Do_not_generate_C_library"
Tramontana
"tramontana;${depLibs}"
include/coriolis2/tramontana
)
install( TARGETS tramontana DESTINATION lib${LIB_SUFFIX} )
install( FILES ${includes}
${mocIncludes} DESTINATION include/coriolis2/tramontana )

View File

@ -0,0 +1,250 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./GraphicTramontanaEngine.cpp" |
// +-----------------------------------------------------------------+
#include <boost/bind.hpp>
#include <QAction>
#include <QMenu>
#include <QMenuBar>
#include <QApplication>
#include <hurricane/Warning.h>
#include <hurricane/Error.h>
#include <hurricane/Breakpoint.h>
#include <hurricane/DebugSession.h>
#include <hurricane/Go.h>
#include <hurricane/Net.h>
#include <hurricane/Cell.h>
#include <hurricane/viewer/Graphics.h>
#include <hurricane/viewer/CellWidget.h>
#include <hurricane/viewer/CellViewer.h>
#include <hurricane/viewer/ControllerWidget.h>
#include <hurricane/viewer/ExceptionWidget.h>
#include <crlcore/Utilities.h>
#include <crlcore/AllianceFramework.h>
#include <anabatic/GCell.h>
#include <tramontana/GraphicTramontanaEngine.h>
namespace Tramontana {
using namespace std;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::Exception;
using Hurricane::Breakpoint;
using Hurricane::DebugSession;
using Hurricane::Point;
using Hurricane::Entity;
using Hurricane::Net;
using Hurricane::Graphics;
using Hurricane::ColorScale;
using Hurricane::DisplayStyle;
using Hurricane::ControllerWidget;
using Hurricane::ExceptionWidget;
using CRL::Catalog;
using CRL::AllianceFramework;
size_t GraphicTramontanaEngine::_references = 0;
GraphicTramontanaEngine* GraphicTramontanaEngine::_singleton = NULL;
#if THIS_IS_DISABLED
void GraphicTramontanaEngine::initGCell ( CellWidget* widget )
{
widget->getDrawingPlanes().setPen( Qt::NoPen );
TramontanaEngine* tramontana = TramontanaEngine::get( widget->getCell() );
if (tramontana) tramontana->setDensityMode( GCell::MaxDensity );
}
void GraphicTramontanaEngine::drawGCell ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& box
, const Transformation& transformation
)
{
const GCell* gcell = static_cast<const GCell*>(go);
QPainter& painter = widget->getPainter();
QPen pen = Graphics::getPen ("Anabatic::GCell",widget->getDarkening());
Box bb = gcell->getBoundingBox();
QRect pixelBb = widget->dbuToScreenRect(bb);
if (GCell::getDisplayMode() == GCell::Density) {
uint32_t density = (unsigned int)( 255.0 * gcell->getDensity() );
if (density > 255) density = 255;
painter.setBrush( Graphics::getColorScale( ColorScale::Fire ).getBrush( density, widget->getDarkening() ) );
painter.drawRect( pixelBb );
} else {
int fontScale = 0;
int halfHeight = 20;
int halfWidth = 80;
if (widget->isPrinter()) {
fontScale = -5;
halfHeight = 9;
halfWidth = 39;
}
painter.setPen ( pen );
painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) );
painter.drawRect( pixelBb );
if ( (pixelBb.width() > 2*halfWidth) and (pixelBb.height() > 2*halfHeight) ) {
QString text = QString("%1").arg(gcell->getId());
QFont font = Graphics::getFixedFont( QFont::Normal, false, false, fontScale );
painter.setFont(font);
pen.setWidth( 1 );
painter.setPen( pen );
painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) );
painter.drawRect ( QRect( -halfWidth, -halfHeight, 2*halfWidth, 2*halfHeight ) );
painter.drawText ( QRect( -halfWidth, -halfHeight, 2*halfWidth, 2*halfHeight )
, text
, QTextOption(Qt::AlignCenter)
);
painter.restore ();
}
}
}
#endif
TramontanaEngine* GraphicTramontanaEngine::createEngine ()
{
Cell* cell = getCell ();
TramontanaEngine* tramontana = TramontanaEngine::get( cell );
if (not tramontana) {
tramontana = TramontanaEngine::create( cell );
tramontana->setViewer( _viewer );
} else
cerr << Warning( "%s already has a Tramontana engine.", getString(cell).c_str() ) << endl;
return tramontana;
}
TramontanaEngine* GraphicTramontanaEngine::getForFramework ( uint32_t flags )
{
// Currently, only one framework is avalaible: Alliance.
TramontanaEngine* tramontana = TramontanaEngine::get( getCell() );
if (tramontana) return tramontana;
if (flags & CreateEngine) {
tramontana = createEngine();
if (not tramontana)
throw Error( "Failed to create Tramontana engine on %s.", getString(getCell()).c_str() );
} else {
throw Error( "TramontanaEngine not created yet, run the global router first." );
}
return tramontana;
}
void GraphicTramontanaEngine::_extract ()
{
TramontanaEngine* tramontana = getForFramework( CreateEngine );
tramontana->extract();
//Breakpoint::stop( 0, "GraphicTramontanaEngine::_extract() done." );
}
void GraphicTramontanaEngine::addToMenu ( CellViewer* viewer )
{
assert(_viewer == NULL);
_viewer = viewer;
if (_viewer->hasMenuAction("placeAndRoute.extract")) {
cerr << Warning( "GraphicTramontanaEngine::addToMenu() - Tramontana extractor already hooked in." ) << endl;
return;
}
_viewer->addToMenu( "placeAndRoute.extract"
, "E&xtract . . . . . [Tramontana]"
, "Run the extractor"
, std::bind(&GraphicTramontanaEngine::_extract,this)
);
}
const Name& GraphicTramontanaEngine::getName () const
{ return TramontanaEngine::staticGetName(); }
Cell* GraphicTramontanaEngine::getCell ()
{
if (not _viewer) {
throw Error( "<b>Tramontana:</b> GraphicTramontanaEngine not bound to any Viewer." );
return NULL;
}
if (not _viewer->getCell()) {
throw Error( "<b>Tramontana:</b> No Cell is loaded into the Viewer." );
return NULL;
}
return _viewer->getCell();
}
GraphicTramontanaEngine* GraphicTramontanaEngine::grab ()
{
if (not _references) {
_singleton = new GraphicTramontanaEngine ();
}
_references++;
return _singleton;
}
size_t GraphicTramontanaEngine::release ()
{
--_references;
if (not _references) {
delete _singleton;
_singleton = NULL;
}
return _references;
}
GraphicTramontanaEngine::GraphicTramontanaEngine ()
: GraphicTool()
, _viewer (NULL)
{
#if THIS_IS_DISABLED
addDrawGo( "Anabatic::GCell", initGCell, drawGCell );
addDrawGo( "Anabatic::Edge" , initEdge , drawEdge );
#endif
}
GraphicTramontanaEngine::~GraphicTramontanaEngine ()
{ }
} // Tramontana namespace.

View File

@ -0,0 +1,113 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyGraphicTramontanaEngine.cpp" |
// +-----------------------------------------------------------------+
#include "tramontana/PyGraphicTramontanaEngine.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/Cell.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(GraphicTramontanaEngine,gtool,function)
namespace Tramontana {
using namespace Hurricane;
using namespace Isobar;
extern "C" {
// +=================================================================+
// | "PyGraphicTramontanaEngine" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
static PyObject* PyGraphicTramontanaEngine_grab ( PyObject* )
{
cdebug_log(40,0) << "PyGraphicTramontanaEngine_grab()" << endl;
PyGraphicTramontanaEngine* pyGraphicTramontanaEngine = NULL;
HTRY
pyGraphicTramontanaEngine = PyObject_NEW ( PyGraphicTramontanaEngine, &PyTypeGraphicTramontanaEngine );
if ( pyGraphicTramontanaEngine == NULL ) return NULL;
pyGraphicTramontanaEngine->ACCESS_OBJECT = GraphicTramontanaEngine::grab();
HCATCH
return (PyObject*)pyGraphicTramontanaEngine;
}
static PyObject* PyGraphicTramontanaEngine_getCell ( PyGraphicTramontanaEngine* self )
{
cdebug_log(40,0) << "PyGraphicTramontanaEngine_getCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD("GraphicTramontanaEngine.getCell()")
cell = gtool->getCell ();
HCATCH
if (cell == NULL) Py_RETURN_NONE;
return PyCell_Link(cell);
}
GetNameMethod(GraphicTramontanaEngine, gtool)
// Standart destroy (Attribute).
PyMethodDef PyGraphicTramontanaEngine_Methods[] =
{ { "grab" , (PyCFunction)PyGraphicTramontanaEngine_grab , METH_NOARGS|METH_STATIC
, "Returns the GraphicTramontanaEngine singleton." }
, { "getName" , (PyCFunction)PyGraphicTramontanaEngine_getName , METH_NOARGS
, "Returns the name of the GraphicTramontanaEngine (class attribute)." }
, { "getCell" , (PyCFunction)PyGraphicTramontanaEngine_getCell , METH_NOARGS
, "Returns the Cell on which this GraphicTramontanaEngine is attached." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// PyGraphicTramontanaEngine Type Methods.
PythonOnlyDeleteMethod(GraphicTramontanaEngine)
PyTypeObjectLinkPyType(GraphicTramontanaEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyGraphicTramontanaEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
LinkCreateMethod(GraphicTramontanaEngine)
PyTypeInheritedObjectDefinitions(GraphicTramontanaEngine,GraphicTool)
#endif // End of Shared Library Code Part.
} // extern "C".
} // CRL namespace.

View File

@ -0,0 +1,107 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyTramontana.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyCell.h"
#include "tramontana/PyTramontanaEngine.h"
#include "tramontana/PyGraphicTramontanaEngine.h"
namespace Tramontana {
using std::cerr;
using std::endl;
using Hurricane::tab;
using Isobar::getPyHash;
using Isobar::__cs;
using CRL::PyTypeToolEngine;
using CRL::PyTypeGraphicTool;
#if !defined(__PYTHON_MODULE__)
// +=================================================================+
// | "PyTramontana" Shared Library Code Part |
// +=================================================================+
# else // End of PyHurricane Shared Library Code Part.
// +=================================================================+
// | "PyTramontana" Python Module Code Part |
// +=================================================================+
extern "C" {
static PyMethodDef PyTramontana_Methods[] =
{ {NULL, NULL, 0, NULL} /* sentinel */
};
static PyModuleDef PyTramontana_ModuleDef =
{ PyModuleDef_HEAD_INIT
, .m_name = "Tramontana"
, .m_doc = "Layout extractor & LVX."
, .m_size = -1
, .m_methods = PyTramontana_Methods
};
// ---------------------------------------------------------------
// Module Initialization : "PyInit_Tramontana ()"
PyMODINIT_FUNC PyInit_Tramontana ( void )
{
cdebug_log(40,0) << "PyInit_Tramontana()" << endl;
PyTramontanaEngine_LinkPyType();
PyGraphicTramontanaEngine_LinkPyType();
PYTYPE_READY_SUB( TramontanaEngine , ToolEngine );
PYTYPE_READY_SUB( GraphicTramontanaEngine, GraphicTool );
PyObject* module = PyModule_Create( &PyTramontana_ModuleDef );
if (module == NULL) {
cerr << "[ERROR]\n"
<< " Failed to initialize Tramontana module." << endl;
return NULL;
}
Py_INCREF( &PyTypeTramontanaEngine );
PyModule_AddObject( module, "TramontanaEngine", (PyObject*)&PyTypeTramontanaEngine );
Py_INCREF( &PyTypeGraphicTramontanaEngine );
PyModule_AddObject( module, "GraphicTramontanaEngine", (PyObject*)&PyTypeGraphicTramontanaEngine );
//PyTramontanaEngine_postModuleInit();
return module;
}
} // End of extern "C".
#endif // End of Python Module Code Part.
} // End of Tramontana namespace.

View File

@ -0,0 +1,194 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyTramontanaEngine.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyNet.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/viewer/PyCellViewer.h"
#include "hurricane/viewer/ExceptionWidget.h"
#include "hurricane/Cell.h"
#include "crlcore/Utilities.h"
#include "tramontana/PyTramontanaEngine.h"
#include <functional>
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(TramontanaEngine,tramontana,function)
namespace Tramontana {
using std::cerr;
using std::endl;
using std::hex;
using std::ostringstream;
using Hurricane::tab;
using Hurricane::Exception;
using Hurricane::Bug;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::ExceptionWidget;
using Isobar::__cs;
using Isobar::Converter;
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::PyNet;
using Isobar::PyCell;
using Isobar::PyCell_Link;
using Isobar::PyCellViewer;
using Isobar::PyTypeCellViewer;
using CRL::PyToolEngine;
extern "C" {
#if defined(__PYTHON_MODULE__)
#define DirectVoidToolMethod(SELF_TYPE, SELF_OBJECT, FUNC_NAME) \
static PyObject* Py##SELF_TYPE##_##FUNC_NAME(Py##SELF_TYPE* self) \
{ \
cdebug_log(40,0) << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \
HTRY \
METHOD_HEAD(#SELF_TYPE "." #FUNC_NAME "()") \
if (SELF_OBJECT->getViewer()) { \
if (ExceptionWidget::catchAllWrapper( std::bind(&TramontanaEngine::FUNC_NAME,SELF_OBJECT) )) { \
PyErr_SetString( HurricaneError, #FUNC_NAME "() has thrown an exception (C++)." ); \
return NULL; \
} \
} else { \
SELF_OBJECT->FUNC_NAME(); \
} \
HCATCH \
Py_RETURN_NONE; \
}
// +=================================================================+
// | "PyTramontanaEngine" Python Module Code Part |
// +=================================================================+
static PyObject* PyTramontanaEngine_get ( PyObject*, PyObject* args )
{
cdebug_log(40,0) << "PyTramontanaEngine_get()" << endl;
TramontanaEngine* tramontana = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Tramontana.get", args, CELL_ARG, &arg0)) return NULL;
tramontana = TramontanaEngine::get(PYCELL_O(arg0));
HCATCH
return PyTramontanaEngine_Link(tramontana);
}
static PyObject* PyTramontanaEngine_create ( PyObject*, PyObject* args )
{
cdebug_log(40,0) << "PyTramontanaEngine_create()" << endl;
TramontanaEngine* tramontana = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Tramontana.get", args, CELL_ARG, &arg0)) return NULL;
Cell* cell = PYCELL_O(arg0);
tramontana = TramontanaEngine::get(cell);
if (tramontana == NULL) {
tramontana = TramontanaEngine::create(cell);
} else
cerr << Warning("%s already has a Tramontana engine.",getString(cell).c_str()) << endl;
HCATCH
return PyTramontanaEngine_Link(tramontana);
}
static PyObject* PyTramontanaEngine_setViewer ( PyTramontanaEngine* self, PyObject* args )
{
cdebug_log(40,0) << "PyTramontanaEngine_setViewer ()" << endl;
HTRY
METHOD_HEAD( "TramontanaEngine.setViewer()" )
PyObject* pyViewer = NULL;
if (not PyArg_ParseTuple(args,"O:TramontanaEngine.setViewer()",&pyViewer)) {
PyErr_SetString( ConstructorError, "Bad parameters given to TramontanaEngine.setViewer()." );
return NULL;
}
if (IsPyCellViewer(pyViewer)) {
tramontana->setViewer( PYCELLVIEWER_O(pyViewer) );
}
HCATCH
Py_RETURN_NONE;
}
// Standart Accessors (Attributes).
// Standart Destroy (Attribute).
DBoDestroyAttribute(PyTramontanaEngine_destroy,PyTramontanaEngine)
PyMethodDef PyTramontanaEngine_Methods[] =
{ { "get" , (PyCFunction)PyTramontanaEngine_get , METH_VARARGS|METH_STATIC
, "Returns the Tramontana engine attached to the Cell, None if there isnt't." }
, { "create" , (PyCFunction)PyTramontanaEngine_create , METH_VARARGS|METH_STATIC
, "Create a Tramontana engine on this cell." }
, { "setViewer" , (PyCFunction)PyTramontanaEngine_setViewer , METH_VARARGS
, "Associate a Viewer to this TramontanaEngine." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
DBoDeleteMethod(TramontanaEngine)
PyTypeObjectLinkPyType(TramontanaEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyTramontanaEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
PyTypeInheritedObjectDefinitions(TramontanaEngine,PyToolEngine)
DBoLinkCreateMethod(TramontanaEngine)
// extern void PyTramontanaEngine_postModuleInit ()
// {
// PyTramontanaFlags_postModuleInit();
// PyDict_SetItemString( PyTypeTramontanaEngine.tp_dict, "Flags", (PyObject*)&PyTypeTramontanaFlags );
// PyObject* constant = NULL;
// LoadObjectConstant( PyTypeTramontanaEngine.tp_dict, TramontanaEngine::GlobalRoutingSuccess , "GlobalRoutingSuccess" )
// LoadObjectConstant( PyTypeTramontanaEngine.tp_dict, TramontanaEngine::DetailedRoutingSuccess, "DetailedRoutingSuccess" )
// }
#endif // Shared Library Code Part.
} // extern "C".
} // Tramontana namespace.

View File

@ -0,0 +1,173 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./TramontanaEngine.cpp" |
// +-----------------------------------------------------------------+
#include <Python.h>
#include <sstream>
#include <fstream>
#include <iomanip>
#include "hurricane/utilities/Path.h"
#include "hurricane/DebugSession.h"
#include "hurricane/UpdateSession.h"
#include "hurricane/Bug.h"
#include "hurricane/Error.h"
#include "hurricane/Warning.h"
#include "hurricane/Breakpoint.h"
#include "hurricane/Timer.h"
#include "hurricane/Layer.h"
#include "hurricane/Net.h"
#include "hurricane/Pad.h"
#include "hurricane/Plug.h"
#include "hurricane/Cell.h"
#include "hurricane/Instance.h"
#include "hurricane/Vertical.h"
#include "hurricane/Horizontal.h"
#include "hurricane/RoutingPad.h"
#include "hurricane/viewer/Script.h"
#include "crlcore/Measures.h"
#include "crlcore/Utilities.h"
#include "crlcore/AllianceFramework.h"
#include "tramontana/TramontanaEngine.h"
namespace Tramontana {
using std::cout;
using std::cerr;
using std::endl;
using std::dec;
using std::setw;
using std::setfill;
using std::left;
using std::string;
using std::ostream;
using std::ofstream;
using std::ostringstream;
using std::setprecision;
using std::vector;
using std::make_pair;
using Hurricane::dbo_ptr;
using Hurricane::UpdateSession;
using Hurricane::DebugSession;
using Hurricane::tab;
using Hurricane::ForEachIterator;
using Hurricane::Bug;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::Breakpoint;
using Hurricane::Timer;
using Hurricane::Box;
using Hurricane::Layer;
using Hurricane::Entity;
using Hurricane::Horizontal;
using Hurricane::Vertical;
using Hurricane::RoutingPad;
using Hurricane::Cell;
using Hurricane::Instance;
using CRL::Catalog;
using CRL::AllianceFramework;
using CRL::addMeasure;
using CRL::Measures;
using CRL::MeasuresSet;
// -------------------------------------------------------------------
// Class : "Tramontana::TramontanaEngine".
Name TramontanaEngine::_toolName = "Tramontana";
const Name& TramontanaEngine::staticGetName ()
{ return _toolName; }
TramontanaEngine* TramontanaEngine::get ( const Cell* cell )
{ return static_cast<TramontanaEngine*>(ToolEngine::get(cell,staticGetName())); }
TramontanaEngine::TramontanaEngine ( Cell* cell )
: Super (cell)
, _viewer (NULL)
{ }
void TramontanaEngine::_postCreate ()
{
Super::_postCreate();
}
TramontanaEngine* TramontanaEngine::create ( Cell* cell )
{
TramontanaEngine* tramontana = new TramontanaEngine ( cell );
tramontana->_postCreate();
return tramontana;
}
void TramontanaEngine::_preDestroy ()
{
cdebug_log(160,1) << "TramontanaEngine::_preDestroy()" << endl;
cmess1 << " o Deleting ToolEngine<" << getName() << "> from Cell <"
<< _cell->getName() << ">" << endl;
Super::_preDestroy();
cdebug_tabw(160,-1);
}
TramontanaEngine::~TramontanaEngine ()
{ }
const Name& TramontanaEngine::getName () const
{ return _toolName; }
void TramontanaEngine::extract ()
{
cerr << "TramontanaEngine::extract() called on " << getCell() << endl;
}
string TramontanaEngine::_getTypeName () const
{ return "Tramontana::TramontanaEngine"; }
string TramontanaEngine::_getString () const
{
ostringstream os;
os << "<TramontanaEngine " << _cell->getName () << ">";
return os.str();
}
Record* TramontanaEngine::_getRecord () const
{
Record* record = Super::_getRecord ();
if (record) {
//record->add( getSlot( "_blocks" , &_blocks ) );
}
return record;
}
} // Tramontana namespace.

View File

@ -0,0 +1,83 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./tramontana/GraphicTramontanaEngine.h" |
// +-----------------------------------------------------------------+
#pragma once
#include <functional>
#include <QObject>
namespace Hurricane {
class Go;
class BasicLayer;
class Transformation;
class CellWidget;
class CellViewer;
}
#include "crlcore/GraphicToolEngine.h"
#include "tramontana/TramontanaEngine.h"
namespace Tramontana {
using Hurricane::Go;
using Hurricane::Box;
using Hurricane::BasicLayer;
using Hurricane::Transformation;
using Hurricane::CellWidget;
using Hurricane::CellViewer;
using CRL::GraphicTool;
// -------------------------------------------------------------------
// Class : "Tramontana::GraphicTramontanaEngine".
class GraphicTramontanaEngine : public GraphicTool {
Q_OBJECT;
public:
enum FunctionFlags { NoFlags=0x0000, CreateEngine=0x0001 };
public:
#if THIS_IS_DISABLED
static void initGCell ( CellWidget* );
static void drawGCell ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
#endif
TramontanaEngine* createEngine ();
TramontanaEngine* getForFramework ( uint32_t flags );
static GraphicTramontanaEngine* grab ();
virtual const Name& getName () const;
Cell* getCell ();
virtual size_t release ();
virtual void addToMenu ( CellViewer* );
void postEvent ();
protected:
static size_t _references;
static GraphicTramontanaEngine* _singleton;
CellViewer* _viewer;
protected:
GraphicTramontanaEngine ();
virtual ~GraphicTramontanaEngine ();
void _extract ();
};
} // Tramontana namespace.

View File

@ -0,0 +1,53 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./tramontana/PyGraphicTramontanaEngine.h" |
// +-----------------------------------------------------------------+
#pragma once
#include "crlcore/PyGraphicToolEngine.h"
#include "tramontana/GraphicTramontanaEngine.h"
namespace Tramontana {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyGraphicTramontanaEngine".
typedef struct {
CRL::PyGraphicTool _baseObject;
} PyGraphicTramontanaEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyTramontana.ccp".
extern PyTypeObject PyTypeGraphicTramontanaEngine;
extern PyMethodDef PyGraphicTramontanaEngine_Methods[];
extern void PyGraphicTramontanaEngine_LinkPyType ();
#define IsPyGraphicTramontanaEngine(v) ( (v)->ob_type == &PyTypeGraphicTramontanaEngine )
#define PY_GRAPHIC_TRAMONTANA_ENGINE(v) ( (PyGraphicTramontanaEngine*)(v) )
#define PY_GRAPHIC_TRAMONTANA_ENGINE_O(v) ( PY_GRAPHIC_TRAMONTANA_ENGINE(v)->_baseObject._object )
} // extern "C".
} // Tramontana namespace.

View File

@ -0,0 +1,56 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./tramontana/PyTramontanaEngine.h" |
// +-----------------------------------------------------------------+
#pragma once
#include "hurricane/isobar/PyHurricane.h"
#include "crlcore/PyToolEngine.h"
#include "tramontana/TramontanaEngine.h"
namespace Tramontana {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyTramontanaEngine".
typedef struct {
CRL::PyToolEngine _baseObject;
} PyTramontanaEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyTramontana.ccp".
extern PyTypeObject PyTypeTramontanaEngine;
extern PyMethodDef PyTramontanaEngine_Methods[];
extern PyObject* PyTramontanaEngine_Link ( Tramontana::TramontanaEngine* );
extern void PyTramontanaEngine_LinkPyType ();
//extern void PyTramontanaEngine_postModuleInit ();
#define IsPyTramontanaEngine(v) ( (v)->ob_type == &PyTypeTramontanaEngine )
#define PYTRAMONTANAENGINE(v) ( (PyTramontanaEngine*)(v) )
#define PYTRAMONTANAENGINE_O(v) ( PYTRAMONTANAENGINE(v)->_baseObject._object )
} // extern "C".
} // Tramontana namespace.

View File

@ -0,0 +1,83 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) Sorbonne Université 2007-2023, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | T r a m o n t a n a - Extractor & LVX |
// | |
// | Algorithm : Christian MASSON |
// | First impl. : Yifei WU |
// | Second impl. : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./tramontana/TramontanaEngine.h" |
// +-----------------------------------------------------------------+
#pragma once
#include <iostream>
#include "hurricane/Name.h"
namespace Hurricane {
class Layer;
class Net;
class Cell;
class CellViewer;
}
#include "crlcore/ToolEngine.h"
namespace Tramontana {
using Hurricane::Record;
using Hurricane::Name;
using Hurricane::Layer;
using Hurricane::Net;
using Hurricane::Cell;
using Hurricane::CellViewer;
using CRL::ToolEngine;
// -------------------------------------------------------------------
// Class : "Tramontana::TramontanaEngine".
class TramontanaEngine : public ToolEngine {
public:
typedef ToolEngine Super;
public:
static const Name& staticGetName ();
static TramontanaEngine* create ( Cell* );
static TramontanaEngine* get ( const Cell* );
public:
const Name& getName () const;
inline void setViewer ( CellViewer* );
void extract ();
virtual Record* _getRecord () const;
virtual std::string _getString () const;
virtual std::string _getTypeName () const;
private:
// Attributes.
static Name _toolName;
protected:
CellViewer* _viewer;
protected:
// Constructors & Destructors.
TramontanaEngine ( Cell* );
virtual ~TramontanaEngine ();
virtual void _postCreate ();
virtual void _preDestroy ();
private:
TramontanaEngine ( const TramontanaEngine& ) = delete;
TramontanaEngine& operator= ( const TramontanaEngine& ) = delete;
};
inline void TramontanaEngine::setViewer ( CellViewer* viewer ) { _viewer=viewer; }
} // Tramontana namespace.
INSPECTOR_P_SUPPORT(Tramontana::TramontanaEngine);

View File

@ -20,7 +20,7 @@ try:
from coriolis import helpers
helpers.loadUserSettings()
from coriolis import Cfg, Hurricane, Viewer, CRL, Etesian, Anabatic, \
Katana, Bora, Tutorial, Unicorn
Katana, Tramontana, Bora, Tutorial, Unicorn
except Exception as e:
helpers.io.showPythonTrace( sys.argv[0], e )
sys.exit(2)
@ -182,8 +182,8 @@ if __name__ == '__main__':
unicorn = Unicorn.UnicornGui.create()
unicorn.setApplicationName ('cgt')
unicorn.registerTool (Etesian.GraphicEtesianEngine.grab())
#unicorn.registerTool (Kite.GraphicKiteEngine.grab())
unicorn.registerTool (Katana.GraphicKatanaEngine.grab())
unicorn.registerTool (Tramontana.GraphicTramontanaEngine.grab())
unicorn.registerTool (Bora.GraphicBoraEngine.grab())
unicorn.registerTool (Tutorial.GraphicTutorialEngine.grab())
#unicorn.setAnonNetSelectable(False)