Skip to content

Commit 6329b53

Browse files
committed
Adds support for negative indexed busses on ports
Signed-off-by: Chris Lavin <[email protected]>
1 parent 315a6d1 commit 6329b53

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/com/xilinx/rapidwright/edif/EDIFTools.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,10 @@ public static int lengthOfNameWithoutBus(char[] name) {
424424
}
425425

426426
/**
427-
* Determines if the char[] ends with the pattern [#:#] where # are positive bus
428-
* values (e.g., [7:0]) and then returns the length of the string without the
429-
* bus suffix (if it exists). If the name does not end with the bus pattern, it
430-
* returns the original length of the char[].
427+
* Determines if the char[] ends with the pattern [#:#] where # are integer bus
428+
* values (e.g., [7:0] or [0:-1]) and then returns the length of the string
429+
* without the bus suffix (if it exists). If the name does not end with the bus
430+
* pattern, it returns the original length of the char[].
431431
*
432432
* @param name
433433
* @param keepOpenBracket In the case of a bussed name, this will return the
@@ -439,11 +439,11 @@ public static int lengthOfNameWithoutBus(char[] name, boolean keepOpenBracket) {
439439
int len = name.length;
440440
int i = len-1;
441441
if (name[i--] != ']') return len;
442-
while (Character.isDigit(name[i])) {
442+
while (Character.isDigit(name[i]) || name[i] == '-') {
443443
i--;
444444
}
445445
if (name[i--] != ':') return len;
446-
while (Character.isDigit(name[i])) {
446+
while (Character.isDigit(name[i]) || name[i] == '-') {
447447
i--;
448448
}
449449
if (name[i] != '[') return len;

test/src/com/xilinx/rapidwright/edif/TestEDIFPort.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public void testCreatePort() {
8282
EDIFCell cell = new EDIFCell(netlist.getWorkLibrary(), "cell_1");
8383
int outer = 0;
8484
// Creates ports: {bus_output[0][3:0], bus_output[2][5:2],
85-
// bus_output[1][0:3], bus_output[3][2:5]}
86-
for (String range : new String[] { "3:0", "0:3", "5:2", "2:5" }) {
85+
// bus_output[1][0:3], bus_output[3][2:5], , bus_output[4][0:-1], bus_output[5][-3:-1]}
86+
for (String range : new String[] { "3:0", "0:3", "5:2", "2:5", "0:-1", "-3:-1" }) {
8787
int left = Integer.parseInt(range.substring(0, range.indexOf(':')));
8888
int right = Integer.parseInt(range.substring(range.indexOf(':') + 1));
8989
int width = Math.abs(left - right) + 1;

0 commit comments

Comments
 (0)