From b65821282c9bbf2149a3c3d6980820eee02a8039 Mon Sep 17 00:00:00 2001 From: HoangAnhP Date: Thu, 21 Jul 2022 11:44:44 +0200 Subject: [PATCH] Seabreeze : optimise with new attribute of Node + fix wrong formula of Elmore's delay --- Seabreeze/src/Node.cpp | 4 ++-- Seabreeze/src/SeabreezeEngine.cpp | 4 ++-- Seabreeze/src/Tree.cpp | 20 ++++++++++---------- Seabreeze/src/seabreeze/Tree.h | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Seabreeze/src/Node.cpp b/Seabreeze/src/Node.cpp index 3e99caae..c783e581 100644 --- a/Seabreeze/src/Node.cpp +++ b/Seabreeze/src/Node.cpp @@ -27,7 +27,7 @@ namespace Seabreeze { , _parent (nullptr) , _childs () , _contact(nullptr) - , _label (-1) + , _label (0) , _ap (0) { } @@ -39,7 +39,7 @@ namespace Seabreeze { , _parent (parent) , _childs () , _contact(contact) - , _label (-1) + , _label (0) , _ap (0) { if (parent) parent->addChild( this ); diff --git a/Seabreeze/src/SeabreezeEngine.cpp b/Seabreeze/src/SeabreezeEngine.cpp index 037e9a2c..bd88ff46 100644 --- a/Seabreeze/src/SeabreezeEngine.cpp +++ b/Seabreeze/src/SeabreezeEngine.cpp @@ -144,7 +144,7 @@ namespace Seabreeze { continue; } cdebug_log(199,0) << "| Elmore's delay: " << elmore->delayElmore(rp) << " " << rp << endl; -/* + Contact* ct = nullptr; for ( Component* comp : rp->getSlaveComponents() ) { Contact* cont = dynamic_cast(comp); @@ -154,8 +154,8 @@ namespace Seabreeze { } } cerr << "| Elmore's delay: " << elmore->delayElmore(rp) << " " << ct << endl; + } -*/ cdebug_tabw(199,-1); DebugSession::close(); } diff --git a/Seabreeze/src/Tree.cpp b/Seabreeze/src/Tree.cpp index f72d3d24..ff00e89f 100644 --- a/Seabreeze/src/Tree.cpp +++ b/Seabreeze/src/Tree.cpp @@ -58,7 +58,6 @@ namespace Seabreeze { void Tree::addNode ( Node* node ) { - node->setLabel( _nodes.size() ); if (find(_nodes.begin(), _nodes.end(), node) == _nodes.end()) _nodes.push_back( node ); } @@ -74,15 +73,18 @@ namespace Seabreeze { } - set Tree::getParents ( Contact* contact ) + void Tree::getBranch ( Contact* contact ) { - set parents; + for ( Node* n : _nodes ) { + n->setLabel(0); + } + Node *ni = getNode( contact ); + ni->setLabel(1); while ( ni->parent() ) { - parents.insert( ni->parent() ); + ni->parent()->setLabel(1); ni = ni->parent(); } - return parents; } @@ -113,18 +115,17 @@ namespace Seabreeze { cdebug_log(199,0) << " rp=" << rp << endl; cdebug_log(199,0) << " sink=" << sink << endl; - set br = getParents( sink ); + getBranch( sink ); Node* ni = getNode( sink ); markNodeAfter( ni ); ni->setAp( 0 ); - // Compute Rt of all nodes for ( size_t k = 0; k < _nodes.size(); k++ ) { if (k == 0) _nodes[k]->setRt( _nodes[k]->R() ); else { if (_nodes[k]->ap() == 0) { - if (br.count(_nodes[k]) > 0) { + if (_nodes[k]->label() == 1) { _nodes[k]->setRt( _nodes[k]->parent()->Rt() + _nodes[k]->R() ); } else { _nodes[k]->setRt( _nodes[k]->parent()->Rt() ); @@ -133,8 +134,7 @@ namespace Seabreeze { _nodes[k]->setRt( ni->Rt() ); } } - } - + } // Compute Elmore delay time double delay = 0.0; for ( size_t k = 0; k < _nodes.size(); k++ ) { diff --git a/Seabreeze/src/seabreeze/Tree.h b/Seabreeze/src/seabreeze/Tree.h index 94e7c62f..16b3aa3e 100644 --- a/Seabreeze/src/seabreeze/Tree.h +++ b/Seabreeze/src/seabreeze/Tree.h @@ -31,7 +31,7 @@ namespace Seabreeze { using Hurricane::Component; -//---------------------------------------------------------- +//--------------------------------------------------------- // Class : Seabreeze::Tree. class Tree { @@ -44,7 +44,7 @@ namespace Seabreeze { void newNode (); void addNode ( Node* ); void markNodeAfter ( Node* ); - std::set getParents ( Contact* ); + void getBranch ( Contact* ); double computeElmoreDelay ( RoutingPad* ); void printNode ( std::ostream& , Node* , size_t depth ); void print ( std::ostream& ); @@ -54,7 +54,7 @@ namespace Seabreeze { }; - inline size_t Tree::getN () { return _nodes.size(); } + inline size_t Tree::getN () { return _nodes.size(); } inline const std::vector& Tree::getNodeList () const { return _nodes; }