Seabreeze : debugged, RC calculated for each node. Testing delay_Elmore

This commit is contained in:
HoangAnhP 2022-07-12 15:03:33 +02:00
parent d1c0e4882a
commit 7267951683
2 changed files with 36 additions and 20 deletions

View File

@ -67,6 +67,7 @@ namespace Seabreeze {
cerr << "Root contact : " << ct->getId() << endl; cerr << "Root contact : " << ct->getId() << endl;
cerr << "Start building tree..." << endl; cerr << "Start building tree..." << endl;
checker.insert(ct);
Node* s = new Node(nullptr, ct); Node* s = new Node(nullptr, ct);
//--------------------------------------------------------- //---------------------------------------------------------
double R = 0; double R = 0;
@ -91,7 +92,6 @@ namespace Seabreeze {
return; return;
} }
build_from_Node(s, seg); build_from_Node(s, seg);
cerr << endl << "Finished building tree !" << endl << endl; cerr << endl << "Finished building tree !" << endl << endl;
_tree->print(cerr); _tree->print(cerr);
} }
@ -107,7 +107,7 @@ namespace Seabreeze {
cdebug_log(199,0) << endl cdebug_log(199,0) << endl
<< endl << endl
<< "Build from contact : " << s->_contact->getId() << endl << "Build from contact : " << s->_contact->getId() << endl
<< "With segment : " << seg << endl; << "With segment : " << seg->getId() << 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) )
@ -120,7 +120,7 @@ namespace Seabreeze {
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
ccont = build_branch(&Rb, &Cb, ccont); ccont = build_branch(&Rb, &Cb, ccont);
cdebug_log(199, 0) << "Found a node : " << ccont << endl; cdebug_log(199, 0) << "Found a node : " << ccont->getId() << endl;
if ( not ccont ) { if ( not ccont ) {
cerr << "This branch leads to a NULL contact ?" << endl; cerr << "This branch leads to a NULL contact ?" << endl;
@ -162,7 +162,7 @@ namespace Seabreeze {
continue; continue;
} }
cdebug_log(199,0) << "Target is : " << target << endl; cdebug_log(199,0) << "Target is : " << target->getId() << endl;
cdebug_tabw(199,-1); cdebug_tabw(199,-1);
if ( checker.count(target) == 0 ){ if ( checker.count(target) == 0 ){
@ -177,14 +177,25 @@ namespace Seabreeze {
{ {
Contact* tmp = ct; Contact* tmp = ct;
cdebug_log(199,1) << endl << "Start building branch with contact : " << ct << endl; cdebug_log(199,1) << endl << "Start building branch with contact : " << ct->getId() << endl;
int count; int count;
do { do {
checker.insert(tmp); checker.insert(tmp);
count = 0; count = 0;
Segment* sm = nullptr;
for ( Component* cp : tmp->getSlaveComponents() ) { for ( Component* cp : tmp->getSlaveComponents() ) {
count += (dynamic_cast<Segment*>(cp)) ? 1 : 0; sm = dynamic_cast<Segment*>(cp);
if ( not sm )
continue;
Contact* tar = dynamic_cast<Contact*>(sm->getOppositeAnchor(tmp));
if ( tar && checker.count(tar) != 0 ) {
Set_RC(R, C, tmp, sm);
cdebug_log(199,0) << "RC from build_branch :" << endl;
cdebug_log(199,0) << "tmp = " << tmp->getId() << "; sm = " << sm->getId() << "; R = " << *R << "; C = " << *C << endl;
}
count += 1;
} }
if ( count == 0 ) { if ( count == 0 ) {
cerr << "Something is not right here : Contact " << tmp << " is isolated ?" << endl; cerr << "Something is not right here : Contact " << tmp << " is isolated ?" << endl;
@ -194,26 +205,25 @@ namespace Seabreeze {
break; break;
} }
else { else {
Segment* sm = nullptr;
Contact* cct = 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 ) if ( not sm )
continue; continue;
cdebug_log(199,1) << "Sm : " << sm << endl; cdebug_log(199,1) << "Sm : " << sm->getId() << endl;
cdebug_tabw(199,-1); cdebug_tabw(199,-1);
Contact* tar = dynamic_cast<Contact*>(sm->getOppositeAnchor(tmp)); Contact* tar = dynamic_cast<Contact*>(sm->getOppositeAnchor(tmp));
cdebug_log(199,0) << "tar : " << tar << endl << endl; cdebug_log(199,0) << "tar : " << tar->getId() << endl << endl;
if ( tar && checker.count(tar) == 0 ) if ( tar && checker.count(tar) == 0 )
cct = tar; cct = tar;
} }
cdebug_tabw(199,-1); cdebug_tabw(199,-1);
cdebug_log(199,0) << "cct : " << cct << endl; cdebug_log(199,0) << "cct : " << cct->getId() << 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;
@ -222,8 +232,6 @@ namespace Seabreeze {
} }
else else
tmp = cct; tmp = cct;
Set_RC(R, C, tmp, sm);
cdebug_log(199,0) << "tmp = " << tmp << "; sm = " << sm << "; R = " << R << "; C = " << C << endl;
} }
} while ( count == 2 ); } while ( count == 2 );
@ -242,7 +250,7 @@ namespace Seabreeze {
(*R) += Rct*S_ct; (*R) += Rct*S_ct;
if ( sm == nullptr ) { if ( sm == nullptr ) {
C = 0; *C = 0;
} }
else { else {
double Rsm = getConfig()->getRsm(); double Rsm = getConfig()->getRsm();
@ -250,10 +258,15 @@ namespace Seabreeze {
double l_sm = DbU::toPhysical(sm->getLength(), DbU::UnitPower::Nano); double l_sm = DbU::toPhysical(sm->getLength(), DbU::UnitPower::Nano);
double w_sm = DbU::toPhysical(sm->getWidth(), DbU::UnitPower::Nano); double w_sm = DbU::toPhysical(sm->getWidth(), DbU::UnitPower::Nano);
double S_sm = l_sm*w_sm; double S_sm = l_sm*w_sm;
//---------------------------------------------------------------------------------------
cdebug_log(199,0) << "sm = " << sm->getId() << "; l_sm = " << l_sm << "; w_sm = " << w_sm << "; S_sm = " << S_sm << endl;
//---------------------------------------------------------------------------------------
(*R) += Rsm*S_sm; (*R) += Rsm*S_sm;
if ( S_sm == 0 )
(*C) += 0;
else
(*C) += 1/(Csm*S_sm); (*C) += 1/(Csm*S_sm);
} }
cdebug_log(199,0) << "ct = " << ct << "; sm = " << sm << "; R = " << R, "; C = " << C << endl;
} }
void Elmore::clearTree () void Elmore::clearTree ()

View File

@ -133,21 +133,24 @@ 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]->_contact << " -> "; out << nodes[0]->_contact->getId()
<< " : R = " << nodes[0]->R
<< ", C = " << nodes[0]->C
<< " -> ";
for(Node* n : nodes[0]->Ne){ for(Node* n : nodes[0]->Ne){
out << n->_contact << ", "; out << n->_contact->getId() << ", ";
} }
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->_contact out << nodes[i]->Np->_contact->getId()
<< " -> " << nodes[i]->_contact << " -> " << nodes[i]->_contact->getId()
<< " : 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->_contact << ", "; out << n->_contact->getId() << ", ";
} }
} }
else else