File tree Expand file tree Collapse file tree 2 files changed +25
-12
lines changed
src/com/xilinx/rapidwright/edif Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ public EDIFPort getPort(String name) {
313313 /**
314314 * Given a port instance name (not including the name of the cell instance),
315315 * gets the associated port.
316- *
316+ *
317317 * @param portInstName
318318 * @return
319319 */
@@ -809,8 +809,10 @@ public boolean isUniquified() {
809809 }
810810
811811 /**
812- * Checks if this cell and the provided cell have the same set of ports
813- *
812+ * Checks if this cell and the provided cell have the same set of ports.
813+ * Port names that are the same except for starting with EDIFTools.VIVADO_PRESERVE_PORT_INTERFACE ("[]") are
814+ * considered equivalent for the purpose of cells having a matching set of ports.
815+ *
814816 * @param other The other cell to match against.
815817 * @return True if the set of ports on both this cell and the other cell match
816818 * exactly. False otherwise.
@@ -822,6 +824,10 @@ public boolean matchesInterface(EDIFCell other) {
822824 Map <String , EDIFPort > otherPorts = other .getPortMap ();
823825 for (EDIFPort port : getPorts ()) {
824826 EDIFPort otherPort = otherPorts .get (port .getBusName (true ));
827+ if (otherPort == null ) {
828+ otherPort = otherPorts .get (EDIFTools .VIVADO_PRESERVE_PORT_INTERFACE
829+ + port .getBusName (true ));
830+ }
825831 if (otherPort == null || port .getWidth () != otherPort .getWidth ()
826832 || port .getDirection () != otherPort .getDirection ()) {
827833 return false ;
Original file line number Diff line number Diff line change @@ -1783,18 +1783,25 @@ public static void ensurePreservedInterfaceVivado(EDIFNetlist netlist) {
17831783 }
17841784 }
17851785
1786+ /**
1787+ * Removes vivado bus prevention annotations from top-level ports. Vivado sometimes adds these annotations
1788+ * to prevent multiple single bit ports with similar names from getting merged into a single bus. The method
1789+ * used here will only work on the top-level cell as we do not traverse the netlist to ensure the new names
1790+ * are consistent.
1791+ *
1792+ * @param netlist The netlist to remove bus prevention annotations from.
1793+ *
1794+ */
17861795 public static void removeVivadoBusPreventionAnnotations (EDIFNetlist netlist ) {
17871796 EDIFCell top = netlist .getTopCell ();
1788- for (EDIFCell cell : netlist .getLibrary (top .getLibrary ().getName ()).getCells ()) {
1789- List <String > portsToRename = new ArrayList <>();
1790- for (EDIFPort p : cell .getPorts ()) {
1791- if (p .getName ().startsWith (VIVADO_PRESERVE_PORT_INTERFACE )) {
1792- portsToRename .add (p .getName ());
1793- }
1794- }
1795- for (String p : portsToRename ) {
1796- cell .renamePort (p , p .substring (VIVADO_PRESERVE_PORT_INTERFACE .length ()));
1797+ List <String > portsToRename = new ArrayList <>();
1798+ for (EDIFPort p : top .getPorts ()) {
1799+ if (p .getName ().startsWith (VIVADO_PRESERVE_PORT_INTERFACE )) {
1800+ portsToRename .add (p .getName ());
17971801 }
17981802 }
1803+ for (String p : portsToRename ) {
1804+ top .renamePort (p , p .substring (VIVADO_PRESERVE_PORT_INTERFACE .length ()));
1805+ }
17991806 }
18001807}
You can’t perform that action at this time.
0 commit comments