Anabatic transient commit 9. Dijkstra::_traceback() replaces _toWires().

* Change: In Anabatic:
    - In Dijkstra, replace _toWires() by _trackback() which is called
      immediatly on reaching a target.
    - In Constants & GCell, added flags for typing the GCells. We now
      have:
        * DeviceGCell, for analogic devices.
        * ChannelGCell, for resizable routing channels.
        * StrutGCell, for fixed spaces in analog designs.
        * MatrixGCell, for square tile in digital designs.
This commit is contained in:
Jean-Paul Chaput 2016-06-17 17:45:32 +02:00
parent 601e3d3da1
commit 379effd92c
5 changed files with 121 additions and 106 deletions

View File

@ -36,8 +36,13 @@ namespace Anabatic {
string s = "";
s += (_flags & Horizontal ) ? 'h' : '-';
s += (_flags & Vertical ) ? 'v' : '-';
s += (_flags & SourceGCell) ? 's' : '-';
s += (_flags & TargetGCell) ? 't' : '-';
s += (_flags & SourceGCell ) ? 'S' : '-';
s += (_flags & TargetGCell ) ? 'T' : '-';
s += (_flags & DeviceGCell ) ? 'd' : '-';
s += (_flags & ChannelGCell) ? 'c' : '-';
s += (_flags & StrutGCell ) ? 's' : '-';
s += (_flags & MatrixGCell ) ? 'm' : '-';
s += ",";
s += (_flags & Invalidated ) ? 'i' : '-';
s += (_flags & Destroy ) ? 'D' : '-';
s += (_flags & PitchAbove ) ? 'A' : '-';

View File

@ -300,23 +300,7 @@ namespace Anabatic {
// We did reach another target (different <connexId>).
// Tag back the path, with a higher <branchId>.
int branchId = _sources.size();
cdebug_log(112,0) << "Trace back branchId:" << branchId << endl;
_targets.erase( current );
while ( current ) {
cdebug_log(112,0) << "| " << current << endl;
if (current->getConnexId() == _connectedsId) break;
_sources.insert( current );
current->setDistance( 0.0 );
current->setConnexId( _connectedsId );
current->setBranchId( branchId );
_queue.push( current );
current = current->getPredecessor();
}
cdebug_tabw(112,-1);
_traceback( current );
return true;
}
@ -329,6 +313,59 @@ namespace Anabatic {
}
void Dijkstra::_traceback ( Vertex* current )
{
cdebug_log(112,1) << "Dijkstra::_traceback() " << _net << " branchId:" << _sources.size() << endl;
int branchId = _sources.size();
_targets.erase( current );
while ( current ) {
cdebug_log(112,0) << "| " << current << endl;
if (current->getConnexId() == _connectedsId) break;
Edge* from = current->getFrom();
if (not from) break;
from->incRealOccupancy( 1 );
_sources.insert( current );
current->setDistance( 0.0 );
current->setConnexId( _connectedsId );
current->setBranchId( branchId );
_queue.push( current );
Vertex* source = current;
Vertex* target = source->getPredecessor();
current = target;
if ( (source->getGCell()->getXMin() > target->getGCell()->getXMin())
or (source->getGCell()->getYMin() > target->getGCell()->getYMin()) )
std::swap( source, target );
Contact* sourceContact = source->getGContact( _net );
Contact* targetContact = target->getGContact( _net );
if (from->isHorizontal()) {
Horizontal::create( sourceContact
, targetContact
, _anabatic->getConfiguration()->getGHorizontalLayer()
, from->getAxis()
, DbU::fromLambda(2.0)
);
} else {
Vertical::create( sourceContact
, targetContact
, _anabatic->getConfiguration()->getGVerticalLayer()
, from->getAxis()
, DbU::fromLambda(2.0)
);
}
}
cdebug_tabw(112,-1);
}
void Dijkstra::run ( Dijkstra::Mode mode )
{
DebugSession::open( _net, 112, 120 );
@ -363,7 +400,6 @@ namespace Anabatic {
while ( not _targets.empty() and _propagate(enabledEdges) );
_toWires();
_queue.clear();
cdebug_tabw(112,-1);
@ -371,47 +407,4 @@ namespace Anabatic {
}
void Dijkstra::_toWires ()
{
cdebug_log(111,1) << "Dijkstra::toWires() " << _net << endl;
for ( Vertex* vertex : _sources ) {
Edge* from = vertex->getFrom();
if (not from) continue;
cdebug_log(111,0) << "| " << vertex << endl;
from->incRealOccupancy( 1 );
Vertex* source = vertex;
Vertex* target = source->getPredecessor();
if ( (source->getGCell()->getXMin() > target->getGCell()->getXMin())
or (source->getGCell()->getYMin() > target->getGCell()->getYMin()) )
std::swap( source, target );
Contact* sourceContact = source->getGContact( _net );
Contact* targetContact = target->getGContact( _net );
if (from->isHorizontal()) {
Horizontal::create( sourceContact
, targetContact
, _anabatic->getConfiguration()->getGHorizontalLayer()
, from->getAxis()
, DbU::fromLambda(2.0)
);
} else {
Vertical::create( sourceContact
, targetContact
, _anabatic->getConfiguration()->getGVerticalLayer()
, from->getAxis()
, DbU::fromLambda(2.0)
);
}
}
cdebug_tabw(111,-1);
}
} // Anabatic namespace.

View File

@ -29,15 +29,19 @@ namespace Anabatic {
, Vertical = (1<<1)
, SourceGCell = (1<<2)
, TargetGCell = (1<<3)
, Invalidated = (1<<4)
, Destroy = (1<<5)
, DeviceGCell = (1<<4)
, ChannelGCell = (1<<5)
, StrutGCell = (1<<6)
, MatrixGCell = (1<<7)
, Invalidated = (1<<8)
, Destroy = (1<<9)
, WestSide = Horizontal|TargetGCell
, EastSide = Horizontal|SourceGCell
, SouthSide = Vertical |TargetGCell
, NorthSide = Vertical |SourceGCell
, AllSides = WestSide|EastSide|SouthSide|NorthSide
, PitchAbove = (1<<6)
, PitchBelow = (1<<7)
, PitchAbove = (1<<10)
, PitchBelow = (1<<11)
};
public:
inline Flags ( unsigned int flags = NoFlags );

View File

@ -22,6 +22,7 @@
#include "hurricane/Observer.h"
namespace Hurricane {
class Net;
class RoutingPad;
}
#include "anabatic/GCell.h"
@ -32,6 +33,7 @@ namespace Anabatic {
using std::multiset;
using Hurricane::Observer;
using Hurricane::Net;
using Hurricane::RoutingPad;
class AnabaticEngine;
@ -52,6 +54,7 @@ namespace Anabatic {
inline Vertex ( GCell* );
//inline Vertex ( size_t id );
inline ~Vertex ();
inline bool hasDoneAllRps () const;
inline unsigned int getId () const;
inline GCell* getGCell () const;
inline AnabaticEngine* getAnabatic () const;
@ -69,6 +72,8 @@ namespace Anabatic {
inline void setConnexId ( int );
inline void setBranchId ( int );
inline void setFrom ( Edge* );
inline void add ( RoutingPad* );
inline void clearRps ();
// Inspector support.
string _getString () const;
private:
@ -227,8 +232,8 @@ namespace Anabatic {
Dijkstra& operator= ( const Dijkstra& );
static DbU::Unit _distance ( const Vertex*, const Vertex*, const Edge* );
bool _propagate ( Flags enabledSides );
void _traceback ( Vertex* );
void _selectFirstSource ();
void _toWires ();
private:
AnabaticEngine* _anabatic;
vector<Vertex*> _vertexes;

View File

@ -75,6 +75,10 @@ namespace Anabatic {
inline bool isHFlat () const;
inline bool isVFlat () const;
inline bool isFlat () const;
inline bool isDevice () const;
inline bool isChannel () const;
inline bool isStrut () const;
inline bool isMatrix () const;
inline AnabaticEngine* getAnabatic () const;
inline DbU::Unit getXMin () const;
inline DbU::Unit getYMin () const;
@ -153,6 +157,10 @@ namespace Anabatic {
inline bool GCell::isHFlat () const { return getYMin() == getYMax(); }
inline bool GCell::isVFlat () const { return getXMin() == getXMax(); }
inline bool GCell::isFlat () const { return isHFlat() or isVFlat(); }
inline bool GCell::isDevice () const { return _flags & Flags::DeviceGCell; }
inline bool GCell::isChannel () const { return _flags & Flags::ChannelGCell; }
inline bool GCell::isStrut () const { return _flags & Flags::StrutGCell; }
inline bool GCell::isMatrix () const { return _flags & Flags::MatrixGCell; }
inline AnabaticEngine* GCell::getAnabatic () const { return _anabatic; }
inline DbU::Unit GCell::getXMin () const { return _xmin; }
inline DbU::Unit GCell::getYMin () const { return _ymin; }