Merge branch 'devel_anabatic' of ssh://bop.soc.lip6.fr/users/largo2/git/coriolis into devel_anabatic

This commit is contained in:
EricLaoGitHub 2016-09-12 10:12:41 +02:00
commit c51c9c6d6f
38 changed files with 344 additions and 1495 deletions

View File

@ -79,8 +79,8 @@ namespace Anabatic {
Point sourcePosition = segment->getSourcePosition();
Point targetPosition = segment->getTargetPosition();
if ( (sourcePosition.getX() >= gcellsArea.getXMax())
or (sourcePosition.getY() >= gcellsArea.getYMax())
if ( (sourcePosition.getX() > gcellsArea.getXMax())
or (sourcePosition.getY() > gcellsArea.getYMax())
or (targetPosition.getX() <= gcellsArea.getXMin())
or (targetPosition.getY() <= gcellsArea.getYMin()) ) {
cerr << Error( "RawGCellsUnder::RawGCellsUnder(): %s is completly outside the GCells area (ignored)."
@ -958,6 +958,14 @@ namespace Anabatic {
{ _timer.stop(); }
void AnabaticEngine::suspendMeasures ()
{ _timer.suspend(); }
void AnabaticEngine::resumeMeasures ()
{ _timer.resume(); }
void AnabaticEngine::printMeasures ( const string& tag ) const
{
ostringstream result;

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

@ -30,6 +30,7 @@
#include "crlcore/RoutingLayerGauge.h"
#include "crlcore/AllianceFramework.h"
#include "anabatic/Configuration.h"
#include "anabatic/GCell.h"
@ -71,6 +72,8 @@ namespace Anabatic {
, _edgeCostK (Cfg::getParamDouble("anabatic.edgeCostK",-10.0)->asDouble())
, _edgeHInc (Cfg::getParamDouble("anabatic.edgeHInc" , 1.5)->asDouble())
{
GCell::setDisplayMode( Cfg::getParamEnumerate("anabatic.gcell.displayMode", GCell::Boundary)->asInt() );
if (cg == NULL) cg = AllianceFramework::get()->getCellGauge();
if (rg == NULL) rg = AllianceFramework::get()->getRoutingGauge();
_cg = cg->getClone();
@ -122,6 +125,8 @@ namespace Anabatic {
, _edgeCostK (other._edgeCostK)
, _edgeHInc (other._edgeHInc)
{
GCell::setDisplayMode( Cfg::getParamEnumerate("anabatic.gcell.displayMode", GCell::Boundary)->asInt() );
if (other._cg) _cg = other._cg->getClone();
if (other._rg) _rg = other._rg->getClone();
}

View File

@ -315,12 +315,16 @@ namespace Anabatic {
string Edge::_getString () const
{
Point center ( getSource()->getCenter() );
string s = Super::_getString();
s.insert( s.size()-1, " "+DbU::getValueString(_axis) );
s.insert( s.size()-1, " "+getString(_realOccupancy) );
s.insert( s.size()-1, "/"+getString(_capacity) );
s.insert( s.size()-1, " h:"+getString(_historicCost) );
s.insert( s.size()-1, " "+getString(_flags) );
s.insert( s.size()-1, " S:["+DbU::getValueString(center.getX()) );
s.insert( s.size()-1, " " +DbU::getValueString(center.getY()) );
s.insert( s.size()-1, "] " +DbU::getValueString(_axis) );
s.insert( s.size()-1, " " +getString(_realOccupancy) );
s.insert( s.size()-1, "/" +getString(_capacity) );
s.insert( s.size()-1, " h:" +getString(_historicCost) );
s.insert( s.size()-1, " " +getString(_flags) );
return s;
}

View File

@ -17,6 +17,7 @@
#include <iostream>
#include "hurricane/Bug.h"
#include "hurricane/Warning.h"
#include "hurricane/Breakpoint.h"
#include "hurricane/Contact.h"
#include "hurricane/RoutingPad.h"
#include "hurricane/UpdateSession.h"
@ -270,7 +271,12 @@ namespace Anabatic {
// -------------------------------------------------------------------
// Class : "Anabatic::GCell".
Name GCell::_extensionName = "Anabatic::GCell";
Name GCell::_extensionName = "Anabatic::GCell";
unsigned int GCell::_displayMode = GCell::Boundary;
unsigned int GCell::getDisplayMode () { return _displayMode; }
void GCell::setDisplayMode ( unsigned int mode ) { _displayMode = mode; }
GCell::GCell ( AnabaticEngine* anabatic, DbU::Unit xmin, DbU::Unit ymin )
@ -720,12 +726,9 @@ namespace Anabatic {
{
getAnabatic()->openSession();
//const vector<GCell*>& gcells = getAnabatic()->getGCells();
//size_t ibegin = gcells.size();
DbU::Unit side = Session::getSliceHeight();
Interval hspan = getSide( Flags::Horizontal );
Interval vspan = getSide( Flags::Vertical );
DbU::Unit side = Session::getSliceHeight();
Interval hspan = getSide( Flags::Horizontal );
Interval vspan = getSide( Flags::Vertical );
if (hspan.getSize() < 3*side) {
cerr << Error( "GCell::doGrid(): GCell is too narrow (dx:%s) to build a grid.\n"

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

@ -2232,7 +2232,7 @@ namespace Anabatic {
void AnabaticEngine::_loadGrByNet ()
{
cmess1 << " o Loading Nets global routing from Knik." << endl;
cmess1 << " o Building detailed routing from global." << endl;
//cmess1 << Dots::asDouble(" - Saturation",getMeasure<double>(getCell(),"Sat.")->getData()) << endl;
startMeasures();

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

@ -278,6 +278,8 @@ namespace Anabatic {
inline const Timer& getTimer () const;
void startMeasures ();
void stopMeasures ();
void suspendMeasures ();
void resumeMeasures ();
void printMeasures ( const string& ) const;
inline void _add ( GCell* );
inline void _remove ( GCell* );

View File

@ -75,6 +75,9 @@ namespace Anabatic {
typedef std::set< GCell*, Entity::CompareById > Set;
typedef std::vector<GCell*> Vector;
public:
enum DisplayMode { Boundary = 1
, Density = 2
};
enum DensityMode { AverageHVDensity = 1 // Average between all densities.
, AverageHDensity = 2 // Average between all H densities.
, AverageVDensity = 3 // Average between all V densities.
@ -120,6 +123,8 @@ namespace Anabatic {
float _density;
};
public:
static unsigned int getDisplayMode ();
static void setDisplayMode ( unsigned int );
static Box getBorder ( const GCell*, const GCell* );
public:
static GCell* create ( AnabaticEngine* );
@ -266,6 +271,7 @@ namespace Anabatic {
GCell& operator= ( const GCell& );
private:
static Name _extensionName;
static unsigned int _displayMode;
Observable _observable;
AnabaticEngine* _anabatic;
Flags _flags;

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

@ -25,6 +25,10 @@ parametersTable = \
, ("anabatic.edgeWidth" ,TypeInt ,4 )
, ("anabatic.edgeCostH" ,TypeDouble ,9.0 )
, ("anabatic.edgeCostK" ,TypeDouble ,-10.0 )
, ("anabatic.gcell.displayMode" ,TypeEnumerate ,1
, { 'values':( ("Boundary" , 1)
, ("Density" , 2) ) }
)
)

View File

@ -85,7 +85,7 @@ stylesTable = \
, (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 })
, (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 })
, (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'threshold':0.02*scale, 'border':4 })
, (Drawing, 'Anabatic::GCell', { 'color':'255,0,0' , 'pattern':'0000000000000000', 'threshold':0.80*scale, 'border':4 })
, (Drawing, 'Anabatic::GCell', { 'color':'255,0,0' , 'pattern':'0000000000000000', 'threshold':0.10*scale, 'border':4 })
)
# ----------------------------------------------------------------------
@ -192,7 +192,7 @@ stylesTable = \
, (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 })
, (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 })
, (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.02*scale })
, (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.80*scale })
, (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.10*scale })
)
# ----------------------------------------------------------------------

View File

@ -8,6 +8,7 @@ layoutTable = \
, (TypeOption , "katabatic.saturateRp" , "Saturate RoutingPad" , 0, 1 )
, (TypeOption , "katabatic.globalLengthThreshold", "Global Length Threshold", 0, 1 )
, (TypeOption , "katabatic.topRoutingLayer" , "Top Routing Layer" , 0, 1 )
, (TypeOption , "anabatic.gcell.displayMode" , "GCell Display Mode" , 1, 1 )
, (TypeRule ,)
, (TypeTitle , "Kite - Detailed Router" )
, (TypeOption , "kite.hTracksReservedLocal", "Vert. Locally Reserved Tracks", 0 )

View File

@ -538,6 +538,7 @@ class Corona ( object ):
if self.horizontalDepth > self.verticalDepth:
contactDepth = self.verticalDepth
UpdateSession.open()
for i in range(self._railsNb):
xBL = self._westSide .getRail(i).axis
yBL = self._southSide.getRail(i).axis
@ -582,4 +583,5 @@ class Corona ( object ):
self._westSide.addBlockages()
self._eastSide.addBlockages()
UpdateSession.close()
return

View File

@ -105,6 +105,7 @@ class HTree ( GaugeConfWrapper ):
raise ErrorMessage( 3, 'ClockTree: clockTree.minimumSide (%g) is less than 100 lambda.' \
% DbU.toLambda(self.minSide) )
UpdateSession.open()
self.framework = CRL.AllianceFramework.get()
self.cell = cell
self.area = area
@ -126,6 +127,7 @@ class HTree ( GaugeConfWrapper ):
if not self.masterClock:
raise ErrorMessage( 3, 'ClockTree: Cell %s has no clock net.' % cell.getName() )
self._createChildNet( self.topBuffer, 'ck_htree' )
UpdateSession.close()
return
@ -371,6 +373,7 @@ class HTreeNode ( object ):
DownBranch = 0x0010
def __init__ ( self, topTree, sourceBuffer, area, prefix, flags ):
UpdateSession.open()
self.topTree = topTree
self.childs = []
self.blLeafs = []
@ -406,6 +409,7 @@ class HTreeNode ( object ):
self.childs.append( HTreeNode( self.topTree, self.tlBuffer, self.tlArea(), self.prefix+'_tl', 0 ) )
self.childs.append( HTreeNode( self.topTree, self.trBuffer, self.trArea(), self.prefix+'_tr', 0 ) )
UpdateSession.close()
return
def xmin ( self ): return self.area.getXMin()

View File

@ -1051,6 +1051,8 @@ void Cell::materialize()
{
if (_flags.isset(Flags::Materialized)) return;
cdebug_log(18,1) << "Cell::materialize() " << this << endl;
_flags |= Flags::Materialized;
for ( Instance* instance : getInstances() ) {
@ -1060,6 +1062,8 @@ void Cell::materialize()
for ( Net* net : getNets () ) net ->materialize();
for ( Marker* marker : getMarkers() ) marker->materialize();
cdebug_tabw(18,-1);
}
void Cell::unmaterialize()
@ -1212,20 +1216,21 @@ Record* Cell::_getRecord() const
{
Record* record = Inherit::_getRecord();
if (record) {
record->add( getSlot("_library" , _library ) );
record->add( getSlot("_name" , &_name ) );
record->add( getSlot("_instances" , &_instanceMap ) );
record->add( getSlot("_quadTree" , _quadTree ) );
record->add( getSlot("_slaveInstances", &_slaveInstanceSet) );
record->add( getSlot("_netMap" , &_netMap ) );
record->add( getSlot("_netAliasSet" , &_netAliasSet ) );
record->add( getSlot("_pinMap" , &_pinMap ) );
record->add( getSlot("_sliceMap" , _sliceMap ) );
record->add( getSlot("_markerSet" , &_markerSet ) );
record->add( getSlot("_slaveEntityMap", &_slaveEntityMap ) );
record->add( getSlot("_abutmentBox" , &_abutmentBox ) );
record->add( getSlot("_boundingBox" , &_boundingBox ) );
record->add( getSlot("_flags" , &_flags ) );
record->add( getSlot("_library" , _library ) );
record->add( getSlot("_name" , &_name ) );
record->add( getSlot("_instances" , &_instanceMap ) );
record->add( getSlot("_quadTree" , _quadTree ) );
record->add( getSlot("_extensionSlices", &_extensionSlices ) );
record->add( getSlot("_slaveInstances" , &_slaveInstanceSet) );
record->add( getSlot("_netMap" , &_netMap ) );
record->add( getSlot("_netAliasSet" , &_netAliasSet ) );
record->add( getSlot("_pinMap" , &_pinMap ) );
record->add( getSlot("_sliceMap" , _sliceMap ) );
record->add( getSlot("_markerSet" , &_markerSet ) );
record->add( getSlot("_slaveEntityMap" , &_slaveEntityMap ) );
record->add( getSlot("_abutmentBox" , &_abutmentBox ) );
record->add( getSlot("_boundingBox" , &_boundingBox ) );
record->add( getSlot("_flags" , &_flags ) );
}
return record;
}
@ -1699,6 +1704,8 @@ Initializer<JsonCell> jsonCellInitialize ( 10 );
JsonCell::JsonCell(unsigned long flags)
// ************************************
: JsonEntity(flags)
, _cell (NULL)
, _materializationState(Go::autoMaterializationIsDisabled())
{
remove( ".Cell" );
add( "_library" , typeid(string) );
@ -1706,6 +1713,19 @@ JsonCell::JsonCell(unsigned long flags)
add( "_abutmentBox" , typeid(Box) );
add( "+instanceMap" , typeid(JsonArray) );
add( "+netMap" , typeid(JsonArray) );
Go::enableAutoMaterialization();
}
JsonCell::~JsonCell()
// ******************
{
cdebug_log(19,0) << "JsonCell::~JsonCell() " << _cell << endl;
Go::enableAutoMaterialization();
if (_cell) _cell->materialize();
if (_materializationState) Go::disableAutoMaterialization();
}
string JsonCell::getTypeName() const
@ -1728,10 +1748,10 @@ void JsonCell::toData(JsonStack& stack)
Library* library = DataBase::getDB()->getLibrary( get<string>(stack,"_library")
, DataBase::CreateLib|DataBase::WarnCreateLib );
Cell* cell = Cell::create( library, get<string>(stack,"_name") );
cell->setAbutmentBox( stack.as<Box>("_abutmentBox") );
_cell = Cell::create( library, get<string>(stack,"_name") );
_cell->setAbutmentBox( stack.as<Box>("_abutmentBox") );
update( stack, cell );
update( stack, _cell );
}
} // End of Hurricane namespace.

View File

@ -73,7 +73,7 @@ namespace Hurricane {
void ExtensionGo::unmaterialize ()
{
cdebug_log(18,1) << "ExtensionGo::unmaterialize() - start" << (void*)this << endl;
cdebug_log(18,1) << "ExtensionGo::unmaterialize() - start" << endl;
if ( isMaterialized() ) {
ExtensionSlice* slice = _cell->getExtensionSlice( getName() );

View File

@ -62,7 +62,7 @@ void Go::_postCreate()
Inherit::_postCreate();
if (not autoMaterializationIsDisabled()) {
materialize();
invalidate( true );
} // materialized after entire post creation
}

View File

@ -20,6 +20,7 @@
#include "hurricane/QuadTree.h"
#include "hurricane/Go.h"
#include "hurricane/Error.h"
#include "hurricane/Warning.h"
namespace Hurricane {
@ -232,18 +233,16 @@ QuadTree::~QuadTree()
const Box& QuadTree::getBoundingBox() const
// ****************************************
{
if (_boundingBox.isEmpty()) {
Box& boundingBox = ((QuadTree*)this)->_boundingBox;
if (_ulChild) boundingBox.merge(_ulChild->getBoundingBox());
if (_urChild) boundingBox.merge(_urChild->getBoundingBox());
if (_llChild) boundingBox.merge(_llChild->getBoundingBox());
if (_lrChild) boundingBox.merge(_lrChild->getBoundingBox());
for_each_go(go, _goSet.getElements()) {
boundingBox.merge(go->getBoundingBox());
end_for;
}
}
return _boundingBox;
if (_boundingBox.isEmpty()) {
Box& boundingBox = const_cast<Box&>( _boundingBox );
if (_ulChild) boundingBox.merge(_ulChild->getBoundingBox());
if (_urChild) boundingBox.merge(_urChild->getBoundingBox());
if (_llChild) boundingBox.merge(_llChild->getBoundingBox());
if (_lrChild) boundingBox.merge(_lrChild->getBoundingBox());
for ( Go* go : _goSet.getElements() )
boundingBox.merge(go->getBoundingBox());
}
return _boundingBox;
}
Gos QuadTree::getGos() const
@ -322,23 +321,23 @@ string QuadTree::_getString() const
}
Record* QuadTree::_getRecord() const
// ***************************
// *********************************
{
Record* record = NULL;
if (_size) {
record = new Record(getString(this));
record->add(getSlot("Parent", _parent));
record->add(getSlot("X", &_x));
record->add(getSlot("Y", &_y));
record->add(getSlot("BoundingBox", &_boundingBox));
record->add(getSlot("Size", &_size));
record->add(getSlot("Gos", &_goSet));
record->add(getSlot("ULChild", _ulChild));
record->add(getSlot("URChild", _urChild));
record->add(getSlot("LLChild", _llChild));
record->add(getSlot("LRChild", _lrChild));
}
return record;
Record* record = NULL;
if (_size) {
record = new Record( getString(this) );
record->add( getSlot("_parent" , _parent ) );
record->add( DbU::getValueSlot("_x", &_x ) );
record->add( DbU::getValueSlot("_y", &_y ) );
record->add( getSlot("_boundingBox", &_boundingBox) );
record->add( getSlot("_size" , &_size ) );
record->add( getSlot("_goSet" , &_goSet ) );
record->add( getSlot("_ulChild" , _ulChild ) );
record->add( getSlot("_urChild" , _urChild ) );
record->add( getSlot("_llChild" , _llChild ) );
record->add( getSlot("_lrChild" , _lrChild ) );
}
return record;
}
QuadTree* QuadTree::_getDeepestChild(const Box& box)

View File

@ -155,37 +155,36 @@ void Go::invalidate(bool propagateFlag)
Property* property = getProperty( UpdateSession::getPropertyName() );
if (property) {
if (not dynamic_cast<UpdateSession*>(property))
throw Error( "Can't invalidate go : bad update session type" );
} else {
SlaveEntityMap::iterator it;
SlaveEntityMap::iterator end;
getCell()->_getSlaveEntities( this, it, end );
for( ; it!=end ; it++ ) {
Go* go = dynamic_cast<Go*>( it->second );
if (go) go->invalidate( propagateFlag );
}
if (isMaterialized()) {
unmaterialize();
put( UPDATOR_STACK->top() );
}
Property* cellUpdateSession = getCell()->getProperty( UpdateSession::getPropertyName() );
if (not cellUpdateSession) {
// Put the cell in the UpdateSession relation, but *do not* unmaterialize it.
//cerr << "Notify Cell::CellAboutToChange to: " << getCell() << endl;
getCell()->put ( UPDATOR_STACK->top() );
getCell()->notify( Cell::Flags::CellAboutToChange );
for ( Instance* instance : getCell()->getSlaveInstances() ) {
instance->invalidate( false );
}
}
if (not dynamic_cast<UpdateSession*>(property))
throw Error( "Can't invalidate go : bad update session type" );
} else {
SlaveEntityMap::iterator it;
SlaveEntityMap::iterator end;
getCell()->_getSlaveEntities( this, it, end );
for( ; it!=end ; it++ ) {
Go* go = dynamic_cast<Go*>( it->second );
if (go) go->invalidate( propagateFlag );
}
cdebug_log(18,0) << "Go::invalidate(" << this << ") - Completed." << endl;
if (isMaterialized() or not Go::autoMaterializationIsDisabled()) {
unmaterialize();
put( UPDATOR_STACK->top() );
}
Property* cellUpdateSession = getCell()->getProperty( UpdateSession::getPropertyName() );
if (not cellUpdateSession) {
// Put the cell in the UpdateSession relation, but *do not* unmaterialize it.
//cerr << "Notify Cell::CellAboutToChange to: " << getCell() << endl;
getCell()->put ( UPDATOR_STACK->top() );
getCell()->notify( Cell::Flags::CellAboutToChange );
for ( Instance* instance : getCell()->getSlaveInstances() ) {
instance->invalidate( false );
}
}
}
cdebug_tabw(18,-1);
cdebug_log(18,0) << "Go::invalidate(" << this << ") - Completed." << endl;
}
void UpdateSession::open()
@ -210,6 +209,16 @@ void UpdateSession::close()
cdebug_log(18,0) << "UpdateSession::close() - Materialization completed." << endl;
}
void UpdateSession::reset()
// ************************
{
cdebug_log(18,1) << "UpdateSession::reset()" << endl;
while ( UPDATOR_STACK and not UPDATOR_STACK->empty() ) close();
cdebug_tabw(18,-1);
}
} // End of Hurricane namespace.

View File

@ -566,9 +566,12 @@ class JsonCell : public JsonEntity {
public: static void initialize();
public: JsonCell(unsigned long flags);
public: virtual ~JsonCell();
public: virtual string getTypeName() const;
public: virtual JsonCell* clone(unsigned long) const;
public: virtual void toData(JsonStack&);
private: Cell* _cell;
private: bool _materializationState;
};
} // End of Hurricane namespace.

View File

@ -19,12 +19,7 @@
// License along with Hurricane. If not, see
// <http://www.gnu.org/licenses/>.
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// +-----------------------------------------------------------------+
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
@ -32,19 +27,16 @@
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./hurricane/ExtensionSlice.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#ifndef __HURRICANE_EXTENSION_SLICE__
#define __HURRICANE_EXTENSION_SLICE__
#ifndef HURRICANE_EXTENSION_SLICE_H
#define HURRICANE_EXTENSION_SLICE_H
#include "hurricane/Mask.h"
#include "hurricane/Name.h"
#include "hurricane/ExtensionSlices.h"
#include "hurricane/QuadTree.h"
#include "hurricane/Mask.h"
#include "hurricane/Name.h"
#include "hurricane/ExtensionSlices.h"
#include "hurricane/QuadTree.h"
namespace Hurricane {
@ -107,5 +99,6 @@ namespace Hurricane {
} // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::ExtensionSlice);
# endif // __HURRICANE_EXTENSION_SLICE__
# endif // HURRICANE_EXTENSION_SLICE_H

View File

@ -74,6 +74,7 @@ class UpdateSession : public SharedProperty {
public: static void open();
public: static void close();
public: static void reset();
};

View File

@ -32,6 +32,7 @@
#include "hurricane/Error.h"
#include "hurricane/Exception.h"
#include "hurricane/TextTranslator.h"
#include "hurricane/UpdateSession.h"
#include "hurricane/viewer/Graphics.h"
#include "hurricane/viewer/ExceptionWidget.h"
@ -97,6 +98,8 @@ namespace Hurricane {
ExceptionWidget::run( message );
}
if (failure) UpdateSession::reset();
return failure;
}

View File

@ -150,7 +150,7 @@ namespace Katana {
annotateGlobalGraph();
startMeasures();
cmess1 << " o Running global routing..." << endl;
cmess1 << " o Running global routing." << endl;
float edgeHInc = getConfiguration()->getEdgeHInc();
@ -172,10 +172,10 @@ namespace Katana {
dijkstra->run();
++netCount;
}
cmess2 << left << setw(6) << netCount << right;
cmess2 << left << setw(6) << netCount;
const vector<Edge*>& ovEdges = getOvEdges();
cmess2 << " ovEdges:" << ovEdges.size();
cmess2 << " ovEdges:" << setw(4) << ovEdges.size();
for ( Edge* edge : ovEdges ) computeNextHCost( edge, edgeHInc );
@ -185,6 +185,7 @@ namespace Katana {
Edge* edge = ovEdges[iEdge];
netCount += edge->ripup();
if (ovEdges.empty()) break;
if (ovEdges[iEdge] == edge) {
cerr << Error( "AnabaticEngine::globalRoute(): Unable to ripup enough segments of edge:\n"
" %s"
@ -196,11 +197,11 @@ namespace Katana {
dijkstra->setSearchAreaHalo( Session::getSliceHeight()*3 );
cmess2 << " ripup:" << netCount;
stopMeasures();
cmess2 << " ripup:" << setw(4) << netCount << right;
suspendMeasures();
cmess2 << " " << setw(10) << Timer::getStringTime (getTimer().getCombTime())
<< " " << setw( 6) << Timer::getStringMemory(getTimer().getIncrease()) << endl;
startMeasures();
resumeMeasures();
++iteration;
} while ( (netCount > 0) and (iteration < 5) );

View File

@ -50,16 +50,143 @@ 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 );
KatanaEngine* katana = KatanaEngine::get( widget->getCell() );
if (katana) katana->setDensityMode( GCell::MaxDensity );
}
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);
if (gcell->isFlat()) return;
if (GCell::getDisplayMode() == GCell::Density) {
unsigned int 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 {
if (pixelBb.width() > 150) {
painter.setPen ( pen );
painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) );
painter.drawRect( pixelBb );
if (pixelBb.width() > 300) {
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 ();
@ -226,7 +353,7 @@ namespace Katana {
);
_viewer->addToMenu( "placeAndRoute.katana.stepByStep.globalRoute"
, "Katana - &Global Route"
, "Run the <b>Knik</b> global router"
, "Run the <b>Katana</b> global router"
, std::bind(&GraphicKatanaEngine::_globalRoute,this)
);
_viewer->addToMenu( "placeAndRoute.katana.stepByStep.detailedRoute"
@ -297,7 +424,10 @@ namespace Katana {
GraphicKatanaEngine::GraphicKatanaEngine ()
: GraphicTool()
, _viewer (NULL)
{ }
{
addDrawGo( "Anabatic::GCell", initGCell, drawGCell );
addDrawGo( "Anabatic::Edge" , initEdge , drawEdge );
}
GraphicKatanaEngine::~GraphicKatanaEngine ()

View File

@ -331,7 +331,7 @@ namespace Katana {
// size_t vTracksReservedLocal = getVTracksReservedLocal();
// if (cparanoid.enabled()) {
// cparanoid << " o Post-checking Knik capacity overload h:" << hTracksReservedLocal
// cparanoid << " o Post-checking Katana capacity overload h:" << hTracksReservedLocal
// << " v:." << vTracksReservedLocal << endl;
// getGCellGrid()->checkEdgeOverflow( hTracksReservedLocal, vTracksReservedLocal );
// }

View File

@ -312,7 +312,7 @@ extern "C" {
, { "getToolSuccess" , (PyCFunction)PyKatanaEngine_getToolSuccess , METH_NOARGS
, "Returns True if the detailed routing has been successful." }
, { "runGlobalRouter" , (PyCFunction)PyKatanaEngine_runGlobalRouter , METH_VARARGS
, "Run the global router (Knik)." }
, "Run the global router (Katana)." }
, { "loadGlobalRouting" , (PyCFunction)PyKatanaEngine_loadGlobalRouting , METH_VARARGS
, "Load global routing into the detailed router." }
, { "layerAssign" , (PyCFunction)PyKatanaEngine_layerAssign , METH_VARARGS

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

@ -32,6 +32,7 @@ try:
print ' - Netlist format: <%s>.' % Cfg.getParamString('stratus1.format').asString()
print ' - Simulator: <%s>.' % Cfg.getParamString('stratus1.simulator').asString()
from Hurricane import UpdateSession
from st_model import *
from st_net import *
from st_instance import *
@ -82,6 +83,7 @@ def buildModel ( moduleName, flags, className=None, modelName=None, parameters={
print '[ERROR] Stratus module <%s> do not contains a design named <%s>.' % (moduleName,className)
sys.exit(1)
UpdateSession.open()
print ' - Generating Stratus Model <%s> (generator:<%s>).' % (modelName, className)
model = module.__dict__[className](modelName,parameters)
model.Interface()
@ -93,6 +95,7 @@ def buildModel ( moduleName, flags, className=None, modelName=None, parameters={
if flags & DoStop: stopLevel = 1
model.View(stopLevel, 'Model %s' % modelName)
model.Save(LOGICAL|PHYSICAL)
UpdateSession.close()
except ImportError, e:
module = str(e).split()[-1]

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())