Skip to content

Commit

Permalink
Override switch for Advanced Flow flag; adds test
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lavin <[email protected]>
  • Loading branch information
clavin-xlnx committed Jan 10, 2025
1 parent d475105 commit d9e826c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/com/xilinx/rapidwright/util/Params.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class Params {

public static String RW_WRITE_DCP_2024_1_NAME = "RW_WRITE_DCP_2024_1";

public static String RW_DISABLE_WRITING_ADV_FLOW_DCPS_NAME = "RW_DISABLE_WRITING_ADV_FLOW_DCPS";

/**
* Flag to have RapidWright decompress gzipped EDIF files to disk prior to
* parsing. This is a tradeoff where pre-decompression improves runtime over the
Expand All @@ -60,6 +62,14 @@ public class Params {
*/
public static boolean RW_WRITE_DCP_2024_1 = isParamSet(RW_WRITE_DCP_2024_1_NAME);

/**
* Flag to disable RapidWright from writing any DCPs that target Vivado's
* Advanced Flow (starting in Vivado 2024.2). By default, RapidWright writes
* DCPs targeting Versal devices with the Advanced Flow compatibility flag set
* to true.
*/
public static boolean RW_DISABLE_WRITING_ADV_FLOW_DCPS = isParamSet(RW_DISABLE_WRITING_ADV_FLOW_DCPS_NAME);

/**
* Checks if the named RapidWright parameter is set via an environment variable
* or by a JVM parameter of the same name.
Expand Down
33 changes: 33 additions & 0 deletions test/src/com/xilinx/rapidwright/design/TestDCPWrite.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.nio.file.Path;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

Expand Down Expand Up @@ -53,4 +54,36 @@ public void testNewPhysDBWrite(@TempDir Path dir) {
VivadoToolsHelper.assertFullyRouted(dcp);
}
}

@Test
public void testAdvancedFlowFlags(@TempDir Path tempDir) {
Design design = RapidWrightDCP.loadDCP("picoblaze_2022.2.dcp");

// Should be true since it is targeting Versal
Assertions.assertTrue(design.isAdvancedFlow());
Path defaultDCPPath = tempDir.resolve("default.dcp");
design.writeCheckpoint(defaultDCPPath);

Design defaultDCP = Design.readCheckpoint(defaultDCPPath);
Assertions.assertTrue(defaultDCP.isAdvancedFlow());

design.setAdvancedFlow(false);
Assertions.assertFalse(design.isAdvancedFlow());
Path setFalseDCPPath = tempDir.resolve("false.dcp");
design.writeCheckpoint(setFalseDCPPath);

Design falseDCP = Design.readCheckpoint(setFalseDCPPath);
Assertions.assertFalse(falseDCP.isAdvancedFlow());

falseDCP.setAdvancedFlow(true);

Params.RW_DISABLE_WRITING_ADV_FLOW_DCPS = true;

Path overrideDCPPath = tempDir.resolve("override.dcp");
Assertions.assertTrue(falseDCP.isAdvancedFlow());
falseDCP.writeCheckpoint(overrideDCPPath);

Design overrideDCP = Design.readCheckpoint(overrideDCPPath);
Assertions.assertFalse(overrideDCP.isAdvancedFlow());
}
}

0 comments on commit d9e826c

Please sign in to comment.