@@ -1081,15 +1081,14 @@ public static boolean removeConnectedRouting(Net net, Node node) {
10811081 */
10821082 public static void unroutePins (Net net , Collection <SitePinInst > pins ) {
10831083 List <SitePinInst > sinkPins = new ArrayList <>(pins .size ());
1084- List < SitePinInst > srcPins = new ArrayList <>();
1085- for ( SitePinInst pin : pins ) {
1086- if ( pin . isOutPin ()) {
1087- srcPins . add ( pin );
1084+ pins . forEach (( spi ) -> {
1085+ if ( spi . isOutPin () ) {
1086+ // TODO - This can lead to a slow down in VCC and GND nets as it is not batched
1087+ DesignTools . unrouteSourcePin ( spi );
10881088 } else {
1089- sinkPins .add (pin );
1089+ sinkPins .add (spi );
10901090 }
1091- }
1092- DesignTools .unrouteSourcePins (srcPins );
1091+ });
10931092 removePIPsFromNet (net ,getTrimmablePIPsFromPins (net , sinkPins ));
10941093 for (SitePinInst pin : sinkPins ) {
10951094 pin .setRouted (false );
@@ -1114,62 +1113,41 @@ private static void removePIPsFromNet(Net net, Set<PIP> pipsToRemove) {
11141113 * @return The set of PIPs that were unrouted from the net.
11151114 */
11161115 public static Set <PIP > unrouteSourcePin (SitePinInst src ) {
1117- return unrouteSourcePins (Collections .singletonList (src ));
1118- }
1116+ if (!src .isOutPin () || src .getNet () == null ) return Collections .emptySet ();
1117+ Node srcNode = src .getConnectedNode ();
1118+ Set <PIP > pipsToRemove = new HashSet <>();
11191119
1120- /**
1121- * Unroutes a list of source SitePinInst of a net. This is desirable when a net
1122- * has multiple SitePinInst source pins (multiple outputs of a Site) and only a
1123- * particular branch is desired to be unrouted. If the entire net is to be
1124- * unrouted, a more efficient method is {@link Net#unroute()}.
1125- *
1126- * @param srcs The list of source pins of the net from which to remove the
1127- * routing
1128- * @return The set of PIPs that were unrouted from the net.
1129- */
1130- public static Set <PIP > unrouteSourcePins (List <SitePinInst > srcs ) {
1131- if (srcs == null || srcs .size () == 0 ) {
1132- return Collections .emptySet ();
1133- }
1134- Net net = srcs .get (0 ).getNet ();
1135- if (net == null ) {
1136- return Collections .emptySet ();
1137- }
11381120 Map <Node , List <PIP >> pipMap = new HashMap <>();
1139- for (PIP pip : net .getPIPs ()) {
1121+ for (PIP pip : src . getNet () .getPIPs ()) {
11401122 Node node = pip .isReversed () ? pip .getEndNode () : pip .getStartNode ();
11411123 pipMap .computeIfAbsent (node , k -> new ArrayList <>()).add (pip );
11421124 }
11431125
11441126 Map <Node ,SitePinInst > sinkNodes = new HashMap <>();
1145- for (SitePinInst sinkPin : net .getSinkPins ()) {
1127+ for (SitePinInst sinkPin : src . getNet () .getSinkPins ()) {
11461128 sinkNodes .put (sinkPin .getConnectedNode (), sinkPin );
11471129 }
11481130
1149- Set <PIP > pipsToRemove = new HashSet <>();
1150- for (SitePinInst src : srcs ) {
1151- if (!src .isOutPin ()) continue ;
1152- Queue <Node > q = new LinkedList <>();
1153- q .add (src .getConnectedNode ());
1154- while (!q .isEmpty ()) {
1155- Node curr = q .poll ();
1156- List <PIP > pips = pipMap .get (curr );
1157- if (pips != null ) {
1158- for (PIP p : pips ) {
1159- Node endNode = p .isReversed () ? p .getStartNode () : p .getEndNode ();
1160- q .add (endNode );
1161- pipsToRemove .add (p );
1162- SitePinInst sink = sinkNodes .get (endNode );
1163- if (sink != null ) {
1164- sink .setRouted (false );
1165- }
1131+ Queue <Node > q = new LinkedList <>();
1132+ q .add (srcNode );
1133+ while (!q .isEmpty ()) {
1134+ Node curr = q .poll ();
1135+ List <PIP > pips = pipMap .get (curr );
1136+ if (pips != null ) {
1137+ for (PIP p : pips ) {
1138+ Node endNode = p .isReversed () ? p .getStartNode () : p .getEndNode ();
1139+ q .add (endNode );
1140+ pipsToRemove .add (p );
1141+ SitePinInst sink = sinkNodes .get (endNode );
1142+ if (sink != null ) {
1143+ sink .setRouted (false );
11661144 }
11671145 }
11681146 }
1169-
1170- src .setRouted (false );
1171- removePIPsFromNet (src .getNet (), pipsToRemove );
11721147 }
1148+
1149+ src .setRouted (false );
1150+ removePIPsFromNet (src .getNet (), pipsToRemove );
11731151 return pipsToRemove ;
11741152 }
11751153
@@ -1842,6 +1820,7 @@ public static void makeBlackBox(Design d, EDIFHierCellInst hierarchicalCell) {
18421820 // Rename nets if source was removed
18431821 Set <String > netsToKeep = new HashSet <>();
18441822 for (Entry <Net , String > e : netsToUpdate .entrySet ()) {
1823+ EDIFHierNet newSource = d .getNetlist ().getHierNetFromName (e .getValue ());
18451824 Net net = e .getKey ();
18461825 if (!net .rename (e .getValue ())) {
18471826 throw new RuntimeException ("ERROR: Failed to rename net '" + net .getName () + "'" );
@@ -1861,7 +1840,7 @@ public static void makeBlackBox(Design d, EDIFHierCellInst hierarchicalCell) {
18611840 }
18621841
18631842 for (SiteInst siteInst : siteInstsToRemove ) {
1864- d .removeSiteInst (siteInst , false , pinsToRemove );
1843+ d .removeSiteInst (siteInst );
18651844 }
18661845
18671846 // Remove any stray stubs on any remaining nets
0 commit comments