From f00b8cd667728e4205c1807ade0d74d0e0b59632 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 11 Sep 2020 12:56:35 +0200 Subject: [PATCH] Allow RoutingPad::getPlugOccurrence() to build upon a Pin. * Change: In Hurricane::RoutingPad::getPlugOccurrence(), it was forbidden to rebuild the Occurrence over anything other than Plug. But as we now also uses Pins, it becomes useful to rebuild the Occurrence on a Pin. The name of the function stays, even if its less meaningful now. --- hurricane/src/hurricane/Pin.cpp | 5 ++--- hurricane/src/hurricane/RoutingPad.cpp | 15 ++++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hurricane/src/hurricane/Pin.cpp b/hurricane/src/hurricane/Pin.cpp index bcfb5771..5de59b96 100644 --- a/hurricane/src/hurricane/Pin.cpp +++ b/hurricane/src/hurricane/Pin.cpp @@ -76,9 +76,8 @@ void Pin::_postCreate() void Pin::_preDestroy() // ********************* { - Inherit::_preDestroy(); - - getCell()->_getPinMap()._remove(this); + Inherit::_preDestroy(); + getCell()->_getPinMap()._remove(this); } string Pin::_getString() const diff --git a/hurricane/src/hurricane/RoutingPad.cpp b/hurricane/src/hurricane/RoutingPad.cpp index f01ba04b..1c161313 100644 --- a/hurricane/src/hurricane/RoutingPad.cpp +++ b/hurricane/src/hurricane/RoutingPad.cpp @@ -319,11 +319,16 @@ namespace Hurricane { Net* net = component->getNet(); Path path = _occurrence.getPath(); - if (path.isEmpty()) - throw Error( "RoutingPad::getPlugOccurrence(): Empty Path, *not* in an instance for\n" - " %s" - , getString(this).c_str() - ); + if (path.isEmpty()) { + Pin* pin = dynamic_cast( component ); + if (not pin) + throw Error( "RoutingPad::getPlugOccurrence(): Empty Path, *not* in an instance for\n" + " %s" + , getString(this).c_str() + ); + + return Occurrence(pin,Path()); + } Instance* instance = path.getTailInstance(); Plug* plug = instance->getPlug(net);