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

[BlockStitcher] Work arounds to address stitching issues in latest Vivado 2024.2 #1134

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
40 changes: 31 additions & 9 deletions src/com/xilinx/rapidwright/edif/EDIFNetlist.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,37 +481,59 @@ public List<String> getComments() {
}

/**
* Migrates all cells in the provided library
* into the standard work library.
* @param library The library with cells to be migrated to work.
* Migrates all cells in the provided library into the standard work library.
*
* @param library The library with cells to be migrated to work.
* @param renameCollisions Flag to rename cells upon name collision
*/
public void migrateToWorkLibrary(String library) {
public void migrateToWorkLibrary(String library, boolean renameCollisions) {
EDIFLibrary work = getWorkLibrary();
EDIFLibrary oldWork = getLibrary(library);
List<EDIFCell> toRemove = new ArrayList<>(oldWork.getCells());
for (EDIFCell c : toRemove) {
oldWork.removeCell(c);
work.addCell(c);
if (renameCollisions) {
work.addCellRenameDuplicates(c, "Work");
} else {
work.addCell(c);
}
}
removeLibrary(library);
}

/**
* Migrates all libraries except HDI primitives and work to
* the work library.
* Migrates all cells in the provided library into the standard work library.
*
* @param library The library with cells to be migrated to work.
*/
public void consolidateAllToWorkLibrary() {
public void migrateToWorkLibrary(String library) {
migrateToWorkLibrary(library, false);
}

/**
* Migrates all libraries except HDI primitives and work to the work library.
*
* @param renameCollisions Flag to rename cells upon name collision
*/
public void consolidateAllToWorkLibrary(boolean renameCollisions) {
List<EDIFLibrary> librariesToMigrate = new ArrayList<>();
for (EDIFLibrary l : getLibraries()) {
if (!l.isHDIPrimitivesLibrary() && !l.isWorkLibrary()) {
librariesToMigrate.add(l);
}
}
for (EDIFLibrary l : librariesToMigrate) {
migrateToWorkLibrary(l.getName());
migrateToWorkLibrary(l.getName(), renameCollisions);
}
}

/**
* Migrates all libraries except HDI primitives and work to the work library.
*/
public void consolidateAllToWorkLibrary() {
consolidateAllToWorkLibrary(false);
}

private EDIFCell migrateCellAndSubCellsWorker(EDIFCell cell) {
EDIFLibrary srcLib = cell.getLibrary();
EDIFLibrary destLib = getLibrary(srcLib.getName());
Expand Down
36 changes: 19 additions & 17 deletions src/com/xilinx/rapidwright/ipi/BlockStitcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ public class BlockStitcher {
private ArrayList<EDIFHierPortInst> getPassThruPortInsts(Port port, EDIFHierPortInst curr) {
ArrayList<EDIFHierPortInst> list = new ArrayList<>();
for (String name : port.getPassThruPortNames()) {
EDIFPortInst passThruInst = curr.getPortInst().getCellInst().getPortInst(name);
EDIFHierCellInst hierInst = curr.getHierarchicalInst();
EDIFPortInst passThruInst = hierInst.getInst().getPortInst(name);
if (passThruInst == null) {
String unconnected = curr.getPortInst().getCellInst().getName() + EDIFTools.EDIF_HIER_SEP + name;
String unconnected = hierInst.getInst().getName() + EDIFTools.EDIF_HIER_SEP + name;
if (!reportedUnconnects.contains(unconnected)) {
System.out.println("INFO: Port " + unconnected + " is unconnected");
reportedUnconnects.add(unconnected);
}
continue;
}
EDIFHierPortInst passThru = new EDIFHierPortInst(curr.getHierarchicalInst(), passThruInst);
EDIFHierPortInst passThru = new EDIFHierPortInst(hierInst.getParent(), passThruInst);
list.add(passThru);
}
return list;
Expand Down Expand Up @@ -462,7 +463,7 @@ public static void main(String[] args) {
}
t.stop().start("Reading Top Level EDIF");
EDIFNetlist topEdifNetlist = EDIFTools.readEdifFile(args[1]);
Design stitched = new Design("top_stitched", stitcher.partName);
Design stitched = new Design(topEdifNetlist.getName(), stitcher.partName);
stitched.setNetlist(topEdifNetlist);
t.stop().start("Implement Blocks");
stitcher.populateModuleInstMaps(topEdifNetlist);
Expand Down Expand Up @@ -534,7 +535,7 @@ public static void main(String[] args) {
}
//System.out.println(modInstName + " " + implementationIndex);
EDIFNetlist tmp = stitched.getNetlist();
stitched.setNetlist(null);
stitched.setNetlist(EDIFTools.createNewNetlist("dummy"));
ModuleInst mi = stitched.createModuleInst(modInstName, modImpls.get(implementationIndex));
stitched.setNetlist(tmp);
miMap.put(mi, modImpls.getNetlist());
Expand Down Expand Up @@ -590,18 +591,19 @@ public static void main(String[] args) {
inst.setCellType(cellType);
}

for (EDIFCell c : stitched.getNetlist().getLibrary("IP_Integrator_Lib").getCells()) {
work.addCell(c);
}

ArrayList<String> libsToRemove = new ArrayList<>();
for (EDIFLibrary lib : stitched.getNetlist().getLibraries()) {
if (lib.getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME) ||
lib.getName().equals(EDIFTools.EDIF_LIBRARY_WORK_NAME)) continue;
libsToRemove.add(lib.getName());
}
for (String lib : libsToRemove) {
stitched.getNetlist().removeLibrary(lib);
// Move all cells to 'work' library
boolean renameCollisions = true;
stitched.getNetlist().consolidateAllToWorkLibrary(renameCollisions);
EDIFLibrary workLib = stitched.getNetlist().getWorkLibrary();
for (EDIFCell workCell : workLib.getCells()) {
for (EDIFCellInst inst : workCell.getCellInsts()) {
EDIFLibrary lib = inst.getCellType().getLibrary();
if (lib.isHDIPrimitivesLibrary() || lib == workLib) {
continue;
} else {
inst.setCellType(work.getCell(inst.getCellType().getName()));
}
}
}
t.stop();
if (DUMP_SYNTH_DCP_ONLY) {
Expand Down
Loading