From b731d00fd8008cf6fb72685eef0f2bed28cf76e9 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Fri, 25 Oct 2024 19:17:35 -0700 Subject: [PATCH] Add and use DREAMPlaceFPGA.isDREAMPlaceFPGAOnPath() Signed-off-by: Eddie Hung --- .../rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java | 8 ++++++++ .../com/xilinx/rapidwright/placer/TestDREAMPlaceFPGA.java | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/com/xilinx/rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java b/src/com/xilinx/rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java index 46e97a27e..de27199af 100644 --- a/src/com/xilinx/rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java +++ b/src/com/xilinx/rapidwright/placer/dreamplacefpga/DREAMPlaceFPGA.java @@ -242,6 +242,14 @@ public static Design placeDesign(EDIFNetlist netlist, Path workDir, boolean make return placedDesign; } + /** + * Checks if dreamplacefpga is available on current PATH (uses unix 'which' or windows 'where'). + * @return true if yosys is on current PATH, false otherwise. + */ + public static boolean isDREAMPlaceFPGAOnPath() { + return FileTools.isExecutableOnPath(dreamPlaceFPGAExec); + } + public static void main(String[] args) throws IOException { // Usage: [--out_of_context] [work directory] if (args.length < 2 || args.length > 4) { diff --git a/test/src/com/xilinx/rapidwright/placer/TestDREAMPlaceFPGA.java b/test/src/com/xilinx/rapidwright/placer/TestDREAMPlaceFPGA.java index c0908f5d7..2e5dcfcb4 100644 --- a/test/src/com/xilinx/rapidwright/placer/TestDREAMPlaceFPGA.java +++ b/test/src/com/xilinx/rapidwright/placer/TestDREAMPlaceFPGA.java @@ -29,6 +29,7 @@ import com.xilinx.rapidwright.util.ReportRouteStatusResult; import com.xilinx.rapidwright.util.VivadoTools; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Assumptions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -40,6 +41,9 @@ public class TestDREAMPlaceFPGA { @Test public void testDREAMPlaceFPGAMain(@TempDir Path tempDir) throws IOException { + // Skip test if dreamplacefpga is not on PATH + Assumptions.assumeTrue(DREAMPlaceFPGA.isDREAMPlaceFPGAOnPath()); + String inputDcp = RapidWrightDCP.getString("gnl_2_4_3_1.3_gnl_3000_07_3_80_80_placed.dcp"); String outputDcp = tempDir.resolve("output.dcp").toString(); DREAMPlaceFPGA.main(new String[]{inputDcp, outputDcp, DREAMPlaceFPGA.MAKE_DCP_OUT_OF_CONTEXT, tempDir.toString()}); @@ -52,6 +56,9 @@ public void testDREAMPlaceFPGAMain(@TempDir Path tempDir) throws IOException { @Test public void testDREAMPlaceFPGA(@TempDir Path tempDir) throws IOException { + // Skip test if dreamplacefpga is not on PATH + Assumptions.assumeTrue(DREAMPlaceFPGA.isDREAMPlaceFPGAOnPath()); + boolean skipXdef = true; Design design = RapidWrightDCP.loadDCP("gnl_2_4_3_1.3_gnl_3000_07_3_80_80_placed.dcp", skipXdef); Assertions.assertTrue(design.getUsedSites().isEmpty());