From 16234d4acc5697ecca545e62ff1900c41b91d928 Mon Sep 17 00:00:00 2001 From: Chris Lavin Date: Mon, 12 Aug 2024 18:06:22 -0600 Subject: [PATCH 1/6] 2024.1.2 rc1 Signed-off-by: Chris Lavin --- .classpath | 4 ++-- .github/workflows/build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index 6c78a14a3..060981e77 100644 --- a/.classpath +++ b/.classpath @@ -33,9 +33,9 @@ - + - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbec2fe82..c4c8c4742 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: pull_request: env: - RAPIDWRIGHT_VERSION: v2024.1.1-beta + RAPIDWRIGHT_VERSION: v2024.1.2-rc1-beta jobs: build: From 3013fa4b33407e7660e10f8e8b399426f31af83d Mon Sep 17 00:00:00 2001 From: eddieh-xlnx Date: Tue, 13 Aug 2024 16:39:53 -0700 Subject: [PATCH 2/6] [TestPIP] Test PIP constructor for reversed wires (#1045) wire0,wire1 for a bidir PIP is unaffected, but wire1,wire0 will be changed to wire0,wire1 with reversed flag set Signed-off-by: Eddie Hung --- .../xilinx/rapidwright/device/TestPIP.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/src/com/xilinx/rapidwright/device/TestPIP.java b/test/src/com/xilinx/rapidwright/device/TestPIP.java index 32ca5ae70..d660d8fea 100644 --- a/test/src/com/xilinx/rapidwright/device/TestPIP.java +++ b/test/src/com/xilinx/rapidwright/device/TestPIP.java @@ -61,4 +61,29 @@ public void testGetArbitraryPIPReversed(String deviceName, String startNodeName, PIP pip = PIP.getArbitraryPIP(startNode, endNode); Assertions.assertEquals(isReversed, pip.isReversed()); } + + @ParameterizedTest + @CsvSource({ + "xcvu3p,INT_X21Y240,BYPASS_E14,INT_NODE_IMUX_18_INT_OUT0,true", + "xcvu3p,INT_X21Y240,INT_NODE_IMUX_18_INT_OUT0,BYPASS_E14,false" + }) + public void testPIP(String deviceName, String tileName, String startWireName, String endWireName, boolean isReversed) { + Device d = Device.getDevice(deviceName); + Tile t = d.getTile(tileName); + int startWireIndex = t.getWireIndex(startWireName); + int endWireIndex = t.getWireIndex(endWireName); + PIP p = new PIP(t, startWireIndex, endWireIndex); + if (isReversed) { + Assertions.assertTrue(p.isReversed()); + Assertions.assertEquals(startWireName, p.getEndWireName()); + Assertions.assertEquals(endWireName, p.getStartWireName()); + } else { + Assertions.assertFalse(p.isReversed()); + Assertions.assertEquals(startWireName, p.getStartWireName()); + Assertions.assertEquals(endWireName, p.getEndWireName()); + } + + Assertions.assertTrue(p.deepEquals(new PIP(t, startWireName, endWireName))); + Assertions.assertTrue(p.deepEquals(new PIP(d, tileName, startWireName, endWireName))); + } } From 30cdde3ed31db8a0c06d0ecbe38dea898c5a16a0 Mon Sep 17 00:00:00 2001 From: eddieh-xlnx Date: Tue, 13 Aug 2024 17:02:01 -0700 Subject: [PATCH 3/6] [TestSiteInst] Add test for unrouting through FF routethru cells (#1041) Signed-off-by: Eddie Hung --- .../rapidwright/design/TestSiteInst.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/test/src/com/xilinx/rapidwright/design/TestSiteInst.java b/test/src/com/xilinx/rapidwright/design/TestSiteInst.java index a694bdbc5..69a3dcef4 100644 --- a/test/src/com/xilinx/rapidwright/design/TestSiteInst.java +++ b/test/src/com/xilinx/rapidwright/design/TestSiteInst.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -166,6 +166,32 @@ public void testUnrouteLUTRouteThru(String deviceName) { } } + @Test + public void testUnrouteFFRouteThru() { + Design d = RapidWrightDCP.loadDCP("microblazeAndILA_3pblocks.dcp"); + SiteInst si = d.getSiteInstFromSiteName("SLICE_X58Y84"); + Cell ffCell = si.getCell("AFF"); + Assertions.assertTrue(ffCell.isFFRoutethruCell()); + + // Check all intra-site routing present + Net net = si.getNetFromSiteWire("AQ"); + Assertions.assertSame(net, si.getNetFromSiteWire("FFMUXA1_OUT1")); + Assertions.assertEquals("D5", si.getUsedSitePIP("FFMUXA1").getInputPinName()); + Assertions.assertSame(net, si.getNetFromSiteWire("A5LUT_O5")); + + // Unroute intra-site net + BELPin o5 = si.getBELPin("A5LUT", "O5"); + BELPin aq = si.getBELPin("AFF", "Q"); + Assertions.assertTrue(si.unrouteIntraSiteNet(o5, aq)); + + // Check all intra-site net (incl. routethru cell) is gone + Assertions.assertNull(si.getNetFromSiteWire("AQ")); + Assertions.assertNull(si.getNetFromSiteWire("FFMUXA1_OUT1")); + Assertions.assertNull(si.getUsedSitePIP("FFMUXA1")); + Assertions.assertNull(si.getNetFromSiteWire("A5LUT_O5")); + Assertions.assertNull(si.getCell("AFF")); + } + @Test public void testUnrouteIntraSiteNet() { Design design = RapidWrightDCP.loadDCP("bnn.dcp"); From 4068a82bf57579525211136f5a0d3850f8292ef9 Mon Sep 17 00:00:00 2001 From: eddieh-xlnx Date: Thu, 15 Aug 2024 13:47:28 -0700 Subject: [PATCH 4/6] EDIF cleanup preventing singleton cells/libraries from attaching to user designs (#1050) * EDIF cleanup preventing singleton cells/libraries from attaching to user designs Signed-off-by: Eddie Hung * Simplify with new EDIFNetlist.copyLibraryAndSubCells() method Signed-off-by: Eddie Hung * Add EDIFLibraryNoNetlist class Signed-off-by: Eddie Hung * Upgrade to RuntimeException Signed-off-by: Eddie Hung * Cleanup Signed-off-by: Eddie Hung * Apply suggestions from code review Signed-off-by: eddieh-xlnx * Rename EDIFLibraryNoNetlist -> EDIFLibraryBuiltin Signed-off-by: Eddie Hung * Copy getMacroPrimitives() result before removing Signed-off-by: Eddie Hung * Apply suggestions from code review Signed-off-by: eddieh-xlnx * rc2 Signed-off-by: Chris Lavin --------- Signed-off-by: Eddie Hung Signed-off-by: eddieh-xlnx Signed-off-by: Chris Lavin Co-authored-by: Chris Lavin --- .classpath | 4 +- .github/workflows/build.yml | 2 +- .../rapidwright/design/DesignTools.java | 2 +- src/com/xilinx/rapidwright/edif/EDIFCell.java | 23 +++++- .../xilinx/rapidwright/edif/EDIFLibrary.java | 56 +++++++++++--- .../rapidwright/edif/EDIFLibraryBuiltin.java | 42 ++++++++++ .../xilinx/rapidwright/edif/EDIFNetlist.java | 76 ++++++++++++------- .../examples/PolynomialGenerator.java | 13 +--- .../interchange/DeviceResourcesVerifier.java | 6 +- .../interchange/DeviceResourcesWriter.java | 10 ++- .../interchange/EnumerateCellBelMapping.java | 4 +- .../device/TestUnisimPlacements.java | 4 +- 12 files changed, 179 insertions(+), 63 deletions(-) create mode 100644 src/com/xilinx/rapidwright/edif/EDIFLibraryBuiltin.java diff --git a/.classpath b/.classpath index 060981e77..fb9b9c897 100644 --- a/.classpath +++ b/.classpath @@ -33,9 +33,9 @@ - + - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c4c8c4742..aca5a6f7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: pull_request: env: - RAPIDWRIGHT_VERSION: v2024.1.2-rc1-beta + RAPIDWRIGHT_VERSION: v2024.1.2-rc2-beta jobs: build: diff --git a/src/com/xilinx/rapidwright/design/DesignTools.java b/src/com/xilinx/rapidwright/design/DesignTools.java index 987ab92ab..24ae7018e 100644 --- a/src/com/xilinx/rapidwright/design/DesignTools.java +++ b/src/com/xilinx/rapidwright/design/DesignTools.java @@ -2095,7 +2095,7 @@ public static boolean placeCell(Cell c, Design design) { // Don't move cell if already placed return true; } - Map> compatTypes = c.getCompatiblePlacements(); + Map> compatTypes = c.getCompatiblePlacements(design.getDevice()); for (Entry> e : compatTypes.entrySet()) { for (Site s : design.getDevice().getAllSitesOfType(e.getKey())) { diff --git a/src/com/xilinx/rapidwright/edif/EDIFCell.java b/src/com/xilinx/rapidwright/edif/EDIFCell.java index 1222d9e61..00270d628 100644 --- a/src/com/xilinx/rapidwright/edif/EDIFCell.java +++ b/src/com/xilinx/rapidwright/edif/EDIFCell.java @@ -1,7 +1,7 @@ /* * * Copyright (c) 2017-2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -78,6 +78,16 @@ public EDIFCell(EDIFLibrary lib, String name) { if (lib != null) lib.addCell(this); } + /** + * Shallow Copy constructor - Creates a new EDIFCell object, EDIFCell + * contents point to orig. + * + * @param orig The original cell + */ + public EDIFCell(EDIFCell orig) { + this(null, orig); + } + /** * Shallow Copy constructor - Creates a new EDIFCell object, EDIFCell * contents point to orig. @@ -477,9 +487,20 @@ public EDIFLibrary getLibrary() { * @param library the library to set */ public void setLibrary(EDIFLibrary library) { + if (library == null) { + throw new RuntimeException("ERROR: library argument cannot be null."); + } + if (this.library != null && this.library != library) { + throw new RuntimeException("ERROR: EDIFCell is already attached to a library. Call EDIFLibrary.removeCell() first."); + } + this.library = library; } + protected void clearLibrary() { + this.library = null; + } + public boolean hasContents() { return instances != null || nets != null; } diff --git a/src/com/xilinx/rapidwright/edif/EDIFLibrary.java b/src/com/xilinx/rapidwright/edif/EDIFLibrary.java index cc91cebbc..1e21411be 100644 --- a/src/com/xilinx/rapidwright/edif/EDIFLibrary.java +++ b/src/com/xilinx/rapidwright/edif/EDIFLibrary.java @@ -1,7 +1,7 @@ /* * * Copyright (c) 2017-2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -59,26 +59,45 @@ public EDIFLibrary(String name) { super(name); } + /** + * Shallow copy constructor - Creates a new EDIFLibrary object containing + * shallow copies of its contained EDIFCell-s. + * + * @param copy The original library + */ + public EDIFLibrary(EDIFLibrary copy) { + super(copy.getName()); + + for (Map.Entry e : copy.getCellMap().entrySet()) { + addCell(e.getValue()); + } + } + protected EDIFLibrary() { } /** - * Adds the provided cell to the library. All cells - * must be unique by their name. + * Adds the provided cell to the library. All cells must be unique by their name. + * If provided cell is already attached to a library, make a shallow copy. * @param cell The cell to add to the library. * @return The cell that has been added. */ public EDIFCell addCell(EDIFCell cell) { if (cells == null) cells = getNewMap(); - EDIFCell collision = cells.put(cell.getName(), cell); - if (collision != null && cell != collision) { + return cells.compute(cell.getName(), (k,v) -> { + if (v == null) { + v = (cell.getLibrary() != null) ? new EDIFCell(cell) : cell; + v.setLibrary(this); + return v; + } + if (v == cell) { + return v; + } throw new RuntimeException("ERROR: Failed to add cell " + - cell.getName() + " to library " + getName()+". The library " - + "already contains a cell with the same name."); - } - cell.setLibrary(this); - return cell; + cell.getName() + " to library " + getName()+". The library " + + "already contains a cell with the same name."); + }); } private String findUniqueCellName(String name) { @@ -150,9 +169,20 @@ public EDIFNetlist getNetlist() { * @param netlist the netlist to set */ public void setNetlist(EDIFNetlist netlist) { + if (netlist == null) { + throw new RuntimeException("ERROR: netlist argument cannot be null."); + } + if (this.netlist != null && this.netlist != netlist) { + throw new RuntimeException("ERROR: EDIFLibrary is already attached to a netlist. Call EDIFNetlist.removeLibrary() first."); + } + this.netlist = netlist; } + protected void clearNetlist() { + this.netlist = null; + } + /** * Removes the cell from the library. Uses the legal EDIF name as the key. * @param cell The cell to remove. @@ -168,7 +198,11 @@ public EDIFCell removeCell(EDIFCell cell) { * @return The removed cell, or null if it did not exist in the library. */ public EDIFCell removeCell(String name) { - return cells == null ? null : cells.remove(name); + EDIFCell cell = cells == null ? null : cells.remove(name); + if (cell != null) { + cell.clearLibrary(); + } + return cell; } /** diff --git a/src/com/xilinx/rapidwright/edif/EDIFLibraryBuiltin.java b/src/com/xilinx/rapidwright/edif/EDIFLibraryBuiltin.java new file mode 100644 index 000000000..29e72df96 --- /dev/null +++ b/src/com/xilinx/rapidwright/edif/EDIFLibraryBuiltin.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All rights reserved. + * + * Author: Eddie Hung, Advanced Micro Devices, Inc. + * + * This file is part of RapidWright. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.xilinx.rapidwright.edif; + +/** + * Extension of {@link EDIFLibrary} with setNetlist() and removeCell() methods disabled. + */ +public class EDIFLibraryBuiltin extends EDIFLibrary { + public EDIFLibraryBuiltin(String name) { + super(name); + } + + @Override + public void setNetlist(EDIFNetlist netlist) { + throw new UnsupportedOperationException(); + } + + @Override + public EDIFCell removeCell(EDIFCell cell) { + throw new UnsupportedOperationException(); + } +} diff --git a/src/com/xilinx/rapidwright/edif/EDIFNetlist.java b/src/com/xilinx/rapidwright/edif/EDIFNetlist.java index d823613d7..f5b1b0007 100644 --- a/src/com/xilinx/rapidwright/edif/EDIFNetlist.java +++ b/src/com/xilinx/rapidwright/edif/EDIFNetlist.java @@ -322,7 +322,11 @@ public EDIFLibrary getWorkLibrary() { } public EDIFLibrary removeLibrary(String name) { - return libraries.remove(name); + EDIFLibrary library = libraries.remove(name); + if (library != null) { + library.clearNetlist(); + } + return library; } public void renameNetlistAndTopCell(String newName) { @@ -486,8 +490,8 @@ public void migrateToWorkLibrary(String library) { EDIFLibrary oldWork = getLibrary(library); List toRemove = new ArrayList<>(oldWork.getCells()); for (EDIFCell c : toRemove) { - work.addCell(c); oldWork.removeCell(c); + work.addCell(c); } removeLibrary(library); } @@ -509,17 +513,19 @@ public void consolidateAllToWorkLibrary() { } private EDIFCell migrateCellAndSubCellsWorker(EDIFCell cell) { - EDIFLibrary destLib = getLibrary(cell.getLibrary().getName()); + EDIFLibrary srcLib = cell.getLibrary(); + EDIFLibrary destLib = getLibrary(srcLib.getName()); if (destLib == null) { - if (cell.getLibrary().getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) { + if (srcLib.isHDIPrimitivesLibrary()) { destLib = getHDIPrimitivesLibrary(); } else { - destLib = addLibrary(new EDIFLibrary(cell.getLibrary().getName())); + destLib = addLibrary(new EDIFLibrary(srcLib.getName())); } } EDIFCell existingCell = destLib.getCell(cell.getName()); if (existingCell == null) { + srcLib.removeCell(cell); destLib.addCell(cell); for (EDIFCellInst inst : cell.getCellInsts()) { inst.setCellType(migrateCellAndSubCellsWorker(inst.getCellType())); @@ -552,16 +558,18 @@ public void migrateCellAndSubCells(EDIFCell cell, boolean uniqueifyCollisions) { //Step 1: add the top cell to the library. //If the top cell belongs to HDIPrimitivesLibrary && the top cell exists in HDIPrimitivesLibrary, return and do nothing. //Otherwise, the code would add the top cell to the library; if repeat happens, using "parameterized" suffix to distinguish - EDIFLibrary destLibTop = getLibrary(cell.getLibrary().getName()); + EDIFLibrary srcLib = cell.getLibrary(); + EDIFLibrary destLibTop = getLibrary(srcLib.getName()); if (destLibTop == null) { - if (cell.getLibrary().getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) { + if (srcLib.isHDIPrimitivesLibrary()) { destLibTop = getHDIPrimitivesLibrary(); } else { - destLibTop = addLibrary(new EDIFLibrary(cell.getLibrary().getName())); + destLibTop = addLibrary(new EDIFLibrary(srcLib.getName())); } } - if (destLibTop.containsCell(cell) && destLibTop.getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) + if (destLibTop.containsCell(cell) && destLibTop.isHDIPrimitivesLibrary()) return; + srcLib.removeCell(cell); int i=0; String currentCellName = cell.getName(); while (destLibTop.containsCell(cell)) { @@ -577,32 +585,34 @@ public void migrateCellAndSubCells(EDIFCell cell, boolean uniqueifyCollisions) { while (!cells.isEmpty()) { EDIFCell pollFromCells = cells.poll(); for (EDIFCellInst inst : pollFromCells.getCellInsts()) { - EDIFCell instCellType = inst.getCellType(); - EDIFLibrary destLibSub = getLibrary(instCellType.getLibrary().getName()); + EDIFCell cellSub = inst.getCellType(); + EDIFLibrary srcLibSub = cellSub.getLibrary(); + EDIFLibrary destLibSub = getLibrary(srcLibSub.getName()); if (destLibSub == null) { - if (instCellType.getLibrary().getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) { + if (srcLibSub.isHDIPrimitivesLibrary()) { destLibSub = getHDIPrimitivesLibrary(); } else { - destLibSub = addLibrary(new EDIFLibrary(instCellType.getLibrary().getName())); + destLibSub = addLibrary(new EDIFLibrary(srcLibSub.getName())); } } - if (destLibSub.containsCell(instCellType) && destLibSub.getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) + if (destLibSub.containsCell(cellSub) && destLibSub.isHDIPrimitivesLibrary()) continue; - i=0; - currentCellName = instCellType.getName(); - if (checkIfAlreadyInLib(instCellType, destLibSub)) { - inst.setViewref(instCellType.getEDIFView()); + currentCellName = cellSub.getName(); + if (checkIfAlreadyInLib(cellSub, destLibSub)) { + inst.setViewref(cellSub.getEDIFView()); continue; } - while (destLibSub.containsCell(instCellType) && !checkIfAlreadyInLib(instCellType, destLibSub)) { + srcLibSub.removeCell(cellSub); + i=0; + while (destLibSub.containsCell(cellSub) && !checkIfAlreadyInLib(cellSub, destLibSub)) { String newName = currentCellName + "_parameterized" + i; - instCellType.setName(newName); - instCellType.setView(newName); + cellSub.setName(newName); + cellSub.setView(newName); i++; } - inst.setCellType(instCellType); // updating the celltype, which could be changed due to adding suffix - destLibSub.addCell(instCellType); - cells.add(instCellType); + inst.setCellType(cellSub); // updating the celltype, which could be changed due to adding suffix + destLibSub.addCell(cellSub); + cells.add(cellSub); } } } @@ -616,6 +626,18 @@ public void copyCellAndSubCells(EDIFCell cell) { copyCellAndSubCellsWorker(cell, copiedCells); } + /** + * This copies the library and all of its cells into this netlist. + * @param library The library (and all its cells) to copy into this netlist's libraries + */ + public EDIFLibrary copyLibraryAndSubCells(EDIFLibrary library) { + Set copiedCells = new HashSet<>(); + for (EDIFCell cell : library.getCells()) { + copyCellAndSubCellsWorker(cell, copiedCells); + } + return getLibrary(library.getName()); + } + private EDIFCell copyCellAndSubCellsWorker(EDIFCell cell, Set copiedCells) { EDIFLibrary destLib = getLibrary(cell.getLibrary().getName()); if (destLib == null) { @@ -637,7 +659,7 @@ private EDIFCell copyCellAndSubCellsWorker(EDIFCell cell, Set copiedCe } return newCell; } else { - if (destLib.isHDIPrimitivesLibrary() || copiedCells.contains(existingCell) || cell==existingCell) { + if (destLib.isHDIPrimitivesLibrary() || copiedCells.contains(existingCell) || cell == existingCell) { return existingCell; } throw new RuntimeException("ERROR: Destination netlist already contains EDIFCell named " + @@ -783,7 +805,9 @@ public void exportEDIF(OutputStream out, boolean stable) throws IOException { List librariesToWrite = new ArrayList<>(); librariesToWrite.add(getHDIPrimitivesLibrary()); for (EDIFLibrary lib : EDIFTools.sortIfStable(getLibrariesMap().values(), stable)) { - if (lib.getName().equals(EDIFTools.EDIF_LIBRARY_HDI_PRIMITIVES_NAME)) continue; + if (lib.isHDIPrimitivesLibrary()) { + continue; + } librariesToWrite.add(lib); } diff --git a/src/com/xilinx/rapidwright/examples/PolynomialGenerator.java b/src/com/xilinx/rapidwright/examples/PolynomialGenerator.java index 4ac719bcc..9f7ec78aa 100644 --- a/src/com/xilinx/rapidwright/examples/PolynomialGenerator.java +++ b/src/com/xilinx/rapidwright/examples/PolynomialGenerator.java @@ -1,7 +1,7 @@ /* * * Copyright (c) 2018-2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -172,7 +172,7 @@ public static Map initializeOperators(Design d, int width) { MultGenerator.createMult(multDesign2, origin, width, MULT_NAME, CLK_NAME); Module mult2 = new Module(multDesign2); ensureCellTypesSet(mult2); - mult2.setNetlist(multDesign.getNetlist()); + mult2.setNetlist(multDesign2.getNetlist()); operators.put("*o", mult2); @@ -204,15 +204,6 @@ public static Map initializeOperators(Design d, int width) { sub.setNetlist(subDesign2.getNetlist()); operators.put("-o", sub2); - for (Design design : new Design[]{multDesign,multDesign2,adderDesign,adderDesign2,subDesign,subDesign2}) { - for (EDIFCell cell : design.getNetlist().getWorkLibrary().getCells()) { - d.getNetlist().getWorkLibrary().addCell(cell); - } - EDIFLibrary hdi = d.getNetlist().getHDIPrimitivesLibrary(); - for (EDIFCell cell : design.getNetlist().getHDIPrimitivesLibrary().getCells()) { - if (!hdi.containsCell(cell)) hdi.addCell(cell); - } - } return operators; } diff --git a/src/com/xilinx/rapidwright/interchange/DeviceResourcesVerifier.java b/src/com/xilinx/rapidwright/interchange/DeviceResourcesVerifier.java index 7bc81d3ea..9da563ede 100644 --- a/src/com/xilinx/rapidwright/interchange/DeviceResourcesVerifier.java +++ b/src/com/xilinx/rapidwright/interchange/DeviceResourcesVerifier.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -504,7 +504,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device Set unisimsExpected = new HashSet(); for (EDIFLibrary lib : primsAndMacros.getLibraries()) { EDIFLibrary reference = lib.isHDIPrimitivesLibrary() ? Design.getPrimitivesLibrary(design.getDevice().getName()) : - Design.getMacroPrimitives(series); + new EDIFLibrary(Design.getMacroPrimitives(series)); if (!lib.isHDIPrimitivesLibrary()) { // Remove unused macros from reference @@ -742,7 +742,7 @@ static private void verifyCellBelPinMap(Map> siteMap, C List> entries = new ArrayList<>(); - Map> sites = physCell.getCompatiblePlacements(); + Map> sites = physCell.getCompatiblePlacements(design.getDevice()); Set siteTypes = new HashSet(); siteTypes.addAll(sites.keySet()); siteTypes.retainAll(siteMap.keySet()); diff --git a/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java b/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java index dece8cbf3..2a186515a 100644 --- a/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java +++ b/src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2020-2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Xilinx Research Labs. @@ -303,10 +303,10 @@ public static void writeDeviceResourcesFile(String part, Device device, CodePerf t.stop().start("Prims&Macros"); // Create an EDIFNetlist populated with just primitive and macro libraries EDIFLibrary prims = Design.getPrimitivesLibrary(device.getName()); - EDIFLibrary macros = Design.getMacroPrimitives(series); + // Copy the macros library so we can modify it + EDIFLibrary macros = new EDIFLibrary(Design.getMacroPrimitives(series)); EDIFNetlist netlist = new EDIFNetlist("PrimitiveLibs"); netlist.addLibrary(prims); - netlist.addLibrary(macros); List dupsToRemove = new ArrayList(); for (EDIFCell hdiCell : prims.getCells()) { EDIFCell cell = macros.getCell(hdiCell.getName()); @@ -321,6 +321,10 @@ public static void writeDeviceResourcesFile(String part, Device device, CodePerf removeUnusedMacros(macros, prims); + // Perform a deep copy because macro cells (which were shallow copied before) + // must now instantiate primitives from our primitives library + macros = netlist.copyLibraryAndSubCells(macros); + Map>> macroCollapseExceptionMap = EDIFNetlist.macroCollapseExceptionMap.getOrDefault(series, Collections.emptyMap()); List unisims = new ArrayList(); diff --git a/src/com/xilinx/rapidwright/interchange/EnumerateCellBelMapping.java b/src/com/xilinx/rapidwright/interchange/EnumerateCellBelMapping.java index f07697fbf..a334247e4 100644 --- a/src/com/xilinx/rapidwright/interchange/EnumerateCellBelMapping.java +++ b/src/com/xilinx/rapidwright/interchange/EnumerateCellBelMapping.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2022, Xilinx, Inc. - * Copyright (c) 2022-2023, Advanced Micro Devices, Inc. + * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Keith Rothman, Google, Inc. @@ -718,7 +718,7 @@ public static void populateCellBelPin(StringEnumerator allStrings, Map> entries = new ArrayList<>(); - Map> sites = physCell.getCompatiblePlacements(); + Map> sites = physCell.getCompatiblePlacements(design.getDevice()); for (Map.Entry> site : sites.entrySet()) { for (String bel : site.getValue()) { entries.add(new AbstractMap.SimpleEntry(site.getKey(), bel)); diff --git a/test/src/com/xilinx/rapidwright/device/TestUnisimPlacements.java b/test/src/com/xilinx/rapidwright/device/TestUnisimPlacements.java index 8a0508da6..bb68567b1 100644 --- a/test/src/com/xilinx/rapidwright/device/TestUnisimPlacements.java +++ b/test/src/com/xilinx/rapidwright/device/TestUnisimPlacements.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Advanced Micro Devices, Inc. + * Copyright (c) 2023-2024, Advanced Micro Devices, Inc. * All rights reserved. * * Author: Chris Lavin, Advanced Micro Devices, Inc. @@ -41,7 +41,7 @@ public void testUnisimPlacements(FamilyType familyType) { Design des = new Design("top", part.getName()); EDIFCell cell = Design.getPrimitivesLibrary(des.getDevice().getName()).getCell("FDRE"); Cell c = des.createCell("inst", cell); - Assertions.assertTrue(c.getCompatiblePlacements().size() > 1); + Assertions.assertTrue(c.getCompatiblePlacements(des.getDevice()).size() > 1); break; } } From 97cda776284ccd7e9660049a2b0cb7a91fda4ff2 Mon Sep 17 00:00:00 2001 From: Chris Lavin Date: Tue, 3 Sep 2024 21:40:31 -0600 Subject: [PATCH 5/6] rc3 Signed-off-by: Chris Lavin --- .classpath | 4 ++-- .github/workflows/build.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index fb9b9c897..f66a9f311 100644 --- a/.classpath +++ b/.classpath @@ -33,9 +33,9 @@ - + - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aca5a6f7f..6c2419c1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: pull_request: env: - RAPIDWRIGHT_VERSION: v2024.1.2-rc2-beta + RAPIDWRIGHT_VERSION: v2024.1.2-rc3-beta jobs: build: From ecdeaf8a6001c6ca68c508eca7d3096acab8e456 Mon Sep 17 00:00:00 2001 From: Chris Lavin Date: Wed, 4 Sep 2024 10:48:06 -0600 Subject: [PATCH 6/6] 2024.1.2 release Signed-off-by: Chris Lavin --- .classpath | 4 ++-- .github/workflows/build.yml | 2 +- RELEASE_NOTES.TXT | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.classpath b/.classpath index f66a9f311..66d56a68a 100644 --- a/.classpath +++ b/.classpath @@ -33,9 +33,9 @@ - + - + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c2419c1e..795ad165f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: pull_request: env: - RAPIDWRIGHT_VERSION: v2024.1.2-rc3-beta + RAPIDWRIGHT_VERSION: v2024.1.2-beta jobs: build: diff --git a/RELEASE_NOTES.TXT b/RELEASE_NOTES.TXT index 015333545..d7e74eede 100644 --- a/RELEASE_NOTES.TXT +++ b/RELEASE_NOTES.TXT @@ -1,3 +1,30 @@ +============= RapidWright 2024.1.2-beta released on 2024-09-04 ================ +Notes: + - Creating a standalone entry point to relocate DCPs (#1047) + - [Interchange] Reorders tile types and tiles to follow their Vivado index (#1039) + - [DesignTools] Conform to Vivado *RST* pin inversion site routing configuration (#1053) + - Fix for design merging, including designs with encrypted cells (#1035) + - Filters out comments in XDC while parsing clk constraints (#1037) + - Assign an empty list when path finding for direct connections fails (#1052) + - Make LogicalNetlistToEdif not expand macros by default (#1051) + - [Interchange] Fixes to support Versal designs via Interchange (#1040) + - EDIF cleanup preventing singleton cells/libraries from attaching to user designs (#1050) + - [RWRoute] Refactoring/cleanup/preparation for multi-threading (#1046) + - Add Hybrid Updating Strategy (HUS) (#1043) + - [TestSiteInst] Add test for unrouting through FF routethru cells (#1041) + - [TestPIP] Test PIP constructor for reversed wires (#1045) + - [RWRoute] Preserve primary source nodes on connections (#1038) + - Small Interchange/PhysNetlistReader/VivadoTools improvements (#1042) + - [UnisimManager] Use EDIFLibraryBuiltin for primitive/macro libs + - Avoids NPE when site routing BRAMs + - Fix isCarry() for Versal devices + - Resolves PIP constructor issue for reversed PIPs + - [SiteInst] unrouteIntraSiteNet() to handle FF routethru cells + +API Additions: + - com.xilinx.rapidwright.design.Design "public Series getSeries()" + - com.xilinx.rapidwright.design.SiteInst "public SitePIP getUsedSitePIP(BEL bel)" + ============= RapidWright 2024.1.1-beta released on 2024-07-17 ================ Notes: - [VivadoTools] Source *_load.tcl from same dir as DCP (#1032)