Anabatic transient commit 8. More Dijkstra bugs correcteds.

* Bug: In Anabatic:
    - In _propagate(), on reaching a target, forgot to remove it from
      the queue before pushing it back with the new distance. It also
      simplificate the core algorithm as target as treated normal nodes.
* New: In Anabatic:
    - Update cdebug to use the fastest macro version.
    - More readable drawings of GCells and Edges.
    - Added timer support.
    - The distance is now computed in DbU::Unit (aka long) and not in
      normalized float.
    - The distance function is now a callback (std::function<>) that
      can be changed (a default is provided at initialization).
    - New concept of branch in the agglomerated connex component.
      Each trace back part create a "branch" (tagged with a "branchId").
      When a node is reached with the same distance, but from two
      different branches, choose the the branch that was lastly created.
      This create a slightly different tree which grows outward from
      the newest branches.
    - Makes the horizontal edges *slightly* longer than the vertical ones
      to skew the tree to use vertical edges, as it is usually less
      congested than the horiontal one (due to metal1 cell terminals).
      It is also my understanding that it is useful to reduce the
      number of vias, whithout introducing a via cost.
* New: In Bootstrap:
    - Script sprof.py to perform sprof & demangle libraries execution
      profile.
* ToDo: In Anabatic:
    - Corner optimization. Sometimes when two corners are possible, the
      wrong one is choosen. That is, one of it's edge cannot be used for
      further grow of the tree.
This commit is contained in:
Jean-Paul Chaput 2016-06-17 13:09:34 +02:00
parent 36a982ce47
commit 601e3d3da1
23 changed files with 412 additions and 237 deletions

View File

@ -59,6 +59,7 @@ namespace Anabatic {
AnabaticEngine::AnabaticEngine ( Cell* cell ) AnabaticEngine::AnabaticEngine ( Cell* cell )
: Super(cell) : Super(cell)
, _timer ()
, _configuration (new ConfigurationConcrete()) , _configuration (new ConfigurationConcrete())
, _matrix () , _matrix ()
, _gcells () , _gcells ()
@ -137,14 +138,14 @@ namespace Anabatic {
if (layerGauges[depth]->getDirection() != Constant::Horizontal) continue; if (layerGauges[depth]->getDirection() != Constant::Horizontal) continue;
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getYMin() capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getYMin()
, span.getVMax() - ab.getYMin() ); , span.getVMax() - ab.getYMin() );
//cdebug.log(110) << "Horizontal edge capacity:" << capacity << endl; //cdebug_log(110,0) << "Horizontal edge capacity:" << capacity << endl;
} }
if (flags & Flags::Vertical) { if (flags & Flags::Vertical) {
if (layerGauges[depth]->getDirection() != Constant::Vertical) continue; if (layerGauges[depth]->getDirection() != Constant::Vertical) continue;
capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getXMin() capacity += layerGauges[depth]->getTrackNumber( span.getVMin() - ab.getXMin()
, span.getVMax() - ab.getXMin() ); , span.getVMax() - ab.getXMin() );
//cdebug.log(110) << "Vertical edge capacity:" << capacity << endl; //cdebug_log(110,0) << "Vertical edge capacity:" << capacity << endl;
} }
} }
@ -163,6 +164,33 @@ namespace Anabatic {
} }
void AnabaticEngine::startMeasures ()
{
_timer.resetIncrease();
_timer.start();
}
void AnabaticEngine::stopMeasures ()
{ _timer.stop(); }
void AnabaticEngine::printMeasures ( const string& tag ) const
{
ostringstream result;
result << Timer::getStringTime(_timer.getCombTime())
<< ", " << Timer::getStringMemory(_timer.getIncrease());
cmess1 << Dots::asString( " - Done in", result.str() ) << endl;
result.str("");
result << _timer.getCombTime()
<< "s, +" << (_timer.getIncrease()>>10) << "Kb/"
<< (_timer.getMemorySize()>>10) << "Kb";
cmess2 << Dots::asString( " - Raw measurements", result.str() ) << endl;
}
string AnabaticEngine::_getTypeName () const string AnabaticEngine::_getTypeName () const
{ return getString(_toolName); } { return getString(_toolName); }

View File

@ -73,6 +73,8 @@ namespace Anabatic {
, _allowedDepth (0) , _allowedDepth (0)
, _edgeLength (DbU::fromLambda(Cfg::getParamInt("anabatic.edgeLength",24)->asInt())) , _edgeLength (DbU::fromLambda(Cfg::getParamInt("anabatic.edgeLength",24)->asInt()))
, _edgeWidth (DbU::fromLambda(Cfg::getParamInt("anabatic.edgeWidth" , 4)->asInt())) , _edgeWidth (DbU::fromLambda(Cfg::getParamInt("anabatic.edgeWidth" , 4)->asInt()))
, _edgeCostH (Cfg::getParamDouble("anabatic.edgeCostH", 9.0)->asDouble())
, _edgeCostK (Cfg::getParamDouble("anabatic.edgeCostK",-10.0)->asDouble())
{ {
if (cg == NULL) cg = AllianceFramework::get()->getCellGauge(); if (cg == NULL) cg = AllianceFramework::get()->getCellGauge();
if (rg == NULL) rg = AllianceFramework::get()->getRoutingGauge(); if (rg == NULL) rg = AllianceFramework::get()->getRoutingGauge();
@ -120,6 +122,8 @@ namespace Anabatic {
, _rg (NULL) , _rg (NULL)
, _extensionCaps(other._extensionCaps) , _extensionCaps(other._extensionCaps)
, _allowedDepth (other._allowedDepth) , _allowedDepth (other._allowedDepth)
, _edgeCostH (other._edgeCostH)
, _edgeCostK (other._edgeCostK)
{ {
if (other._cg) _cg = other._cg->getClone(); if (other._cg) _cg = other._cg->getClone();
if (other._rg) _rg = other._rg->getClone(); if (other._rg) _rg = other._rg->getClone();
@ -128,7 +132,7 @@ namespace Anabatic {
ConfigurationConcrete::~ConfigurationConcrete () ConfigurationConcrete::~ConfigurationConcrete ()
{ {
cdebug.log(145) << "About to delete attribute _rg (RoutingGauge)." << endl; cdebug_log(145,0) << "About to delete attribute _rg (RoutingGauge)." << endl;
_cg->destroy (); _cg->destroy ();
_rg->destroy (); _rg->destroy ();
} }
@ -284,6 +288,14 @@ namespace Anabatic {
{ return _edgeWidth; } { return _edgeWidth; }
float ConfigurationConcrete::getEdgeCostH () const
{ return _edgeCostH; }
float ConfigurationConcrete::getEdgeCostK () const
{ return _edgeCostK; }
void ConfigurationConcrete::print ( Cell* cell ) const void ConfigurationConcrete::print ( Cell* cell ) const
{ {
@ -317,11 +329,13 @@ namespace Anabatic {
Record* ConfigurationConcrete::_getRecord () const Record* ConfigurationConcrete::_getRecord () const
{ {
Record* record = new Record ( _getString() ); Record* record = new Record ( _getString() );
record->add ( getSlot( "_rg" , _rg ) ); record->add ( getSlot( "_rg" , _rg ) );
record->add ( getSlot( "_gmetalh" , _gmetalh ) ); record->add ( getSlot( "_gmetalh" , _gmetalh ) );
record->add ( getSlot( "_gmetalv" , _gmetalv ) ); record->add ( getSlot( "_gmetalv" , _gmetalv ) );
record->add ( getSlot( "_gcontact" , _gcontact ) ); record->add ( getSlot( "_gcontact" , _gcontact ) );
record->add ( getSlot( "_allowedDepth" , _allowedDepth ) ); record->add ( getSlot( "_allowedDepth", _allowedDepth ) );
record->add ( getSlot( "_edgeCostH" , _edgeCostH ) );
record->add ( getSlot( "_edgeCostK" , _edgeCostK ) );
return ( record ); return ( record );
} }

View File

@ -22,6 +22,7 @@
#include "hurricane/Vertical.h" #include "hurricane/Vertical.h"
#include "hurricane/UpdateSession.h" #include "hurricane/UpdateSession.h"
#include "hurricane/DebugSession.h" #include "hurricane/DebugSession.h"
#include "crlcore/Utilities.h"
#include "anabatic/AnabaticEngine.h" #include "anabatic/AnabaticEngine.h"
#include "anabatic/Dijkstra.h" #include "anabatic/Dijkstra.h"
@ -45,7 +46,7 @@ namespace Anabatic {
// Class : "Anabatic::Vertex". // Class : "Anabatic::Vertex".
float Vertex::unreached = numeric_limits<float>::max(); DbU::Unit Vertex::unreached = std::numeric_limits<long>::max();
bool Vertex::hasValidStamp () const bool Vertex::hasValidStamp () const
@ -63,7 +64,8 @@ namespace Anabatic {
+ " @(" + DbU::getValueString(_gcell->getXMin()) + " @(" + DbU::getValueString(_gcell->getXMin())
+ "," + DbU::getValueString(_gcell->getYMin()) + ")" + "," + DbU::getValueString(_gcell->getYMin()) + ")"
+ " connexId:" + getString(_connexId) + " connexId:" + getString(_connexId)
+ " d:" + ((_distance == unreached) ? "unreached" : getString(_distance) ) + " d:" + ((_distance == unreached) ? "unreached" : DbU::getValueString(_distance) )
+ "+" + getString(_branchId)
+ " stamp:" + (hasValidStamp() ? "valid" : "outdated") + " stamp:" + (hasValidStamp() ? "valid" : "outdated")
+ " from:" + ((_from) ? "set" : "NULL") + " from:" + ((_from) ? "set" : "NULL")
+ ">"; + ">";
@ -74,7 +76,7 @@ namespace Anabatic {
void Vertex::notify ( Vertex* vertex, unsigned int flags ) void Vertex::notify ( Vertex* vertex, unsigned int flags )
{ {
//Vertex* vertex = getOwner(); //Vertex* vertex = getOwner();
cdebug.log(111) << "Vertex::notify() " << vertex << endl; cdebug_log(111,0) << "Vertex::notify() " << vertex << endl;
// Take into account the GCell modification here. // Take into account the GCell modification here.
} }
@ -101,14 +103,14 @@ namespace Anabatic {
} }
float Dijkstra::getDistance ( const Vertex* a, const Vertex* b, const Edge* e ) DbU::Unit Dijkstra::_distance ( const Vertex* a, const Vertex* b, const Edge* e )
{ {
float distance = a->getDistance() + e->getDistance(); DbU::Unit distance = a->getDistance() + e->getDistance();
Edge* aFrom = a->getFrom(); // Edge* aFrom = a->getFrom();
if (aFrom) { // if (aFrom) {
distance += (aFrom->isHorizontal() xor e->isHorizontal()) ? 3.0 : 0.0; // distance += (aFrom->isHorizontal() xor e->isHorizontal()) ? 3.0 : 0.0;
} // }
return distance; return distance;
} }
@ -116,6 +118,7 @@ namespace Anabatic {
Dijkstra::Dijkstra ( AnabaticEngine* anabatic ) Dijkstra::Dijkstra ( AnabaticEngine* anabatic )
: _anabatic (anabatic) : _anabatic (anabatic)
, _vertexes () , _vertexes ()
, _distanceCb (_distance)
, _mode (Mode::Standart) , _mode (Mode::Standart)
, _net (NULL) , _net (NULL)
, _stamp (-1) , _stamp (-1)
@ -142,8 +145,8 @@ namespace Anabatic {
{ {
_net = net; _net = net;
DebugSession::open( _net, 110, 120 ); DebugSession::open( _net, 112, 120 );
cdebug.log(111,1) << "Dijkstra::load() " << _net << endl; cdebug_log(112,1) << "Dijkstra::load() " << _net << endl;
_sources.clear(); _sources.clear();
_targets.clear(); _targets.clear();
@ -170,11 +173,13 @@ namespace Anabatic {
Vertex* vertex = gcell->getObserver<Vertex>(GCell::Observable::Vertex); Vertex* vertex = gcell->getObserver<Vertex>(GCell::Observable::Vertex);
if (vertex->getConnexId() < 0) { if (vertex->getConnexId() < 0) {
vertex->setDistance( Vertex::unreached );
vertex->setStamp ( _stamp ); vertex->setStamp ( _stamp );
vertex->setConnexId( _targets.size() ); vertex->setConnexId( _targets.size() );
vertex->setBranchId( 0 );
vertex->setFrom ( NULL ); vertex->setFrom ( NULL );
_targets.insert( vertex ); _targets.insert( vertex );
cdebug.log(111) << "Add Vertex: " << vertex << endl; cdebug_log(112,0) << "Add Vertex: " << vertex << endl;
} }
Contact* gcontact = vertex->getGContact( _net ); Contact* gcontact = vertex->getGContact( _net );
@ -182,8 +187,8 @@ namespace Anabatic {
rp->getBodyHook()->attach( gcontact->getBodyHook() ); rp->getBodyHook()->attach( gcontact->getBodyHook() );
} }
cdebug.log(111) << "Search area: " << _searchArea << endl; cdebug_log(112,0) << "Search area: " << _searchArea << endl;
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
DebugSession::close(); DebugSession::close();
} }
@ -191,9 +196,11 @@ namespace Anabatic {
void Dijkstra::_selectFirstSource () void Dijkstra::_selectFirstSource ()
{ {
if (_targets.empty()) { if (_targets.empty()) {
cerr << Error( "Dijkstra::_selectFirstSource(): %s has no vertexes to route, ignored." #if 0
, getString(_net).c_str() cparanoid << Error( "Dijkstra::_selectFirstSource(): %s has no vertexes to route, ignored."
) << endl; , getString(_net).c_str()
) << endl;
#endif
return; return;
} }
@ -236,13 +243,13 @@ namespace Anabatic {
_targets.erase ( firstSource ); _targets.erase ( firstSource );
_sources.insert( firstSource ); _sources.insert( firstSource );
cdebug.log(111) << "Dijkstra::_selectFirstSource() " << *_sources.begin() << endl; cdebug_log(112,0) << "Dijkstra::_selectFirstSource() " << *_sources.begin() << endl;
} }
bool Dijkstra::_propagate ( Flags enabledSides ) bool Dijkstra::_propagate ( Flags enabledSides )
{ {
cdebug.log(111,1) << "Dijkstra::_propagate() " << _net << endl; cdebug_log(112,1) << "Dijkstra::_propagate() " << _net << endl;
while ( not _queue.empty() ) { while ( not _queue.empty() ) {
_queue.dump(); _queue.dump();
@ -260,38 +267,31 @@ namespace Anabatic {
if (not _searchArea.contains(vneighbor->getCenter())) continue; if (not _searchArea.contains(vneighbor->getCenter())) continue;
cdebug.log(111) << "| Edge " << edge << endl; cdebug_log(111,0) << "| Edge " << edge << endl;
cdebug.log(111) << "+ Neighbor: " << vneighbor << endl; cdebug_log(111,0) << "+ Neighbor: " << vneighbor << endl;
float distance = getDistance( current, vneighbor, edge ); DbU::Unit distance = _distanceCb( current, vneighbor, edge );
if (vneighbor->getConnexId() == _connectedsId) continue; if (vneighbor->getConnexId() == _connectedsId) continue;
if (vneighbor->getConnexId() >= 0) {
vneighbor->setFrom ( edge );
vneighbor->setDistance( distance );
cdebug.log(111) << "Push (before): (size:" << _queue.size() << ")" << endl;
_queue.push( vneighbor );
cdebug.log(111) << "Push (target): (size:" << _queue.size() << ") " << vneighbor << endl; if ( (distance < vneighbor->getDistance())
continue; or ( (distance == vneighbor->getDistance())
} and (current->getBranchId() > vneighbor->getBranchId())) ) {
if (distance < vneighbor->getDistance()) {
cdebug.log(111) << "Push (before erase): (size:" << _queue.size() << ") " << vneighbor << endl;
if (vneighbor->getDistance() != Vertex::unreached) { if (vneighbor->getDistance() != Vertex::unreached) {
_queue.erase( vneighbor ); _queue.erase( vneighbor );
_queue.dump();
} else { } else {
vneighbor->setStamp ( _stamp ); if (not vneighbor->hasValidStamp()) {
vneighbor->setConnexId( -1 ); vneighbor->setConnexId( -1 );
vneighbor->setStamp ( _stamp );
}
} }
cdebug.log(111) << "Push (after erase): (size:" << _queue.size() << ")" << endl;
vneighbor->setBranchId( current->getBranchId() );
vneighbor->setDistance( distance ); vneighbor->setDistance( distance );
vneighbor->setFrom ( edge ); vneighbor->setFrom ( edge );
_queue.push( vneighbor ); _queue.push( vneighbor );
cdebug.log(111) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl; cdebug_log(111,0) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl;
} }
} }
@ -299,22 +299,24 @@ namespace Anabatic {
} }
// We did reach another target (different <connexId>). // We did reach another target (different <connexId>).
// Tag back the path. // Tag back the path, with a higher <branchId>.
cdebug.log(111) << "Trace back" << endl; int branchId = _sources.size();
cdebug_log(112,0) << "Trace back branchId:" << branchId << endl;
_targets.erase( current ); _targets.erase( current );
while ( current ) { while ( current ) {
cdebug.log(111) << "| " << current << endl; cdebug_log(112,0) << "| " << current << endl;
if (current->getConnexId() == _connectedsId) break; if (current->getConnexId() == _connectedsId) break;
_sources.insert( current ); _sources.insert( current );
current->setDistance( 0.0 ); current->setDistance( 0.0 );
current->setConnexId( _connectedsId ); current->setConnexId( _connectedsId );
current->setBranchId( branchId );
_queue.push( current ); _queue.push( current );
current = current->getPredecessor(); current = current->getPredecessor();
} }
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
return true; return true;
} }
@ -322,22 +324,22 @@ namespace Anabatic {
, getString(_net).c_str() , getString(_net).c_str()
) << endl; ) << endl;
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
return false; return false;
} }
void Dijkstra::run ( Dijkstra::Mode mode ) void Dijkstra::run ( Dijkstra::Mode mode )
{ {
DebugSession::open( _net, 110, 120 ); DebugSession::open( _net, 112, 120 );
cdebug.log(111,1) << "Dijkstra::run() on " << _net << " mode:" << mode << endl; cdebug_log(112,1) << "Dijkstra::run() on " << _net << " mode:" << mode << endl;
_mode = mode; _mode = mode;
_selectFirstSource(); _selectFirstSource();
if (_sources.empty()) { if (_sources.empty()) {
cdebug.log(111) << "No source to start, not routed." << endl; cdebug_log(112,0) << "No source to start, not routed." << endl;
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
return; return;
} }
@ -355,7 +357,7 @@ namespace Anabatic {
_connectedsId = source->getConnexId(); _connectedsId = source->getConnexId();
source->setDistance( 0.0 ); source->setDistance( 0.0 );
cdebug.log(111) << "Push source: (size:" << _queue.size() << ") " cdebug_log(112,0) << "Push source: (size:" << _queue.size() << ") "
<< source << source
<< " _connectedsId:" << _connectedsId << endl; << " _connectedsId:" << _connectedsId << endl;
@ -364,20 +366,20 @@ namespace Anabatic {
_toWires(); _toWires();
_queue.clear(); _queue.clear();
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
DebugSession::close(); DebugSession::close();
} }
void Dijkstra::_toWires () void Dijkstra::_toWires ()
{ {
cdebug.log(111,1) << "Dijkstra::toWires() " << _net << endl; cdebug_log(111,1) << "Dijkstra::toWires() " << _net << endl;
for ( Vertex* vertex : _sources ) { for ( Vertex* vertex : _sources ) {
Edge* from = vertex->getFrom(); Edge* from = vertex->getFrom();
if (not from) continue; if (not from) continue;
cdebug.log(111) << "| " << vertex << endl; cdebug_log(111,0) << "| " << vertex << endl;
from->incRealOccupancy( 1 ); from->incRealOccupancy( 1 );
@ -408,7 +410,7 @@ namespace Anabatic {
} }
} }
cdebug.tabw(111,-1); cdebug_tabw(111,-1);
} }

View File

@ -85,10 +85,10 @@ namespace Anabatic {
Edge* edge = new Edge ( source, target, flags ); Edge* edge = new Edge ( source, target, flags );
edge->_postCreate(); edge->_postCreate();
cdebug.log(110,1) << "Edge::create(): " << (void*)edge << ":" << edge << endl; cdebug_log(110,1) << "Edge::create(): " << (void*)edge << ":" << edge << endl;
cdebug.log(110) << "source:" << (void*)source << ":" << edge->getSource() << endl; cdebug_log(110,0) << "source:" << (void*)source << ":" << edge->getSource() << endl;
cdebug.log(110) << "target:" << (void*)target << ":" << edge->getTarget() << endl; cdebug_log(110,0) << "target:" << (void*)target << ":" << edge->getTarget() << endl;
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return edge; return edge;
} }
@ -156,14 +156,17 @@ namespace Anabatic {
} }
float Edge::getDistance () const DbU::Unit Edge::getDistance () const
{ {
Point sourceCenter = getSource()->getBoundingBox().getCenter(); Point sourceCenter = getSource()->getBoundingBox().getCenter();
Point targetCenter = getTarget()->getBoundingBox().getCenter(); Point targetCenter = getTarget()->getBoundingBox().getCenter();
DbU::Unit dx = targetCenter.getX() - sourceCenter.getX(); DbU::Unit dx = targetCenter.getX() - sourceCenter.getX();
DbU::Unit dy = targetCenter.getY() - sourceCenter.getY(); DbU::Unit dy = targetCenter.getY() - sourceCenter.getY();
return (float)( ((dx > 0) ? dx : -dx) + ((dy > 0) ? dy : -dy) ) / (float)unity; if (dx < 0) dx = -dx;
if (dx) dx += DbU::fromLambda( 0.1 );
return dx + ((dy > 0) ? dy : -dy);
} }
@ -193,7 +196,7 @@ namespace Anabatic {
Super::invalidate( false ); Super::invalidate( false );
_flags.reset( Flags::Invalidated ); _flags.reset( Flags::Invalidated );
cdebug.log(110) << "Edge::_revalidate() " << this << endl; cdebug_log(110,0) << "Edge::_revalidate() " << this << endl;
} }

View File

@ -33,14 +33,14 @@ namespace Anabatic {
, _filterFlags(filterFlags) , _filterFlags(filterFlags)
, _iedge (0) , _iedge (0)
{ {
// cdebug.log(110) << "GCell_Edges::Locator::Locator() " << isValid() << endl; // cdebug_log(110,0) << "GCell_Edges::Locator::Locator() " << isValid() << endl;
if (_gcell->getEastEdges().empty() or not _filterFlags.contains(Flags::EastSide)) progress(); if (_gcell->getEastEdges().empty() or not _filterFlags.contains(Flags::EastSide)) progress();
} }
EdgesHL* GCell_Edges::Locator::getClone () const EdgesHL* GCell_Edges::Locator::getClone () const
{ {
// cdebug.log(110) << "GCell_Edges::Locator::getClone()" << endl; // cdebug_log(110,0) << "GCell_Edges::Locator::getClone()" << endl;
return new Locator (*this); return new Locator (*this);
} }
@ -61,48 +61,48 @@ namespace Anabatic {
void GCell_Edges::Locator::progress () void GCell_Edges::Locator::progress ()
{ {
// cdebug.log(110) << "GCell_Edges::Locator::progress() [from] " << _stateFlags << " iedge:" << _iedge << endl; // cdebug_log(110,0) << "GCell_Edges::Locator::progress() [from] " << _stateFlags << " iedge:" << _iedge << endl;
// cdebug.log(110) << " East:" << _gcell->getEastEdges().size() // cdebug_log(110,0) << " East:" << _gcell->getEastEdges().size()
// << " North:" << _gcell->getNorthEdges().size() // << " North:" << _gcell->getNorthEdges().size()
// << " West:" << _gcell->getWestEdges().size() // << " West:" << _gcell->getWestEdges().size()
// << " South:" << _gcell->getSouthEdges().size() << endl; // << " South:" << _gcell->getSouthEdges().size() << endl;
// cdebug.log(110) << this << endl; // cdebug_log(110,0) << this << endl;
++_iedge; ++_iedge;
while (_stateFlags) { while (_stateFlags) {
if ((_stateFlags & _filterFlags).contains(Flags::EastSide)) { if ((_stateFlags & _filterFlags).contains(Flags::EastSide)) {
if (_iedge < _gcell->getEastEdges().size()) break; if (_iedge < _gcell->getEastEdges().size()) break;
// cdebug.log(110) << "Switching to North side." << endl; // cdebug_log(110,0) << "Switching to North side." << endl;
_stateFlags = Flags::NorthSide; _stateFlags = Flags::NorthSide;
_iedge = 0; _iedge = 0;
// cdebug.log(110) << this << endl; // cdebug_log(110,0) << this << endl;
continue; continue;
} }
if ((_stateFlags & _filterFlags).contains(Flags::NorthSide)) { if ((_stateFlags & _filterFlags).contains(Flags::NorthSide)) {
if (_iedge < _gcell->getNorthEdges().size()) break; if (_iedge < _gcell->getNorthEdges().size()) break;
// cdebug.log(110) << "Switching to West side." << endl; // cdebug_log(110,0) << "Switching to West side." << endl;
_stateFlags = Flags::WestSide; _stateFlags = Flags::WestSide;
_iedge = 0; _iedge = 0;
// cdebug.log(110) << this << endl; // cdebug_log(110,0) << this << endl;
continue; continue;
} }
if ((_stateFlags & _filterFlags).contains(Flags::WestSide)) { if ((_stateFlags & _filterFlags).contains(Flags::WestSide)) {
if (_iedge < _gcell->getWestEdges().size()) break; if (_iedge < _gcell->getWestEdges().size()) break;
// cdebug.log(110) << "Switching to South side." << endl; // cdebug_log(110,0) << "Switching to South side." << endl;
_stateFlags = Flags::SouthSide; _stateFlags = Flags::SouthSide;
_iedge = 0; _iedge = 0;
continue; continue;
} }
if ((_stateFlags & _filterFlags).contains(Flags::SouthSide)) { if ((_stateFlags & _filterFlags).contains(Flags::SouthSide)) {
if (_iedge < _gcell->getSouthEdges().size()) break; if (_iedge < _gcell->getSouthEdges().size()) break;
// cdebug.log(110) << "All edges done." << endl; // cdebug_log(110,0) << "All edges done." << endl;
_stateFlags = 0; _stateFlags = 0;
_iedge = 0; _iedge = 0;
break;; break;;
} }
} }
cdebug.log(110) << "GCell_Edges::Locator::progress() [to] " << _stateFlags << " iedge:" << _iedge << endl; //cdebug_log(110,0) << "GCell_Edges::Locator::progress() [to] " << _stateFlags << " iedge:" << _iedge << endl;
} }

View File

@ -108,59 +108,59 @@ namespace Anabatic {
void GCell::_add ( Edge* edge, Flags side ) void GCell::_add ( Edge* edge, Flags side )
{ {
cdebug.log(110,1) << "GCell::_add(side): side:" << side << " " << edge << endl; cdebug_log(110,1) << "GCell::_add(side): side:" << side << " " << edge << endl;
if (side.contains(Flags::WestSide)) { if (side.contains(Flags::WestSide)) {
cdebug.log(110) << "Adding to West side of " << this << endl; cdebug_log(110,0) << "Adding to West side of " << this << endl;
for ( auto iedge=_westEdges.begin() ; iedge != _westEdges.end() ; ++iedge ) for ( auto iedge=_westEdges.begin() ; iedge != _westEdges.end() ; ++iedge )
if ((*iedge)->getAxisMin() > edge->getAxisMin()) { if ((*iedge)->getAxisMin() > edge->getAxisMin()) {
_westEdges.insert( iedge, edge ); _westEdges.insert( iedge, edge );
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return; return;
} }
_westEdges.push_back( edge ); _westEdges.push_back( edge );
} }
if (side.contains(Flags::EastSide)) { if (side.contains(Flags::EastSide)) {
cdebug.log(110) << "Adding to East side of " << this << endl; cdebug_log(110,0) << "Adding to East side of " << this << endl;
for ( auto iedge=_eastEdges.begin() ; iedge != _eastEdges.end() ; ++iedge ) for ( auto iedge=_eastEdges.begin() ; iedge != _eastEdges.end() ; ++iedge )
if ((*iedge)->getAxisMin() > edge->getAxisMin()) { if ((*iedge)->getAxisMin() > edge->getAxisMin()) {
_eastEdges.insert( iedge, edge ); _eastEdges.insert( iedge, edge );
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return; return;
} }
_eastEdges.push_back( edge ); _eastEdges.push_back( edge );
} }
if (side.contains(Flags::SouthSide)) { if (side.contains(Flags::SouthSide)) {
cdebug.log(110) << "Adding to South side of " << this << endl; cdebug_log(110,0) << "Adding to South side of " << this << endl;
for ( auto iedge=_southEdges.begin() ; iedge != _southEdges.end() ; ++iedge ) for ( auto iedge=_southEdges.begin() ; iedge != _southEdges.end() ; ++iedge )
cdebug.log(110) << "| @" << DbU::getValueString((*iedge)->getAxisMin()) << " " << *iedge << endl; cdebug_log(110,0) << "| @" << DbU::getValueString((*iedge)->getAxisMin()) << " " << *iedge << endl;
for ( auto iedge=_southEdges.begin() ; iedge != _southEdges.end() ; ++iedge ) for ( auto iedge=_southEdges.begin() ; iedge != _southEdges.end() ; ++iedge )
if ((*iedge)->getAxisMin() > edge->getAxisMin()) { if ((*iedge)->getAxisMin() > edge->getAxisMin()) {
cdebug.log(110) << "Insert *before* " << *iedge << endl; cdebug_log(110,0) << "Insert *before* " << *iedge << endl;
_southEdges.insert( iedge, edge ); _southEdges.insert( iedge, edge );
for ( auto iedge2=_southEdges.begin() ; iedge2 != _southEdges.end() ; ++iedge2 ) for ( auto iedge2=_southEdges.begin() ; iedge2 != _southEdges.end() ; ++iedge2 )
cdebug.log(110) << "| @" << DbU::getValueString((*iedge2)->getAxisMin()) << " " << *iedge2 << endl; cdebug_log(110,0) << "| @" << DbU::getValueString((*iedge2)->getAxisMin()) << " " << *iedge2 << endl;
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return; return;
} }
_southEdges.push_back( edge ); _southEdges.push_back( edge );
} }
if (side.contains(Flags::NorthSide)) { if (side.contains(Flags::NorthSide)) {
cdebug.log(110) << "Adding to North side of " << this << endl; cdebug_log(110,0) << "Adding to North side of " << this << endl;
for ( auto iedge=_northEdges.begin() ; iedge != _northEdges.end() ; ++iedge ) for ( auto iedge=_northEdges.begin() ; iedge != _northEdges.end() ; ++iedge )
if ((*iedge)->getAxisMin() > edge->getAxisMin()) { if ((*iedge)->getAxisMin() > edge->getAxisMin()) {
_northEdges.insert( iedge, edge ); _northEdges.insert( iedge, edge );
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return; return;
} }
_northEdges.push_back( edge ); _northEdges.push_back( edge );
} }
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
} }
@ -260,7 +260,7 @@ namespace Anabatic {
GCell* GCell::vcut ( DbU::Unit x ) GCell* GCell::vcut ( DbU::Unit x )
{ {
cdebug.log(119,1) << "GCell::vcut() @x:" << DbU::getValueString(x) << " " << this << endl; cdebug_log(119,1) << "GCell::vcut() @x:" << DbU::getValueString(x) << " " << this << endl;
if ( (x < getXMin()) or (x > getXMax()) ) if ( (x < getXMin()) or (x > getXMax()) )
throw Error( "GCell::vcut(): Vertical cut axis at %s is outside GCell box,\n" throw Error( "GCell::vcut(): Vertical cut axis at %s is outside GCell box,\n"
@ -270,17 +270,17 @@ namespace Anabatic {
); );
GCell* chunk = _create( x, getYMin() ); GCell* chunk = _create( x, getYMin() );
cdebug.log(119) << "New chunk:" << chunk << endl; cdebug_log(119,0) << "New chunk:" << chunk << endl;
_moveEdges( chunk, 0, Flags::EastSide ); _moveEdges( chunk, 0, Flags::EastSide );
Edge::create( this, chunk, Flags::Horizontal ); Edge::create( this, chunk, Flags::Horizontal );
if (not _southEdges.empty()) { if (not _southEdges.empty()) {
cdebug.log(110) << "Split/create south edges." << endl; cdebug_log(110,0) << "Split/create south edges." << endl;
size_t iedge = 0; size_t iedge = 0;
for ( ; (iedge < _southEdges.size()) ; ++iedge ) { for ( ; (iedge < _southEdges.size()) ; ++iedge ) {
cdebug.log(110) << "[" << iedge << "] xmax of:" cdebug_log(110,0) << "[" << iedge << "] xmax of:"
<< _southEdges[iedge]->getOpposite(this) << _southEdges[iedge]->getOpposite(this)
<< " " << _southEdges[iedge] << endl; << " " << _southEdges[iedge] << endl;
if (x <= _southEdges[iedge]->getOpposite(this)->getXMax()) break; if (x <= _southEdges[iedge]->getOpposite(this)->getXMax()) break;
@ -295,7 +295,7 @@ namespace Anabatic {
} }
if (not _northEdges.empty()) { if (not _northEdges.empty()) {
cdebug.log(110) << "Split/create north edges." << endl; cdebug_log(110,0) << "Split/create north edges." << endl;
size_t iedge = 0; size_t iedge = 0;
for ( ; (iedge < _northEdges.size()) ; ++iedge ) for ( ; (iedge < _northEdges.size()) ; ++iedge )
@ -312,7 +312,7 @@ namespace Anabatic {
_revalidate(); _revalidate();
chunk->_revalidate(); chunk->_revalidate();
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
return chunk; return chunk;
} }
@ -320,7 +320,7 @@ namespace Anabatic {
GCell* GCell::hcut ( DbU::Unit y ) GCell* GCell::hcut ( DbU::Unit y )
{ {
cdebug.log(119,1) << "GCell::hcut() @y:" << DbU::getValueString(y) << " " << this << endl; cdebug_log(119,1) << "GCell::hcut() @y:" << DbU::getValueString(y) << " " << this << endl;
if ( (y < getYMin()) or (y > getYMax()) ) if ( (y < getYMin()) or (y > getYMax()) )
throw Error( "GCell::hcut(): Horizontal cut axis at %s is outside GCell box,\n" throw Error( "GCell::hcut(): Horizontal cut axis at %s is outside GCell box,\n"
@ -330,7 +330,7 @@ namespace Anabatic {
); );
GCell* chunk = _create( getXMin(), y ); GCell* chunk = _create( getXMin(), y );
cdebug.log(119) << "New chunk:" << chunk << endl; cdebug_log(119,0) << "New chunk:" << chunk << endl;
_moveEdges( chunk, 0, Flags::NorthSide ); _moveEdges( chunk, 0, Flags::NorthSide );
Edge::create( this, chunk, Flags::Vertical ); Edge::create( this, chunk, Flags::Vertical );
@ -364,7 +364,7 @@ namespace Anabatic {
_revalidate(); _revalidate();
chunk->_revalidate(); chunk->_revalidate();
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
return chunk; return chunk;
} }
@ -422,11 +422,11 @@ namespace Anabatic {
void GCell::_revalidate () void GCell::_revalidate ()
{ {
cdebug.log(110,1) << "GCell::revalidate() " << this << endl; cdebug_log(110,1) << "GCell::revalidate() " << this << endl;
cdebug.log(110,1) << "West side." << endl; for ( Edge* edge : _westEdges ) edge->revalidate(); cdebug.tabw(110,-1); cdebug_log(110,1) << "West side." << endl; for ( Edge* edge : _westEdges ) edge->revalidate(); cdebug_tabw(110,-1);
cdebug.log(110,1) << "East side." << endl; for ( Edge* edge : _eastEdges ) edge->revalidate(); cdebug.tabw(110,-1); cdebug_log(110,1) << "East side." << endl; for ( Edge* edge : _eastEdges ) edge->revalidate(); cdebug_tabw(110,-1);
cdebug.log(110,1) << "South side." << endl; for ( Edge* edge : _southEdges ) edge->revalidate(); cdebug.tabw(110,-1); cdebug_log(110,1) << "South side." << endl; for ( Edge* edge : _southEdges ) edge->revalidate(); cdebug_tabw(110,-1);
cdebug.log(110,1) << "North side." << endl; for ( Edge* edge : _northEdges ) edge->revalidate(); cdebug.tabw(110,-1); cdebug_log(110,1) << "North side." << endl; for ( Edge* edge : _northEdges ) edge->revalidate(); cdebug_tabw(110,-1);
if (_xmin > getXMax()+1) if (_xmin > getXMax()+1)
cerr << Error( "GCell::_revalidate(): %s, X Min is greater than Max.", getString(this).c_str() ); cerr << Error( "GCell::_revalidate(): %s, X Min is greater than Max.", getString(this).c_str() );
@ -434,21 +434,21 @@ namespace Anabatic {
cerr << Error( "GCell::_revalidate(): %s, Y Min is greater than Max.", getString(this).c_str() ); cerr << Error( "GCell::_revalidate(): %s, Y Min is greater than Max.", getString(this).c_str() );
_anabatic->_updateLookup( this ); _anabatic->_updateLookup( this );
_anabatic->getMatrix()->show(); //_anabatic->getMatrix()->show();
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
} }
void GCell::_moveEdges ( GCell* dest, size_t ibegin, Flags flags ) void GCell::_moveEdges ( GCell* dest, size_t ibegin, Flags flags )
{ {
cdebug.log(110,1) << "GCell::_moveEdges() " << this << endl; cdebug_log(110,1) << "GCell::_moveEdges() " << this << endl;
cdebug.log(110) << " toward " << dest << endl; cdebug_log(110,0) << " toward " << dest << endl;
cdebug.log(110) << " ibegin: " << ibegin << " flags:" << flags << endl; cdebug_log(110,0) << " ibegin: " << ibegin << " flags:" << flags << endl;
size_t iclear = ibegin; size_t iclear = ibegin;
if (flags.contains(Flags::SouthSide) and not _southEdges.empty()) { if (flags.contains(Flags::SouthSide) and not _southEdges.empty()) {
cdebug.log(110) << "South side." << endl; cdebug_log(110,0) << "South side." << endl;
if (iclear < _southEdges.size()) { if (iclear < _southEdges.size()) {
for ( size_t iedge=ibegin ; (iedge < _southEdges.size()) ; ++iedge ) { for ( size_t iedge=ibegin ; (iedge < _southEdges.size()) ; ++iedge ) {
@ -468,7 +468,7 @@ namespace Anabatic {
} }
if (flags.contains(Flags::NorthSide) and not _northEdges.empty()) { if (flags.contains(Flags::NorthSide) and not _northEdges.empty()) {
cdebug.log(110) << "North side." << endl; cdebug_log(110,0) << "North side." << endl;
if (iclear < _northEdges.size()) { if (iclear < _northEdges.size()) {
for ( size_t iedge=ibegin ; (iedge < _northEdges.size()) ; ++iedge ) { for ( size_t iedge=ibegin ; (iedge < _northEdges.size()) ; ++iedge ) {
@ -488,7 +488,7 @@ namespace Anabatic {
} }
if (flags.contains(Flags::WestSide) and not _westEdges.empty()) { if (flags.contains(Flags::WestSide) and not _westEdges.empty()) {
cdebug.log(110) << "West side." << endl; cdebug_log(110,0) << "West side." << endl;
if (iclear < _westEdges.size()) { if (iclear < _westEdges.size()) {
for ( size_t iedge=ibegin ; (iedge < _westEdges.size()) ; ++iedge ) { for ( size_t iedge=ibegin ; (iedge < _westEdges.size()) ; ++iedge ) {
@ -508,7 +508,7 @@ namespace Anabatic {
} }
if (flags.contains(Flags::EastSide) and not _eastEdges.empty()) { if (flags.contains(Flags::EastSide) and not _eastEdges.empty()) {
cdebug.log(110) << "East side." << endl; cdebug_log(110,0) << "East side." << endl;
if (iclear < _eastEdges.size()) { if (iclear < _eastEdges.size()) {
for ( size_t iedge=ibegin ; (iedge < _eastEdges.size()) ; ++iedge ) { for ( size_t iedge=ibegin ; (iedge < _eastEdges.size()) ; ++iedge ) {
@ -527,7 +527,7 @@ namespace Anabatic {
} }
} }
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
} }
@ -536,7 +536,7 @@ namespace Anabatic {
for ( Contact* contact : _contacts ) { for ( Contact* contact : _contacts ) {
if (contact->getNet() == net) { if (contact->getNet() == net) {
cdebug.log(111) << "GCell::getGContact(): " << contact << endl; cdebug_log(111,0) << "GCell::getGContact(): " << contact << endl;
return contact; return contact;
} }
} }
@ -549,7 +549,7 @@ namespace Anabatic {
, DbU::fromLambda(2.0) , DbU::fromLambda(2.0)
, DbU::fromLambda(2.0) , DbU::fromLambda(2.0)
); );
cdebug.log(111) << "GCell::getGContact(): " << contact << endl; cdebug_log(111,0) << "GCell::getGContact(): " << contact << endl;
return contact; return contact;
} }

View File

@ -14,6 +14,7 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#include <cmath>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
@ -64,6 +65,43 @@ namespace Anabatic {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Test functions. // 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 ) void anabaticTest_1 ( AnabaticEngine* engine )
{ {
engine->getSouthWestGCell()->doGrid(); engine->getSouthWestGCell()->doGrid();
@ -83,33 +121,33 @@ namespace Anabatic {
DbU::Unit xcorner = engine->getCell()->getAbutmentBox().getXMin(); DbU::Unit xcorner = engine->getCell()->getAbutmentBox().getXMin();
DbU::Unit ycorner = engine->getCell()->getAbutmentBox().getYMin(); DbU::Unit ycorner = engine->getCell()->getAbutmentBox().getYMin();
cdebug.log(119,1) << "row0: " << row0 << endl; cdebug_log(119,1) << "row0: " << row0 << endl;
GCell* row1 = row0->hcut( ycorner+DbU::fromLambda(50.0) ); GCell* row1 = row0->hcut( ycorner+DbU::fromLambda(50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row1: " << row1 << endl; cdebug_log(119,1) << "row1: " << row1 << endl;
GCell* row2 = row1->hcut( ycorner+DbU::fromLambda(2*50.0) ); GCell* row2 = row1->hcut( ycorner+DbU::fromLambda(2*50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row2: " << row2 << endl; cdebug_log(119,1) << "row2: " << row2 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(50.0) ); row0 = row0->vcut( xcorner+DbU::fromLambda(50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row0+1: " << row0 << endl; cdebug_log(119,1) << "row0+1: " << row0 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(3*50.0) ); row0 = row0->vcut( xcorner+DbU::fromLambda(3*50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row0+2: " << row0 << endl; cdebug_log(119,1) << "row0+2: " << row0 << endl;
row0 = row0->vcut( xcorner+DbU::fromLambda(5*50.0) ); row0 = row0->vcut( xcorner+DbU::fromLambda(5*50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row0+3: " << row0 << endl; cdebug_log(119,1) << "row0+3: " << row0 << endl;
row1 = row1->vcut( xcorner+DbU::fromLambda(2*50.0) ); row1 = row1->vcut( xcorner+DbU::fromLambda(2*50.0) );
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
cdebug.log(119,1) << "row1+1: " << row1 << endl; cdebug_log(119,1) << "row1+1: " << row1 << endl;
cdebug.tabw(119,-1); cdebug_tabw(119,-1);
UpdateSession::close(); UpdateSession::close();
} }
@ -118,14 +156,14 @@ namespace Anabatic {
void anabaticTest_3 ( AnabaticEngine* engine ) void anabaticTest_3 ( AnabaticEngine* engine )
{ {
for ( int i=0 ; i<4 ; ++i ) { for ( int i=0 ; i<4 ; ++i ) {
cdebug.log(110,1) << "Running test 3, loop:" << i << " ..." << endl; cdebug_log(110,1) << "Running test 3, loop:" << i << " ..." << endl;
if ( i%2) anabaticTest_1( engine ); if ( i%2) anabaticTest_1( engine );
else anabaticTest_2( engine ); else anabaticTest_2( engine );
engine->reset(); engine->reset();
cdebug.log(110,1) << "Test 3, loop:" << i << " completed." << endl; cdebug_log(110,1) << "Test 3, loop:" << i << " completed." << endl;
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
} }
} }
@ -161,12 +199,28 @@ namespace Anabatic {
cell->createRoutingPadRings( Cell::Flags::BuildRings ); cell->createRoutingPadRings( Cell::Flags::BuildRings );
//DebugSession::addToTrace( cell->getNet("alu_out(3)") ); //DebugSession::addToTrace( cell->getNet("alu_out(3)") );
DebugSession::addToTrace( cell->getNet("imuxe.not_aux2") ); //DebugSession::addToTrace( cell->getNet("imuxe.not_i(1)") );
DebugSession::addToTrace( cell->getNet("r(0)") );
DebugSession::addToTrace( cell->getNet("ialu.not_aux104") );
engine->startMeasures();
cmess1 << " o Building regular grid..." << endl;
UpdateSession::open(); UpdateSession::open();
engine->getSouthWestGCell()->doGrid(); 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* dijkstra = new Dijkstra ( engine );
dijkstra->setDistance( DigitalDistance( engine->getConfiguration()->getEdgeCostH()
, engine->getConfiguration()->getEdgeCostK() ) );
for ( Net* net : cell->getNets() ) { for ( Net* net : cell->getNets() ) {
if (net->isPower() or net->isClock()) continue; if (net->isPower() or net->isClock()) continue;
dijkstra->load( net ); dijkstra->load( net );
@ -174,6 +228,9 @@ namespace Anabatic {
} }
delete dijkstra; delete dijkstra;
UpdateSession::close(); UpdateSession::close();
engine->stopMeasures();
engine->printMeasures( "Dijkstra" );
} }
@ -201,29 +258,32 @@ namespace Anabatic {
QPainter& painter = widget->getPainter(); QPainter& painter = widget->getPainter();
QPen pen = Graphics::getPen ("Anabatic::GCell",widget->getDarkening()); QPen pen = Graphics::getPen ("Anabatic::GCell",widget->getDarkening());
Box bb = gcell->getBoundingBox(); Box bb = gcell->getBoundingBox();
QRect pixelBb = widget->dbuToScreenRect(bb);
painter.setPen ( pen ); painter.setPen ( pen );
painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) ); painter.setBrush( Graphics::getBrush("Anabatic::GCell",widget->getDarkening()) );
painter.drawRect( widget->dbuToScreenRect(bb) ); painter.drawRect( pixelBb );
if (gcell->isFlat()) return; if (gcell->isFlat()) return;
QString text = QString("id:%1").arg(gcell->getId()); if (pixelBb.width() > 150) {
QFont font = Graphics::getFixedFont( QFont::Bold ); QString text = QString("id:%1").arg(gcell->getId());
painter.setFont(font); QFont font = Graphics::getFixedFont( QFont::Bold );
painter.setFont(font);
pen.setWidth( 1 ); pen.setWidth( 1 );
painter.setPen( pen ); painter.setPen( pen );
painter.save (); painter.save ();
painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) ); painter.translate( widget->dbuToScreenPoint(bb.getCenter().getX(), bb.getCenter().getY()) );
painter.drawRect (QRect( -75, -25, 150, 50 )); painter.drawRect (QRect( -75, -25, 150, 50 ));
painter.drawText (QRect( -75, -25, 150, 50 ) painter.drawText (QRect( -75, -25, 150, 50 )
, text , text
, QTextOption(Qt::AlignCenter) , QTextOption(Qt::AlignCenter)
); );
painter.restore (); painter.restore ();
}
} }
@ -240,6 +300,9 @@ namespace Anabatic {
, const Transformation& transformation , const Transformation& transformation
) )
{ {
static QFont font = Graphics::getFixedFont( QFont::Bold );
static int fontHeight = QFontMetrics(font).height();
const Edge* edge = static_cast<const Edge*>(go); const Edge* edge = static_cast<const Edge*>(go);
if (edge) { if (edge) {
@ -258,13 +321,15 @@ namespace Anabatic {
if (edge->getCapacity() > 0.0) if (edge->getCapacity() > 0.0)
brush = Graphics::getColorScale( ColorScale::Fire ).getBrush( occupancy, widget->getDarkening() ); brush = Graphics::getColorScale( ColorScale::Fire ).getBrush( occupancy, widget->getDarkening() );
QRect pixelBb = widget->dbuToScreenRect( bb, false);
painter.setPen( Qt::NoPen ); painter.setPen( Qt::NoPen );
painter.setBrush( brush ); painter.setBrush( brush );
painter.drawRect( widget->dbuToScreenRect( bb, false) ); painter.drawRect( pixelBb );
if (fontHeight > ((edge->isHorizontal()) ? pixelBb.height() : pixelBb.width()) + 4) return;
QString text = QString("%1/%2").arg(edge->getRealOccupancy()).arg(edge->getCapacity()); QString text = QString("%1/%2").arg(edge->getRealOccupancy()).arg(edge->getCapacity());
QColor color ( Qt::white ); QColor color ( (occupancy > 170) ? Qt::black : Qt::white );
QFont font = Graphics::getFixedFont( QFont::Bold );
painter.setPen (DisplayStyle::darken(color,widget->getDarkening())); painter.setPen (DisplayStyle::darken(color,widget->getDarkening()));
painter.setFont(font); painter.setFont(font);

View File

@ -67,14 +67,14 @@ namespace Anabatic {
_jmax = _area.getHeight() / side + ((_area.getHeight() % side) ? 1 : 0); _jmax = _area.getHeight() / side + ((_area.getHeight() % side) ? 1 : 0);
_gcells.resize( _imax*_jmax ); _gcells.resize( _imax*_jmax );
cdebug.log(110) << "Matrix::setCell(): " << this << endl; cdebug_log(110,0) << "Matrix::setCell(): " << this << endl;
} }
GCell* Matrix::getUnder ( DbU::Unit x, DbU::Unit y ) const GCell* Matrix::getUnder ( DbU::Unit x, DbU::Unit y ) const
{ {
int index = xy2maxIndex(x,y); int index = xy2maxIndex(x,y);
cdebug.log(110) << "Matrix::getUnder() (" cdebug_log(110,0) << "Matrix::getUnder() ("
<< DbU::getValueString(x) << " " << DbU::getValueString(x) << " "
<< DbU::getValueString(y) << ") index:" << index << endl; << DbU::getValueString(y) << ") index:" << index << endl;
return (index < 0) ? NULL : _gcells[index]->getUnder(x,y); return (index < 0) ? NULL : _gcells[index]->getUnder(x,y);
@ -83,26 +83,26 @@ namespace Anabatic {
void Matrix::updateLookup ( GCell* gcell ) void Matrix::updateLookup ( GCell* gcell )
{ {
cdebug.log(110,1) << "Matrix::updateLookup(): " << gcell << endl; cdebug_log(110,1) << "Matrix::updateLookup(): " << gcell << endl;
if (gcell->isFlat()) { if (gcell->isFlat()) {
cdebug.log(110) << " GCell is flat, no update." << endl; cdebug_log(110,0) << " GCell is flat, no update." << endl;
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
return; return;
} }
Box gcellBb = gcell->getBoundingBox(); Box gcellBb = gcell->getBoundingBox();
Box updateArea = _area.getIntersection( gcellBb ); Box updateArea = _area.getIntersection( gcellBb );
cdebug.log(110) << "_side " << _side << endl; cdebug_log(110,0) << "_side " << _side << endl;
cdebug.log(110) << "_area.getXMin() " << _area.getXMin() << endl; cdebug_log(110,0) << "_area.getXMin() " << _area.getXMin() << endl;
cdebug.log(110) << "_area.getYMin() " << _area.getYMin() << endl; cdebug_log(110,0) << "_area.getYMin() " << _area.getYMin() << endl;
cdebug.log(110) << "_area.getXMax() " << _area.getXMax() << endl; cdebug_log(110,0) << "_area.getXMax() " << _area.getXMax() << endl;
cdebug.log(110) << "_area.getYMax() " << _area.getYMax() << endl; cdebug_log(110,0) << "_area.getYMax() " << _area.getYMax() << endl;
cdebug.log(110) << "updateArea.getXMin() " << updateArea.getXMin() << endl; cdebug_log(110,0) << "updateArea.getXMin() " << updateArea.getXMin() << endl;
cdebug.log(110) << "updateArea.getYMin() " << updateArea.getYMin() << endl; cdebug_log(110,0) << "updateArea.getYMin() " << updateArea.getYMin() << endl;
cdebug.log(110) << "updateArea.getXMax() " << updateArea.getXMax() << endl; cdebug_log(110,0) << "updateArea.getXMax() " << updateArea.getXMax() << endl;
cdebug.log(110) << "updateArea.getYMax() " << updateArea.getYMax() << endl; cdebug_log(110,0) << "updateArea.getYMax() " << updateArea.getYMax() << endl;
if (updateArea.isEmpty()) { if (updateArea.isEmpty()) {
cerr << Error( "Matrix::updateLookup(): %s is not under area of %s." cerr << Error( "Matrix::updateLookup(): %s is not under area of %s."
@ -118,13 +118,13 @@ namespace Anabatic {
DbU::Unit dx = updateArea.getXMin() - _area.getXMin(); DbU::Unit dx = updateArea.getXMin() - _area.getXMin();
DbU::Unit dy = updateArea.getYMin() - _area.getYMin(); DbU::Unit dy = updateArea.getYMin() - _area.getYMin();
cdebug.log(110) << "raw_i:" << (dx / _side + ((dx%_side) ? 1 : 0)) cdebug_log(110,0) << "raw_i:" << (dx / _side + ((dx%_side) ? 1 : 0))
<< " raw_j:" << (dy / _side + ((dy%_side) ? 1 : 0)) << endl; << " raw_j:" << (dy / _side + ((dy%_side) ? 1 : 0)) << endl;
cdebug.log(110) << "indexMin:" << indexMin << endl; cdebug_log(110,0) << "indexMin:" << indexMin << endl;
cdebug.log(110) << "indexMax:" << indexMax << endl; cdebug_log(110,0) << "indexMax:" << indexMax << endl;
cdebug.log(110) << "xspan: " << xspan << endl; cdebug_log(110,0) << "xspan: " << xspan << endl;
if (not indexMin.valid() or not indexMax.valid()) { cdebug.tabw(110,-1); return; } if (not indexMin.valid() or not indexMax.valid()) { cdebug_tabw(110,-1); return; }
int index = indexMin.index(); int index = indexMin.index();
while ( index <= indexMax.index() ) { while ( index <= indexMax.index() ) {
@ -134,17 +134,17 @@ namespace Anabatic {
else index += _imax - xspan; else index += _imax - xspan;
} }
cdebug.tabw(110,-1); cdebug_tabw(110,-1);
} }
void Matrix::show () const void Matrix::show () const
{ {
cdebug.log(111) << this << endl; cdebug_log(111,0) << this << endl;
for ( size_t i=0 ; i<_gcells.size() ; ++i ) { for ( size_t i=0 ; i<_gcells.size() ; ++i ) {
cdebug.log(111) << "[" << setw(3) << setfill('0') << i << setfill(' ') << "] (" cdebug_log(111,0) << "[" << setw(3) << setfill('0') << i << setfill(' ') << "] ("
<< setw(3) << index2i(i) << "," << setw(3) << index2i(i) << ","
<< setw(3) << index2j(i) << ") " << _gcells[i] << endl; << setw(3) << index2j(i) << ") " << _gcells[i] << endl;
} }
} }

View File

@ -62,7 +62,7 @@ extern "C" {
// Module Initialization : "initAnabatic ()" // Module Initialization : "initAnabatic ()"
DL_EXPORT(void) initAnabatic () { DL_EXPORT(void) initAnabatic () {
cdebug.log(32) << "initAnabatic()" << endl; cdebug_log(32,0) << "initAnabatic()" << endl;
PyAnabaticEngine_LinkPyType(); PyAnabaticEngine_LinkPyType();
PyGraphicAnabaticEngine_LinkPyType(); PyGraphicAnabaticEngine_LinkPyType();

View File

@ -85,7 +85,7 @@ extern "C" {
static PyObject* PyAnabaticEngine_get ( PyObject*, PyObject* args ) static PyObject* PyAnabaticEngine_get ( PyObject*, PyObject* args )
{ {
cdebug.log(32) << "PyAnabaticEngine_get()" << endl; cdebug_log(32,0) << "PyAnabaticEngine_get()" << endl;
AnabaticEngine* engine = NULL; AnabaticEngine* engine = NULL;
@ -102,7 +102,7 @@ extern "C" {
static PyObject* PyAnabaticEngine_create ( PyObject*, PyObject* args ) static PyObject* PyAnabaticEngine_create ( PyObject*, PyObject* args )
{ {
cdebug.log(32) << "PyAnabaticEngine_create()" << endl; cdebug_log(32,0) << "PyAnabaticEngine_create()" << endl;
AnabaticEngine* engine = NULL; AnabaticEngine* engine = NULL;
@ -126,7 +126,7 @@ extern "C" {
static PyObject* PyAnabaticEngine_setViewer ( PyAnabaticEngine* self, PyObject* args ) static PyObject* PyAnabaticEngine_setViewer ( PyAnabaticEngine* self, PyObject* args )
{ {
cdebug.log(32) << "PyAnabaticEngine_setViewer ()" << endl; cdebug_log(32,0) << "PyAnabaticEngine_setViewer ()" << endl;
HTRY HTRY
METHOD_HEAD( "AnabaticEngine.setViewer()" ) METHOD_HEAD( "AnabaticEngine.setViewer()" )
@ -148,7 +148,7 @@ extern "C" {
#if 0 #if 0
PyObject* PyAnabaticEngine_runTest ( PyAnabaticEngine* self, PyObject* args ) PyObject* PyAnabaticEngine_runTest ( PyAnabaticEngine* self, PyObject* args )
{ {
cdebug.log(32) << "PyAnabaticEngine_runTest()" << endl; cdebug_log(32,0) << "PyAnabaticEngine_runTest()" << endl;
HTRY HTRY
METHOD_HEAD("AnabaticEngine.runTest()") METHOD_HEAD("AnabaticEngine.runTest()")

View File

@ -48,7 +48,7 @@ extern "C" {
static PyObject* PyGraphicAnabaticEngine_grab ( PyObject* ) static PyObject* PyGraphicAnabaticEngine_grab ( PyObject* )
{ {
cdebug.log(32) << "PyGraphicAnabaticEngine_grab()" << endl; cdebug_log(32,0) << "PyGraphicAnabaticEngine_grab()" << endl;
PyGraphicAnabaticEngine* pyGraphicAnabaticEngine = NULL; PyGraphicAnabaticEngine* pyGraphicAnabaticEngine = NULL;
HTRY HTRY
@ -64,7 +64,7 @@ extern "C" {
static PyObject* PyGraphicAnabaticEngine_getCell ( PyGraphicAnabaticEngine* self ) static PyObject* PyGraphicAnabaticEngine_getCell ( PyGraphicAnabaticEngine* self )
{ {
cdebug.log(32) << "PyGraphicAnabaticEngine_getCell ()" << endl; cdebug_log(32,0) << "PyGraphicAnabaticEngine_getCell ()" << endl;
Cell* cell = NULL; Cell* cell = NULL;

View File

@ -20,6 +20,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "hurricane/Timer.h"
namespace Hurricane { namespace Hurricane {
class Name; class Name;
class Cell; class Cell;
@ -37,6 +38,7 @@ namespace Anabatic {
using std::string; using std::string;
using std::vector; using std::vector;
using Hurricane::Timer;
using Hurricane::Name; using Hurricane::Name;
using Hurricane::Record; using Hurricane::Record;
using Hurricane::Interval; using Hurricane::Interval;
@ -69,6 +71,9 @@ namespace Anabatic {
inline const Flags& flags () const; inline const Flags& flags () const;
inline Flags& flags (); inline Flags& flags ();
void reset (); void reset ();
void startMeasures ();
void stopMeasures ();
void printMeasures ( const string& ) const;
inline void _add ( GCell* ); inline void _add ( GCell* );
inline void _remove ( GCell* ); inline void _remove ( GCell* );
inline void _updateLookup ( GCell* ); inline void _updateLookup ( GCell* );
@ -88,6 +93,7 @@ namespace Anabatic {
AnabaticEngine& operator= ( const AnabaticEngine& ); AnabaticEngine& operator= ( const AnabaticEngine& );
private: private:
static Name _toolName; static Name _toolName;
Timer _timer;
Configuration* _configuration; Configuration* _configuration;
Matrix _matrix; Matrix _matrix;
vector<GCell*> _gcells; vector<GCell*> _gcells;
@ -112,7 +118,7 @@ namespace Anabatic {
inline void AnabaticEngine::_add ( GCell* gcell ) inline void AnabaticEngine::_add ( GCell* gcell )
{ {
_gcells.push_back( gcell ); _gcells.push_back( gcell );
std::sort( _gcells.begin(), _gcells.end(), Entity::CompareById() ); //std::sort( _gcells.begin(), _gcells.end(), Entity::CompareById() );
} }
inline void AnabaticEngine::_remove ( GCell* gcell ) inline void AnabaticEngine::_remove ( GCell* gcell )

View File

@ -86,6 +86,8 @@ namespace Anabatic {
virtual void setAllowedDepth ( size_t ) = 0; virtual void setAllowedDepth ( size_t ) = 0;
virtual DbU::Unit getEdgeLength () const = 0; virtual DbU::Unit getEdgeLength () const = 0;
virtual DbU::Unit getEdgeWidth () const = 0; virtual DbU::Unit getEdgeWidth () const = 0;
virtual float getEdgeCostH () const = 0;
virtual float getEdgeCostK () const = 0;
virtual void print ( Cell* ) const = 0; virtual void print ( Cell* ) const = 0;
virtual Record* _getRecord () const = 0; virtual Record* _getRecord () const = 0;
virtual string _getString () const = 0; virtual string _getString () const = 0;
@ -139,6 +141,8 @@ namespace Anabatic {
virtual void setAllowedDepth ( size_t ); virtual void setAllowedDepth ( size_t );
virtual DbU::Unit getEdgeLength () const; virtual DbU::Unit getEdgeLength () const;
virtual DbU::Unit getEdgeWidth () const; virtual DbU::Unit getEdgeWidth () const;
virtual float getEdgeCostH () const;
virtual float getEdgeCostK () const;
virtual void print ( Cell* ) const; virtual void print ( Cell* ) const;
virtual Record* _getRecord () const; virtual Record* _getRecord () const;
virtual string _getString () const; virtual string _getString () const;
@ -154,6 +158,8 @@ namespace Anabatic {
size_t _allowedDepth; size_t _allowedDepth;
DbU::Unit _edgeLength; DbU::Unit _edgeLength;
DbU::Unit _edgeWidth; DbU::Unit _edgeWidth;
float _edgeCostH;
float _edgeCostK;
private: private:
ConfigurationConcrete ( const ConfigurationConcrete& ); ConfigurationConcrete ( const ConfigurationConcrete& );
ConfigurationConcrete& operator= ( const ConfigurationConcrete& ); ConfigurationConcrete& operator= ( const ConfigurationConcrete& );

View File

@ -45,7 +45,7 @@ namespace Anabatic {
inline bool operator() ( const Vertex* lhs, const Vertex* rhs ); inline bool operator() ( const Vertex* lhs, const Vertex* rhs );
}; };
public: public:
static float unreached; static DbU::Unit unreached;
public: public:
static void notify ( Vertex*, unsigned flags ); static void notify ( Vertex*, unsigned flags );
public: public:
@ -58,14 +58,16 @@ namespace Anabatic {
inline Contact* getGContact ( Net* ); inline Contact* getGContact ( Net* );
bool hasValidStamp () const; bool hasValidStamp () const;
inline Point getCenter () const; inline Point getCenter () const;
inline float getDistance () const; inline DbU::Unit getDistance () const;
inline int getStamp () const; inline int getStamp () const;
inline int getBranchId () const;
inline int getConnexId () const; inline int getConnexId () const;
inline Edge* getFrom () const; inline Edge* getFrom () const;
inline Vertex* getPredecessor () const; inline Vertex* getPredecessor () const;
inline void setDistance ( float ); inline void setDistance ( DbU::Unit );
inline void setStamp ( int ); inline void setStamp ( int );
inline void setConnexId ( int ); inline void setConnexId ( int );
inline void setBranchId ( int );
inline void setFrom ( Edge* ); inline void setFrom ( Edge* );
// Inspector support. // Inspector support.
string _getString () const; string _getString () const;
@ -77,8 +79,9 @@ namespace Anabatic {
GCell* _gcell; GCell* _gcell;
Observer<Vertex> _observer; Observer<Vertex> _observer;
int _connexId; int _connexId;
int _branchId;
int _stamp; int _stamp;
float _distance; DbU::Unit _distance;
Edge* _from; Edge* _from;
}; };
@ -88,6 +91,7 @@ namespace Anabatic {
, _gcell (gcell) , _gcell (gcell)
, _observer(this) , _observer(this)
, _connexId(-1) , _connexId(-1)
, _branchId( 0)
, _stamp (-1) , _stamp (-1)
, _distance(unreached) , _distance(unreached)
, _from (NULL) , _from (NULL)
@ -95,15 +99,6 @@ namespace Anabatic {
gcell->setObserver( GCell::Observable::Vertex, &_observer ); gcell->setObserver( GCell::Observable::Vertex, &_observer );
} }
// inline Vertex::Vertex ( size_t id )
// : _id (id)
// , _gcell (NULL)
// , _observer((Vertex*)0x1) // To trick the NULL detection.
// , _connexId(-1)
// , _stamp (-1)
// , _distance(unreached)
// , _from (NULL)
// { }
inline Vertex::~Vertex () { } inline Vertex::~Vertex () { }
inline unsigned int Vertex::getId () const { return _id; } inline unsigned int Vertex::getId () const { return _id; }
@ -111,14 +106,16 @@ namespace Anabatic {
inline AnabaticEngine* Vertex::getAnabatic () const { return _gcell->getAnabatic(); } inline AnabaticEngine* Vertex::getAnabatic () const { return _gcell->getAnabatic(); }
inline Contact* Vertex::getGContact ( Net* net ) { return _gcell->getGContact(net); } inline Contact* Vertex::getGContact ( Net* net ) { return _gcell->getGContact(net); }
inline Point Vertex::getCenter () const { return _gcell->getBoundingBox().getCenter(); } inline Point Vertex::getCenter () const { return _gcell->getBoundingBox().getCenter(); }
inline float Vertex::getDistance () const { return hasValidStamp() ? _distance : unreached; } inline DbU::Unit Vertex::getDistance () const { return hasValidStamp() ? _distance : unreached; }
inline int Vertex::getStamp () const { return _stamp; } inline int Vertex::getStamp () const { return _stamp; }
inline int Vertex::getConnexId () const { return hasValidStamp() ? _connexId : -1; } inline int Vertex::getConnexId () const { return hasValidStamp() ? _connexId : -1; }
inline int Vertex::getBranchId () const { return hasValidStamp() ? _branchId : 0; }
inline Edge* Vertex::getFrom () const { return _from; } inline Edge* Vertex::getFrom () const { return _from; }
inline void Vertex::setDistance ( float distance ) { _distance=distance; } inline void Vertex::setDistance ( DbU::Unit distance ) { _distance=distance; }
inline void Vertex::setFrom ( Edge* from ) { _from=from; } inline void Vertex::setFrom ( Edge* from ) { _from=from; }
inline void Vertex::setStamp ( int stamp ) { _stamp=stamp; } inline void Vertex::setStamp ( int stamp ) { _stamp=stamp; }
inline void Vertex::setConnexId ( int id ) { _connexId=id; } inline void Vertex::setConnexId ( int id ) { _connexId=id; }
inline void Vertex::setBranchId ( int id ) { _branchId=id; }
inline Vertex* Vertex::getPredecessor () const inline Vertex* Vertex::getPredecessor () const
{ return (hasValidStamp() and _from) ? _from->getOpposite(_gcell)->getObserver<Vertex>(GCell::Observable::Vertex) : NULL; } { return (hasValidStamp() and _from) ? _from->getOpposite(_gcell)->getObserver<Vertex>(GCell::Observable::Vertex) : NULL; }
@ -156,7 +153,10 @@ namespace Anabatic {
inline bool PriorityQueue::CompareByDistance::operator() ( const Vertex* lhs, const Vertex* rhs ) inline bool PriorityQueue::CompareByDistance::operator() ( const Vertex* lhs, const Vertex* rhs )
{ return lhs->getDistance() < rhs->getDistance(); } {
if (lhs->getDistance() == rhs->getDistance()) return lhs->getBranchId() > rhs->getBranchId();
return lhs->getDistance() < rhs->getDistance();
}
inline PriorityQueue::PriorityQueue () : _queue() { } inline PriorityQueue::PriorityQueue () : _queue() { }
@ -169,7 +169,7 @@ namespace Anabatic {
inline void PriorityQueue::pop () inline void PriorityQueue::pop ()
{ {
cdebug.log(111) << "Pop: (size:" << _queue.size() << ") " << *_queue.begin() << std::endl; cdebug_log(112,0) << "Pop: (size:" << _queue.size() << ") " << *_queue.begin() << std::endl;
_queue.erase(_queue.begin()); _queue.erase(_queue.begin());
} }
@ -182,12 +182,12 @@ namespace Anabatic {
inline void PriorityQueue::dump () const inline void PriorityQueue::dump () const
{ {
if (cdebug.enabled(111)) { if (cdebug.enabled(112)) {
cdebug.log(111,1) << "PriorityQueue::dump() size:" << size() << std::endl; cdebug_log(112,1) << "PriorityQueue::dump() size:" << size() << std::endl;
size_t order = 0; size_t order = 0;
for ( Vertex* v : _queue ) for ( Vertex* v : _queue )
cdebug.log(111) << "[" << std::setw(3) << order++ << "] " << v << std::endl; cdebug_log(112,0) << "[" << std::setw(3) << order++ << "] " << v << std::endl;
cdebug.tabw(111,-1); cdebug_tabw(112,-1);
} }
} }
@ -211,25 +211,28 @@ namespace Anabatic {
virtual std::string _getTypeName () const; virtual std::string _getTypeName () const;
virtual std::string _getString () const; virtual std::string _getString () const;
}; };
public:
typedef std::function<DbU::Unit(const Vertex*,const Vertex*,const Edge*)> distance_t;
public: public:
float getDistance ( const Vertex*, const Vertex*, const Edge* ); Dijkstra ( AnabaticEngine* );
public: ~Dijkstra ();
Dijkstra ( AnabaticEngine* ); public:
~Dijkstra (); inline bool isBipoint () const;
public: inline void setDistance ( distance_t );
inline bool isBipoint () const; void load ( Net* );
void load ( Net* ); void run ( Mode mode=Mode::Standart );
void run ( Mode mode=Mode::Standart ); private:
private: Dijkstra ( const Dijkstra& );
Dijkstra ( const Dijkstra& ); Dijkstra& operator= ( const Dijkstra& );
Dijkstra& operator= ( const Dijkstra& ); static DbU::Unit _distance ( const Vertex*, const Vertex*, const Edge* );
bool _propagate ( Flags enabledSides ); bool _propagate ( Flags enabledSides );
void _selectFirstSource (); void _selectFirstSource ();
void _toWires (); void _toWires ();
private: private:
AnabaticEngine* _anabatic; AnabaticEngine* _anabatic;
vector<Vertex*> _vertexes; vector<Vertex*> _vertexes;
distance_t _distanceCb;
Mode _mode; Mode _mode;
Net* _net; Net* _net;
int _stamp; int _stamp;
@ -244,7 +247,8 @@ namespace Anabatic {
inline Dijkstra::Mode::Mode ( unsigned int flags ) : BaseFlags(flags) { } inline Dijkstra::Mode::Mode ( unsigned int flags ) : BaseFlags(flags) { }
inline Dijkstra::Mode::Mode ( BaseFlags base ) : BaseFlags(base) { } inline Dijkstra::Mode::Mode ( BaseFlags base ) : BaseFlags(base) { }
inline bool Dijkstra::isBipoint () const { return _net and (_targets.size()+_sources.size() == 2); } inline bool Dijkstra::isBipoint () const { return _net and (_targets.size()+_sources.size() == 2); }
inline void Dijkstra::setDistance ( distance_t cb ) { _distanceCb = cb; }
} // Anabatic namespace. } // Anabatic namespace.

View File

@ -55,7 +55,7 @@ namespace Anabatic {
inline unsigned int getCapacity () const; inline unsigned int getCapacity () const;
inline unsigned int getRealOccupancy () const; inline unsigned int getRealOccupancy () const;
inline unsigned int getEstimateOccupancy () const; inline unsigned int getEstimateOccupancy () const;
float getDistance () const; DbU::Unit getDistance () const;
inline GCell* getSource () const; inline GCell* getSource () const;
inline GCell* getTarget () const; inline GCell* getTarget () const;
GCell* getOpposite ( const GCell* ) const; GCell* getOpposite ( const GCell* ) const;

View File

@ -92,7 +92,7 @@ namespace Anabatic {
, _filterFlags(locator._filterFlags) , _filterFlags(locator._filterFlags)
, _iedge (locator._iedge) , _iedge (locator._iedge)
{ {
// cdebug.log(110) << "GCell_Edges::Locator::Locator(const Locator&)" << std::endl; // cdebug_log(110,0) << "GCell_Edges::Locator::Locator(const Locator&)" << std::endl;
} }

37
bootstrap/sprof.py Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python
import sys
import os.path
import subprocess
import re
reSymbol = re.compile(r'(?P<head>.*)(?P<symbol>_Z\w+)(?P<tail>.*)')
soPathName = sys.argv[1]
soFileName = os.path.basename( soPathName )
profName = soFileName + '.profile'
if not os.path.isfile(profName):
print '[ERROR] No profile datas <%s>.' % profName
sys.exit( 1 )
sprof = subprocess.Popen ( ['sprof'
, soPathName
, profName ]
, stdout=subprocess.PIPE )
for line in sprof.stdout.readlines():
m = reSymbol.match( line[:-1] )
if m:
cppfilt = subprocess.Popen ( ['c++filt'
, '--no-verbose'
, '--no-params'
, m.group('symbol')]
, stdout=subprocess.PIPE )
symbol = cppfilt.stdout.readlines()[0][:-1]
print m.group('head'), symbol
else:
print line[:-1]
sys.exit( 0 )

View File

@ -23,6 +23,8 @@ parametersTable = \
# Anabatic parameters are temporarily hosted here. # Anabatic parameters are temporarily hosted here.
, ("anabatic.edgeLength" ,TypeInt ,24 ) , ("anabatic.edgeLength" ,TypeInt ,24 )
, ("anabatic.edgeWidth" ,TypeInt ,4 ) , ("anabatic.edgeWidth" ,TypeInt ,4 )
, ("anabatic.edgeCostH" ,TypeDouble ,9.0 )
, ("anabatic.edgeCostK" ,TypeDouble ,-10.0 )
) )

View File

@ -84,9 +84,8 @@ stylesTable = \
, (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'light_antihash0.8', 'border':1 }) , (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'light_antihash0.8', 'border':1 })
, (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 })
, (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 })
, (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'threshold':0.80*scale, 'border':4 }) , (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.80*scale, 'border':4 })
#, (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'threshold':0.80*scale, 'border':4 })
) )
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -192,8 +191,8 @@ stylesTable = \
, (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'antislash2.32' , 'border':1 }) , (Drawing, 'gmetalh' , { 'color':'128,255,200', 'pattern':'antislash2.32' , 'border':1 })
, (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 }) , (Drawing, 'gmetalv' , { 'color':'200,200,255', 'pattern':'light_antihash1.8', 'border':1 })
, (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 }) , (Drawing, 'gcut' , { 'color':'255,255,190', 'border':1 })
, (Drawing, 'Anabatic::Edge' , { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4 }) , (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.40*scale }) , (Drawing, 'Anabatic::GCell', { 'color':'255,255,190', 'pattern':'0000000000000000', 'border':4, 'threshold':0.80*scale })
) )
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------

View File

@ -26,6 +26,7 @@
#find_package(NIMBUS REQUIRED) #find_package(NIMBUS REQUIRED)
#find_package(METIS REQUIRED) #find_package(METIS REQUIRED)
#find_package(MAUKA REQUIRED) #find_package(MAUKA REQUIRED)
find_package(ANABATIC REQUIRED)
find_package(ETESIAN REQUIRED) find_package(ETESIAN REQUIRED)
find_package(KNIK REQUIRED) find_package(KNIK REQUIRED)
find_package(KATABATIC REQUIRED) find_package(KATABATIC REQUIRED)

View File

@ -49,6 +49,8 @@
${KNIK_LIBRARIES} ${KNIK_LIBRARIES}
${ETESIAN_GRAPHICAL_LIBRARIES} ${ETESIAN_GRAPHICAL_LIBRARIES}
${ETESIAN_LIBRARIES} ${ETESIAN_LIBRARIES}
${ANABATIC_GRAPHICAL_LIBRARIES}
${ANABATIC_LIBRARIES}
${CORIOLIS_PYTHON_LIBRARIES} ${CORIOLIS_PYTHON_LIBRARIES}
${CORIOLIS_LIBRARIES} ${CORIOLIS_LIBRARIES}
${HURRICANE_PYTHON_LIBRARIES} ${HURRICANE_PYTHON_LIBRARIES}

View File

@ -1,4 +1,3 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
@ -65,6 +64,8 @@ using namespace CRL;
// #include "mauka/GraphicMaukaEngine.h" // #include "mauka/GraphicMaukaEngine.h"
// using namespace Mauka; // using namespace Mauka;
#include "anabatic/GraphicAnabaticEngine.h"
#include "etesian/GraphicEtesianEngine.h" #include "etesian/GraphicEtesianEngine.h"
using namespace Etesian; using namespace Etesian;
@ -268,16 +269,17 @@ int main ( int argc, char *argv[] )
cmess1 << UnicornGui::getBanner() << endl; cmess1 << UnicornGui::getBanner() << endl;
cmess1 << " Tool Credits" << endl; cmess1 << " Tool Credits" << endl;
cmess1 << " Hurricane .................... Remy Escassut & Christian Masson" << endl; cmess1 << " Hurricane .................... Remy Escassut & Christian Masson" << endl;
cmess1 << " Nimbus - Infrastructure .......................... Hugo Clement" << endl; cmess1 << " Etesian - Placer .............................. Gabriel Gouvine" << endl;
cmess1 << " Mauka - Placer ........................... Christophe Alexandre" << endl;
cmess1 << " Knik - Global Router ............................ Damien Dupuis" << endl; cmess1 << " Knik - Global Router ............................ Damien Dupuis" << endl;
cmess1 << " Kite - Detailed Router ....................... Jean-Paul Chaput" << endl; cmess1 << " Kite - Detailed Router ....................... Jean-Paul Chaput" << endl;
cmess1 << " " << endl;
cmess1 << " Contributors" << endl;
cmess1 << " Sophie Belloeil, Hugo Clement, Marek Sroka, Wu Yifei" << endl;
cmess1 << endl; cmess1 << endl;
cout << " hMETIS software credits (used by Mauka)" << endl; cmess1 << " Coloquinte software credits (used by Etesian)" << endl;
cout << " Author ........................................ Georges Karypis" << endl; cmess1 << " Author ........................................ Gabriel Gouvine" << endl;
cout << " Prof. Ident. .......................... University of Minnesota" << endl;
cout << " URL .......................... http://glaros.dtc.umn.edu/gkhome" << endl;
cout << endl; cout << endl;
cout << " FLUTE software credits (used by Knik)" << endl; cout << " FLUTE software credits (used by Knik)" << endl;
@ -329,6 +331,7 @@ int main ( int argc, char *argv[] )
unicorn->setApplicationName ( QObject::tr("cgt") ); unicorn->setApplicationName ( QObject::tr("cgt") );
//unicorn->registerTool ( Mauka::GraphicMaukaEngine::grab() ); //unicorn->registerTool ( Mauka::GraphicMaukaEngine::grab() );
unicorn->registerTool ( Anabatic::GraphicAnabaticEngine::grab() );
unicorn->registerTool ( Etesian::GraphicEtesianEngine::grab() ); unicorn->registerTool ( Etesian::GraphicEtesianEngine::grab() );
//unicorn->registerTool ( Knik::GraphicKnikEngine::grab() ); //unicorn->registerTool ( Knik::GraphicKnikEngine::grab() );
unicorn->registerTool ( Kite::GraphicKiteEngine::grab() ); unicorn->registerTool ( Kite::GraphicKiteEngine::grab() );

View File

@ -47,6 +47,9 @@ def credits ():
s += ' Knik - Global Router ............................ Damien Dupuis\n' s += ' Knik - Global Router ............................ Damien Dupuis\n'
s += ' Kite - Detailed Router ....................... Jean-Paul Chaput\n\n' s += ' Kite - Detailed Router ....................... Jean-Paul Chaput\n\n'
s += ' Contributors\n'
s += ' Sophie Belloeil, Hugo Clement, Marek Sroka, Wu Yifei\n'
s += ' Coloquinte software credits (used by Etesian)\n' s += ' Coloquinte software credits (used by Etesian)\n'
s += ' Author ........................................ Gabriel Gouvine\n' s += ' Author ........................................ Gabriel Gouvine\n'
@ -179,7 +182,7 @@ if __name__ == '__main__':
unicorn = Unicorn.UnicornGui.create() unicorn = Unicorn.UnicornGui.create()
unicorn.setApplicationName ('cgt') unicorn.setApplicationName ('cgt')
#unicorn.registerTool (Anabatic.GraphicAnabaticEngine.grab()) unicorn.registerTool (Anabatic.GraphicAnabaticEngine.grab())
unicorn.registerTool (Etesian.GraphicEtesianEngine.grab()) unicorn.registerTool (Etesian.GraphicEtesianEngine.grab())
unicorn.registerTool (Kite.GraphicKiteEngine.grab()) unicorn.registerTool (Kite.GraphicKiteEngine.grab())
#unicorn.setAnonNetSelectable(False) #unicorn.setAnonNetSelectable(False)