At last make use of cdebug_log() in Track::repair().

This commit is contained in:
Jean-Paul Chaput 2021-06-17 23:36:35 +02:00
parent f873e616cb
commit ddc7aef13b
1 changed files with 24 additions and 29 deletions

View File

@ -124,9 +124,8 @@ namespace {
uint64_t id = element->getNet()->getId(); uint64_t id = element->getNet()->getId();
if (_spans.empty()) { if (_spans.empty()) {
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() new range " << i
// cerr << "GapSet::merge() new range " << i << " " << _track->getSegment(i) << endl;
// << " " << _track->getSegment(i) << endl;
_spans.push_back( make_pair(i,i) ); _spans.push_back( make_pair(i,i) );
return; return;
} }
@ -134,33 +133,28 @@ namespace {
size_t ispan = 0; size_t ispan = 0;
DbU::Unit segSourceU = element->getSourceU()+_halfSpacing; DbU::Unit segSourceU = element->getSourceU()+_halfSpacing;
DbU::Unit segTargetU = element->getTargetU()-_halfSpacing; DbU::Unit segTargetU = element->getTargetU()-_halfSpacing;
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() " << element << endl;
// cerr << "GapSet::merge() " << element << endl;
for ( ; ispan<_spans.size() ; ++ispan ) { for ( ; ispan<_spans.size() ; ++ispan ) {
if (targetU(ispan) >= segSourceU) { if (targetU(ispan) >= segSourceU) {
if (targetU(ispan) >= segTargetU) { if (targetU(ispan) >= segTargetU) {
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() already inside range" << endl;
// cerr << "GapSet::merge() already inside range" << endl;
return; return;
} }
_spans[ispan].second = i; _spans[ispan].second = i;
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() becomes range end" << endl;
// cerr << "GapSet::merge() becomes range end" << endl;
break; break;
} }
} }
if (ispan == _spans.size()) { if (ispan == _spans.size()) {
_spans.push_back( make_pair(i,i) ); _spans.push_back( make_pair(i,i) );
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() new range" << endl;
// cerr << "GapSet::merge() new range" << endl;
return; return;
} }
while ( ispan+1 < _spans.size() ) { while ( ispan+1 < _spans.size() ) {
if (targetU(ispan) >= sourceU(ispan+1)) { if (targetU(ispan) >= sourceU(ispan+1)) {
_spans[ispan].second = std::max( targetU(ispan), targetU(ispan+1) ); _spans[ispan].second = std::max( targetU(ispan), targetU(ispan+1) );
_spans.erase( _spans.begin()+ispan+1 ); _spans.erase( _spans.begin()+ispan+1 );
//if (id == 317015) cdebug_log(159,0) << "GapSet::merge() fuse with next range" << endl;
// cerr << "GapSet::merge() fuse with next range" << endl;
} }
} }
} }
@ -1003,7 +997,8 @@ namespace Katana {
uint32_t Track::repair () const uint32_t Track::repair () const
{ {
// cerr << "Track::repair() " << this << endl; //if ((getIndex() == 6428) and isVertical()) DebugSession::open( 150, 160 );
cdebug_log(159,0) << "Track::repair() " << this << endl;
if (_segments.empty()) return 0; if (_segments.empty()) return 0;
DbU::Unit minSpacing = getLayer()->getMinimalSpacing(); DbU::Unit minSpacing = getLayer()->getMinimalSpacing();
@ -1013,8 +1008,7 @@ namespace Katana {
GapSet gapsetPrev ( this ); GapSet gapsetPrev ( this );
GapSet gapsetCurr ( this ); GapSet gapsetCurr ( this );
for ( size_t i=0 ; i<_segments.size()-1 ; i++ ) { for ( size_t i=0 ; i<_segments.size()-1 ; i++ ) {
// if (getIndex() == 1750) cdebug_log(159,0) << "[" << i << "] " << _segments[i] << endl;
// cerr << "[" << i << "] " << _segments[i] << endl;
netChange = false; netChange = false;
gapsetCurr.merge( i ); gapsetCurr.merge( i );
if ( (_segments[i]->getNet() != _segments[i+1]->getNet()) if ( (_segments[i]->getNet() != _segments[i+1]->getNet())
@ -1050,25 +1044,25 @@ namespace Katana {
if (netChange or (i+2 == _segments.size())) { if (netChange or (i+2 == _segments.size())) {
if (gapsetCurr.size() > 1) { if (gapsetCurr.size() > 1) {
// cerr << "potential gap around " << _segments[i] << endl; cdebug_log(159,0) << "potential gap around " << _segments[i] << endl;
for ( size_t j=0 ; j+1 < gapsetCurr.size() ; ++j ) { for ( size_t j=0 ; j+1 < gapsetCurr.size() ; ++j ) {
// cerr << j << "=[" << DbU::getValueString(gapsetCurr.sourceU(j)) cdebug_log(159,0) << j << "=[" << DbU::getValueString(gapsetCurr.sourceU(j))
// << " " << DbU::getValueString(gapsetCurr.targetU(j)) << "], " << " " << DbU::getValueString(gapsetCurr.targetU(j)) << "], "
// << j+1 << "=[" << DbU::getValueString(gapsetCurr.sourceU(j+1)) << j+1 << "=[" << DbU::getValueString(gapsetCurr.sourceU(j+1))
// << " " << DbU::getValueString(gapsetCurr.targetU(j+1)) << "]" << endl; << " " << DbU::getValueString(gapsetCurr.targetU(j+1)) << "]" << endl;
DbU::Unit spacing = gapsetCurr.sourceU(j+1) - gapsetCurr.targetU(j); DbU::Unit spacing = gapsetCurr.sourceU(j+1) - gapsetCurr.targetU(j);
// cerr << "| spacing=" << DbU::getValueString(spacing) << endl; cdebug_log(159,0) << "| spacing=" << DbU::getValueString(spacing) << endl;
if (spacing < minSpacing) { if (spacing < minSpacing) {
// cerr << j << "=[" << DbU::getValueString(gapsetCurr.sourceU(j)) cdebug_log(159,0) << j << "=[" << DbU::getValueString(gapsetCurr.sourceU(j))
// << " " << DbU::getValueString(gapsetCurr.targetU(j)) << "], " << " " << DbU::getValueString(gapsetCurr.targetU(j)) << "], "
// << j+1 << "=[" << DbU::getValueString(gapsetCurr.sourceU(j+1)) << j+1 << "=[" << DbU::getValueString(gapsetCurr.sourceU(j+1))
// << " " << DbU::getValueString(gapsetCurr.targetU(j+1)) << "]" << endl; << " " << DbU::getValueString(gapsetCurr.targetU(j+1)) << "]" << endl;
if (gapsetCurr.span(j+1).first >= _segments.size()) { if (gapsetCurr.span(j+1).first >= _segments.size()) {
cerr << Error("gapsetCurr.span(j+1).first >= _segments.size()") << endl; cerr << Error("gapsetCurr.span(j+1).first >= _segments.size()") << endl;
} else { } else {
AutoSegment* first = _segments[gapsetCurr.span(j+1).first]->base(); AutoSegment* first = _segments[gapsetCurr.span(j+1).first]->base();
// cerr << "spacing:" << DbU::getValueString(spacing) << " " << first << endl; cdebug_log(159,0) << "spacing:" << DbU::getValueString(spacing) << " " << first << endl;
if (first == NULL) { if (first == NULL) {
cerr << Error("null first, NOT correcting gap") << endl; cerr << Error("null first, NOT correcting gap") << endl;
} else { } else {
@ -1076,14 +1070,14 @@ namespace Katana {
if (segment->getSourcePosition() < first->getSourcePosition()) if (segment->getSourcePosition() < first->getSourcePosition())
first = segment; first = segment;
} }
// cerr << "duSource:" << DbU::getValueString(first->getDuSource()) << endl; cdebug_log(159,0) << "duSource:" << DbU::getValueString(first->getDuSource()) << endl;
first->setDuSource( first->getDuSource() - spacing - minSpacing/2 ); first->setDuSource( first->getDuSource() - spacing - minSpacing/2 );
} }
++gaps; ++gaps;
cerr << Warning( " Track::repair(): Closing same net gap in %s near:\n %s" cerr << Warning( " Track::repair(): Closing same net gap in %s near:\n %s"
, getString(this).c_str() , getString(this).c_str()
, getString(_segments[(i) ? i-1 : 0]).c_str() ) << endl; , getString(_segments[(i) ? i-1 : 0]).c_str() ) << endl;
// cerr << first << endl; cdebug_log(159,0) << first << endl;
} }
} }
} }
@ -1094,6 +1088,7 @@ namespace Katana {
} }
} }
//if ((getIndex() == 6428) and isVertical()) DebugSession::close();
return gaps; return gaps;
} }