Skip to content

Commit

Permalink
[RWRoute] Further divide LOCAL nodes into EAST/WEST for UltraScale(+) (
Browse files Browse the repository at this point in the history
…#1098)

* [TestNode] Expand testNodeReachabilityUltraScale

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Expand testNodeReachabilityVersal too

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* UltraScale+: Sub-divide LOCALs into _EAST/_WEST and stick to sink's side

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Re-add EXCLUSIVE_SINK (non-sided) for CTRL sinks

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Support UltraScale

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Print

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Expand testNodeReachabilityVersal

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Do not error out for Versal

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Fix failing assertions

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Remove unused import

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Fix another typo

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Fix SLR crossings

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* More Versal fixes

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Update testSLRCrossingNonTimingDriven golden values

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Tidy up and comments

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Add a few more testcases

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* [RWRoute] Non-verbose mode to print out nodes popped

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Update comments/asserts

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Clean up RouteNodeGraph.isAccessible()

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Fixes for UltraScale

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Skip another assert for Versal

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

* Another assertion

Signed-off-by: Eddie Hung <eddie.hung@amd.com>

---------

Signed-off-by: Eddie Hung <eddie.hung@amd.com>
  • Loading branch information
eddieh-xlnx authored Nov 12, 2024
1 parent b81febd commit a3af7dc
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 131 deletions.
4 changes: 2 additions & 2 deletions src/com/xilinx/rapidwright/rwroute/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void addAltSinkRnode(RouteNode sinkRnode) {
} else {
assert(!altSinkRnodes.contains(sinkRnode));
}
assert(sinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK ||
assert(sinkRnode.getType().isExclusiveSink() ||
// Can be a WIRE if node is not exclusive a sink
sinkRnode.getType() == RouteNodeType.NON_LOCAL);
altSinkRnodes.add(sinkRnode);
Expand Down Expand Up @@ -487,7 +487,7 @@ public void setAllTargets(RWRoute.ConnectionState state) {
// where the same physical pin services more than one logical pin
if (rnode.countConnectionsOfUser(netWrapper) == 0 ||
// Except if it is not an EXCLUSIVE_SINK
rnode.getType() != RouteNodeType.EXCLUSIVE_SINK) {
rnode.getType().isExclusiveSink()) {
assert(rnode.getIntentCode() != IntentCode.NODE_PINBOUNCE);
rnode.markTarget(state);
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/xilinx/rapidwright/rwroute/PartialRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ protected void determineRoutingTargets() {
preservedNet = routingGraph.getPreservedNet(sinkRnode);
if (preservedNet != null && preservedNet != net) {
unpreserveNets.add(preservedNet);
assert(sinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK);
assert(sinkRnode.getType().isExclusiveSink());
}
}

Expand Down Expand Up @@ -599,7 +599,7 @@ protected void unpreserveNet(Net net) {
RouteNode sourceRnode = connection.getSourceRnode();
RouteNode sinkRnode = connection.getSinkRnode();
assert(sourceRnode.getType() == RouteNodeType.EXCLUSIVE_SOURCE);
assert(sinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK);
assert(sinkRnode.getType().isExclusiveSink());

// Even though this connection is not expected to have any routing yet,
// perform a rip up anyway in order to release any exclusive sinks
Expand Down
42 changes: 35 additions & 7 deletions src/com/xilinx/rapidwright/rwroute/RWRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
Expand Down Expand Up @@ -600,15 +601,28 @@ protected NetWrapper createNetWrapperAndConnections(Net net) {
}

indirectConnections.add(connection);
RouteNode sinkRnode = routingGraph.getOrCreate(sinkINTNode, RouteNodeType.EXCLUSIVE_SINK);
sinkRnode.setType(RouteNodeType.EXCLUSIVE_SINK);
BitSet[] eastWestWires = (routingGraph.eastWestWires == null) ? null :
routingGraph.eastWestWires.get(sinkINTNode.getTile().getTileTypeEnum());
RouteNode sinkRnode;
if (eastWestWires != null && eastWestWires[0].get(sinkINTNode.getWireIndex())) {
sinkRnode = routingGraph.getOrCreate(sinkINTNode, RouteNodeType.EXCLUSIVE_SINK_EAST);
sinkRnode.setType(RouteNodeType.EXCLUSIVE_SINK_EAST);
} else if (eastWestWires != null && eastWestWires[1].get(sinkINTNode.getWireIndex())) {
sinkRnode = routingGraph.getOrCreate(sinkINTNode, RouteNodeType.EXCLUSIVE_SINK_WEST);
sinkRnode.setType(RouteNodeType.EXCLUSIVE_SINK_WEST);
} else {
sinkRnode = routingGraph.getOrCreate(sinkINTNode, RouteNodeType.EXCLUSIVE_SINK);
sinkRnode.setType(RouteNodeType.EXCLUSIVE_SINK);
}
connection.setSinkRnode(sinkRnode);

// Where appropriate, allow all 6 LUT pins to be swapped to begin with
char lutLetter = sink.getName().charAt(0);
int numberOfSwappablePins = (lutPinSwapping && sink.isLUTInputPin())
? LUTTools.MAX_LUT_SIZE : 0;
if (numberOfSwappablePins > 0) {
assert(sinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK_EAST || sinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK_WEST);

for (Cell cell : DesignTools.getConnectedCells(sink)) {
BEL bel = cell.getBEL();
assert(bel.isLUT());
Expand Down Expand Up @@ -650,8 +664,8 @@ protected NetWrapper createNetWrapperAndConnections(Net net) {
if (routingGraph.isPreserved(node)) {
continue;
}
RouteNode altSinkRnode = routingGraph.getOrCreate(node, RouteNodeType.EXCLUSIVE_SINK);
assert(altSinkRnode.getType() == RouteNodeType.EXCLUSIVE_SINK);
RouteNode altSinkRnode = routingGraph.getOrCreate(node, sinkRnode.getType());
assert(altSinkRnode.getType().isExclusiveSink());
connection.addAltSinkRnode(altSinkRnode);
}

Expand Down Expand Up @@ -1798,13 +1812,18 @@ private void exploreAndExpand(ConnectionState state, RouteNode rnode) {
}
switch (childRNode.getType()) {
case LOCAL:
case LOCAL_EAST:
case LOCAL_WEST:
if (!routingGraph.isAccessible(childRNode, connection)) {
continue;
}
// Verify invariant that east/west wires stay east/west
assert(rnode.getType() != RouteNodeType.LOCAL_EAST || childRNode.getType() == RouteNodeType.LOCAL_EAST);
assert(rnode.getType() != RouteNodeType.LOCAL_WEST || childRNode.getType() == RouteNodeType.LOCAL_WEST);
break;
case NON_LOCAL:
// LOCALs cannot connect to NON_LOCALs except via a LUT routethru
assert(rnode.getType() != RouteNodeType.LOCAL ||
assert(!rnode.getType().isLocal() ||
routingGraph.lutRoutethru && rnode.getIntentCode() == IntentCode.NODE_PINFEED ||
// FIXME:
design.getSeries() == Series.Versal);
Expand All @@ -1819,6 +1838,13 @@ private void exploreAndExpand(ConnectionState state, RouteNode rnode) {
}
break;
case EXCLUSIVE_SINK:
case EXCLUSIVE_SINK_EAST:
case EXCLUSIVE_SINK_WEST:
assert(childRNode.getType() != RouteNodeType.EXCLUSIVE_SINK_EAST || rnode.getType() == RouteNodeType.LOCAL_EAST);
assert(childRNode.getType() != RouteNodeType.EXCLUSIVE_SINK_WEST || rnode.getType() == RouteNodeType.LOCAL_WEST);
assert(childRNode.getType() != RouteNodeType.EXCLUSIVE_SINK || rnode.getType() == RouteNodeType.LOCAL ||
// FIXME:
design.getSeries() == Series.Versal);
if (!isAccessibleSink(childRNode, connection)) {
continue;
}
Expand Down Expand Up @@ -1863,7 +1889,7 @@ protected boolean isAccessibleSink(RouteNode child, Connection connection) {
}

protected boolean isAccessibleSink(RouteNode child, Connection connection, boolean assertOnOveruse) {
assert(child.getType() == RouteNodeType.EXCLUSIVE_SINK);
assert(child.getType().isExclusiveSink());
assert(!assertOnOveruse || !child.isOverUsed());

if (child.isTarget()) {
Expand Down Expand Up @@ -2142,7 +2168,9 @@ protected void printRoutingStatistics() {
printFormattedString("Num iterations:", routeIteration);
printFormattedString("Connections routed:", connectionsRouted.get());
printFormattedString("Nodes pushed:", nodesPushed.get());
printFormattedString("Nodes popped:", nodesPopped.get());
}
printFormattedString("Nodes popped:", nodesPopped.get());
if (config.isVerbose()) {
System.out.printf("------------------------------------------------------------------------------\n");
}

Expand Down
12 changes: 9 additions & 3 deletions src/com/xilinx/rapidwright/rwroute/RouteNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class RouteNode extends Node implements Comparable<RouteNode> {

protected RouteNode(RouteNodeGraph routingGraph, Node node, RouteNodeType type) {
super(node);
RouteNodeInfo nodeInfo = RouteNodeInfo.get(this, routingGraph);
RouteNodeInfo nodeInfo = RouteNodeInfo.get(node, routingGraph);
this.type = (type == null) ? nodeInfo.type : type;
endTileXCoordinate = nodeInfo.endTileXCoordinate;
endTileYCoordinate = nodeInfo.endTileYCoordinate;
Expand Down Expand Up @@ -124,10 +124,16 @@ private void setBaseCost(Series series) {
(length <= 3 && series == Series.Versal));
break;
case EXCLUSIVE_SINK:
case EXCLUSIVE_SINK_EAST:
case EXCLUSIVE_SINK_WEST:
assert(length == 0 ||
(length == 1 && (series == Series.UltraScalePlus || series == Series.UltraScale) && getIntentCode() == IntentCode.NODE_PINBOUNCE));
break;
case LOCAL:
assert(length == 0);
break;
case LOCAL_EAST:
case LOCAL_WEST:
assert(length == 0 ||
(length == 1 && (
((series == Series.UltraScalePlus || series == Series.UltraScale) && getIntentCode() == IntentCode.NODE_PINBOUNCE) ||
Expand Down Expand Up @@ -361,10 +367,10 @@ public RouteNodeType getType() {
public void setType(RouteNodeType type) {
assert(this.type == type ||
// Support demotion from EXCLUSIVE_SINK to LOCAL since they have the same base cost
(this.type == RouteNodeType.EXCLUSIVE_SINK && type == RouteNodeType.LOCAL) ||
(this.type.isExclusiveSink() && type == RouteNodeType.LOCAL) ||
// Or promotion from LOCAL to EXCLUSIVE_SINK (by PartialRouter when NODE_PINBOUNCE on
// a newly unpreserved net becomes a sink)
(this.type == RouteNodeType.LOCAL && type == RouteNodeType.EXCLUSIVE_SINK));
(this.type == RouteNodeType.LOCAL && type.isExclusiveSink()));
this.type = type;
}

Expand Down
Loading

0 comments on commit a3af7dc

Please sign in to comment.