Work for Nets with 2 or less RoutingPads. Further analysis for bigger nets

This commit is contained in:
HoangAnhP 2022-06-09 17:15:06 +02:00
parent 0864db6c2f
commit 3bd38f4363
4 changed files with 46 additions and 19 deletions

View File

@ -1,5 +1,6 @@
#include "Seabreeze/Seabreeze.h" #include "Seabreeze/Seabreeze.h"
#include "hurricane/Net.h" #include "hurricane/Net.h"
#include "hurricane/Segment.h"
namespace Seabreeze { namespace Seabreeze {
@ -10,6 +11,7 @@ namespace Seabreeze {
using Hurricane::Instance; using Hurricane::Instance;
using Hurricane::PrivateProperty; using Hurricane::PrivateProperty;
using Hurricane::Component; using Hurricane::Component;
using Hurricane::Segment;
//--------------------------------------------------------- //---------------------------------------------------------
// Class : "Elmore" // Class : "Elmore"
@ -17,7 +19,7 @@ namespace Seabreeze {
Elmore::Elmore ( Net* net ) Elmore::Elmore ( Net* net )
: _conts() : _conts()
, checker() , checker()
, _tree() , _tree(new Tree())
{} {}
Elmore::~Elmore () Elmore::~Elmore ()
@ -29,6 +31,8 @@ namespace Seabreeze {
for ( RoutingPad* rp : net->getRoutingPads() ) { for ( RoutingPad* rp : net->getRoutingPads() ) {
for ( Component* c : rp->getSlaveComponents() ) { for ( Component* c : rp->getSlaveComponents() ) {
Contact* ct = dynamic_cast<Contact*>(c); Contact* ct = dynamic_cast<Contact*>(c);
if ( not ct ) continue; if ( not ct ) continue;
@ -68,7 +72,11 @@ namespace Seabreeze {
void Elmore::build_from_node ( Node* s ) void Elmore::build_from_node ( Node* s )
{ {
if ( s->_contact == nullptr || find(_conts.begin(), _conts.end(), s->_contact) == _conts.end() ) { //-----------------------------------------------------------------------
cerr << "Elmore::build_from_node" << endl;
//-----------------------------------------------------------------------
if ( s->_contact == nullptr ) {
cerr << "No contact found" << s->_contact << endl;
return; return;
} }
@ -77,26 +85,35 @@ namespace Seabreeze {
// To check for circle // To check for circle
checker.insert(s->_contact); checker.insert(s->_contact);
for ( Component* c : (s->_contact)->getSlaveComponents() ) { for ( Component* comp : (s->_contact)->getSlaveComponents() ) {
Contact* ccont = dynamic_cast<Contact*>(c);
Segment* seg = dynamic_cast<Segment*>(comp);
//-----------------------------------------
cerr << "Segment : " << seg << endl;
//-----------------------------------------
if ( not seg ) continue;
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
//----------------------------------------------------------------
cerr << ccont << endl;
//----------------------------------------------------------------
if ( not ccont ) if ( not ccont )
continue; continue;
else{ else{
if ( find( _conts.begin(), _conts.end(), ccont) != _conts.end() ) {
if ( find( checker.begin(), checker.end(), ccont) != checker.end() ) { if ( find( checker.begin(), checker.end(), ccont) != checker.end() ) {
cerr << "Net contains a circle. Cannot apply Elmore's delay here !" << endl; cerr << "Net contains a circle. Cannot apply Elmore's delay here !" << endl;
return; return;
} }
else { else {
if ( ccont != (s->Np)->_contact ) { //-----------------------------------------------------------------------
cerr << "Contact found in the net" << endl;
//-----------------------------------------------------------------------
if ( not s->Np || ccont != (s->Np)->_contact ) {
Node* node = new Node( s, ccont ); Node* node = new Node( s, ccont );
build_from_node(node); build_from_node(node);
} }
} }
}
} }
} }
} }

View File

@ -30,20 +30,27 @@ namespace Seabreeze {
class Elmore { class Elmore {
public: public:
Elmore ( Net* net = NULL ); Elmore ( Net* net = NULL );
~Elmore (); ~Elmore ();
void contFromNet ( Net* net ); void contFromNet ( Net* net );
void buildTree ( RoutingPad* rp ); void buildTree ( RoutingPad* rp );
void build_from_node ( Node* source ); void build_from_node ( Node* source );
void clearTree (); void clearTree ();
Tree* getTree (); Tree* getTree ();
int delayElmore ( RoutingPad* rp ); inline const set<Contact*>& get_conts () const;
void toTREE ( ostream& ) const; int delayElmore ( RoutingPad* rp );
void toTREE ( ostream& ) const;
private: private:
set<Contact*> _conts; set<Contact*> _conts;
set<Contact*> checker; set<Contact*> checker;
Tree* _tree; Tree* _tree;
}; };
inline const set<Contact*>& Elmore::get_conts () const
{
return _conts;
}
//--------------------------------------------------------- //---------------------------------------------------------
// Class : Seabreeze::ElmoreProperty // Class : Seabreeze::ElmoreProperty

View File

@ -15,7 +15,7 @@ using Hurricane::Contact;
using Hurricane::RoutingPad; using Hurricane::RoutingPad;
using Hurricane::Component; using Hurricane::Component;
class Tree{ class Tree {
public: public:
Tree (); Tree ();
~Tree (); ~Tree ();

View File

@ -107,6 +107,9 @@ namespace Seabreeze {
Elmore* elm = ElmoreProperty::create(net)->getElmore(); Elmore* elm = ElmoreProperty::create(net)->getElmore();
elm->contFromNet(net); elm->contFromNet(net);
//-------------------------------------------------------------------------
cerr << "There are : " << (elm->get_conts()).size() << " contacts" << endl;
//-------------------------------------------------------------------------
elm->buildTree(driver); elm->buildTree(driver);
cerr << "Tree built succesfully !" << endl; cerr << "Tree built succesfully !" << endl;
} }