Skip to content

Commit

Permalink
PartialRouter's global router to not unpreserve sink nodes (#736)
Browse files Browse the repository at this point in the history
* PartialRouter's global router to not unpreserve sinks nodes

Signed-off-by: Eddie Hung <[email protected]>

* Only disallow if input pin

Signed-off-by: Eddie Hung <[email protected]>

* Update comment

Signed-off-by: Eddie Hung <[email protected]>

* Refactor PartialRouter.getGlobalRoutingNodeStatus()

Signed-off-by: Eddie Hung <[email protected]>

* Remove extra char

Signed-off-by: Eddie Hung <[email protected]>

---------

Signed-off-by: Eddie Hung <[email protected]>
  • Loading branch information
eddieh-xlnx authored Jul 5, 2023
1 parent 263cfe1 commit 830c4dc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 28 deletions.
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

0 comments on commit 830c4dc

Please sign in to comment.