diff --git a/hurricane/src/hurricane/RoutingPad.cpp b/hurricane/src/hurricane/RoutingPad.cpp index 554f1e2f..52b5af88 100644 --- a/hurricane/src/hurricane/RoutingPad.cpp +++ b/hurricane/src/hurricane/RoutingPad.cpp @@ -343,8 +343,20 @@ namespace Hurricane { double bestArea = getArea(bestComponent); if (compArea == bestArea) { - if (icomponent->getId() < bestComponent->getId()) - bestComponent = *icomponent; + Box compBox = icomponent->getBoundingBox(); + Box bestBox = bestComponent->getBoundingBox(); + + if (compBox.getXMin() == bestBox.getXMin()) { + if (compBox.getYMin() == bestBox.getYMin()) { + if (icomponent->getId() < bestComponent->getId()) + bestComponent = *icomponent; + } else + if (compBox.getYMin() < bestBox.getYMin()) + bestComponent = *icomponent; + } else { + if (compBox.getXMin() < bestBox.getXMin()) + bestComponent = *icomponent; + } } else { if (compArea > bestArea) bestComponent = *icomponent;