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