Add net driver detection in Dijkstra (just a check for now).
This commit is contained in:
parent
2b0a2c88b7
commit
79e47d1ef2
|
@ -19,6 +19,7 @@
|
||||||
#include "hurricane/Error.h"
|
#include "hurricane/Error.h"
|
||||||
#include "hurricane/Warning.h"
|
#include "hurricane/Warning.h"
|
||||||
#include "hurricane/Net.h"
|
#include "hurricane/Net.h"
|
||||||
|
#include "hurricane/Pin.h"
|
||||||
#include "hurricane/RoutingPad.h"
|
#include "hurricane/RoutingPad.h"
|
||||||
#include "hurricane/Horizontal.h"
|
#include "hurricane/Horizontal.h"
|
||||||
#include "hurricane/Vertical.h"
|
#include "hurricane/Vertical.h"
|
||||||
|
@ -42,6 +43,7 @@ namespace Anabatic {
|
||||||
using Hurricane::Error;
|
using Hurricane::Error;
|
||||||
using Hurricane::Warning;
|
using Hurricane::Warning;
|
||||||
using Hurricane::Component;
|
using Hurricane::Component;
|
||||||
|
using Hurricane::Pin;
|
||||||
using Hurricane::Segment;
|
using Hurricane::Segment;
|
||||||
using Hurricane::Horizontal;
|
using Hurricane::Horizontal;
|
||||||
using Hurricane::Vertical;
|
using Hurricane::Vertical;
|
||||||
|
@ -1546,7 +1548,6 @@ namespace Anabatic {
|
||||||
|
|
||||||
cdebug_log(112,0) << "@ frp:" << rp << endl;
|
cdebug_log(112,0) << "@ frp:" << rp << endl;
|
||||||
rps.push_back( rp );
|
rps.push_back( rp );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1555,14 +1556,16 @@ namespace Anabatic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t driverCount = 0;
|
||||||
for ( auto rp : rps ) {
|
for ( auto rp : rps ) {
|
||||||
if (not _anabatic->getConfiguration()->selectRpComponent(rp))
|
if (not _anabatic->getConfiguration()->selectRpComponent(rp))
|
||||||
cerr << Warning( "Dijktra::load(): %s has no components on grid.", getString(rp).c_str() ) << endl;
|
cerr << Warning( "Dijktra::load(): %s has no components on grid.", getString(rp).c_str() ) << endl;
|
||||||
|
|
||||||
cdebug_log(112,0) << "@ rp: " << rp << ", getCenter(): " << rp->getBoundingBox().getCenter() << endl;
|
cdebug_log(112,0) << "@ rp: " << rp << ", getCenter(): " << rp->getBoundingBox().getCenter() << endl;
|
||||||
Point center = rp->getBoundingBox().getCenter();
|
Point center = rp->getBoundingBox().getCenter();
|
||||||
GCell* gcell = _anabatic->getGCellUnder( center );
|
GCell* gcell = _anabatic->getGCellUnder( center );
|
||||||
Box bb = rp->getBoundingBox();
|
Box bb = rp->getBoundingBox();
|
||||||
|
bool isDriver = false;
|
||||||
|
|
||||||
cdebug_log(112,0) << bb.getXMin() << " " << bb.getXMax() << endl;
|
cdebug_log(112,0) << bb.getXMin() << " " << bb.getXMax() << endl;
|
||||||
cdebug_log(112,0) << "center X:" << center.getX() << " gcell Xmax:" << gcell->getXMax() << endl;
|
cdebug_log(112,0) << "center X:" << center.getX() << " gcell Xmax:" << gcell->getXMax() << endl;
|
||||||
|
@ -1580,6 +1583,29 @@ namespace Anabatic {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Net* rpNet = NULL;
|
||||||
|
Plug* plug = dynamic_cast<Plug*>( rp->getPlugOccurrence().getEntity() );
|
||||||
|
if (plug) {
|
||||||
|
rpNet = plug->getMasterNet();
|
||||||
|
if (rpNet->getDirection() & Net::Direction::DirOut) {
|
||||||
|
cdebug_log(112,0) << "Driver/cell: " << rp << endl;
|
||||||
|
cdebug_log(112,0) << "masterNet: " << rpNet << endl;
|
||||||
|
++driverCount;
|
||||||
|
isDriver = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Pin* pin = dynamic_cast<Pin*>( rp->getPlugOccurrence().getEntity() );
|
||||||
|
if (pin) {
|
||||||
|
rpNet = pin->getNet();
|
||||||
|
if (rpNet->getDirection() & Net::Direction::DirIn) {
|
||||||
|
cdebug_log(112,0) << "Driver/pin: " << rp << endl;
|
||||||
|
cdebug_log(112,0) << "masterNet: " << rpNet << endl;
|
||||||
|
++driverCount;
|
||||||
|
isDriver = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_searchArea.merge( gcell->getBoundingBox() ); // TO CHANGE
|
_searchArea.merge( gcell->getBoundingBox() ); // TO CHANGE
|
||||||
cdebug_log(112,0) << "| Merged search area: " << _searchArea << ", gcell: " << gcell << endl;
|
cdebug_log(112,0) << "| Merged search area: " << _searchArea << ", gcell: " << gcell << endl;
|
||||||
|
|
||||||
|
@ -1604,6 +1630,8 @@ namespace Anabatic {
|
||||||
vertex->setDegree ( 0 );
|
vertex->setDegree ( 0 );
|
||||||
vertex->setRpCount ( 0 );
|
vertex->setRpCount ( 0 );
|
||||||
vertex->setFrom ( NULL );
|
vertex->setFrom ( NULL );
|
||||||
|
if (isDriver)
|
||||||
|
vertex->setDriver( true );
|
||||||
|
|
||||||
vertex->setFrom2 ( NULL);
|
vertex->setFrom2 ( NULL);
|
||||||
vertex->unsetFlags ( Vertex::UseFromFrom2 );
|
vertex->unsetFlags ( Vertex::UseFromFrom2 );
|
||||||
|
@ -1629,6 +1657,17 @@ namespace Anabatic {
|
||||||
rp->getBodyHook()->attach( vcontact->getBodyHook() );
|
rp->getBodyHook()->attach( vcontact->getBodyHook() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (driverCount == 0) {
|
||||||
|
cerr << Error( "Diskstra::load(): Net \"%s\" do not have a driver.\n"
|
||||||
|
, getString(_net->getName()).c_str()
|
||||||
|
) << endl;
|
||||||
|
}
|
||||||
|
if (driverCount > 1) {
|
||||||
|
cerr << Error( "Diskstra::load(): Net \"%s\" have multiple drivers (%u).\n"
|
||||||
|
, getString(_net->getName()).c_str(), driverCount
|
||||||
|
) << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (state and state->isSymmetric() and not state->isSelfSym() and state->isSymMaster()) {
|
if (state and state->isSymmetric() and not state->isSelfSym() and state->isSymMaster()) {
|
||||||
if (state->isSymVertical()) {
|
if (state->isSymVertical()) {
|
||||||
if ( (_searchArea.getXMin() < state->getSymAxis())
|
if ( (_searchArea.getXMin() < state->getSymAxis())
|
||||||
|
@ -1805,8 +1844,15 @@ namespace Anabatic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex* firstSource = NULL;
|
Vertex* firstSource = NULL;
|
||||||
|
VertexSet drivers;
|
||||||
|
|
||||||
|
for ( Vertex* vertex : _targets ) {
|
||||||
|
if (vertex->isDriver()) drivers.insert( vertex );
|
||||||
|
}
|
||||||
|
if (drivers.empty()) drivers = _targets;
|
||||||
|
|
||||||
|
#if THIS_IS_DISABLED
|
||||||
if (_mode & Mode::Monotonic) {
|
if (_mode & Mode::Monotonic) {
|
||||||
if (_targets.size() == 2) {
|
if (_targets.size() == 2) {
|
||||||
auto ivertex = _targets.begin();
|
auto ivertex = _targets.begin();
|
||||||
|
@ -1823,24 +1869,25 @@ namespace Anabatic {
|
||||||
_mode = Mode::Standart;
|
_mode = Mode::Standart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (not firstSource) {
|
if (not firstSource) {
|
||||||
// Standart routing.
|
// Standart routing.
|
||||||
bool hasDevice = false;
|
bool hasDevice = false;
|
||||||
for ( Vertex* ivertex : _targets ) {
|
for ( Vertex* vertex : drivers ) {
|
||||||
if (ivertex->getGCell()->isDevice()) hasDevice = true;
|
if (vertex->getGCell()->isDevice()) hasDevice = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point areaCenter;
|
Point areaCenter;
|
||||||
if (hasDevice) areaCenter = _getPonderedPoint();
|
if (hasDevice) areaCenter = _getPonderedPoint();
|
||||||
else areaCenter = _searchArea.getCenter();
|
else areaCenter = _searchArea.getCenter();
|
||||||
|
|
||||||
auto ivertex = _targets.begin();
|
auto ivertex = drivers.begin();
|
||||||
|
|
||||||
firstSource = *ivertex++;
|
firstSource = *ivertex++;
|
||||||
DbU::Unit minDistance = areaCenter.manhattanDistance( firstSource->getCenter() );
|
DbU::Unit minDistance = areaCenter.manhattanDistance( firstSource->getCenter() );
|
||||||
|
|
||||||
for ( ; ivertex != _targets.end() ; ++ivertex ) {
|
for ( ; ivertex != drivers.end() ; ++ivertex ) {
|
||||||
DbU::Unit distance = areaCenter.manhattanDistance( (*ivertex)->getCenter() );
|
DbU::Unit distance = areaCenter.manhattanDistance( (*ivertex)->getCenter() );
|
||||||
if (distance < minDistance) {
|
if (distance < minDistance) {
|
||||||
minDistance = distance;
|
minDistance = distance;
|
||||||
|
|
|
@ -187,6 +187,7 @@ namespace Anabatic {
|
||||||
, iHorizontal = (1<<7)
|
, iHorizontal = (1<<7)
|
||||||
, iVertical = (1<<8)
|
, iVertical = (1<<8)
|
||||||
, iSet = (1<<9)
|
, iSet = (1<<9)
|
||||||
|
, Driver = (1<<10)
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
static DbU::Unit unreached;
|
static DbU::Unit unreached;
|
||||||
|
@ -198,6 +199,7 @@ namespace Anabatic {
|
||||||
inline Vertex ( GCell* );
|
inline Vertex ( GCell* );
|
||||||
//inline Vertex ( size_t id );
|
//inline Vertex ( size_t id );
|
||||||
inline ~Vertex ();
|
inline ~Vertex ();
|
||||||
|
inline bool isDriver () const;
|
||||||
inline bool isAnalog () const;
|
inline bool isAnalog () const;
|
||||||
inline bool hasDoneAllRps () const;
|
inline bool hasDoneAllRps () const;
|
||||||
inline Contact* hasGContact ( Net* ) const;
|
inline Contact* hasGContact ( Net* ) const;
|
||||||
|
@ -218,6 +220,7 @@ namespace Anabatic {
|
||||||
Edge* getFrom () const;
|
Edge* getFrom () const;
|
||||||
inline Vertex* getPredecessor () const;
|
inline Vertex* getPredecessor () const;
|
||||||
inline Vertex* getNeighbor ( Edge* ) const;
|
inline Vertex* getNeighbor ( Edge* ) const;
|
||||||
|
inline void setDriver ( bool state );
|
||||||
inline void setDistance ( DbU::Unit );
|
inline void setDistance ( DbU::Unit );
|
||||||
inline void setStamp ( int );
|
inline void setStamp ( int );
|
||||||
inline void setConnexId ( int );
|
inline void setConnexId ( int );
|
||||||
|
@ -331,6 +334,7 @@ namespace Anabatic {
|
||||||
|
|
||||||
inline Vertex* Vertex::lookup ( GCell* gcell ) { return gcell->getObserver<Vertex>(GCell::Observable::Vertex); }
|
inline Vertex* Vertex::lookup ( GCell* gcell ) { return gcell->getObserver<Vertex>(GCell::Observable::Vertex); }
|
||||||
inline Vertex::~Vertex () { _gcell->setObserver( GCell::Observable::Vertex, NULL ); }
|
inline Vertex::~Vertex () { _gcell->setObserver( GCell::Observable::Vertex, NULL ); }
|
||||||
|
inline bool Vertex::isDriver () const { return _flags & Driver; }
|
||||||
inline bool Vertex::isAnalog () const { return _gcell->isAnalog(); }
|
inline bool Vertex::isAnalog () const { return _gcell->isAnalog(); }
|
||||||
inline Box Vertex::getBoundingBox () const { return _gcell->getBoundingBox(); }
|
inline Box Vertex::getBoundingBox () const { return _gcell->getBoundingBox(); }
|
||||||
inline Edges Vertex::getEdges ( Flags sides ) const { return _gcell->getEdges(sides); }
|
inline Edges Vertex::getEdges ( Flags sides ) const { return _gcell->getEdges(sides); }
|
||||||
|
@ -367,6 +371,12 @@ namespace Anabatic {
|
||||||
return (gcell) ? gcell->getObserver<Vertex>(GCell::Observable::Vertex) : NULL;
|
return (gcell) ? gcell->getObserver<Vertex>(GCell::Observable::Vertex) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void Vertex::setDriver ( bool state )
|
||||||
|
{
|
||||||
|
if (state) _flags |= Driver;
|
||||||
|
else _flags &= ~Driver;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool Vertex::CompareById::operator() ( const Vertex* lhs, const Vertex* rhs ) const
|
inline bool Vertex::CompareById::operator() ( const Vertex* lhs, const Vertex* rhs ) const
|
||||||
{ return lhs->getId() < rhs->getId(); }
|
{ return lhs->getId() < rhs->getId(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue