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