From 54dacdc98d7f48c7e4a98a8f9611e20817fdc05a Mon Sep 17 00:00:00 2001 From: Chris Lavin Date: Tue, 11 Feb 2025 13:25:40 -0700 Subject: [PATCH 1/2] rc1 Signed-off-by: Chris Lavin --- .classpath | 4 ++-- .github/workflows/build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index 154addfe2..44545455e 100644 --- a/.classpath +++ b/.classpath @@ -33,9 +33,9 @@ - + - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac3e2074c..960006abe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: pull_request: env: - RAPIDWRIGHT_VERSION: v2024.2.1-beta + RAPIDWRIGHT_VERSION: v2024.2.2-rc1-beta jobs: build: From eb3eff83492bd8fdd6617c0722dcd01fc0412415 Mon Sep 17 00:00:00 2001 From: Chris Lavin Date: Fri, 14 Feb 2025 17:05:40 -0700 Subject: [PATCH 2/2] Enables batching of SitePinInst removals during MakeBlackBox (#1142) Signed-off-by: Chris Lavin --- .../rapidwright/design/DesignTools.java | 79 ++++++++++++------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/src/com/xilinx/rapidwright/design/DesignTools.java b/src/com/xilinx/rapidwright/design/DesignTools.java index f4db21143..5a3c0a59b 100644 --- a/src/com/xilinx/rapidwright/design/DesignTools.java +++ b/src/com/xilinx/rapidwright/design/DesignTools.java @@ -1081,14 +1081,15 @@ public static boolean removeConnectedRouting(Net net, Node node) { */ public static void unroutePins(Net net, Collection pins) { List sinkPins = new ArrayList<>(pins.size()); - pins.forEach((spi) -> { - if (spi.isOutPin()) { - // TODO - This can lead to a slow down in VCC and GND nets as it is not batched - DesignTools.unrouteSourcePin(spi); + List srcPins = new ArrayList<>(); + for (SitePinInst pin : pins) { + if (pin.isOutPin()) { + srcPins.add(pin); } else { - sinkPins.add(spi); + sinkPins.add(pin); } - }); + } + DesignTools.unrouteSourcePins(srcPins); removePIPsFromNet(net,getTrimmablePIPsFromPins(net, sinkPins)); for (SitePinInst pin : sinkPins) { pin.setRouted(false); @@ -1113,41 +1114,62 @@ private static void removePIPsFromNet(Net net, Set pipsToRemove) { * @return The set of PIPs that were unrouted from the net. */ public static Set unrouteSourcePin(SitePinInst src) { - if (!src.isOutPin() || src.getNet() == null) return Collections.emptySet(); - Node srcNode = src.getConnectedNode(); - Set pipsToRemove = new HashSet<>(); + return unrouteSourcePins(Collections.singletonList(src)); + } + /** + * Unroutes a list of source SitePinInst of a net. This is desirable when a net + * has multiple SitePinInst source pins (multiple outputs of a Site) and only a + * particular branch is desired to be unrouted. If the entire net is to be + * unrouted, a more efficient method is {@link Net#unroute()}. + * + * @param srcs The list of source pins of the net from which to remove the + * routing + * @return The set of PIPs that were unrouted from the net. + */ + public static Set unrouteSourcePins(List srcs) { + if (srcs == null || srcs.size() == 0) { + return Collections.emptySet(); + } + Net net = srcs.get(0).getNet(); + if (net == null) { + return Collections.emptySet(); + } Map> pipMap = new HashMap<>(); - for (PIP pip : src.getNet().getPIPs()) { + for (PIP pip : net.getPIPs()) { Node node = pip.isReversed() ? pip.getEndNode() : pip.getStartNode(); pipMap.computeIfAbsent(node, k -> new ArrayList<>()).add(pip); } Map sinkNodes = new HashMap<>(); - for (SitePinInst sinkPin : src.getNet().getSinkPins()) { + for (SitePinInst sinkPin : net.getSinkPins()) { sinkNodes.put(sinkPin.getConnectedNode(), sinkPin); } - Queue q = new LinkedList<>(); - q.add(srcNode); - while (!q.isEmpty()) { - Node curr = q.poll(); - List pips = pipMap.get(curr); - if (pips != null) { - for (PIP p : pips) { - Node endNode = p.isReversed() ? p.getStartNode() : p.getEndNode(); - q.add(endNode); - pipsToRemove.add(p); - SitePinInst sink = sinkNodes.get(endNode); - if (sink != null) { - sink.setRouted(false); + Set pipsToRemove = new HashSet<>(); + for (SitePinInst src : srcs) { + if (!src.isOutPin()) continue; + Queue q = new LinkedList<>(); + q.add(src.getConnectedNode()); + while (!q.isEmpty()) { + Node curr = q.poll(); + List pips = pipMap.get(curr); + if (pips != null) { + for (PIP p : pips) { + Node endNode = p.isReversed() ? p.getStartNode() : p.getEndNode(); + q.add(endNode); + pipsToRemove.add(p); + SitePinInst sink = sinkNodes.get(endNode); + if (sink != null) { + sink.setRouted(false); + } } } } - } - src.setRouted(false); - removePIPsFromNet(src.getNet(), pipsToRemove); + src.setRouted(false); + removePIPsFromNet(src.getNet(), pipsToRemove); + } return pipsToRemove; } @@ -1820,7 +1842,6 @@ public static void makeBlackBox(Design d, EDIFHierCellInst hierarchicalCell) { // Rename nets if source was removed Set netsToKeep = new HashSet<>(); for (Entry e : netsToUpdate.entrySet()) { - EDIFHierNet newSource = d.getNetlist().getHierNetFromName(e.getValue()); Net net = e.getKey(); if (!net.rename(e.getValue())) { throw new RuntimeException("ERROR: Failed to rename net '" + net.getName() + "'"); @@ -1840,7 +1861,7 @@ public static void makeBlackBox(Design d, EDIFHierCellInst hierarchicalCell) { } for (SiteInst siteInst : siteInstsToRemove) { - d.removeSiteInst(siteInst); + d.removeSiteInst(siteInst, false, pinsToRemove); } // Remove any stray stubs on any remaining nets