Skip to content

Commit fc35343

Browse files
authored
Add DiffPhysNetlist utility (#66)
* Add DiffPhysNetlist utility Signed-off-by: Eddie Hung <eddie.hung@amd.com> * Print out detailed diff report; update to 2024 Signed-off-by: Eddie Hung <eddie.hung@amd.com> * Update RapidWright submodule Signed-off-by: Eddie Hung <eddie.hung@amd.com> * Add entry to README.md Signed-off-by: Eddie Hung <eddie.hung@amd.com> --------- Signed-off-by: Eddie Hung <eddie.hung@amd.com>
1 parent 1d4fc44 commit fc35343

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ Utilities:
1515
* [`net_printer`](https://github.com/Xilinx/fpga24_routing_contest/tree/master/net_printer) -- inspect the routing of nets in a Physical Netlist.
1616
* [`DcpToFPGAIF`](https://github.com/Xilinx/fpga24_routing_contest/pull/10) -- process a DCP into FPGAIF Logical and Physical Netlists for use with this contest.
1717
* [`wirelength_analyzer`](https://github.com/Xilinx/fpga24_routing_contest/tree/master/wirelength_analyzer) -- compute a [critical-path wirelength](https://xilinx.github.io/fpga24_routing_contest/score.html#critical-path-wirelength) for a routed FPGAIF Physical Netlist.
18+
* [`DiffPhysNetlist`](https://github.com/Xilinx/fpga24_routing_contest/pull/66) -- display any placement/intra-site routing differences between two FPGAIF Physical Netlists.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
3+
*
4+
* Author: Eddie Hung, AMD
5+
*
6+
* SPDX-License-Identifier: MIT
7+
*
8+
*/
9+
10+
package com.xilinx.fpga24_routing_contest;
11+
12+
import com.xilinx.rapidwright.design.Design;
13+
import com.xilinx.rapidwright.design.compare.DesignComparator;
14+
import com.xilinx.rapidwright.interchange.PhysNetlistReader;
15+
16+
import java.io.IOException;
17+
18+
public class DiffPhysNetlist {
19+
public static void main(String[] args) throws IOException {
20+
if (args.length != 2) {
21+
System.err.println("USAGE: <routed.phys> <unrouted.phys>");
22+
return;
23+
}
24+
25+
// Disable verbose Physical Netlist checks
26+
PhysNetlistReader.CHECK_CONSTANT_ROUTING_AND_NET_NAMING = false;
27+
PhysNetlistReader.CHECK_AND_CREATE_LOGICAL_CELL_IF_NOT_PRESENT = false;
28+
PhysNetlistReader.VALIDATE_MACROS_PLACED_FULLY = false;
29+
PhysNetlistReader.CHECK_MACROS_CONSISTENT = false;
30+
31+
// Read the routed and unrouted Physical Netlists
32+
Design routedDesign = PhysNetlistReader.readPhysNetlist(args[0]);
33+
Design unroutedDesign = PhysNetlistReader.readPhysNetlist(args[1]);
34+
35+
DesignComparator dc = new DesignComparator();
36+
// Only compare PIPs on static and clock nets
37+
dc.setComparePIPs((net) -> net.isStaticNet() || net.isClockNet());
38+
int numDiffs = dc.compareDesigns(unroutedDesign, routedDesign);
39+
if (numDiffs == 0) {
40+
System.out.println("INFO: No differences found between routed and unrouted netlists");
41+
} else {
42+
dc.printDiffReport(System.out);
43+
}
44+
45+
System.exit(numDiffs == 0 ? 0 : 1);
46+
}
47+
}
48+

0 commit comments

Comments
 (0)