From cbb5e8781df7ddfe0753bd999906513679dc7171 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 28 Aug 2016 19:09:07 +0200 Subject: [PATCH] In AutoSegment slackening, bad positioning of the perpandicular. --- anabatic/src/AutoHorizontal.cpp | 47 ++++++++++++++++++++------------- anabatic/src/AutoSegment.cpp | 2 +- anabatic/src/AutoVertical.cpp | 38 +++++++++++++++----------- katana/src/TrackSegment.cpp | 1 + 4 files changed, 53 insertions(+), 35 deletions(-) diff --git a/anabatic/src/AutoHorizontal.cpp b/anabatic/src/AutoHorizontal.cpp index d21369f0..c16d1a1a 100644 --- a/anabatic/src/AutoHorizontal.cpp +++ b/anabatic/src/AutoHorizontal.cpp @@ -272,11 +272,12 @@ namespace Anabatic { cdebug_log(149,0) << "test:" << (getLength() < 5*getPitch()) << endl; cdebug_log(149,0) << "length:" << DbU::getValueString(getLength()) << endl; - int lowSlack = (flags & Flags::HalfSlacken) ? 3 : 10; - bool slackened = false; - bool halfSlackened = false; - DbU::Unit targetPosition = getTargetPosition(); - AutoSegment* parallel = this; + int lowSlack = (flags & Flags::HalfSlacken) ? 3 : 10; + bool sourceSlackened = false; + bool targetSlackened = false; + bool halfSlackened = false; + DbU::Unit targetPosition = getTargetPosition(); + AutoSegment* parallel = this; if (source->isTerminal()) { Interval perpandConstraints = getAutoTarget()->getUConstraints(Flags::Horizontal); @@ -293,14 +294,14 @@ namespace Anabatic { if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) { cdebug_log(149,0) << "Slackening from Source: " << source << endl; _makeDogleg( source->getGCell(), Flags::NoFlags ); - slackened = true; + sourceSlackened = true; } else if (slack < 10) { halfSlackened = true; } const vector& doglegs = Session::getDoglegs(); - if (doglegs.size() >= 2) { - cdebug_log(149,0) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; + if (sourceSlackened and (doglegs.size() >= 2)) { + cdebug_log(149,0) << "AutoHorizontal::_slacken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; doglegs[doglegs.size()-2]->setAxis( getSourcePosition() ); success = true; @@ -331,21 +332,14 @@ namespace Anabatic { if ((nativeSlack < lowSlack) or (nativeSlack - slack < 3)) { cdebug_log(149,0) << "Slackening from Target: " << target << endl; parallel->_makeDogleg( target->getGCell(), Flags::NoFlags ); - slackened = true; + targetSlackened = true; } else if (slack < 10) { halfSlackened = true; } - if (halfSlackened) { - setFlags( SegHalfSlackened ); - } else if (slackened) { - setFlags ( SegSlackened ); - unsetFlags( SegHalfSlackened ); - } - const vector& doglegs = Session::getDoglegs(); - if (doglegs.size() >= 2) { - cdebug_log(149,0) << "AutoSegment::_slaken(): Target @" << DbU::getValueString(targetPosition) << endl; + if (targetSlackened and (doglegs.size() >= 2)) { + cdebug_log(149,0) << "AutoHorizontal::_slacken(): Target @" << DbU::getValueString(targetPosition) << endl; doglegs[doglegs.size()-2]->setAxis( targetPosition ); success = true; @@ -358,6 +352,21 @@ namespace Anabatic { } } } + + if (sourceSlackened and targetSlackened) { + setFlags ( SegSlackened ); + unsetFlags( SegHalfSlackened ); + } else { + if (sourceSlackened or targetSlackened) { + if (halfSlackened) { + setFlags( SegHalfSlackened ); + } else { + setFlags ( SegSlackened ); + unsetFlags( SegHalfSlackened ); + } + } + } + cdebug_tabw(149,-1); return success; @@ -720,7 +729,7 @@ namespace Anabatic { unsigned int AutoHorizontal::_makeDogleg ( GCell* doglegGCell, unsigned int flags ) { DebugSession::open( getNet(), 140, 150 ); - cdebug_log(149,0) << "AutoHorizontal::_makeDogleg(GCell*)" << endl; + cdebug_log(149,0) << "AutoHorizontal::_makeDogleg(GCell*) in " << doglegGCell << endl; cdebug_tabw(149,1); //Session::doglegReset(); diff --git a/anabatic/src/AutoSegment.cpp b/anabatic/src/AutoSegment.cpp index 684bd31c..5c6d2627 100644 --- a/anabatic/src/AutoSegment.cpp +++ b/anabatic/src/AutoSegment.cpp @@ -838,7 +838,7 @@ namespace Anabatic { if ( (axis == getAxis()) and not (flags & Flags::Realignate) ) return; - cdebug_log(149,0) << "setAxis() @" + cdebug_log(159,0) << "setAxis() @" << ((isHorizontal())?"Y ":"X ") << DbU::toLambda(getAxis()) << " to " << DbU::toLambda(axis) << " on " << this << endl; cdebug_tabw(145,1); diff --git a/anabatic/src/AutoVertical.cpp b/anabatic/src/AutoVertical.cpp index 79fc9396..ee1f940e 100644 --- a/anabatic/src/AutoVertical.cpp +++ b/anabatic/src/AutoVertical.cpp @@ -237,12 +237,13 @@ namespace Anabatic { cdebug_log(149,0) << "test:" << (getLength() < getPitch()*5) << endl; cdebug_log(149,0) << "length:" << DbU::getValueString(getLength()) << endl; - bool success = false; - bool slackened = false; - bool halfSlackened = false; - int lowSlack = (flags & Flags::HalfSlacken) ? 3 : 10; - AutoContact* source = getAutoSource(); - AutoSegment* parallel = this; + bool success = false; + bool sourceSlackened = false; + bool targetSlackened = false; + bool halfSlackened = false; + int lowSlack = (flags & Flags::HalfSlacken) ? 3 : 10; + AutoContact* source = getAutoSource(); + AutoSegment* parallel = this; if (source->isTerminal()) { Interval constraints = source->getUConstraints (Flags::Horizontal|Flags::NoGCellShrink); @@ -253,14 +254,14 @@ namespace Anabatic { // Ugly: GCell's track number is hardwired. if ((slack < lowSlack) or (nativeSlack - slack < 3)) { _makeDogleg( source->getGCell(), Flags::NoFlags ); - slackened = true; + sourceSlackened = true; } else if (slack < 10) { halfSlackened = true; } const vector& doglegs = Session::getDoglegs(); - if (doglegs.size() >= 2) { - cdebug_log(149,0) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; + if (sourceSlackened and (doglegs.size() >= 2)) { + cdebug_log(149,0) << "AutoVertical::_slacken(): Source @" << DbU::getValueString(getSourcePosition()) << endl; doglegs[doglegs.size()-2]->_setAxis( getSourcePosition() ); success = true; @@ -284,24 +285,31 @@ namespace Anabatic { // Ugly: GCell's track number is hardwired. if ((slack < lowSlack) or (nativeSlack - slack < 3)) { _makeDogleg( target->getGCell(), Flags::NoFlags ); - slackened = true; + targetSlackened = true; } else if (slack < 10) { halfSlackened = true; } const vector& doglegs = Session::getDoglegs(); - if (doglegs.size() >= 2) { - cdebug_log(149,0) << "AutoSegment::_slaken(): Source @" << DbU::getValueString(getTargetPosition()) << endl; + if (targetSlackened and (doglegs.size() >= 2)) { + cdebug_log(149,0) << "AutoVertical::_slacken(): Source @" << DbU::getValueString(getTargetPosition()) << endl; doglegs[doglegs.size()-2]->_setAxis( getTargetPosition() ); success = true; } } - if (halfSlackened) { - setFlags( SegHalfSlackened ); - } else if (slackened) { + if (sourceSlackened and targetSlackened) { setFlags ( SegSlackened ); unsetFlags( SegHalfSlackened ); + } else { + if (sourceSlackened or targetSlackened) { + if (halfSlackened) { + setFlags( SegHalfSlackened ); + } else { + setFlags ( SegSlackened ); + unsetFlags( SegHalfSlackened ); + } + } } cdebug_tabw(149,-1); diff --git a/katana/src/TrackSegment.cpp b/katana/src/TrackSegment.cpp index 3265cf83..c7f6ae20 100644 --- a/katana/src/TrackSegment.cpp +++ b/katana/src/TrackSegment.cpp @@ -422,6 +422,7 @@ namespace Katana { return (not isSlackened() and (getDoglegLevel() <= 3)) ? _base->canSlacken(Flags::Propagate) : false; } + bool TrackSegment::slacken ( unsigned int flags ) { cdebug_log(159,0) << "TrackSegment::slacken()" << endl;