Seabreeze : Segmentation fault when acceding vector nodes of tree
This commit is contained in:
parent
77ecf5523d
commit
801e31f716
|
@ -16,7 +16,10 @@ Node::Node ( Node* p, Contact* ct )
|
|||
, _contact(ct)
|
||||
, label(-1)
|
||||
, ap(0)
|
||||
{ (p->Ne).push_back(this); }
|
||||
{
|
||||
if( p != nullptr)
|
||||
(p->Ne).push_back(this);
|
||||
}
|
||||
|
||||
Node::~Node ()
|
||||
{}
|
||||
|
|
|
@ -44,14 +44,26 @@ namespace Seabreeze {
|
|||
cerr << "Input RoutingPad is NULL. Please select a RoutingPad !" << endl;
|
||||
return;
|
||||
}
|
||||
Contact* ct = dynamic_cast<Contact*>(rp);
|
||||
if ( not ct ) {
|
||||
Contact* ct = nullptr;
|
||||
for ( Component* c : rp->getSlaveComponents() ) {
|
||||
Contact* cont = dynamic_cast<Contact*>(c);
|
||||
|
||||
if ( cont ) {
|
||||
ct = cont;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ct == nullptr ) {
|
||||
cerr << "No contact found" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
cerr << "Start building tree..." << endl;
|
||||
Node* s = new Node(nullptr, ct);
|
||||
build_from_node(s);
|
||||
cerr << "Finished building tree !" << endl;
|
||||
_tree->print(cerr);
|
||||
}
|
||||
|
||||
void Elmore::build_from_node ( Node* s )
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
|
||||
#include "hurricane/Contact.h"
|
||||
#include "hurricane/RoutingPad.h"
|
||||
#include "hurricane/Component.h"
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Contact;
|
||||
using Hurricane::RoutingPad;
|
||||
using Hurricane::Component;
|
||||
|
||||
class Tree{
|
||||
public:
|
||||
|
|
|
@ -106,7 +106,9 @@ namespace Seabreeze {
|
|||
}
|
||||
|
||||
Elmore* elm = ElmoreProperty::create(net)->getElmore();
|
||||
elm->contFromNet(net);
|
||||
elm->buildTree(driver);
|
||||
cerr << "Tree built succesfully !" << endl;
|
||||
}
|
||||
|
||||
SeabreezeEngine::SeabreezeEngine ( Cell* cell )
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
using namespace std;
|
||||
|
||||
Tree::Tree ()
|
||||
:nodes()
|
||||
:nodes()
|
||||
{}
|
||||
|
||||
Tree::~Tree ()
|
||||
|
@ -79,8 +79,18 @@ int Tree::Delay_Elmore ( RoutingPad* rp )
|
|||
cerr << "Input RoutingPad is NULL. Please select a RoutingPad !" << endl;
|
||||
return -1;
|
||||
}
|
||||
Contact* ct = dynamic_cast<Contact*>(rp);
|
||||
if ( not ct ) {
|
||||
|
||||
Contact* ct = nullptr;
|
||||
for ( Component* c : rp->getSlaveComponents() ) {
|
||||
Contact* cont = dynamic_cast<Contact*>(c);
|
||||
|
||||
if ( ct ) {
|
||||
ct = cont;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ct == nullptr ) {
|
||||
cerr << "No contact found" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
@ -121,15 +131,15 @@ int Tree::Delay_Elmore ( RoutingPad* rp )
|
|||
|
||||
void Tree::print ( ostream& out )
|
||||
{
|
||||
out << "Start printing tree" << endl;
|
||||
out << "Tree has " << nodes.size() << " nodes :" << endl;
|
||||
|
||||
out << nodes[0]->label << " -> ";
|
||||
for(Node* n : nodes[0]->Ne){
|
||||
out << n->label << ", ";
|
||||
}
|
||||
out << std::endl;
|
||||
|
||||
for ( int i = 1; i < nodes.size(); i++ ) {
|
||||
for ( size_t i = 1; i < nodes.size(); i++ ) {
|
||||
out << nodes[i]->Np->label
|
||||
<< " -> " << nodes[i]->label
|
||||
<< " : R = " << nodes[i]->R
|
||||
|
|
Loading…
Reference in New Issue