Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set reversed flag on bi-directional PIPs used from end->start #774

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public static void routeStaticNet(Net currNet,
if (debug) System.out.println(" " + routingNode.toString());
routingNode = routingNode.getPrev();
}
netPIPs.addAll(RouterHelper.getPIPsFromNodes(pathNodes));
netPIPs.addAll(RouterHelper.getPIPsFromNodes(pathNodes, true));

// If the source is an output site pin, put it aside for consideration
// to add as a new source pin
Expand Down
41 changes: 35 additions & 6 deletions src/com/xilinx/rapidwright/rwroute/RouterHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,41 @@ public static List<PIP> getConnectionPIPs(Connection connection) {
return getPIPsFromNodes(connection.getNodes());
}


/**
* Gets a list of {@link PIP} instances from a list of {@link Node} instances.
* @param connectionNodes The list of nodes of a routed {@link Connection} instance.
*
* @param connectionNodes The list of nodes of a routed {@link Connection}
* instance.
* @return A list of PIPs generated from the list of nodes.
*/
public static List<PIP> getPIPsFromNodes(List<Node> connectionNodes) {
return getPIPsFromNodes(connectionNodes, false);
}

/**
* Gets a list of {@link PIP} instances from a list of {@link Node} instances.
*
* @param connectionNodes The list of nodes of a routed {@link Connection}
* instance.
* @param srcToSinkOrder Specifies the order of the connection nodes. True
* indicates the first node is the source and the last
* is the sink. False indicates the opposite.
* @return A list of PIPs generated from the list of nodes.
*/
public static List<PIP> getPIPsFromNodes(List<Node> connectionNodes, boolean srcToSinkOrder) {
List<PIP> connectionPIPs = new ArrayList<>();
if (connectionNodes == null) return connectionPIPs;
// Nodes of a connection are added to the list starting from its sink to its source
// Nodes of a connection are added to the list starting from its sink to its
// source -- unless srcToSinkOrder is true (as is the case in static routing)
int driverOffsetIdx = 1;
int loadOffsetIdx = 0;
if (srcToSinkOrder) {
driverOffsetIdx = 0;
loadOffsetIdx = 1;
}
for (int i = 0; i < connectionNodes.size() - 1; i++) {
Node driver = connectionNodes.get(i+1);
Node load = connectionNodes.get(i);
Node driver = connectionNodes.get(i + driverOffsetIdx);
Node load = connectionNodes.get(i + loadOffsetIdx);
PIP pip = findPIPbetweenNodes(driver, load);
if (pip != null) {
connectionPIPs.add(pip);
Expand Down Expand Up @@ -249,6 +271,9 @@ public static PIP getPIP(Tile loadTile, Wire[] driverWires, int loadWire) {
if (wire.getTile().equals(loadTile)) {
pip = loadTile.getPIP(wire.getWireIndex(), loadWire);
if (pip != null) {
if (pip.isBidirectional() && pip.getStartWireIndex() == loadWire) {
pip.setIsReversed(true);
}
break;
}
}
Expand All @@ -268,8 +293,12 @@ public static PIP getPIP(Node driver, Node load) {
return p;
}
for (PIP p : driver.getAllUphillPIPs()) {
if (p.getStartNode().equals(load))
if (p.getStartNode().equals(load)) {
if (p.isBidirectional()) {
p.setIsReversed(true);
}
return p;
}
}
return null;
}
Expand Down