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

PartialRouter's global router to not unpreserve sink nodes #736

Merged
merged 5 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 30 additions & 26 deletions src/com/xilinx/rapidwright/rwroute/PartialRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,21 +191,24 @@ protected int getNumConnectionsCrossingSLRs() {

@Override
protected NodeStatus getGlobalRoutingNodeStatus(Net net, Node node) {
// In softPreserve mode, allow global router to use all nodes -- including
// those already preserved by another net

Net preservedNet = routingGraph.getPreservedNet(node);
if (preservedNet != null) {
// Unavailable only if it isn't carrying the net undergoing routing
return preservedNet == net ? NodeStatus.INUSE :
softPreserve ? NodeStatus.AVAILABLE :
NodeStatus.UNAVAILABLE;
if (preservedNet == net) {
return NodeStatus.INUSE;
}
if (!softPreserve && preservedNet != null) {
return NodeStatus.UNAVAILABLE;
}

RouteNode rnode = routingGraph.getNode(node);
if (rnode != null) {
// In softPreserve mode, allow global router to use all nodes -- including
// those already preserved by another net, unless it's an input pin
if (!softPreserve || rnode.getType() == RouteNodeType.PINFEED_I) {
return NodeStatus.UNAVAILABLE;
}
}

// A RouteNode will only be created if the net is necessary for
// a to-be-routed connection
return softPreserve || routingGraph.getNode(node) == null ? NodeStatus.AVAILABLE
: NodeStatus.UNAVAILABLE;
return NodeStatus.AVAILABLE;
}

@Override
Expand All @@ -226,21 +229,22 @@ protected void routeGlobalClkNets() {
for (PIP pip : clk.getPIPs()) {
for (Node node : Arrays.asList(pip.getStartNode(), pip.getEndNode())) {
Net preservedNet = routingGraph.getPreservedNet(node);
if (preservedNet != clk) {
if (preservedNet != null) {
unpreserveNet(preservedNet);
unpreserveNets.add(preservedNet);
}
// Redo preserving clk
Net oldNet = routingGraph.preserve(node, clk);
assert(oldNet == null);

// Clear preservedNode's prev pointer so that it doesn't get misinterpreted
// by RouteNodeGraph.mustInclude as being part of an existing route
RouteNode rnode = routingGraph.getNode(node);
assert(rnode.getPrev() != null);
rnode.clearPrev();
if (preservedNet == clk) {
continue;
}
assert(preservedNet != null);

unpreserveNet(preservedNet);
unpreserveNets.add(preservedNet);
// Redo preserving clk
Net oldNet = routingGraph.preserve(node, clk);
assert(oldNet == null);

// Clear preservedNode's prev pointer so that it doesn't get misinterpreted
// by RouteNodeGraph.mustInclude as being part of an existing route
RouteNode rnode = routingGraph.getNode(node);
assert(rnode.getPrev() != null);
rnode.clearPrev();
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions src/com/xilinx/rapidwright/rwroute/RWRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ private void categorizeNets() {
addNetConnectionToRoutingTargets(net);
} else if (RouterHelper.isDriverLessOrLoadLessNet(net)) {
preserveNet(net, true);
if (DesignTools.isNetDrivenByHierPort(net)) {
// For the case of nets driven by hierarchical ports (out of context designs)
// create a RouteNode for all its sink ports in order to prevent them from
// being unpreserved
for (SitePinInst spi : net.getSinkPins()) {
getOrCreateRouteNode(spi.getConnectedNode(), RouteNodeType.PINFEED_I);
}
}
numNotNeedingRoutingNets++;
} else if (RouterHelper.isInternallyRoutedNet(net)) {
preserveNet(net, true);
Expand Down Expand Up @@ -371,8 +379,8 @@ protected void addGlobalClkRoutingTargets(Net clk) {
protected NodeStatus getGlobalRoutingNodeStatus(Net net, Node node) {
if (routingGraph.isPreserved(node)) {
// Node is preserved by any net -- for base RWRoute, we don't need
// to check which net it is because global/static nets are routed
// fully in one pass
// to check which net it is nor whether it is already in use
// because global/static nets are routed from scratch
return NodeStatus.UNAVAILABLE;
}

Expand Down