From 8abd58439d1770c80311e743e2c56899b6452b04 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 14 Nov 2024 13:08:15 -0800 Subject: [PATCH] Re-preserve moved sinks, also remove GND net if no sinks left Signed-off-by: Eddie Hung --- src/com/xilinx/rapidwright/rwroute/RWRoute.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/com/xilinx/rapidwright/rwroute/RWRoute.java b/src/com/xilinx/rapidwright/rwroute/RWRoute.java index 7032f2e3f..687ad948f 100644 --- a/src/com/xilinx/rapidwright/rwroute/RWRoute.java +++ b/src/com/xilinx/rapidwright/rwroute/RWRoute.java @@ -536,14 +536,26 @@ protected void routeStaticNets() { if (staticNetAndRoutingTargets.isEmpty()) return; - List gndPins = staticNetAndRoutingTargets.get(design.getGndNet()); + Net gndNet = design.getGndNet(); + List gndPins = staticNetAndRoutingTargets.get(gndNet); if (gndPins != null) { boolean invertGndToVccForLutInputs = config.isInvertGndToVccForLutInputs(); Set newVccPins = RouterHelper.invertPossibleGndPinsToVccPins(design, gndPins, invertGndToVccForLutInputs); if (!newVccPins.isEmpty()) { gndPins.removeAll(newVccPins); - staticNetAndRoutingTargets.computeIfAbsent(design.getVccNet(), (net) -> new ArrayList<>()) + if (gndPins.isEmpty()) { + staticNetAndRoutingTargets.remove(gndNet); + } + Net vccNet = design.getVccNet(); + staticNetAndRoutingTargets.computeIfAbsent(vccNet, (net) -> new ArrayList<>()) .addAll(newVccPins); + // Re-preserve these new VCC sinks + for (SitePinInst spi : newVccPins) { + Node node = spi.getConnectedNode(); + assert(routingGraph.getPreservedNet(node) == gndNet); + routingGraph.unpreserve(node); + routingGraph.preserve(node, vccNet); + } } }