Skip to content

Commit

Permalink
Route backward from sinks to LCBs and update test
Browse files Browse the repository at this point in the history
Signed-off-by: Wenhao Lin <wenhao.lin@amd.com>
  • Loading branch information
WenhaoLin-AMD committed Nov 14, 2024
1 parent 9533bc3 commit 579b93a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
13 changes: 13 additions & 0 deletions src/com/xilinx/rapidwright/router/RouteNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,19 @@ public ArrayList<PIP> getPIPsBackToSourceByNodes() {
return pips;
}

public ArrayList<PIP> getPIPsForwardToSinkByNodes() {
ArrayList<PIP> pips = new ArrayList<>();
RouteNode curr = this;
do {
PIP pip = RouterHelper.findPIPbetweenNodes(Node.getNode(curr), Node.getNode(curr.parent));
if (pip != null) {
pips.add(pip);
}
curr = curr.parent;
} while (curr.parent != null);
return pips;
}

public Wire[] getWiresInNode() {
return Node.getWiresInNode(getTile(),getWire());
}
Expand Down
16 changes: 8 additions & 8 deletions src/com/xilinx/rapidwright/rwroute/GlobalSignalRouting.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ public static void symmetricClkRouting(Net clk, Device device, Function<Node,Nod
Map<RouteNode, List<SitePinInst>> lcbMappings = getLCBPinMappingsOnVersal(clk, getNodeStatus);
VersalClockRouting.routeDistributionToLCBs(clk, upDownDistLines, lcbMappings.keySet());

VersalClockRouting.routeLCBsToSinks(clk, lcbMappings, getNodeStatus);

Set<PIP> clkPIPsWithoutDuplication = new HashSet<>(clk.getPIPs());
clk.setPIPs(clkPIPsWithoutDuplication);
}
Expand Down Expand Up @@ -446,20 +444,19 @@ public static Map<RouteNode, List<SitePinInst>> getLCBPinMappingsOnVersal(Net cl
IntentCode.NODE_PINFEED,
IntentCode.NODE_GLOBAL_LEAF
);
Set<Node> used = new HashSet<>();
Set<Node> visited = new HashSet<>();
Queue<RouteNode> q = new LinkedList<>();
Predicate<Node> isNodeUnavailable = (node) -> getNodeStatus.apply(node) == NodeStatus.UNAVAILABLE;
RouteThruHelper routeThruHelper = new RouteThruHelper(clk.getDesign().getDevice());

nextPin: for (SitePinInst p: clk.getPins()) {
if (p.isOutPin()) continue;
Node intNode = RouterHelper.projectInputPinToINTNode(p);
RouteNode intRouteNode = new RouteNode(intNode.getTile(), intNode.getWireIndex(), null, 0);
Node sinkNode = p.getConnectedNode();
RouteNode sinkRouteNode = new RouteNode(sinkNode.getTile(), sinkNode.getWireIndex(), null, 0);
ClockRegion cr = p.getTile().getClockRegion();

q.clear();
q.add(intRouteNode);
q.add(sinkRouteNode);

while (!q.isEmpty()) {
RouteNode curr = q.poll();
Expand All @@ -469,11 +466,14 @@ public static Map<RouteNode, List<SitePinInst>> getLCBPinMappingsOnVersal(Net cl
if (!uphill.getTile().getClockRegion().equals(cr)) continue;
if (!allowedIntentCodes.contains(uphill.getIntentCode())) continue;
if (!visited.add(uphill)) continue;
if (used.contains(uphill)) continue;
// if (used.contains(uphill)) continue;
if (routeThruHelper.isRouteThru(uphill, currNode) && currNode.getIntentCode() != IntentCode.NODE_IRI) continue;
if (isNodeUnavailable.test(uphill)) continue;
if (uphill.getIntentCode() == IntentCode.NODE_GLOBAL_LEAF) {
RouteNode rn = new RouteNode(uphill.getTile(), uphill.getWireIndex(), null, 0);
RouteNode rn = new RouteNode(uphill.getTile(), uphill.getWireIndex(), curr, curr.getLevel()+1);
clk.getPIPs().addAll(rn.getPIPsForwardToSinkByNodes());
rn.setParent(null);
rn.setLevel(0);
lcbMappings.computeIfAbsent(rn, (k) -> new ArrayList<>()).add(p);
visited.clear();
continue nextPin;
Expand Down
6 changes: 0 additions & 6 deletions test/src/com/xilinx/rapidwright/rwroute/TestRWRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,6 @@ public void testSingleConnection(String partName,
@Test
public void testClockRoutingOnVersal() {
Design design = RapidWrightDCP.loadDCP("two_clk_check_NetTools.dcp");
design.setTrackNetChanges(true);

// Pseudo-randomly unroute some pins from a multi-pin net
for (Net net : design.getNets()) {
if (NetTools.isGlobalClock(net)) {
net.unroute();
Expand All @@ -558,9 +555,6 @@ public void testClockRoutingOnVersal() {
router.initialize();
router.routeGlobalClkNets();

for (Net net : design.getModifiedNets()) {
assertAllPinsRouted(net);
}
VivadoToolsHelper.assertFullyRouted(design);
}
}

0 comments on commit 579b93a

Please sign in to comment.