Skip to content

Commit

Permalink
Adds an Override Flag for Advanced Flow Settings in Designs (#1135)
Browse files Browse the repository at this point in the history
* Override switch for Advanced Flow flag; adds test

Signed-off-by: Chris Lavin <[email protected]>

* Change test to reflect DCP load behavior

Signed-off-by: Chris Lavin <[email protected]>

* rc5

Signed-off-by: Chris Lavin <[email protected]>

* debug

Signed-off-by: Chris Lavin <[email protected]>

* Fix internal test failures

Signed-off-by: Chris Lavin <[email protected]>

* Add debug

Signed-off-by: Chris Lavin <[email protected]>

* Revert

Signed-off-by: Chris Lavin <[email protected]>

---------

Signed-off-by: Chris Lavin <[email protected]>
  • Loading branch information
clavin-xlnx authored Jan 14, 2025
1 parent d475105 commit ab92606
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
<classpathentry kind="lib" path="jars/kryo-5.2.1.jar"/>
<classpathentry kind="lib" path="jars/minlog-1.3.1.jar"/>
<classpathentry kind="lib" path="jars/jython-standalone-2.7.2.jar"/>
<classpathentry kind="lib" path="jars/rapidwright-api-lib-2024.2.1-rc4.jar">
<classpathentry kind="lib" path="jars/rapidwright-api-lib-2024.2.1-rc5.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/RapidWright/jars/rapidwright-api-lib-2024.2.1-rc4-javadoc.jar!/"/>
<attribute name="javadoc_location" value="jar:platform:/resource/RapidWright/jars/rapidwright-api-lib-2024.2.1-rc5-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/jgrapht-core-1.3.0.jar"/>
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

env:
RAPIDWRIGHT_VERSION: v2024.2.1-rc4-beta
RAPIDWRIGHT_VERSION: v2024.2.1-rc5-beta

jobs:
build:
Expand Down
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
12 changes: 9 additions & 3 deletions src/com/xilinx/rapidwright/util/VivadoTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@

package com.xilinx.rapidwright.util;

import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.edif.EDIFTools;

import java.io.File;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.edif.EDIFTools;

/**
* Utility methods to provide access to vivado and parse logs
*
Expand Down Expand Up @@ -115,6 +116,11 @@ public static List<String> runTcl(Path outputLog, Path tclScript, boolean verbos
+ tclScript.toString();
Integer exitCode = FileTools.runCommand(vivadoCmd, verbose, environ, runDir);
if (exitCode != 0) {
if (Files.exists(outputLog)) {
for (String l : FileTools.getLinesFromTextFile(outputLog.toString())) {
System.out.println("FAILED OUTPUT> " + l);
}
}
throw new RuntimeException("Vivado exited with code: " + exitCode);
}
return FileTools.getLinesFromTextFile(outputLog.toString());
Expand Down
32 changes: 32 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,35 @@ 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);
// Write DCP should revert flag to default case (true)
Assertions.assertTrue(falseDCP.isAdvancedFlow());

falseDCP.setAdvancedFlow(true);

Path overrideDCPPath = tempDir.resolve("override.dcp");
Params.RW_DISABLE_WRITING_ADV_FLOW_DCPS = true;
Assertions.assertTrue(falseDCP.isAdvancedFlow());
falseDCP.writeCheckpoint(overrideDCPPath);
// Return to default for other tests
Params.RW_DISABLE_WRITING_ADV_FLOW_DCPS = false;
}
}

0 comments on commit ab92606

Please sign in to comment.