From da423ab308362f60a4b78a0cc325509d1e3be5ba Mon Sep 17 00:00:00 2001 From: EricLaoGitHub Date: Mon, 20 Jun 2016 18:36:00 +0200 Subject: [PATCH] in CMakeLists: - (Add) HurricaneAMS includes in Dijkstra: - (Add+Modify) Handle restriction rules in Vertex for analog devices in GCell: - (Add) Check neighboring cells (North/South/East/West) --- anabatic/CMakeLists.txt | 1 + anabatic/src/CMakeLists.txt | 2 ++ anabatic/src/Dijkstra.cpp | 36 ++++++++++++++++++++++++++++++-- anabatic/src/GCell.cpp | 8 +++---- anabatic/src/anabatic/Dijkstra.h | 28 ++++++++++++++++++++++++- 5 files changed, 68 insertions(+), 7 deletions(-) diff --git a/anabatic/CMakeLists.txt b/anabatic/CMakeLists.txt index 4187e409..e2baa825 100644 --- a/anabatic/CMakeLists.txt +++ b/anabatic/CMakeLists.txt @@ -22,6 +22,7 @@ find_package(VLSISAPD REQUIRED) find_package(HURRICANE REQUIRED) find_package(CORIOLIS REQUIRED) + find_package(HURRICANEAMS REQUIRED) add_subdirectory(src) add_subdirectory(cmake_modules) diff --git a/anabatic/src/CMakeLists.txt b/anabatic/src/CMakeLists.txt index e666a39a..999f55e9 100644 --- a/anabatic/src/CMakeLists.txt +++ b/anabatic/src/CMakeLists.txt @@ -11,6 +11,7 @@ endif ( CHECK_DETERMINISM ) ${Boost_INCLUDE_DIRS} ${QtX_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH} + ${HURRICANEAMS_INCLUDE_DIR} ) set( includes anabatic/Constants.h anabatic/Configuration.h @@ -55,6 +56,7 @@ endif ( CHECK_DETERMINISM ) ${Boost_LIBRARIES} ${LIBXML2_LIBRARIES} ${PYTHON_LIBRARIES} -lutil + ${HURRICANEAMS_LIBRARIES} ) add_library( anabatic ${cpps} ${mocCpps} ) diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index a9f5ac15..4c4975e4 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -47,6 +47,7 @@ namespace Anabatic { DbU::Unit Vertex::unreached = std::numeric_limits::max(); + DbU::Unit Vertex::unreachable = std::numeric_limits::max()-1; bool Vertex::hasValidStamp () const @@ -64,10 +65,14 @@ namespace Anabatic { + " @(" + DbU::getValueString(_gcell->getXMin()) + "," + DbU::getValueString(_gcell->getYMin()) + ")" + " connexId:" + getString(_connexId) - + " d:" + ((_distance == unreached) ? "unreached" : DbU::getValueString(_distance) ) + + " d:" + ((_distance == unreached) ? "unreached" : ((_distance == unreachable) ? "unreachable" : DbU::getValueString(_distance)) ) + "+" + getString(_branchId) + " stamp:" + (hasValidStamp() ? "valid" : "outdated") + " from:" + ((_from) ? "set" : "NULL") + + " restricted:" + (isNRestricted() ? "N" : "-") + + (isSRestricted() ? "S" : "-") + + (isERestricted() ? "E" : "-") + + (isWRestricted() ? "W" : "-") + ">"; return s; } @@ -107,6 +112,9 @@ namespace Anabatic { { 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; + } // Edge* aFrom = a->getFrom(); // if (aFrom) { // distance += (aFrom->isHorizontal() xor e->isHorizontal()) ? 3.0 : 0.0; @@ -115,7 +123,7 @@ namespace Anabatic { } - bool Dijkstra::isRestricted ( const Vertex* v1, const Vertex* v2 ) const + bool Dijkstra::isRestricted ( const Vertex* v1, const Vertex* v2 ) { bool restricted = true; GCell* c1 = v1->getGCell(); @@ -222,8 +230,32 @@ namespace Anabatic { vertex->setBranchId( 0 ); vertex->setFrom ( NULL ); _targets.insert( vertex ); + vertex->clearRestriction(); cdebug_log(112,0) << "Add Vertex: " << vertex << endl; } + // Analog Restrictions + Plug* plug = dynamic_cast(rp->getPlugOccurrence().getEntity()); + Cell* cell = plug->getInstance()->getMasterCell(); + Device* dev = dynamic_cast(cell); + TransistorFamily* tf = dynamic_cast(dev); + + if (tf){ + Transistor* t = dynamic_cast(tf); + SimpleCurrentMirror* scm = dynamic_cast(tf); + DifferentialPair* dp = dynamic_cast(tf); + CommonSourcePair* csp = dynamic_cast(tf); + + unsigned int rule = 0; + if (t) { rule = t->getRestriction(plug->getMasterNet()); + } else if (scm) { rule = scm->getRestriction(plug->getMasterNet()); + } else if (dp) { rule = dp->getRestriction(plug->getMasterNet()); + } else if (csp) { rule = csp->getRestriction(plug->getMasterNet()); + } + if (!(rule&0x3 )) vertex->setWRestricted(); + if (!(rule&0xC )) vertex->setERestricted(); + if (!(rule&0x30)) vertex->setSRestricted(); + if (!(rule&0xC0)) vertex->setNRestricted(); + } Contact* gcontact = vertex->getGContact( _net ); rp->getBodyHook()->detach(); diff --git a/anabatic/src/GCell.cpp b/anabatic/src/GCell.cpp index bd7eab55..df23bf34 100644 --- a/anabatic/src/GCell.cpp +++ b/anabatic/src/GCell.cpp @@ -577,7 +577,7 @@ namespace Anabatic { { bool found = false; for (vector::const_iterator it = _northEdges.begin(); it != _northEdges.end(); it++){ - if ( (*it)->getOpposite(this)->getId() == getId() ) { + if ( (*it)->getOpposite(this)->getId() == c->getId() ) { found = true; break; } @@ -590,7 +590,7 @@ namespace Anabatic { { bool found = false; for (vector::const_iterator it = _southEdges.begin(); it != _southEdges.end(); it++){ - if ( (*it)->getOpposite(this)->getId() == getId() ) { + if ( (*it)->getOpposite(this)->getId() == c->getId() ) { found = true; break; } @@ -603,7 +603,7 @@ namespace Anabatic { { bool found = false; for (vector::const_iterator it = _eastEdges.begin(); it != _eastEdges.end(); it++){ - if ( (*it)->getOpposite(this)->getId() == getId() ) { + if ( (*it)->getOpposite(this)->getId() == c->getId() ) { found = true; break; } @@ -616,7 +616,7 @@ namespace Anabatic { { bool found = false; for (vector::const_iterator it = _westEdges.begin(); it != _westEdges.end(); it++){ - if ( (*it)->getOpposite(this)->getId() == getId() ) { + if ( (*it)->getOpposite(this)->getId() == c->getId() ) { found = true; break; } diff --git a/anabatic/src/anabatic/Dijkstra.h b/anabatic/src/anabatic/Dijkstra.h index b94e1907..70d2df8e 100644 --- a/anabatic/src/anabatic/Dijkstra.h +++ b/anabatic/src/anabatic/Dijkstra.h @@ -25,6 +25,11 @@ namespace Hurricane { class RoutingPad; } #include "anabatic/GCell.h" +#include "hurricaneAMS/analogic/Device.h" +#include "hurricaneAMS/devices/Transistor.h" +#include "hurricaneAMS/devices/SimpleCurrentMirror.h" +#include "hurricaneAMS/devices/DifferentialPair.h" +#include "hurricaneAMS/devices/CommonSourcePair.h" namespace Anabatic { @@ -34,6 +39,7 @@ namespace Anabatic { using Hurricane::Observer; using Hurricane::Net; using Hurricane::RoutingPad; + using Hurricane::Plug; class AnabaticEngine; @@ -55,6 +61,7 @@ namespace Anabatic { }; public: static DbU::Unit unreached; + static DbU::Unit unreachable; public: static void notify ( Vertex*, unsigned flags ); public: @@ -90,6 +97,15 @@ namespace Anabatic { inline bool isSRestricted () const; inline bool isERestricted () const; inline bool isWRestricted () const; + inline bool isNotRestricted() const; + + inline void setRestricted (); + inline void clearRestriction (); + inline void setNRestricted (); + inline void setSRestricted (); + inline void setERestricted (); + inline void setWRestricted (); + inline unsigned int getFlags () const; // Inspector support. string _getString () const; @@ -105,6 +121,7 @@ namespace Anabatic { int _stamp; DbU::Unit _distance; Edge* _from; + unsigned int _flags; }; @@ -157,6 +174,15 @@ 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 void Vertex::setRestricted () { _flags |= 0xF; } + inline void Vertex::clearRestriction () { _flags &= ~(0xF); } + inline void Vertex::setNRestricted () { _flags |= 0x1; } + inline void Vertex::setSRestricted () { _flags |= 0x2; } + inline void Vertex::setERestricted () { _flags |= 0x4; } + inline void Vertex::setWRestricted () { _flags |= 0x8; } + inline unsigned int Vertex::getFlags () const { return _flags; } // ------------------------------------------------------------------- @@ -262,7 +288,7 @@ namespace Anabatic { void _selectFirstSource (); void _toWires (); - bool isRestricted ( const Vertex* v1, const Vertex* v2 ) const; + static bool isRestricted ( const Vertex* v1, const Vertex* v2 ); private: AnabaticEngine* _anabatic; vector _vertexes;