From e0bae89a81b5eba126cab0ab9137d92dd9bbf4a5 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 1 Feb 2021 16:43:42 +0100 Subject: [PATCH] Bug in KatanaEngine::annotateGlobalGraph(), bad edge capacity computation. * Bug: In KatanaEngine::annotateGlobalGraph(), overlapping blockages or fixed segments where taken into account as separate ones. This was making the edge capacity reservation too high. Creating false zero-capacity edges at some points. Didn't show up until now because we did not have overlaps. --- katana/src/KatanaEngine.cpp | 72 ++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index 4739ded0..a2e9b2f0 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -462,12 +462,18 @@ namespace Katana { if (rp->getLayerGauge()->getType() == Constant::PinOnly) continue; if (rp->getLayerGauge()->getDepth() > getConfiguration()->getAllowedDepth()) continue; - size_t tracksSize = rp->getTracksSize(); + int elementCapacity = 1; + size_t tracksSize = rp->getTracksSize(); for ( size_t itrack=0 ; itrackgetTrackByIndex( itrack ); - + Track* track = rp->getTrackByIndex( itrack ); + DbU::Unit axis = track->getAxis(); + Flags side = (track->getDirection() == Flags::Vertical) ? Flags::NorthSide + : Flags::EastSide; + Point source; + Point target; cdebug_log(159,0) << "Capacity from: " << track << endl; + Interval uspan; for ( size_t ielement=0 ; ielementgetSize() ; ++ielement ) { TrackElement* element = track->getSegment( ielement ); @@ -482,23 +488,55 @@ namespace Katana { continue; } - Segment* segment = element->getSegment(); - Flags side = Flags::EastSide; - DbU::Unit axis = track->getAxis(); - Point source = segment->getSourcePosition(); - Point target = segment->getTargetPosition(); - - if (track->getDirection() == Flags::Vertical) { - side = Flags::NorthSide; - source.setX( axis ); - target.setX( axis ); + cdebug_log(159,0) << "Capacity from: " << element << ":" << elementCapacity << endl; + Segment* segment = element->getSegment(); + Interval segmentUSpan; + + source = segment->getSourcePosition(); + target = segment->getTargetPosition(); + if (track->getDirection() == Flags::Vertical) + segmentUSpan = Interval( source.getY(), target.getY() ); + else + segmentUSpan = Interval( source.getX(), target.getX() ); + + if (uspan.isEmpty()) { + uspan = segmentUSpan; + continue; } else { - source.setY( axis ); - target.setY( axis ); + if (uspan.contains(segmentUSpan)) continue; + if (uspan.intersect(segmentUSpan)) { + uspan.merge( segmentUSpan ); + continue; + } } - int elementCapacity = 1; - cdebug_log(159,0) << "Capacity from: " << element << ":" << elementCapacity << endl; + if (track->getDirection() == Flags::Vertical) { + source = Point( axis, uspan.getVMin() ); + target = Point( axis, uspan.getVMax() ); + } else { + source = Point( uspan.getVMin(), axis ); + target = Point( uspan.getVMax(), axis ); + } + + GCellsUnder gcells = getGCellsUnder( source, target ); + if (not gcells->empty()) { + for ( size_t i=0 ; isize()-1 ; ++i ) { + Edge* edge = gcells->gcellAt(i)->getEdgeAt( side, axis ); + edge->reserveCapacity( elementCapacity ); + } + } + + uspan = segmentUSpan; + } + + if (not uspan.isEmpty()) { + if (track->getDirection() == Flags::Vertical) { + source = Point( axis, uspan.getVMin() ); + target = Point( axis, uspan.getVMax() ); + } else { + source = Point( uspan.getVMin(), axis ); + target = Point( uspan.getVMax(), axis ); + } GCellsUnder gcells = getGCellsUnder( source, target ); if (not gcells->empty()) {