forked from Xilinx/fpga24_routing_contest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contest-specific DCP to FPGA Interchange Format Utility (#10)
* Add DcpToFPGAIF.java Signed-off-by: Eddie Hung <[email protected]> * Discover alternate sources Signed-off-by: Eddie Hung <[email protected]> * Add import, fix exit code Signed-off-by: Eddie Hung <[email protected]> * Update README.md * Update README.md * Update details.md * Update FAQ.md * Update README.md --------- Signed-off-by: Eddie Hung <[email protected]>
- Loading branch information
1 parent
3d6040f
commit aea3358
Showing
4 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2023, Advanced Micro Devices, Inc. All rights reserved. | ||
* | ||
* Author: Eddie Hung, AMD | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
package com.xilinx.fpga24_routing_contest; | ||
|
||
import com.xilinx.rapidwright.design.Design; | ||
import com.xilinx.rapidwright.design.DesignTools; | ||
import com.xilinx.rapidwright.design.SitePinInst; | ||
import com.xilinx.rapidwright.design.Net; | ||
import com.xilinx.rapidwright.interchange.LogNetlistWriter; | ||
import com.xilinx.rapidwright.interchange.PhysNetlistWriter; | ||
import com.xilinx.rapidwright.util.FileTools; | ||
|
||
import java.io.IOException; | ||
|
||
public class DcpToFPGAIF { | ||
public static void main(String[] args) throws IOException { | ||
if (args.length != 3) { | ||
System.err.println("USAGE: <input.dcp> <output.netlist> <output.phys>"); | ||
System.exit(1); | ||
} | ||
|
||
Design design = Design.readCheckpoint(args[0]); | ||
|
||
// Even though the design is fully placed-and-routed, still need to call this to | ||
// infer any unrouted SitePinInst-s from nets with hierarchical ports --- not for | ||
// routing to since they are out-of-context ports --- but so that it's clear to | ||
// other nets that those nodes are off limits | ||
DesignTools.createMissingSitePinInsts(design); | ||
|
||
for (Net net : design.getNets()) { | ||
if (net.isStaticNet() || net.isClockNet()) { | ||
continue; | ||
} | ||
|
||
// Where a net only has a single source, try and discover if an alternate | ||
// source exists | ||
SitePinInst altSource = net.getAlternateSource(); | ||
if (altSource == null) { | ||
altSource = DesignTools.getLegalAlternativeOutputPin(net); | ||
if (altSource != null) { | ||
// Commit this pin to the SiteInst | ||
altSource.getSiteInst().addPin(altSource); | ||
DesignTools.routeAlternativeOutputSitePin(net, altSource); | ||
} | ||
} | ||
|
||
net.unroute(); | ||
} | ||
|
||
PhysNetlistWriter.writePhysNetlist(design, args[2]); | ||
|
||
// Write logical netlist after physical since it collapses macros | ||
LogNetlistWriter.writeLogNetlist(design.getNetlist(), args[1]); | ||
} | ||
} | ||
|