Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to support 2024.1 DCP writing #995

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1.0.jar">
<classpathentry kind="lib" path="jars/rapidwright-api-lib-2024.1.0-rc4.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/RapidWright/jars/rapidwright-api-lib-2024.1.0-javadoc.jar!/"/>
<attribute name="javadoc_location" value="jar:platform:/resource/RapidWright/jars/rapidwright-api-lib-2024.1.0-rc4-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.1.0-beta
RAPIDWRIGHT_VERSION: v2024.1.0-rc4-beta

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion src/com/xilinx/rapidwright/edif/EDIFNetlist.java
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public EDIFHierPortInst getHierPortInstFromName(String hierPortInstName) {
* @param name the hierarchical name
* @return A pair of EdifHierCellInst and the unmatched portion of the name. The name may be null if we found a complete match
*/
private Pair<List<EDIFCellInst>, String> getHierObject(String name) {
public Pair<List<EDIFCellInst>, String> getHierObject(String name) {
if (name.isEmpty()) return new Pair<>(Collections.singletonList(getTopCellInst()), null);
String[] parts = name.split(EDIFTools.EDIF_HIER_SEP);

Expand Down
59 changes: 24 additions & 35 deletions src/com/xilinx/rapidwright/edif/EDIFTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -896,11 +897,27 @@ public static EDIFNetlist readEdifFile(Path edifFileName) {
return readEdifFile(edifFileName, Integer.MAX_VALUE);
}

public static EDIFNetlist readEdifFile(Path edifFileName, int maxThreads) {
Path parent = edifFileName.getParent();
if (parent == null) {
parent = Paths.get(System.getProperty("user.dir"));
public static List<String> getEDNFiles(Path parent) {
String edifDirectoryName = parent.toAbsolutePath().toString();
File origDir = new File(edifDirectoryName);
String[] ednFiles = origDir.list(FileTools.getEDNFilenameFilter());
if (ednFiles != null && ednFiles.length > 0) {
edifDirectoryName = edifDirectoryName + File.separator;
for (int i = 0; i < ednFiles.length; i++) {
ednFiles[i] = edifDirectoryName + ednFiles[i];
}
return new ArrayList<>(Arrays.asList(ednFiles));
}
return Collections.emptyList();
}

public static Path getEDIFParentDir(Path edifFileName) {
Path parent = edifFileName == null ? null : edifFileName.getParent();
return parent == null ? Paths.get(System.getProperty("user.dir")) : parent;
}

public static EDIFNetlist readEdifFile(Path edifFileName, int maxThreads) {
Path parent = getEDIFParentDir(edifFileName);
if (RW_ENABLE_EDIF_BINARY_CACHING) {
Path bedif = parent.resolve(
edifFileName.getFileName().toString().replace(".edf", ".bedf"));
Expand All @@ -915,37 +932,9 @@ public static EDIFNetlist readEdifFile(Path edifFileName, int maxThreads) {
}
}
}
EDIFNetlist edif;
File edifFile = edifFileName.toFile();
String edifDirectoryName = parent.toAbsolutePath().toString();
if (edifDirectoryName == null) {
try {
File canEdifFile = edifFile.getCanonicalFile();
if (canEdifFile != null) {
edifDirectoryName = canEdifFile.getParent();
}
} catch (IOException e) {
// Unable to determine EDIF source directory - not sure if
// this is worth throwing an error as we are only checking for EDN files
System.err.println("WARNING: Could not determine source directory for EDIF. "
+ "If it contained encrypted cells \n(present as .edn files), they will not "
+ "be passed to resulting DCP load script.");
}
}
edif = loadEDIFFile(edifFileName, maxThreads);
if (edifDirectoryName != null) {
File origDir = new File(edifDirectoryName);
edif.setOrigDirectory(edifDirectoryName);
String[] ednFiles = origDir.list(FileTools.getEDNFilenameFilter());
if (ednFiles != null && ednFiles.length > 0) {
edifDirectoryName = edifDirectoryName + File.separator;
for (int i=0; i < ednFiles.length; i++) {
ednFiles[i] = edifDirectoryName + ednFiles[i];
}

}
edif.setEncryptedCells(new ArrayList<>(Arrays.asList(ednFiles)));
}
EDIFNetlist edif = loadEDIFFile(edifFileName, maxThreads);
edif.setOrigDirectory(parent.toAbsolutePath().toString());
edif.setEncryptedCells(getEDNFiles(parent));
if (RW_ENABLE_EDIF_BINARY_CACHING) {
Path bedif = parent.resolve(
edifFileName.getFileName().toString().replace(".edf", ".bedf"));
Expand Down
1 change: 1 addition & 0 deletions src/com/xilinx/rapidwright/util/ParallelismTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public static <T> T get(Future<T> future) {
* @param <T> Type returned by all tasks.
* @return A Deque of Future objects corresponding to each task (in order).
*/
@SafeVarargs
public static <T> Deque<Future<T>> invokeFirstSubmitRest(@NotNull Callable<T>... tasks) {
Deque<Future<T>> futures = new ArrayDeque<>(tasks.length);

Expand Down
9 changes: 9 additions & 0 deletions src/com/xilinx/rapidwright/util/Params.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class Params {

public static int RW_ZSTD_DEFAULT_COMPRESSION_LEVEL = 3;

public static String RW_WRITE_DCP_2024_1_NAME = "RW_WRITE_DCP_2024_1";

/**
* 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 @@ -51,6 +53,13 @@ public class Params {
public static int RW_ZSTD_COMPRESSION_LEVEL = getParamOrDefaultIntSetting(RW_DECOMPRESS_GZIPPED_EDIF_TO_DISK_NAME,
RW_ZSTD_DEFAULT_COMPRESSION_LEVEL);

/**
* Flag to have RapidWright write out DCPs such that they will only be readable
* in Vivado 2024.1 and later. The advantage is that these DCPs will be read in
* faster and will provide better support for the largest devices.
*/
public static boolean RW_WRITE_DCP_2024_1 = isParamSet(RW_WRITE_DCP_2024_1_NAME);

/**
* Checks if the named RapidWright parameter is set via an environment variable
* or by a JVM parameter of the same name.
Expand Down
Loading