* Change: Dijkstra, GCell

Restriction on vertex are now correctly done.

* Change: Constants
  There is only one type of Strut.

* New: LoadGlobalRouting
  Detailed Routing can be performed for analog circuits.
  The router does not take into account analog constraints yet.
  Warnings on "metal2" should be corrected in the future.
  Types of GCell considered by the router are: Device, VChannel/HChannel and Strut.
  The analog circuit MUST be organized in a slicing structure.
This commit is contained in:
EricLaoGitHub 2016-09-30 18:09:05 +02:00
parent e5d423a61c
commit 5f25ba349f
6 changed files with 1214 additions and 239 deletions

View File

@ -33,11 +33,10 @@ namespace Anabatic {
const unsigned int Flags::DeviceGCell = (1 << 5);
const unsigned int Flags::HChannelGCell = (1 << 6);
const unsigned int Flags::VChannelGCell = (1 << 7);
const unsigned int Flags::HStrutGCell = (1 << 8);
const unsigned int Flags::VStrutGCell = (1 << 9);
const unsigned int Flags::MatrixGCell = (1 << 10);
const unsigned int Flags::IoPadGCell = (1 << 11);
const unsigned int Flags::Saturated = (1 << 12);
const unsigned int Flags::StrutGCell = (1 << 8);
const unsigned int Flags::MatrixGCell = (1 << 9);
const unsigned int Flags::IoPadGCell = (1 << 10);
const unsigned int Flags::Saturated = (1 << 11);
// Flags for Anabatic objects states only.
const unsigned int Flags::DemoMode = (1 << 5);
const unsigned int Flags::WarnOnGCellOverload = (1 << 6);
@ -55,7 +54,7 @@ namespace Anabatic {
const unsigned int Flags::EndsMask = Source|Target;
const unsigned int Flags::DirectionMask = Horizontal|Vertical;
const unsigned int Flags::DestroyMask = DestroyGCell|DestroyBaseContact|DestroyBaseSegment;
const unsigned int Flags::GCellTypeMask = DeviceGCell|HChannelGCell|VChannelGCell|HStrutGCell|VStrutGCell|MatrixGCell|IoPadGCell;
const unsigned int Flags::GCellTypeMask = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell;
// Flags for functions arguments only.
const unsigned int Flags::Create = (1 << 5);
const unsigned int Flags::WithPerpands = (1 << 6);
@ -104,8 +103,7 @@ namespace Anabatic {
s += (_flags & DeviceGCell ) ? 'd' : '-';
s += (_flags & HChannelGCell) ? 'c' : '-';
s += (_flags & VChannelGCell) ? 'c' : '-';
s += (_flags & HStrutGCell ) ? 's' : '-';
s += (_flags & VStrutGCell ) ? 's' : '-';
s += (_flags & StrutGCell ) ? 's' : '-';
s += (_flags & MatrixGCell ) ? 'm' : '-';
s += ",";
s += (_flags & Invalidated ) ? 'i' : '-';

View File

@ -47,7 +47,7 @@ namespace Anabatic {
// Class : "Anabatic::Vertex".
DbU::Unit Vertex::unreached = std::numeric_limits<long>::max();
DbU::Unit Vertex::unreached = std::numeric_limits<long>::max();
DbU::Unit Vertex::unreachable = std::numeric_limits<long>::max()-1;
@ -116,10 +116,15 @@ namespace Anabatic {
DbU::Unit Dijkstra::_distance ( const Vertex* a, const Vertex* b, const Edge* e )
{
cdebug_log(112,0) << "Calcul _distance "<< endl;
cdebug_log(112,0) << "a: "<< b->hasRestrictions() << ", " << a << endl;
cdebug_log(112,0) << "b: "<< b->hasRestrictions() << ", " << b << endl;
DbU::Unit distance = a->getDistance() + e->getDistance();
if ( (a->isNotRestricted()) && (b->isNotRestricted()) ) { // A remplacer avec verification sur type IsDevice()?.
if (isRestricted(a, b)) distance = Vertex::unreachable;
if ( (a->hasRestrictions()) || (b->hasRestrictions()) ) {
if (isRestricted(a, b)) {
distance = Vertex::unreachable;
}
}
// Edge* aFrom = a->getFrom();
// if (aFrom) {
@ -213,14 +218,24 @@ namespace Anabatic {
vector<RoutingPad*> rps;
for ( Component* component : _net->getComponents() ) {
RoutingPad* rp = dynamic_cast<RoutingPad*>( component );
if (rp) { rps.push_back( rp ); continue; }
if (rp) {
rps.push_back( rp );
cerr << "rp to route: " << rp << endl;
continue;
}
}
for ( auto rp : rps ) {
Point center = rp->getBoundingBox().getCenter();
GCell* gcell = _anabatic->getGCellUnder( center );
cerr << "rp : " << rp << endl;
cerr << "gcell: " << gcell << endl;
if (gcell->isDevice()){
_searchArea.merge( _net->getCell()->getAbutmentBox() );
}
cdebug_log(112,0) << "| " << rp << " || " << gcell << endl;
cdebug_log(112,0) << "| " << rp << endl;
if (not gcell) {
cerr << Error( "Dijkstra::load(): %s\n"
@ -233,7 +248,9 @@ namespace Anabatic {
continue;
}
cdebug_log(112,0) << "Current Search area: " << _searchArea << ", gcell: " << gcell << endl;
_searchArea.merge( gcell->getBoundingBox() );
cdebug_log(112,0) << "New Search area: " << _searchArea << endl;
Vertex* seed = gcell->getObserver<Vertex>(GCell::Observable::Vertex);
if (seed->getConnexId() < 0) {
@ -348,7 +365,7 @@ namespace Anabatic {
_queue.dump();
Vertex* current = _queue.top();
cdebug_log(111,0) << "Current Vertex: " << current << endl;
cdebug_log(111,0) << "[Current Vertex]: " << current << endl;
_queue.pop();
if ((current->getConnexId() == _connectedsId) or (current->getConnexId() < 0)) {
@ -364,7 +381,7 @@ namespace Anabatic {
//if (not _searchArea.contains(vneighbor->getCenter())) {
if (not _searchArea.intersect(gneighbor->getBoundingBox())) {
cdebug_log(111,0) << "not _searchArea.contains(vneighbor->getCenter()):" << _searchArea << endl;
cdebug_log(111,0) << "not in _searchArea: " << _searchArea << ", gneighbor area: " << gneighbor->getBoundingBox() << endl;
continue;
}
@ -372,15 +389,26 @@ namespace Anabatic {
cdebug_log(111,0) << "+ Neighbor: " << vneighbor << endl;
DbU::Unit distance = _distanceCb( current, vneighbor, edge );
cdebug_log(111,0) << "Distance: " << distance << ", unreachable: " << Vertex::unreachable << endl;
if (vneighbor->getConnexId() == _connectedsId) continue;
if ( (distance < vneighbor->getDistance())
or ( (distance == vneighbor->getDistance())
and (current->getBranchId() > vneighbor->getBranchId())) ) {
if (vneighbor->getConnexId() == _connectedsId) {
cdebug_log(111,0) << "ConnectedsId" << endl;
continue;
}
if ( ( (distance < vneighbor->getDistance())
or ( (distance == vneighbor->getDistance())
and (current->getBranchId() > vneighbor->getBranchId()))
)
and (distance != Vertex::unreachable)
){
cdebug_log(111,0) << "1" << endl;
if (vneighbor->getDistance() != Vertex::unreached) {
cdebug_log(111,0) << "2" << endl;
_queue.erase( vneighbor );
} else {
cdebug_log(111,0) << "3" << endl;
if (not vneighbor->hasValidStamp()) {
vneighbor->setConnexId( -1 );
vneighbor->setStamp ( _stamp );
@ -512,6 +540,10 @@ namespace Anabatic {
if (aligneds.front()->isHorizontal()) {
if (sourceContact->getX() > targetContact->getX())
std::swap( sourceContact, targetContact );
if (sourceContact->getX() == targetContact->getX()){
cerr << "source Vertex: " << source << endl;
cerr << "target Vertex: " << source << endl;
}
segment = Horizontal::create( sourceContact
, targetContact
@ -523,6 +555,10 @@ namespace Anabatic {
} else {
if (sourceContact->getY() > targetContact->getY())
std::swap( sourceContact, targetContact );
if (sourceContact->getY() == targetContact->getY()){
cerr << "source Vertex: " << source << endl;
cerr << "target Vertex: " << source << endl;
}
segment = Vertical::create( sourceContact
, targetContact

File diff suppressed because it is too large Load Diff

View File

@ -34,12 +34,11 @@ namespace Anabatic {
// Flags for GCell objects states only.
static const unsigned int DeviceGCell ; // = (1 << 5);
static const unsigned int HChannelGCell ; // = (1 << 6);
static const unsigned int VChannelGCell ; // = (1 << 6);
static const unsigned int HStrutGCell ; // = (1 << 7);
static const unsigned int VStrutGCell ; // = (1 << 7);
static const unsigned int MatrixGCell ; // = (1 << 8);
static const unsigned int IoPadGCell ; // = (1 << 9);
static const unsigned int Saturated ; // = (1 << 10);
static const unsigned int VChannelGCell ; // = (1 << 7);
static const unsigned int StrutGCell ; // = (1 << 8);
static const unsigned int MatrixGCell ; // = (1 << 9);
static const unsigned int IoPadGCell ; // = (1 << 10);
static const unsigned int Saturated ; // = (1 << 11);
// Flags for Anabatic objects states only.
static const unsigned int DemoMode ; // = (1 << 5);
static const unsigned int WarnOnGCellOverload ; // = (1 << 6);
@ -57,7 +56,7 @@ namespace Anabatic {
static const unsigned int EndsMask ; // = Source|Target;
static const unsigned int DirectionMask ; // = Horizontal|Vertical;
static const unsigned int DestroyMask ; // = DestroyGCell|DestroyBaseContact|DestroyBaseSegment;
static const unsigned int GCellTypeMask ; // = DeviceGCell|HChannelGCell|VChannelGCell|HStrutGCell|VStrutGCell|MatrixGCell|IoPadGCell;
static const unsigned int GCellTypeMask ; // = DeviceGCell|HChannelGCell|VChannelGCell|StrutGCell|MatrixGCell|IoPadGCell;
// Flags for functions arguments only.
static const unsigned int Create ; // = (1 << 5);
static const unsigned int WithPerpands ;

View File

@ -100,7 +100,7 @@ namespace Anabatic {
inline bool isSRestricted () const;
inline bool isERestricted () const;
inline bool isWRestricted () const;
inline bool isNotRestricted() const;
inline bool hasRestrictions() const;
inline void setRestricted ();
inline void clearRestriction ();
@ -190,7 +190,7 @@ namespace Anabatic {
inline bool Vertex::isSRestricted () const { return (_flags & SRestricted); }
inline bool Vertex::isERestricted () const { return (_flags & ERestricted); }
inline bool Vertex::isWRestricted () const { return (_flags & WRestricted); }
inline bool Vertex::isNotRestricted () const { return ((!_flags) & 0xF); }
inline bool Vertex::hasRestrictions () const { return ( isNRestricted()||isSRestricted()||isERestricted()||isWRestricted()) ; }
inline void Vertex::setRestricted () { _flags |= 0xF; }
inline void Vertex::clearRestriction () { _flags &= ~(0xF); }

View File

@ -138,8 +138,7 @@ namespace Anabatic {
inline bool isDevice () const;
inline bool isHChannel () const;
inline bool isVChannel () const;
inline bool isHStrut () const;
inline bool isVStrut () const;
inline bool isStrut () const;
inline bool isMatrix () const;
inline bool isIoPad () const;
bool isWest ( GCell* ) const;
@ -305,8 +304,7 @@ namespace Anabatic {
inline bool GCell::isDevice () const { return _flags & Flags::DeviceGCell; }
inline bool GCell::isHChannel () const { return _flags & Flags::HChannelGCell; }
inline bool GCell::isVChannel () const { return _flags & Flags::VChannelGCell; }
inline bool GCell::isHStrut () const { return _flags & Flags::HStrutGCell; }
inline bool GCell::isVStrut () const { return _flags & Flags::VStrutGCell; }
inline bool GCell::isStrut () const { return _flags & Flags::StrutGCell; }
inline bool GCell::isMatrix () const { return _flags & Flags::MatrixGCell; }
inline bool GCell::isIoPad () const { return _flags & Flags::IoPadGCell; }
inline bool GCell::isSaturated () const { return _flags & Flags::Saturated; }