Skip to content

Commit

Permalink
Add and use DREAMPlaceFPGA.isDREAMPlaceFPGAOnPath()
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Hung <[email protected]>
  • Loading branch information
eddieh-xlnx committed Oct 26, 2024
1 parent 4be072e commit b731d00
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: <input DCP> <output DCP> [--out_of_context] [work directory]
if (args.length < 2 || args.length > 4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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()});
Expand All @@ -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());
Expand Down

0 comments on commit b731d00

Please sign in to comment.