Seabreeze : Step 1 - Building Tree is done. Going to step 2 - Compute RC
This commit is contained in:
parent
9b59c50efc
commit
d9db42447d
|
@ -49,7 +49,7 @@ namespace Seabreeze {
|
||||||
for ( Component* c : rp->getSlaveComponents() ) {
|
for ( Component* c : rp->getSlaveComponents() ) {
|
||||||
Contact* cont = dynamic_cast<Contact*>(c);
|
Contact* cont = dynamic_cast<Contact*>(c);
|
||||||
|
|
||||||
if ( cont ) {//&& find(_conts.begin(), _conts.end(), cont) != _conts.end() ) {
|
if ( cont ) {
|
||||||
ct = cont;
|
ct = cont;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace Seabreeze {
|
||||||
cerr << "Start building tree..." << endl;
|
cerr << "Start building tree..." << endl;
|
||||||
|
|
||||||
Node* s = new Node(nullptr, ct);
|
Node* s = new Node(nullptr, ct);
|
||||||
// build_from_node(s);
|
|
||||||
Segment* seg = nullptr;
|
Segment* seg = nullptr;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for ( Component* comp : ct->getSlaveComponents() ) {
|
for ( Component* comp : ct->getSlaveComponents() ) {
|
||||||
|
@ -81,56 +81,17 @@ namespace Seabreeze {
|
||||||
|
|
||||||
cerr << endl << "Finished building tree !" << endl << endl;
|
cerr << endl << "Finished building tree !" << endl << endl;
|
||||||
_tree->print(cerr);
|
_tree->print(cerr);
|
||||||
// cerr << "Tree built succesfully !" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Elmore::build_from_node ( Node* s )
|
|
||||||
{
|
|
||||||
if ( s->_contact == nullptr ) {
|
|
||||||
cerr << "No contact found" << s->_contact << endl;
|
|
||||||
cerr << "Tree build failed" << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tree->add_node(s);
|
|
||||||
|
|
||||||
// To check for circle
|
|
||||||
checker.insert(s->_contact);
|
|
||||||
|
|
||||||
for ( Component* comp : (s->_contact)->getSlaveComponents() ) {
|
|
||||||
|
|
||||||
Segment* seg = dynamic_cast<Segment*>(comp);
|
|
||||||
|
|
||||||
if ( not seg ) continue;
|
|
||||||
|
|
||||||
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
|
|
||||||
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
|
|
||||||
continue;
|
|
||||||
else{
|
|
||||||
if ( find( checker.begin(), checker.end(), ccont) != checker.end() ) {
|
|
||||||
cerr << "Net contains a circle. Cannot apply Elmore's delay here !" << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ( not s->Np || ccont != (s->Np)->_contact ) {
|
|
||||||
Node* node = new Node(s, ccont);
|
|
||||||
build_from_node(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Elmore::build_from_Node ( Node* s, Segment* seg ) {
|
void Elmore::build_from_Node ( Node* s, Segment* seg ) {
|
||||||
if ( s->_contact == nullptr ) {
|
if ( s->_contact == nullptr ) {
|
||||||
cerr << "No contact found" << s->_contact << endl;
|
cerr << "No contact found" << s->_contact << endl;
|
||||||
cerr << "Tree build failed" << endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_tree->add_node(s);
|
_tree->add_node(s);
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
cerr << "Build from contact : " << s->_contact << endl;
|
cerr << endl << endl << "Build from contact : " << s->_contact << endl;
|
||||||
|
cerr << "With segment : " << seg << endl;
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
|
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
|
||||||
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
|
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
|
||||||
|
@ -138,127 +99,55 @@ namespace Seabreeze {
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
cerr << "Target contact : " << ccont << endl;
|
cerr << "Target contact : " << ccont << endl;
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// ccont = build_branch(ccont);
|
ccont = build_branch(ccont);
|
||||||
Contact* ctr = nullptr;
|
|
||||||
build_branch(ctr, ccont);
|
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
cerr << "Found a node : " << ctr << endl;
|
cerr << "Found a node : " << ccont << endl;
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
// if ( not ccont ) {
|
if ( not ccont ) {
|
||||||
if ( not ctr ) {
|
|
||||||
cerr << "This branch leads to a NULL contact ?" << endl;
|
cerr << "This branch leads to a NULL contact ?" << endl;
|
||||||
cerr << "Tree build failed" << endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* node = new Node(s, ccont);
|
Node* node = new Node(s, ccont);
|
||||||
int count = 1;
|
int count = 0;
|
||||||
// for ( Component* comp : ccont->getSlaveComponents() ) {
|
for ( Component* comp : ccont->getSlaveComponents() ) {
|
||||||
for ( Component* comp : ctr->getSlaveComponents() ) {
|
|
||||||
count += (dynamic_cast<Segment*>(comp)) ? 1 : 0;
|
count += (dynamic_cast<Segment*>(comp)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
cerr << "This contact has : " << count << " segments" << endl;
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
if ( count == 1 ){
|
if ( count == 1 ){
|
||||||
_tree->add_node(node);
|
_tree->add_node(node);
|
||||||
}
|
}
|
||||||
else if ( count > 2 ) {
|
else if ( count > 2 ) {
|
||||||
// for ( Component* comp : ccont->getSlaveComponents() ) {
|
for ( Component* comp : ccont->getSlaveComponents() ) {
|
||||||
for ( Component* comp : ctr->getSlaveComponents() ) {
|
|
||||||
Segment* segmt = dynamic_cast<Segment*>(comp);
|
Segment* segmt = dynamic_cast<Segment*>(comp);
|
||||||
if ( not segmt ) continue;
|
if ( not segmt )
|
||||||
build_from_Node(node, segmt);
|
continue;
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
cerr << "Segment : " << segmt << endl;
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
Contact* target = dynamic_cast<Contact*>(segmt->getOppositeAnchor(ccont));
|
||||||
|
if ( not target ) {
|
||||||
|
cerr << "Wait... How can this happen ?" << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
cerr << "Target is : " << target << endl;
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
if ( checker.count(target) == 0 ){
|
||||||
|
build_from_Node(node, segmt);
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Elmore::build_branch ( Contact* ctr, Contact* ct ) {
|
|
||||||
int count = 0;
|
|
||||||
checker.insert(ct);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
cerr << "Build branch from contact : " << ct << endl;
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
for ( Component* cp : ct->getSlaveComponents() ) {
|
|
||||||
count += (dynamic_cast<Segment*>(cp)) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( count == 0 ) {
|
|
||||||
cerr << "Something is not right here : Contact " << ct << " is isolated ?" << endl;
|
|
||||||
}
|
|
||||||
else if ( count == 2 ) {
|
|
||||||
Segment* sm = nullptr;
|
|
||||||
for ( Component* cp : ct->getSlaveComponents() ) {
|
|
||||||
sm = dynamic_cast<Segment*>(cp);
|
|
||||||
if ( not sm ) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Contact* cct = dynamic_cast<Contact*>(sm->getOppositeAnchor(ct));
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
cerr << "To contact : " << cct << endl;
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
if ( not cct || find(checker.begin(), checker.end(), cct) != checker.end() ) {
|
|
||||||
cerr << "This branch leads to no where ?" << endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
build_branch(ctr, cct);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ctr = ct;
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
cerr << "Return contact : " << ctr << endl;
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Contact* Elmore::build_branch ( Contact* ct ) {
|
|
||||||
int count = 0;
|
|
||||||
checker.insert(ct);
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
cerr << "Build branch from contact : " << ct << endl;
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
for ( Component* cp : ct->getSlaveComponents() ) {
|
|
||||||
count += (dynamic_cast<Segment*>(cp)) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Contact* cont = nullptr;
|
|
||||||
if ( count == 0 ) {
|
|
||||||
cerr << "Something is not right here : Contact " << ct << " is isolated ?" << endl;
|
|
||||||
}
|
|
||||||
else if ( count == 2 ) {
|
|
||||||
Segment* sm = nullptr;
|
|
||||||
for ( Component* cp : ct->getSlaveComponents() ) {
|
|
||||||
sm = dynamic_cast<Segment*>(cp);
|
|
||||||
if ( not sm ) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Contact* cct = dynamic_cast<Contact*>(sm->getOppositeAnchor(ct));
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
cerr << "To contact : " << cct << endl;
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
if ( not cct || find(checker.begin(), checker.end(), cct) != checker.end() ) {
|
|
||||||
cerr << "This branch leads to no where ?" << endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
build_branch(cct);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cont = ct;
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
cerr << "Return contact : " << cont << endl;
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
cerr << "After the else : " << cont << endl;
|
|
||||||
cerr << "Is this line printed twice ?" << endl;
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
return cont;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Contact* Elmore::build_branch ( Contact* ct ) {
|
Contact* Elmore::build_branch ( Contact* ct ) {
|
||||||
Contact* tmp = ct;
|
Contact* tmp = ct;
|
||||||
|
//------------------------------------------------------
|
||||||
|
cerr << endl << "Start building branch with contact : " << ct << endl;
|
||||||
|
//------------------------------------------------------
|
||||||
int count;
|
int count;
|
||||||
do {
|
do {
|
||||||
checker.insert(tmp);
|
checker.insert(tmp);
|
||||||
|
@ -275,12 +164,25 @@ namespace Seabreeze {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Segment* sm = nullptr;
|
Segment* sm = nullptr;
|
||||||
|
Contact* cct = nullptr;
|
||||||
for ( Component* cp : tmp->getSlaveComponents() ) {
|
for ( Component* cp : tmp->getSlaveComponents() ) {
|
||||||
sm = dynamic_cast<Segment*>(cp);
|
sm = dynamic_cast<Segment*>(cp);
|
||||||
if ( not sm ) continue;
|
if ( not sm )
|
||||||
|
continue;
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
cerr << "Sm : " << sm << endl;
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
Contact* tar = dynamic_cast<Contact*>(sm->getOppositeAnchor(tmp));
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
cerr << "tar : " << tar << endl;
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
if ( tar && checker.count(tar) == 0 )
|
||||||
|
cct = tar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact* cct = dynamic_cast<Contact*>(sm->getOppositeAnchor(ct));
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
cerr << "cct : " << cct << endl;
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
if ( not cct || checker.count(cct) != 0 ) {
|
if ( not cct || checker.count(cct) != 0 ) {
|
||||||
cerr << "This branch leads to no where ?" << endl;
|
cerr << "This branch leads to no where ?" << endl;
|
||||||
tmp = nullptr;
|
tmp = nullptr;
|
||||||
|
@ -290,7 +192,9 @@ namespace Seabreeze {
|
||||||
tmp = cct;
|
tmp = cct;
|
||||||
}
|
}
|
||||||
} while ( count == 2 );
|
} while ( count == 2 );
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
cerr << "Branch done !" << endl;
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,8 @@ namespace Seabreeze {
|
||||||
~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, Segment* seg );
|
void build_from_Node ( Node* source, Segment* seg );
|
||||||
Contact* build_branch ( Contact* contact );
|
Contact* build_branch ( Contact* contact );
|
||||||
void build_branch ( Contact* ctr, Contact* contact );
|
|
||||||
void clearTree ();
|
void clearTree ();
|
||||||
Tree* getTree ();
|
Tree* getTree ();
|
||||||
inline const set<Contact*>& get_conts () const;
|
inline const set<Contact*>& get_conts () const;
|
||||||
|
|
|
@ -46,7 +46,8 @@ void Tree::new_node ()
|
||||||
void Tree::add_node ( Node* node )
|
void Tree::add_node ( Node* node )
|
||||||
{
|
{
|
||||||
node->label = nodes.size();
|
node->label = nodes.size();
|
||||||
nodes.push_back(node);
|
if ( find(nodes.begin(), nodes.end(), node) == nodes.end() )
|
||||||
|
nodes.push_back(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tree::After_i ( Node *ni )
|
void Tree::After_i ( Node *ni )
|
||||||
|
@ -133,21 +134,21 @@ void Tree::print ( ostream& out )
|
||||||
{
|
{
|
||||||
out << "Start printing tree..." << endl;
|
out << "Start printing tree..." << endl;
|
||||||
out << "Tree has " << nodes.size() << " nodes :" << endl;
|
out << "Tree has " << nodes.size() << " nodes :" << endl;
|
||||||
out << nodes[0]->label << " -> ";
|
out << nodes[0]->_contact << " -> ";
|
||||||
for(Node* n : nodes[0]->Ne){
|
for(Node* n : nodes[0]->Ne){
|
||||||
out << n->label << ", ";
|
out << n->_contact << ", ";
|
||||||
}
|
}
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
for ( size_t i = 1; i < nodes.size(); i++ ) {
|
for ( size_t i = 1; i < nodes.size(); i++ ) {
|
||||||
out << nodes[i]->Np->label
|
out << nodes[i]->Np->_contact
|
||||||
<< " -> " << nodes[i]->label
|
<< " -> " << nodes[i]->_contact
|
||||||
<< " : R = " << nodes[i]->R
|
<< " : R = " << nodes[i]->R
|
||||||
<< ", C = " << nodes[i]->C;
|
<< ", C = " << nodes[i]->C;
|
||||||
if ( !(nodes[i]->Ne).empty() ) {
|
if ( !(nodes[i]->Ne).empty() ) {
|
||||||
out << " -> ";
|
out << " -> ";
|
||||||
for ( Node* n : nodes[i]->Ne ) {
|
for ( Node* n : nodes[i]->Ne ) {
|
||||||
out << n->label << ", ";
|
out << n->_contact << ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue