Seabreeze : error while returning the contact from build_branch()
This commit is contained in:
parent
e2c27cc039
commit
2c89e5b41a
|
@ -29,23 +29,9 @@ namespace Seabreeze {
|
|||
|
||||
void Elmore::contFromNet ( Net* net ) {
|
||||
for ( RoutingPad* rp : net->getRoutingPads() ) {
|
||||
|
||||
for ( Component* comp : rp->getSlaveComponents() ) {
|
||||
|
||||
/* Segment* seg = dynamic_cast<Segment*>(comp);
|
||||
if ( not seg ) continue;
|
||||
|
||||
for( Component* c : seg->getAnchors() ){
|
||||
Contact* ct = dynamic_cast<Contact*>(c);
|
||||
if( not ct ) continue;
|
||||
|
||||
_conts.insert(ct);
|
||||
}
|
||||
Contact* ct = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));*/
|
||||
|
||||
Contact* ct = dynamic_cast<Contact*>(comp);
|
||||
if ( not ct ) continue;
|
||||
|
||||
_conts.insert(ct);
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +41,10 @@ namespace Seabreeze {
|
|||
{
|
||||
if ( rp == nullptr ) {
|
||||
cerr << "Input RoutingPad is NULL. Please select a RoutingPad !" << endl;
|
||||
cerr << "Cannot build tree" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Contact* ct = nullptr;
|
||||
for ( Component* c : rp->getSlaveComponents() ) {
|
||||
Contact* cont = dynamic_cast<Contact*>(c);
|
||||
|
@ -66,28 +54,41 @@ namespace Seabreeze {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ct == nullptr ) {
|
||||
cerr << "No contact found" << endl;
|
||||
cerr << "Cannot build tree" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
cerr << "Root contact : " << ct << endl;
|
||||
cerr << "Start building tree..." << endl;
|
||||
|
||||
Node* s = new Node(nullptr, ct);
|
||||
build_from_node(s);
|
||||
cerr << "Finished building tree !" << endl << endl;
|
||||
// build_from_node(s);
|
||||
Segment* seg = nullptr;
|
||||
int c = 0;
|
||||
for ( Component* comp : ct->getSlaveComponents() ) {
|
||||
seg = dynamic_cast<Segment*>(comp);
|
||||
if ( not seg ) continue;
|
||||
c++;
|
||||
}
|
||||
if ( c != 1 ) {
|
||||
cerr << "Not begin with a RoutingPad ? Something doesn't seem right : " << c << " linked segments" << endl;
|
||||
cerr << "Tree build failed" << endl;
|
||||
return;
|
||||
}
|
||||
build_from_Node(s, seg);
|
||||
|
||||
cerr << endl << "Finished building tree !" << endl << endl;
|
||||
_tree->print(cerr);
|
||||
// cerr << "Tree built succesfully !" << endl;
|
||||
}
|
||||
|
||||
void Elmore::build_from_node ( Node* s )
|
||||
{
|
||||
//-----------------------------------------------------------------------
|
||||
// cerr << "Elmore::build_from_node" << endl;
|
||||
// cerr << "From contact : " << s->_contact << endl;
|
||||
//-----------------------------------------------------------------------
|
||||
if ( s->_contact == nullptr ) {
|
||||
cerr << "No contact found" << s->_contact << endl;
|
||||
cerr << "Tree build failed" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -102,16 +103,7 @@ namespace Seabreeze {
|
|||
|
||||
if ( not seg ) continue;
|
||||
|
||||
//-----------------------------------------
|
||||
// cerr << "Segment : " << seg << endl;
|
||||
//-----------------------------------------
|
||||
|
||||
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// cerr << "Target contc : " << ccont << endl;
|
||||
//----------------------------------------------------------------
|
||||
|
||||
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
|
||||
continue;
|
||||
else{
|
||||
|
@ -120,15 +112,8 @@ namespace Seabreeze {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
//-----------------------------------------------------------------------
|
||||
// cerr << "Contact found in the net" << endl;
|
||||
//-----------------------------------------------------------------------
|
||||
if ( not s->Np || ccont != (s->Np)->_contact ) {
|
||||
Node* node = new Node(s, ccont);
|
||||
//-----------------------------------------------------------------------
|
||||
// cerr << "Parent node : " << node->Np->_contact << endl;
|
||||
// cerr << endl;
|
||||
//-----------------------------------------------------------------------
|
||||
build_from_node(node);
|
||||
}
|
||||
}
|
||||
|
@ -139,19 +124,29 @@ namespace Seabreeze {
|
|||
void Elmore::build_from_Node ( Node* s, Segment* seg ) {
|
||||
if ( s->_contact == nullptr ) {
|
||||
cerr << "No contact found" << s->_contact << endl;
|
||||
cerr << "Tree build failed" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
_tree->add_node(s);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
cerr << "Build from contact : " << s->_contact << endl;
|
||||
//----------------------------------------------------------------------------------------
|
||||
Contact* ccont = dynamic_cast<Contact*>(seg->getOppositeAnchor(s->_contact));
|
||||
if ( not ccont || (s->Np && ccont == (s->Np)->_contact) )
|
||||
return;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
cerr << "Target contact : " << ccont << endl;
|
||||
//----------------------------------------------------------------------------------------
|
||||
ccont = build_branch(ccont);
|
||||
|
||||
if ( not ccont )
|
||||
//----------------------------------------------------------------------------------------
|
||||
cerr << "Found a node : " << ccont << endl;
|
||||
//----------------------------------------------------------------------------------------
|
||||
if ( not ccont ) {
|
||||
cerr << "This branch leads to a NULL contact ?" << endl;
|
||||
cerr << "Tree build failed" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Node* node = new Node(s, ccont);
|
||||
int count = 1;
|
||||
|
@ -173,6 +168,9 @@ namespace Seabreeze {
|
|||
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;
|
||||
}
|
||||
|
@ -189,6 +187,9 @@ namespace Seabreeze {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -198,8 +199,13 @@ namespace Seabreeze {
|
|||
}
|
||||
else {
|
||||
cont = ct;
|
||||
//-------------------------------------------------------------------
|
||||
cerr << "Return contact : " << cont << endl;
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
cerr << "After the else : " << cont << endl;
|
||||
//-------------------------------------------------------------------
|
||||
return cont;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "hurricane/Property.h"
|
||||
#include "hurricane/RoutingPad.h"
|
||||
#include "hurricane/Contact.h"
|
||||
#include "hurricane/Segment.h"
|
||||
|
||||
#include "Tree.h"
|
||||
|
||||
|
@ -23,6 +24,7 @@ namespace Seabreeze {
|
|||
using Hurricane::RoutingPad;
|
||||
using Hurricane::Contact;
|
||||
using Hurricane::Instance;
|
||||
using Hurricane::Segment;
|
||||
using Hurricane::PrivateProperty;
|
||||
|
||||
//----------------------------------------------------------
|
||||
|
|
|
@ -116,7 +116,6 @@ namespace Seabreeze {
|
|||
cerr << endl;
|
||||
//-------------------------------------------------------------------------
|
||||
elm->buildTree(driver);
|
||||
cerr << "Tree built succesfully !" << endl;
|
||||
}
|
||||
|
||||
SeabreezeEngine::SeabreezeEngine ( Cell* cell )
|
||||
|
|
Loading…
Reference in New Issue