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); + } } }