Remove GraphicAnabaticengine, temporarily made for debugging.

* Change: In Anabatic, remove GraphicAnabaticEngine, PyGraphicAnabaticEngine,
    PyAnabaticEngine (but keep PyAnabatic for constants exportation)
    and GlobalRoute (moved to Katana). Drawing methods for Edge & GCell
    are moved into GraphicKatanaEngine.
This commit is contained in:
Jean-Paul Chaput 2016-09-07 11:21:36 +02:00
parent 061480dbd9
commit 8376d0c209
13 changed files with 143 additions and 1377 deletions

View File

@ -18,7 +18,6 @@ endif ( CHECK_DETERMINISM )
anabatic/Edge.h anabatic/Edges.h
anabatic/GCell.h #anabatic/GCells.h
anabatic/AnabaticEngine.h
anabatic/GraphicAnabaticEngine.h
anabatic/Dijkstra.h
anabatic/AutoContact.h
@ -32,10 +31,7 @@ endif ( CHECK_DETERMINISM )
anabatic/Session.h
anabatic/ChipTools.h
)
set( mocIncludes anabatic/GraphicAnabaticEngine.h )
set( pyIncludes anabatic/PyAnabaticEngine.h
anabatic/PyGraphicAnabaticEngine.h
)
set( pyIncludes )
set( cpps Constants.cpp
Configuration.cpp
Matrix.cpp
@ -43,8 +39,6 @@ endif ( CHECK_DETERMINISM )
Edges.cpp
GCell.cpp
AnabaticEngine.cpp
GlobalRoute.cpp
GraphicAnabaticEngine.cpp
Dijkstra.cpp
AutoContact.cpp
@ -63,11 +57,8 @@ endif ( CHECK_DETERMINISM )
LayerAssign.cpp
PreRouteds.cpp
)
set( pyCpps PyAnabaticEngine.cpp
PyGraphicAnabaticEngine.cpp
PyAnabatic.cpp
set( pyCpps PyAnabatic.cpp
)
qtX_wrap_cpp( mocCpps ${mocIncludes} )
set( depLibs ${CORIOLIS_PYTHON_LIBRARIES}
${CORIOLIS_LIBRARIES}
@ -85,7 +76,7 @@ endif ( CHECK_DETERMINISM )
${PYTHON_LIBRARIES} -lutil
)
add_library( anabatic ${cpps} ${mocCpps} )
add_library( anabatic ${cpps} )
set_target_properties( anabatic PROPERTIES VERSION 1.0 SOVERSION 1 )
target_link_libraries( anabatic ${depLibs} )
@ -97,7 +88,6 @@ endif ( CHECK_DETERMINISM )
include/coriolis2/anabatic
)
install( TARGETS anabatic DESTINATION lib${LIB_SUFFIX} )
install( FILES ${includes}
${mocIncludes} DESTINATION include/coriolis2/anabatic )
install( TARGETS anabatic DESTINATION lib${LIB_SUFFIX} )
install( FILES ${includes} DESTINATION include/coriolis2/anabatic )

View File

@ -1,248 +0,0 @@
// -*- mode: C++; explicit-buffer-name: "GlobalRoute.cpp<anabatic>" -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./GlobalRoute.cpp" |
// +-----------------------------------------------------------------+
#include <sstream>
#include <iostream>
#include "hurricane/Error.h"
#include "hurricane/RegularLayer.h"
#include "hurricane/Horizontal.h"
#include "hurricane/Vertical.h"
#include "hurricane/Cell.h"
#include "hurricane/UpdateSession.h"
#include "hurricane/DebugSession.h"
#include "crlcore/RoutingGauge.h"
#include "anabatic/GCell.h"
#include "anabatic/Dijkstra.h"
#include "anabatic/AnabaticEngine.h"
namespace {
using std::cerr;
using std::endl;
using std::setw;
using std::left;
using std::right;
using Hurricane::DbU;
using Anabatic::Edge;
using Anabatic::Vertex;
class DigitalDistance {
public:
inline DigitalDistance ( float h, float k );
DbU::Unit operator() ( const Vertex* source ,const Vertex* target,const Edge* edge ) const;
private:
// For an explanation of h & k parameters, see:
// "KNIK, routeur global pour la plateforme Coriolis", p. 52.
float _h;
float _k;
};
inline DigitalDistance::DigitalDistance ( float h, float k ) : _h(h), _k(k) { }
DbU::Unit DigitalDistance::operator() ( const Vertex* source ,const Vertex* target,const Edge* edge ) const
{
if (edge->getCapacity() <= 0) return Vertex::unreached;
float congestion = (float)edge->getRealOccupancy() / (float)edge->getCapacity();
float congestionCost = 1.0 + _h / (1.0 + std::exp(_k * (congestion - 1.0)));
float distance = (float)source->getDistance()
+ congestionCost * (float)edge->getDistance();
+ edge->getHistoricCost();
// Edge* sourceFrom = source->getFrom();
// if (sourceFrom) {
// distance += ((sourceFrom->isHorizontal() xor edge->isHorizontal()) ? 3.0 : 0.0) * (float)Edge::unity;
// }
cdebug_log(112,0) << "cong:" << congestion
<< " ccost:" << congestionCost
<< " digitalDistance:" << DbU::getValueString((DbU::Unit)distance) << endl;
return (DbU::Unit)distance;
}
void computeNextHCost ( Edge* edge, float edgeHInc )
{
float congestion = (float)edge->getRealOccupancy() / (float)edge->getCapacity();
float hCost = edge->getHistoricCost();
float alpha = (congestion < 1.0) ? congestion : std::exp( std::log(8)*( congestion - 1 ) );
edge->setHistoricCost( alpha * (hCost + ((congestion < 1.0) ? 0.0 : edgeHInc) ));
cdebug_log(113,0) << edge << endl;
}
} // Anonymous namespace.
namespace Anabatic {
using std::cerr;
using std::cout;
using std::endl;
using std::setw;
using std::ostringstream;
using Hurricane::Error;
using Hurricane::RegularLayer;
using Hurricane::Component;
using Hurricane::Horizontal;
using Hurricane::Vertical;
using Hurricane::Cell;
using Hurricane::UpdateSession;
using Hurricane::DebugSession;
using CRL::RoutingGauge;
using CRL::RoutingLayerGauge;
// -------------------------------------------------------------------
// Class : "Anabatic::AnabaticEngine".
//
// Methods dedicateds to complete global routing.
void AnabaticEngine::globalRoute ()
{
Cell* cell = getCell();
cell->flattenNets( Cell::Flags::BuildRings );
cell->createRoutingPadRings( Cell::Flags::BuildRings );
//DebugSession::addToTrace( cell->getNet("ra(2)") );
//DebugSession::addToTrace( cell->getNet("alu_out(3)") );
//DebugSession::addToTrace( cell->getNet("imuxe.not_i(1)") );
//DebugSession::addToTrace( cell->getNet("r(0)") );
//DebugSession::addToTrace( cell->getNet("a_from_pads(0)") );
//DebugSession::addToTrace( cell->getNet("ialu.not_aux104") );
//DebugSession::addToTrace( cell->getNet("mips_r3000_1m_dp_shift32_rshift_se_muxoutput(159)") );
//DebugSession::addToTrace( cell->getNet("mips_r3000_1m_dp_shift32_rshift_se_c1(3)") );
startMeasures();
if (getGCells().size() == 1) {
cmess1 << " o Building regular grid..." << endl;
getSouthWestGCell()->doGrid();
} else {
cmess1 << " o Reusing existing grid." << endl;
}
cmess1 << Dots::asInt(" - GCells" ,getGCells().size()) << endl;
stopMeasures();
printMeasures( "Anabatic Grid" );
setupSpecialNets();
setupPreRouteds ();
setupNetDatas();
openSession();
startMeasures();
cmess1 << " o Running global routing..." << endl;
float edgeHInc = getConfiguration()->getEdgeHInc();
Dijkstra* dijkstra = new Dijkstra ( this );
dijkstra->setDistance( DigitalDistance( getConfiguration()->getEdgeCostH()
, getConfiguration()->getEdgeCostK() ) );
size_t iteration = 0;
size_t netCount = 0;
do {
cmess2 << " [" << setw(3) << iteration << "] nets:";
netCount = 0;
for ( NetData* netData : _netOrdering ) {
if (netData->isGlobalRouted()) continue;
dijkstra->load( netData->getNet() );
dijkstra->run();
++netCount;
}
cmess2 << left << setw(6) << netCount << right;
//Session::revalidate();
const vector<Edge*>& ovEdges = getOvEdges();
cmess2 << " ovEdges:" << ovEdges.size();
for ( Edge* edge : ovEdges ) computeNextHCost( edge, edgeHInc );
netCount = 0;
size_t iEdge = 0;
while ( iEdge < ovEdges.size() ) {
Edge* edge = ovEdges[iEdge];
netCount += edge->ripup();
if (ovEdges[iEdge] == edge) {
cerr << Error( "AnabaticEngine::globalRoute(): Unable to ripup enough segments of edge:\n"
" %s"
, getString(edge).c_str()
) << endl;
++iEdge;
}
}
dijkstra->setSearchAreaHalo( Session::getSliceHeight()*3 );
cmess2 << " ripup:" << netCount;
stopMeasures();
cmess2 << " " << setw(10) << Timer::getStringTime (_timer.getCombTime())
<< " " << setw( 6) << Timer::getStringMemory(_timer.getIncrease()) << endl;
startMeasures();
#if THIS_IS_A_TEST
if (iteration == 0) {
Net* testNet = getCell()->getNet( "ra(2)" );
DebugSession::open( testNet, 112, 120 );
if (testNet) {
for ( Component* component : testNet->getComponents() ) {
if (component->getId() == 23947) {
Segment* segment = static_cast<Segment*>( component );
GCellsUnder gcells = getGCellsUnder( segment );
Contact* contact = breakAt( segment, gcells->gcellAt(2) );
cerr << "break:" << contact << endl;
unify( contact );
//ripup( static_cast<Segment*>(component), Flags::Propagate );
//iteration = 5;
//netsToRoute.insert( testNet );
break;
}
}
}
DebugSession::close();
}
#endif
++iteration;
} while ( (netCount > 0) and (iteration < 5) );
stopMeasures();
printMeasures( "Dijkstra" );
delete dijkstra;
Session::close();
_state = EngineGlobalLoaded;
}
} // Anabatic namespace.

View File

@ -1,529 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "GraphicAnabaticEngine.cpp" |
// +-----------------------------------------------------------------+
#include <cmath>
#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/UpdateSession.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 "anabatic/GraphicAnabaticEngine.h"
#include "anabatic/Dijkstra.h"
namespace Anabatic {
using namespace std;
using Hurricane::Error;
using Hurricane::Warning;
using Hurricane::Exception;
using Hurricane::Breakpoint;
using Hurricane::DebugSession;
using Hurricane::UpdateSession;
using Hurricane::Point;
using Hurricane::Entity;
using Hurricane::Net;
using Hurricane::Graphics;
using Hurricane::ColorScale;
using Hurricane::DisplayStyle;
using Hurricane::DrawingStyle;
using Hurricane::ControllerWidget;
using Hurricane::ExceptionWidget;
using CRL::Catalog;
using CRL::AllianceFramework;
// -------------------------------------------------------------------
// Test functions.
class DigitalDistance {
public:
inline DigitalDistance ( float h, float k );
DbU::Unit operator() ( const Vertex* source ,const Vertex* target,const Edge* edge ) const;
private:
// For an explanation of h & k parameters, see:
// "KNIK, routeur global pour la plateforme Coriolis", p. 52.
float _h;
float _k;
};
inline DigitalDistance::DigitalDistance ( float h, float k ) : _h(h), _k(k) { }
DbU::Unit DigitalDistance::operator() ( const Vertex* source ,const Vertex* target,const Edge* edge ) const
{
if (edge->getCapacity() <= 0) return Vertex::unreached;
float congestion = (float)edge->getRealOccupancy() / (float)edge->getCapacity();
float congestionCost = 1.0 + _h / (1.0 + std::exp(_k * (congestion - 1.0)));
float distance = (float)source->getDistance() + congestionCost * (float)edge->getDistance();
// Edge* sourceFrom = source->getFrom();
// if (sourceFrom) {
// distance += ((sourceFrom->isHorizontal() xor edge->isHorizontal()) ? 3.0 : 0.0) * (float)Edge::unity;
// }
cdebug_log(112,0) << "cong:" << congestion
<< " ccost:" << congestionCost
<< " digitalDistance:" << DbU::getValueString((DbU::Unit)distance) << endl;
return (DbU::Unit)distance;
}
void anabaticTest_1 ( AnabaticEngine* engine )
{
engine->getSouthWestGCell()->doGrid();
Point position ( DbU::fromLambda(100.0), DbU::fromLambda(100.0) );
GCell* gcell = engine->getGCellUnder( position );
cerr << "Gcell under:" << position << " is " << gcell << endl;
}
void anabaticTest_2 ( AnabaticEngine* engine )
{
UpdateSession::open();
GCell* row0 = engine->getSouthWestGCell();
DbU::Unit xcorner = engine->getCell()->getAbutmentBox().getXMin();
DbU::Unit ycorner = engine->getCell()->getAbutmentBox().getYMin();
cdebug_log(119,1) << "row0: " << row0 << endl;
GCell* row1 = row0->hcut( ycorner+DbU::fromLambda(50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row1: " << row1 << endl;
GCell* row2 = row1->hcut( ycorner+DbU::fromLambda(2*50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row2: " << row2 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row0+1: " << row0 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(3*50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row0+2: " << row0 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(5*50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row0+3: " << row0 << endl;
row1 = row1->vcut( xcorner+DbU::fromLambda(2*50.0) );
cdebug_tabw(119,-1);
cdebug_log(119,1) << "row1+1: " << row1 << endl;
cdebug_tabw(119,-1);
UpdateSession::close();
}
void anabaticTest_3 ( AnabaticEngine* engine )
{
for ( int i=0 ; i<4 ; ++i ) {
cdebug_log(110,1) << "Running test 3, loop:" << i << " ..." << endl;
if ( i%2) anabaticTest_1( engine );
else anabaticTest_2( engine );
engine->reset();
cdebug_log(110,1) << "Test 3, loop:" << i << " completed." << endl;
cdebug_tabw(110,-1);
}
}
void anabaticTest_4 ( AnabaticEngine* engine )
{
Cell* cell = engine->getCell();
cell->flattenNets( Cell::Flags::BuildRings );
cell->createRoutingPadRings( Cell::Flags::BuildRings );
engine->getSouthWestGCell()->doGrid();
vector<Net*> nets;
nets.push_back( cell->getNet( "ialu.inv_x2_3_sig" ) );
nets.push_back( cell->getNet( "iram.na3_x1_13_sig" ) );
nets.push_back( cell->getNet( "iram.ram_idx_7(1)" ) );
Dijkstra* dijkstra = new Dijkstra ( engine );
for ( Net* net : nets ) {
dijkstra->load( net );
dijkstra->run();
}
delete dijkstra;
}
void anabaticTest_5 ( AnabaticEngine* engine )
{
Cell* cell = engine->getCell();
cell->flattenNets( Cell::Flags::BuildRings );
cell->createRoutingPadRings( Cell::Flags::BuildRings );
//DebugSession::addToTrace( cell->getNet("alu_out(3)") );
//DebugSession::addToTrace( cell->getNet("imuxe.not_i(1)") );
//DebugSession::addToTrace( cell->getNet("r(0)") );
//DebugSession::addToTrace( cell->getNet("ialu.not_aux104") );
DebugSession::addToTrace( cell->getNet("mips_r3000_1m_dp_shift32_rshift_se_muxoutput(159)") );
engine->startMeasures();
cmess1 << " o Building regular grid..." << endl;
UpdateSession::open();
engine->getSouthWestGCell()->doGrid();
UpdateSession::close();
engine->stopMeasures();
engine->printMeasures( "Anbatic Grid" );
engine->startMeasures();
cmess1 << " o Running global routing..." << endl;
UpdateSession::open();
Dijkstra* dijkstra = new Dijkstra ( engine );
dijkstra->setDistance( DigitalDistance( engine->getConfiguration()->getEdgeCostH()
, engine->getConfiguration()->getEdgeCostK() ) );
for ( Net* net : cell->getNets() ) {
if (net->isPower() or net->isClock()) continue;
dijkstra->load( net );
dijkstra->run();
}
UpdateSession::close();
engine->stopMeasures();
engine->printMeasures( "Dijkstra" );
#if 0
const vector<Edge*>& ovEdges = engine->getOvEdges();
if (not ovEdges.empty()) {
size_t count = 0;
cmess1 << " - " << ovEdges.size() << " overloaded edges." << endl;
cmess1 << " " << ovEdges[0] << endl;
NetSet nets;
engine->getNetsFromEdge( ovEdges[0], nets );
for ( Net* net : nets ) {
cmess1 << " [" << setw(2) << count++ << "] " << net << endl;
}
UpdateSession::open();
Net* net = *nets.begin();
//dijkstra->load( net );
//dijkstra->ripup( ovEdges[0] );
UpdateSession::close();
}
#endif
UpdateSession::open();
delete dijkstra;
UpdateSession::close();
}
// -------------------------------------------------------------------
// Class : "Anabatic::GraphicAnabaticEngine".
size_t GraphicAnabaticEngine::_references = 0;
GraphicAnabaticEngine* GraphicAnabaticEngine::_singleton = NULL;
void GraphicAnabaticEngine::initGCell ( CellWidget* widget )
{
widget->getDrawingPlanes().setPen( Qt::NoPen );
}
void GraphicAnabaticEngine::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);
painter.setPen ( pen );
painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) );
painter.drawRect( pixelBb );
if (gcell->isFlat()) return;
if (pixelBb.width() > 150) {
QString text = QString("id:%1").arg(gcell->getId());
QFont font = Graphics::getFixedFont( QFont::Bold );
painter.setFont(font);
pen.setWidth( 1 );
painter.setPen( pen );
painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) );
painter.drawRect (QRect( -75, -25, 150, 50 ));
painter.drawText (QRect( -75, -25, 150, 50 )
, text
, QTextOption(Qt::AlignCenter)
);
painter.restore ();
}
}
void GraphicAnabaticEngine::initEdge ( CellWidget* widget )
{
widget->getDrawingPlanes().setPen( Qt::NoPen );
}
void GraphicAnabaticEngine::drawEdge ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& box
, const Transformation& transformation
)
{
static QFont font = Graphics::getFixedFont( QFont::Bold );
static int fontHeight = QFontMetrics(font).height();
const Edge* edge = static_cast<const Edge*>(go);
if (edge) {
Box bb = edge->getBoundingBox();
unsigned int occupancy = 255;
if (edge->getRealOccupancy() < edge->getCapacity())
occupancy = (unsigned int)( 255.0 * ( (float)edge->getRealOccupancy() / (float)edge->getCapacity() ) );
QPainter& painter = widget->getPainter();
if (edge->getRealOccupancy() > edge->getCapacity()) {
QColor color ( Qt::cyan );
painter.setPen( DisplayStyle::darken(color,widget->getDarkening()) );
}
QBrush brush = QBrush( Qt::white, Qt::DiagCrossPattern );
if (edge->getCapacity() > 0.0)
brush = Graphics::getColorScale( ColorScale::Fire ).getBrush( occupancy, widget->getDarkening() );
QRect pixelBb = widget->dbuToScreenRect( bb, false);
painter.setPen( Qt::NoPen );
painter.setBrush( brush );
painter.drawRect( pixelBb );
if (fontHeight > ((edge->isHorizontal()) ? pixelBb.height() : pixelBb.width()) + 4) return;
QString text = QString("%1/%2").arg(edge->getRealOccupancy()).arg(edge->getCapacity());
QColor color ( (occupancy > 170) ? Qt::black : Qt::white );
painter.setPen (DisplayStyle::darken(color,widget->getDarkening()));
painter.setFont(font);
if (edge->isVertical()) {
painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getXMin(), bb.getYMin()) );
painter.rotate ( -90 );
painter.drawText (QRect( 0
, 0
, widget->dbuToScreenLength(bb.getHeight())
, widget->dbuToScreenLength(bb.getWidth ()))
, text
, QTextOption(Qt::AlignCenter)
);
painter.restore ();
} else
painter.drawText( widget->dbuToScreenRect(bb,false ), text, QTextOption(Qt::AlignCenter) );
painter.setPen( Qt::NoPen );
}
}
AnabaticEngine* GraphicAnabaticEngine::createEngine ()
{
Cell* cell = getCell();
AnabaticEngine* engine = AnabaticEngine::get( cell );
if (not engine) {
engine = AnabaticEngine::create( cell );
} else
cerr << Warning( "%s already has a Anabatic engine.", getString(cell).c_str() ) << endl;
return engine;
}
AnabaticEngine* GraphicAnabaticEngine::getForFramework ( unsigned int flags )
{
// Currently, only one framework is avalaible: Alliance.
AnabaticEngine* engine = AnabaticEngine::get( getCell() );
if (engine) return engine;
if (flags & CreateEngine) {
engine = createEngine();
if (not engine)
throw Error( "Failed to create Anabatic engine on %s.", getString(getCell()).c_str() );
} else {
throw Error( "AnabaticEngine not created yet, run the global router first." );
}
return engine;
}
void GraphicAnabaticEngine::_runTest ()
{
if (_viewer) _viewer->emitCellAboutToChange();
AnabaticEngine* engine = getForFramework( CreateEngine );
//anabaticTest_1( engine );
//anabaticTest_2( engine );
//anabaticTest_3( engine );
//anabaticTest_4( engine );
anabaticTest_5( engine );
if (_viewer) _viewer->emitCellChanged();
}
void GraphicAnabaticEngine::_globalRoute ()
{
AnabaticEngine* engine = getForFramework( CreateEngine );
engine->globalRoute();
}
void GraphicAnabaticEngine::_detailRoute ()
{
AnabaticEngine* engine = getForFramework( CreateEngine );
engine->loadGlobalRouting( EngineLoadGrByNet );
engine->layerAssign( EngineNoNetLayerAssign );
}
void GraphicAnabaticEngine::addToMenu ( CellViewer* viewer )
{
assert( _viewer == NULL );
_viewer = viewer;
if (_viewer->hasMenuAction("placeAndRoute.anabatic.globalRoute")) {
cerr << Warning( "GraphicAnabaticEngine::addToMenu() - Anabatic engine already hooked in." ) << endl;
return;
}
_viewer->addMenu ( "placeAndRoute.anabatic", "Anabatic" );
_viewer->addToMenu( "placeAndRoute.anabatic.runTest"
, "Anabatic - &Test Run"
, "Perform a test run of Anabatic on the design"
, std::bind(&GraphicAnabaticEngine::_runTest,this)
);
_viewer->addToMenu( "placeAndRoute.anabatic.globalRoute"
, "Anabatic - &Global Route"
, "Global Route"
, std::bind(&GraphicAnabaticEngine::_globalRoute,this)
);
_viewer->addToMenu( "placeAndRoute.anabatic.detailedRoute"
, "Anabatic - &Detailed Route"
, "Run the <b>Anabatic</b> detailed router"
, std::bind(&GraphicAnabaticEngine::_detailRoute,this)
);
}
const Name& GraphicAnabaticEngine::getName () const
{ return AnabaticEngine::staticGetName(); }
Cell* GraphicAnabaticEngine::getCell ()
{
if (_viewer == NULL) {
throw Error( "<b>Anabatic:</b> GraphicAnabaticEngine not bound to any Viewer." );
return NULL;
}
if (_viewer->getCell() == NULL) {
throw Error( "<b>Anabatic:</b> No Cell is loaded into the Viewer." );
return NULL;
}
return _viewer->getCell();
}
GraphicAnabaticEngine* GraphicAnabaticEngine::grab ()
{
if (not _references)
_singleton = new GraphicAnabaticEngine ();
_references++;
return _singleton;
}
size_t GraphicAnabaticEngine::release ()
{
--_references;
if (not _references) {
delete _singleton;
_singleton = NULL;
}
return _references;
}
GraphicAnabaticEngine::GraphicAnabaticEngine ()
: GraphicTool()
, _viewer (NULL)
{
addDrawGo( "Anabatic::GCell", initGCell, drawGCell );
addDrawGo( "Anabatic::Edge" , initEdge , drawEdge );
}
GraphicAnabaticEngine::~GraphicAnabaticEngine ()
{ }
} // Anabatic namespace.

View File

@ -16,8 +16,7 @@
#include "hurricane/isobar/PyHurricane.h"
#include "hurricane/isobar/PyCell.h"
#include "anabatic/PyAnabaticEngine.h"
#include "anabatic/PyGraphicAnabaticEngine.h"
#include "anabatic/Constants.h"
namespace Anabatic {
@ -26,8 +25,6 @@ namespace Anabatic {
using std::endl;
using Hurricane::tab;
using Isobar::__cs;
using CRL::PyTypeToolEngine;
using CRL::PyTypeGraphicTool;
#if !defined(__PYTHON_MODULE__)
@ -64,13 +61,6 @@ extern "C" {
DL_EXPORT(void) initAnabatic () {
cdebug_log(32,0) << "initAnabatic()" << endl;
PyAnabaticEngine_LinkPyType();
PyGraphicAnabaticEngine_LinkPyType();
PYTYPE_READY_SUB( AnabaticEngine , ToolEngine );
PYTYPE_READY_SUB( GraphicAnabaticEngine, GraphicTool );
PyObject* module = Py_InitModule( "Anabatic", PyAnabatic_Methods );
if (module == NULL) {
cerr << "[ERROR]\n"
@ -78,11 +68,6 @@ extern "C" {
return;
}
Py_INCREF( &PyTypeAnabaticEngine );
PyModule_AddObject( module, "AnabaticEngine", (PyObject*)&PyTypeAnabaticEngine );
Py_INCREF( &PyTypeGraphicAnabaticEngine );
PyModule_AddObject( module, "GraphicAnabaticEngine", (PyObject*)&PyTypeGraphicAnabaticEngine );
PyObject* dictionnary = PyModule_GetDict(module);
PyObject* constant;

View File

@ -1,221 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyAnabaticEngine.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyCell.h"
#include "hurricane/viewer/PyCellViewer.h"
#include "hurricane/viewer/ExceptionWidget.h"
#include "hurricane/Cell.h"
#include "anabatic/PyAnabaticEngine.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(AnabaticEngine,engine,function)
namespace Anabatic {
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::ProxyProperty;
using Isobar::ProxyError;
using Isobar::ConstructorError;
using Isobar::HurricaneError;
using Isobar::HurricaneWarning;
using Isobar::ParseOneArg;
using Isobar::ParseTwoArg;
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) \
{ \
trace << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \
HTRY \
METHOD_HEAD(#SELF_TYPE "." #FUNC_NAME "()") \
if (SELF_OBJECT->getViewer()) { \
if (ExceptionWidget::catchAllWrapper( std::bind(&AnabaticEngine::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; \
}
// +=================================================================+
// | "PyAnabaticEngine" Python Module Code Part |
// +=================================================================+
static PyObject* PyAnabaticEngine_get ( PyObject*, PyObject* args )
{
cdebug_log(32,0) << "PyAnabaticEngine_get()" << endl;
AnabaticEngine* engine = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Anabatic.get", args, CELL_ARG, &arg0)) return NULL;
engine = AnabaticEngine::get(PYCELL_O(arg0));
HCATCH
return PyAnabaticEngine_Link(engine);
}
static PyObject* PyAnabaticEngine_create ( PyObject*, PyObject* args )
{
cdebug_log(32,0) << "PyAnabaticEngine_create()" << endl;
AnabaticEngine* engine = NULL;
HTRY
PyObject* arg0;
if (not ParseOneArg("Anabatic.get", args, CELL_ARG, &arg0)) return NULL;
Cell* cell = PYCELL_O(arg0);
engine = AnabaticEngine::get(cell);
if (engine == NULL) {
engine = AnabaticEngine::create(cell);
} else
cerr << Warning("%s already has a Anabatic engine.",getString(cell).c_str()) << endl;
HCATCH
return PyAnabaticEngine_Link(engine);
}
static PyObject* PyAnabaticEngine_setViewer ( PyAnabaticEngine* self, PyObject* args )
{
cdebug_log(32,0) << "PyAnabaticEngine_setViewer ()" << endl;
HTRY
METHOD_HEAD( "AnabaticEngine.setViewer()" )
PyObject* pyViewer = NULL;
if (not PyArg_ParseTuple(args,"O:EtesianEngine.setViewer()",&pyViewer)) {
PyErr_SetString( ConstructorError, "Bad parameters given to EtesianEngine.setViewer()." );
return NULL;
}
if (IsPyCellViewer(pyViewer)) {
engine->setViewer( PYCELLVIEWER_O(pyViewer) );
}
HCATCH
Py_RETURN_NONE;
}
#if 0
PyObject* PyAnabaticEngine_runTest ( PyAnabaticEngine* self, PyObject* args )
{
cdebug_log(32,0) << "PyAnabaticEngine_runTest()" << endl;
HTRY
METHOD_HEAD("AnabaticEngine.runTest()")
unsigned int flags = 0;
if (PyArg_ParseTuple(args,"I:AnabaticEngine.runTest", &flags)) {
if (engine->getViewer()) {
if (ExceptionWidget::catchAllWrapper( std::bind(&AnabaticEngine::_runTest,engine) )) {
PyErr_SetString( HurricaneError, "AnabaticEngine::runTest() has thrown an exception (C++)." );
return NULL;
}
} else {
engine->_runTest();
}
} else {
PyErr_SetString(ConstructorError, "AnabaticEngine.runGlobalRouter(): Invalid number/bad type of parameter.");
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
#endif
// Standart Accessors (Attributes).
// Standart Destroy (Attribute).
DBoDestroyAttribute(PyAnabaticEngine_destroy,PyAnabaticEngine)
PyMethodDef PyAnabaticEngine_Methods[] =
{ { "get" , (PyCFunction)PyAnabaticEngine_get , METH_VARARGS|METH_STATIC
, "Returns the Anabatic engine attached to the Cell, None if there isnt't." }
, { "create" , (PyCFunction)PyAnabaticEngine_create , METH_VARARGS|METH_STATIC
, "Create a Anabatic engine on this cell." }
, { "setViewer" , (PyCFunction)PyAnabaticEngine_setViewer , METH_VARARGS
, "Associate a Viewer to this AnabaticEngine." }
#if 0
, { "runTest" , (PyCFunction)PyAnabaticEngine_runTest , METH_VARARGS
, "Run the test procedure." }
#endif
, { "destroy" , (PyCFunction)PyAnabaticEngine_destroy , METH_NOARGS
, "Destroy the associated hurricane object. The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
DBoDeleteMethod(AnabaticEngine)
PyTypeObjectLinkPyType(AnabaticEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyAnabaticEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
PyTypeInheritedObjectDefinitions(AnabaticEngine,PyToolEngine)
DBoLinkCreateMethod(AnabaticEngine)
#endif // Shared Library Code Part.
} // extern "C".
} // Anabatic namespace.

View File

@ -1,122 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyGraphicAnabaticEngine.cpp" |
// +-----------------------------------------------------------------+
#include "anabatic/PyGraphicAnabaticEngine.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(GraphicAnabaticEngine,gengine,function)
namespace Anabatic {
using namespace Hurricane;
using namespace Isobar;
extern "C" {
// +=================================================================+
// | "PyGraphicAnabaticEngine" Python Module Code Part |
// +=================================================================+
#if defined(__PYTHON_MODULE__)
// +-------------------------------------------------------------+
// | "PyGraphicAnabaticEngine" Attribute Methods |
// +-------------------------------------------------------------+
static PyObject* PyGraphicAnabaticEngine_grab ( PyObject* )
{
cdebug_log(32,0) << "PyGraphicAnabaticEngine_grab()" << endl;
PyGraphicAnabaticEngine* pyGraphicAnabaticEngine = NULL;
HTRY
pyGraphicAnabaticEngine = PyObject_NEW ( PyGraphicAnabaticEngine, &PyTypeGraphicAnabaticEngine );
if ( pyGraphicAnabaticEngine == NULL ) return NULL;
pyGraphicAnabaticEngine->ACCESS_OBJECT = GraphicAnabaticEngine::grab();
HCATCH
return (PyObject*)pyGraphicAnabaticEngine;
}
static PyObject* PyGraphicAnabaticEngine_getCell ( PyGraphicAnabaticEngine* self )
{
cdebug_log(32,0) << "PyGraphicAnabaticEngine_getCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD("GraphicAnabaticEngine.getCell()")
cell = gengine->getCell ();
HCATCH
if (cell == NULL) Py_RETURN_NONE;
return PyCell_Link(cell);
}
GetNameMethod(GraphicAnabaticEngine, gengine)
// Standart destroy (Attribute).
PyMethodDef PyGraphicAnabaticEngine_Methods[] =
{ { "grab" , (PyCFunction)PyGraphicAnabaticEngine_grab , METH_NOARGS|METH_STATIC
, "Returns the GraphicAnabaticEngine singleton." }
, { "getName" , (PyCFunction)PyGraphicAnabaticEngine_getName , METH_NOARGS
, "Returns the name of the GraphicAnabaticEngine (class attribute)." }
, { "getCell" , (PyCFunction)PyGraphicAnabaticEngine_getCell , METH_NOARGS
, "Returns the Cell on which this GraphicAnabaticEngine is attached." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// PyGraphicAnabaticEngine Type Methods.
PythonOnlyDeleteMethod(GraphicAnabaticEngine)
PyTypeObjectLinkPyType(GraphicAnabaticEngine)
#else // End of Python Module Code Part.
// +=================================================================+
// | "PyGraphicAnabaticEngine" Shared Library Code Part |
// +=================================================================+
// Link/Creation Method.
LinkCreateMethod(GraphicAnabaticEngine)
PyTypeInheritedObjectDefinitions(GraphicAnabaticEngine,GraphicTool)
#endif // End of Shared Library Code Part.
} // extern "C".
} // CRL namespace.

View File

@ -1,92 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./anabatic/GraphicAnabaticEngine.h" |
// +-----------------------------------------------------------------+
#ifndef ANABATIC_GRAPHIC_ANABATIC_ENGINE_H
#define ANABATIC_GRAPHIC_ANABATIC_ENGINE_H
#include <functional>
#include <QObject>
namespace Hurricane {
class Go;
class BasicLayer;
class Transformation;
class CellWidget;
class CellViewer;
}
#include "crlcore/GraphicToolEngine.h"
#include "anabatic/AnabaticEngine.h"
namespace Anabatic {
using Hurricane::Go;
using Hurricane::Box;
using Hurricane::BasicLayer;
using Hurricane::Transformation;
using Hurricane::CellWidget;
using Hurricane::CellViewer;
using CRL::GraphicTool;
// -------------------------------------------------------------------
// Class : "Anabatic::GraphicAnabaticEngine".
class GraphicAnabaticEngine : public GraphicTool {
Q_OBJECT;
public:
enum Flags { NoFlags=0x0000, CreateEngine=0x0001 };
public:
AnabaticEngine* createEngine ();
AnabaticEngine* getForFramework ( unsigned int flags );
static void initGCell ( CellWidget* );
static void drawGCell ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
static void initEdge ( CellWidget* );
static void drawEdge ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
static GraphicAnabaticEngine* grab ();
virtual const Name& getName () const;
Cell* getCell ();
virtual size_t release ();
virtual void addToMenu ( CellViewer* );
protected:
static size_t _references;
static GraphicAnabaticEngine* _singleton;
CellViewer* _viewer;
protected:
GraphicAnabaticEngine ();
virtual ~GraphicAnabaticEngine ();
void _runTest ();
void _globalRoute ();
void _detailRoute ();
};
} // Anabatic namespace.
#endif // ANABATIC_GRAPHIC_ANABATIC_ENGINE_H

View File

@ -1,55 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./anabatic/PyAnabaticEngine.h" |
// +-----------------------------------------------------------------+
#ifndef PY_ANABATIC_ENGINE_H
#define PY_ANABATIC_ENGINE_H
#include "hurricane/isobar/PyHurricane.h"
#include "crlcore/PyToolEngine.h"
#include "anabatic/AnabaticEngine.h"
namespace Anabatic {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyAnabaticEngine".
typedef struct {
CRL::PyToolEngine _baseObject;
} PyAnabaticEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyAnabatic.ccp".
extern PyTypeObject PyTypeAnabaticEngine;
extern PyMethodDef PyAnabaticEngine_Methods[];
extern PyObject* PyAnabaticEngine_Link ( Anabatic::AnabaticEngine* );
extern void PyAnabaticEngine_LinkPyType ();
#define IsPyAnabaticEngine(v) ( (v)->ob_type == &PyTypeAnabaticEngine )
#define PYANABATICENGINE(v) ( (PyAnabaticEngine*)(v) )
#define PYANABATICENGINE_O(v) ( PYANABATICENGINE(v)->_baseObject._object )
} // extern "C".
} // Anabatic namespace.
#endif // PY_ANABATIC_ENGINE_H

View File

@ -1,53 +0,0 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2016-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | A n a b a t i c - Global Routing Toolbox |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./anabatic/PyGraphicAnabaticEngine.h" |
// +-----------------------------------------------------------------+
#ifndef ANABATIC_PY_GRAPHIC_ANABATIC_ENGINE_H
#define ANABATIC_PY_GRAPHIC_ANABATIC_ENGINE_H
#include "crlcore/PyGraphicToolEngine.h"
#include "anabatic/GraphicAnabaticEngine.h"
namespace Anabatic {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyGraphicAnabaticEngine".
typedef struct {
CRL::PyGraphicTool _baseObject;
} PyGraphicAnabaticEngine;
// -------------------------------------------------------------------
// Functions & Types exported to "PyAnabatic.ccp".
extern PyTypeObject PyTypeGraphicAnabaticEngine;
extern PyMethodDef PyGraphicAnabaticEngine_Methods[];
extern void PyGraphicAnabaticEngine_LinkPyType ();
#define IsPyGraphicAnabaticEngine(v) ( (v)->ob_type == &PyTypeGraphicAnabaticEngine )
#define PY_GRAPHIC_ANABATIC_ENGINE(v) ( (PyGraphicAnabaticEngine*)(v) )
#define PY_GRAPHIC_ANABATIC_ENGINE_O(v) ( PY_GRAPHIC_ANABATIC_ENGINE(v)->_baseObject._object )
} // extern "C".
} // Anabatic namespace.
#endif // ANABATIC_PY_GRAPHIC_ANABATIC_ENGINE_H

View File

@ -50,16 +50,131 @@ namespace Katana {
using Hurricane::Net;
using Hurricane::Graphics;
using Hurricane::ColorScale;
using Hurricane::DisplayStyle;
using Hurricane::ControllerWidget;
using Hurricane::ExceptionWidget;
using CRL::Catalog;
using CRL::AllianceFramework;
using Anabatic::Edge;
using Anabatic::GCell;
size_t GraphicKatanaEngine::_references = 0;
GraphicKatanaEngine* GraphicKatanaEngine::_singleton = NULL;
void GraphicKatanaEngine::initGCell ( CellWidget* widget )
{
widget->getDrawingPlanes().setPen( Qt::NoPen );
}
void GraphicKatanaEngine::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);
painter.setPen ( pen );
painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) );
painter.drawRect( pixelBb );
if (gcell->isFlat()) return;
if (pixelBb.width() > 150) {
QString text = QString("id:%1").arg(gcell->getId());
QFont font = Graphics::getFixedFont( QFont::Bold );
painter.setFont(font);
pen.setWidth( 1 );
painter.setPen( pen );
painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) );
painter.drawRect (QRect( -75, -25, 150, 50 ));
painter.drawText (QRect( -75, -25, 150, 50 )
, text
, QTextOption(Qt::AlignCenter)
);
painter.restore ();
}
}
void GraphicKatanaEngine::initEdge ( CellWidget* widget )
{
widget->getDrawingPlanes().setPen( Qt::NoPen );
}
void GraphicKatanaEngine::drawEdge ( CellWidget* widget
, const Go* go
, const BasicLayer* basicLayer
, const Box& box
, const Transformation& transformation
)
{
static QFont font = Graphics::getFixedFont( QFont::Bold );
static int fontHeight = QFontMetrics(font).height();
const Edge* edge = static_cast<const Edge*>(go);
if (edge) {
Box bb = edge->getBoundingBox();
unsigned int occupancy = 255;
if (edge->getRealOccupancy() < edge->getCapacity())
occupancy = (unsigned int)( 255.0 * ( (float)edge->getRealOccupancy() / (float)edge->getCapacity() ) );
QPainter& painter = widget->getPainter();
if (edge->getRealOccupancy() > edge->getCapacity()) {
QColor color ( Qt::cyan );
painter.setPen( DisplayStyle::darken(color,widget->getDarkening()) );
}
QBrush brush = QBrush( Qt::white, Qt::DiagCrossPattern );
if (edge->getCapacity() > 0.0)
brush = Graphics::getColorScale( ColorScale::Fire ).getBrush( occupancy, widget->getDarkening() );
QRect pixelBb = widget->dbuToScreenRect( bb, false);
painter.setPen( Qt::NoPen );
painter.setBrush( brush );
painter.drawRect( pixelBb );
if (fontHeight > ((edge->isHorizontal()) ? pixelBb.height() : pixelBb.width()) + 4) return;
QString text = QString("%1/%2").arg(edge->getRealOccupancy()).arg(edge->getCapacity());
QColor color ( (occupancy > 170) ? Qt::black : Qt::white );
painter.setPen (DisplayStyle::darken(color,widget->getDarkening()));
painter.setFont(font);
if (edge->isVertical()) {
painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getXMin(), bb.getYMin()) );
painter.rotate ( -90 );
painter.drawText (QRect( 0
, 0
, widget->dbuToScreenLength(bb.getHeight())
, widget->dbuToScreenLength(bb.getWidth ()))
, text
, QTextOption(Qt::AlignCenter)
);
painter.restore ();
} else
painter.drawText( widget->dbuToScreenRect(bb,false ), text, QTextOption(Qt::AlignCenter) );
painter.setPen( Qt::NoPen );
}
}
KatanaEngine* GraphicKatanaEngine::createEngine ()
{
Cell* cell = getCell ();
@ -297,7 +412,10 @@ namespace Katana {
GraphicKatanaEngine::GraphicKatanaEngine ()
: GraphicTool()
, _viewer (NULL)
{ }
{
addDrawGo( "Anabatic::GCell", initGCell, drawGCell );
addDrawGo( "Anabatic::Edge" , initEdge , drawEdge );
}
GraphicKatanaEngine::~GraphicKatanaEngine ()

View File

@ -53,6 +53,20 @@ namespace Katana {
public:
enum FunctionFlags { NoFlags=0x0000, CreateEngine=0x0001 };
public:
static void initGCell ( CellWidget* );
static void drawGCell ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
static void initEdge ( CellWidget* );
static void drawEdge ( CellWidget*
, const Go*
, const BasicLayer*
, const Box&
, const Transformation&
);
KatanaEngine* createEngine ();
KatanaEngine* getForFramework ( unsigned int flags );
static GraphicKatanaEngine* grab ();

View File

@ -55,32 +55,12 @@ using namespace Hurricane;
#include "crlcore/DefExport.h"
using namespace CRL;
// #include "nimbus/NimbusEngine.h"
// using namespace Nimbus;
// #include "metis/MetisEngine.h"
// using namespace Metis;
// #include "mauka/GraphicMaukaEngine.h"
// using namespace Mauka;
#include "anabatic/GraphicAnabaticEngine.h"
#include "katana/GraphicKatanaEngine.h"
#include "etesian/GraphicEtesianEngine.h"
using namespace Etesian;
#include "knik/GraphicKnikEngine.h"
using namespace Knik;
#include "kite/GraphicKiteEngine.h"
using namespace Kite;
#include "equinox/GraphicEquinoxEngine.h"
using namespace Equinox;
#include "solstice/GraphicSolsticeEngine.h"
using namespace Solstice;
#include "solstice/GraphicSolsticeEngine.h"
#include "unicorn/UnicornGui.h"
using namespace Unicorn;
@ -331,7 +311,7 @@ int main ( int argc, char *argv[] )
unicorn->setApplicationName ( QObject::tr("cgt") );
//unicorn->registerTool ( Mauka::GraphicMaukaEngine::grab() );
unicorn->registerTool ( Anabatic::GraphicAnabaticEngine::grab() );
unicorn->registerTool ( Katana::GraphicKatanaEngine::grab() );
unicorn->registerTool ( Etesian::GraphicEtesianEngine::grab() );
//unicorn->registerTool ( Knik::GraphicKnikEngine::grab() );
unicorn->registerTool ( Kite::GraphicKiteEngine::grab() );
@ -403,7 +383,7 @@ int main ( int argc, char *argv[] )
unsigned int globalFlags = (loadGlobal) ? Kite::KtLoadGlobalRouting
: Kite::KtBuildGlobalRouting;
KiteEngine* kite = KiteEngine::create ( cell );
Kite::KiteEngine* kite = Kite::KiteEngine::create ( cell );
if ( showConf ) kite->printConfiguration ();
kite->runGlobalRouter ( globalFlags );

View File

@ -183,7 +183,6 @@ if __name__ == '__main__':
unicorn = Unicorn.UnicornGui.create()
unicorn.setApplicationName ('cgt')
unicorn.registerTool (Anabatic.GraphicAnabaticEngine.grab())
unicorn.registerTool (Katana.GraphicKatanaEngine.grab())
unicorn.registerTool (Etesian.GraphicEtesianEngine.grab())
unicorn.registerTool (Kite.GraphicKiteEngine.grab())