Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion src/com/xilinx/rapidwright/debug/DotEdifDumper.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected Stream<EDIFPortInst> getPorts(EDIFCellInst edifCellInst) {
protected Stream<Pair<EDIFPort,Integer>> getPortTemplates(EDIFCellInst edifCellInst) {
return edifCellInst.getCellType().getPorts().stream().flatMap(p-> {
if (p.isBus()) {
return Arrays.stream(p.getBitBlastedIndicies()).mapToObj(i -> new Pair<>(p, i));
return Arrays.stream(p.getBitBlastedIndices()).mapToObj(i -> new Pair<>(p, i));
}
return Stream.of(new Pair<>(p, 0));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static void createAndPlaceFlopsInlineOnTopPorts(Design design, String clk
continue;
}
if (port.isBus()) {
for (int i : port.getBitBlastedIndicies()) {
for (int i : port.getBitBlastedIndices()) {
EDIFPortInst inst = port.getInternalPortInstFromIndex(i);
Pair<Site, BEL> loc = nextAvailPlacement(design, siteItr);
Cell flop = createAndPlaceFlopInlineOnTopPortInst(design, inst, loc, clk);
Expand Down
3 changes: 1 addition & 2 deletions src/com/xilinx/rapidwright/edif/EDIFCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,8 @@ public void renamePort(String currName, String newName) {

EDIFPort newPort = new EDIFPort(newName, port.getDirection(), port.getWidth());
addPort(newPort);
int[] indices = port.isBus() ? port.getBitBlastedIndicies() : new int[]{0};

for (int i : indices) {
for (int i : port.getBitBlastedIndices()) {
EDIFPortInst portInst = port.getInternalPortInstFromIndex(i);
if (portInst == null) {
continue;
Expand Down
32 changes: 26 additions & 6 deletions src/com/xilinx/rapidwright/edif/EDIFPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,33 @@ public boolean isBus() {
return width > 1 || !getName().equals(busName);
}

private static final int[] SINGLE_BIT_INDICES = new int[] { 0 };

/**
* @see #getBitBlastedIndicies()
* @deprecated Misspelling in name, to be removed in 2026.1.0
*/
public int[] getBitBlastedIndicies() {
int lastLeftBracket = getName().lastIndexOf('[');
if (getName().contains(":"))
return EDIFTools.bitBlastBus(getName().substring(lastLeftBracket));
if (getName().contains("["))
return new int[] {Integer.parseInt(getName().substring(lastLeftBracket,getName().length()-1))};
return null;
return getBitBlastedIndices();
}

/**
* Returns an array of all the integer indices of this port. If the port is a
* single bit it returns an array with a single entry of '0'. This is useful
* when needing to iterate over a port's PortInst objects.
*
* @return The integer list of indices of this port, or {0} for a single bit
* port.
*/
public int[] getBitBlastedIndices() {
if (isBus()) {
int lastLeftBracket = getName().lastIndexOf('[');
assert(lastLeftBracket != -1);
return getName().contains(":") ?
EDIFTools.bitBlastBus(getName().substring(lastLeftBracket)) :
new int[] { Integer.parseInt(getName().substring(lastLeftBracket, getName().length() - 1)) };
}
return SINGLE_BIT_INDICES;
}

public boolean isBusRangeEqual(EDIFPort otherPort) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/xilinx/rapidwright/edif/EDIFTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ public static EDIFNetlist createFlatNetlist(EDIFNetlist netlist, String partName
for (EDIFPort topPort : netlist.getTopCell().getPorts()) {
EDIFPort flatPort = flatTop.createPort(topPort);
if (flatPort.isBus()) {
int[] indicies = flatPort.getBitBlastedIndicies();
int[] indicies = flatPort.getBitBlastedIndices();
int i = 0;
for (EDIFNet net : topPort.getInternalNets()) {
if (net == null) continue;
Expand Down
13 changes: 3 additions & 10 deletions test/src/com/xilinx/rapidwright/design/TestPartitionPin.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,10 @@ public void testPartitionPins() {
int wireIdx = 10;
int count = 0;
for (EDIFPort port : design.getTopEDIFCell().getPorts()) {
if (port.isBus()) {
for (int i : port.getBitBlastedIndicies()) {
Node node = Node.getNode(t, wireIdx++);
PartitionPin ppin = design.createPartitionPin(port, i, node);
testPortPartitionPin(design, ppin, port, i, node);
count++;
}
} else {
for (int i : port.getBitBlastedIndices()) {
Node node = Node.getNode(t, wireIdx++);
PartitionPin ppin = design.createPartitionPin(port, node);
testPortPartitionPin(design, ppin, port, -1, node);
PartitionPin ppin = design.createPartitionPin(port, i, node);
testPortPartitionPin(design, ppin, port, i, node);
count++;
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/src/com/xilinx/rapidwright/edif/TestEDIFCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void testRenamePort() {
EDIFPort myNewSignal = topCell.getPort("my_new_signal[");
Assertions.assertNotNull(myNewSignal);

for (int i : myNewSignal.getBitBlastedIndicies()) {
for (int i : myNewSignal.getBitBlastedIndices()) {
EDIFPortInst portInst = myNewSignal.getInternalPortInstFromIndex(i);
Assertions.assertNotNull(portInst);
}
Expand All @@ -164,7 +164,7 @@ public void testRenamePort() {
EDIFPort newTestZero = topCell.getPort("new_test_zero[");
Assertions.assertNotNull(newTestZero);

for (int i : newTestZero.getBitBlastedIndicies()) {
for (int i : newTestZero.getBitBlastedIndices()) {
EDIFPortInst portInst = newTestZero.getInternalPortInstFromIndex(i);
Assertions.assertNotNull(portInst);
}
Expand All @@ -179,7 +179,7 @@ public void testRenamePort() {
EDIFPort newTestFive = topCell.getPort("new_test_five[");
Assertions.assertNotNull(newTestFive);

for (int i : newTestFive.getBitBlastedIndicies()) {
for (int i : newTestFive.getBitBlastedIndices()) {
EDIFPortInst portInst = newTestFive.getInternalPortInstFromIndex(i);
Assertions.assertNotNull(portInst);
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/com/xilinx/rapidwright/edif/TestEDIFPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testCreatePort() {
EDIFPort copy = cell.getPort("bus_output[" + outer + "][");
Assertions.assertEquals(busOutput, copy);

int[] portIndices = busOutput.getBitBlastedIndicies();
int[] portIndices = busOutput.getBitBlastedIndices();
Assertions.assertEquals(width, portIndices.length);
Assertions.assertEquals(left, portIndices[0]);
Assertions.assertEquals(right, portIndices[portIndices.length - 1]);
Expand Down