Skip to content

Commit 1af0efc

Browse files
committed
Merge branch '2025.2.0' into array_builder
Signed-off-by: Chris Lavin <[email protected]>
2 parents 2a19bab + 8ba3a54 commit 1af0efc

File tree

11 files changed

+56
-44
lines changed

11 files changed

+56
-44
lines changed

src/com/xilinx/rapidwright/debug/DotEdifDumper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected Stream<EDIFPortInst> getPorts(EDIFCellInst edifCellInst) {
6363
protected Stream<Pair<EDIFPort,Integer>> getPortTemplates(EDIFCellInst edifCellInst) {
6464
return edifCellInst.getCellType().getPorts().stream().flatMap(p-> {
6565
if (p.isBus()) {
66-
return Arrays.stream(p.getBitBlastedIndicies()).mapToObj(i -> new Pair<>(p, i));
66+
return Arrays.stream(p.getBitBlastedIndices()).mapToObj(i -> new Pair<>(p, i));
6767
}
6868
return Stream.of(new Pair<>(p, 0));
6969
});

src/com/xilinx/rapidwright/design/tools/InlineFlopTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private static void createAndPlaceFlopsInlineOnTopPorts(Design design, String cl
126126
continue;
127127
}
128128
if (port.isBus()) {
129-
for (int i : port.getBitBlastedIndicies()) {
129+
for (int i : port.getBitBlastedIndices()) {
130130
EDIFPortInst inst = port.getInternalPortInstFromIndex(i);
131131
if (allLeavesAreIBUF(design, inst)) {
132132
continue;

src/com/xilinx/rapidwright/device/helper/TileColumnPattern.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static TileColumnPattern createTileColumnPattern(List<TileTypeEnum> types
8686

8787
/**
8888
* Creates a TileColumnPattern from an existing list of tile types and uses the start and end
89-
* as indicies to get a sublist of filteredTypes.
89+
* as indices to get a sublist of filteredTypes.
9090
* @param filteredTypes The list of tile types to turn into a pattern
9191
* @param start The start index to use to build a subList of filteredTypes
9292
* @param end The end index to use to build a subList of filteredTypes

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,8 @@ public void renamePort(String currName, String newName) {
346346

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

351-
for (int i : indices) {
350+
for (int i : port.getBitBlastedIndices()) {
352351
EDIFPortInst portInst = port.getInternalPortInstFromIndex(i);
353352
if (portInst == null) {
354353
continue;

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

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ else if (c == '[') {
108108
}
109109
}
110110
if (colonIdx == -1 || leftBracket == -1) {
111-
throw new RuntimeException("ERROR: Interpreting port " + getName() + ", couldn't identify indicies.");
111+
throw new RuntimeException("ERROR: Interpreting port " + getName() + ", couldn't identify indices.");
112112
}
113113

114114
int left = Integer.parseInt(name.substring(leftBracket+1, colonIdx));
@@ -356,13 +356,33 @@ public boolean isBus() {
356356
return width > 1 || !getName().equals(busName);
357357
}
358358

359+
private static final int[] SINGLE_BIT_INDICES = new int[] { 0 };
360+
361+
/**
362+
* @see #getBitBlastedIndicies()
363+
* @deprecated Misspelling in name, to be removed in 2026.1.0
364+
*/
359365
public int[] getBitBlastedIndicies() {
360-
int lastLeftBracket = getName().lastIndexOf('[');
361-
if (getName().contains(":"))
362-
return EDIFTools.bitBlastBus(getName().substring(lastLeftBracket));
363-
if (getName().contains("["))
364-
return new int[] {Integer.parseInt(getName().substring(lastLeftBracket,getName().length()-1))};
365-
return null;
366+
return getBitBlastedIndices();
367+
}
368+
369+
/**
370+
* Returns an array of all the integer indices of this port. If the port is a
371+
* single bit it returns an array with a single entry of '0'. This is useful
372+
* when needing to iterate over a port's PortInst objects.
373+
*
374+
* @return The integer list of indices of this port, or {0} for a single bit
375+
* port.
376+
*/
377+
public int[] getBitBlastedIndices() {
378+
if (isBus()) {
379+
int lastLeftBracket = getName().lastIndexOf('[');
380+
assert(lastLeftBracket != -1);
381+
return getName().indexOf(':', lastLeftBracket) != -1 ?
382+
EDIFTools.bitBlastBus(getName().substring(lastLeftBracket)) :
383+
new int[] { Integer.parseInt(getName().substring(lastLeftBracket, getName().length() - 1)) };
384+
}
385+
return SINGLE_BIT_INDICES;
366386
}
367387

368388
public boolean isBusRangeEqual(EDIFPort otherPort) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ else if (c == '[') {
475475
}
476476
}
477477
if (colonIdx == -1 || leftBracket == -1) {
478-
throw new RuntimeException("ERROR: Interpreting port " + name + ", couldn't identify indicies.");
478+
throw new RuntimeException("ERROR: Interpreting port " + name + ", couldn't identify indices.");
479479
}
480480

481481
int left = Integer.parseInt(name.substring(leftBracket+1, colonIdx));
@@ -1736,15 +1736,15 @@ public static EDIFNetlist createFlatNetlist(EDIFNetlist netlist, String partName
17361736
for (EDIFPort topPort : netlist.getTopCell().getPorts()) {
17371737
EDIFPort flatPort = flatTop.createPort(topPort);
17381738
if (flatPort.isBus()) {
1739-
int[] indicies = flatPort.getBitBlastedIndicies();
1739+
int[] indices = flatPort.getBitBlastedIndices();
17401740
int i = 0;
17411741
for (EDIFNet net : topPort.getInternalNets()) {
17421742
if (net == null) continue;
17431743
EDIFNet flatNet = flatTop.getNet(net.getName());
17441744
if (flatNet == null) {
17451745
flatNet = flatTop.createNet(net.getName());
17461746
}
1747-
flatNet.createPortInst(flatPort, indicies[i++]);
1747+
flatNet.createPortInst(flatPort, indices[i++]);
17481748
}
17491749
} else {
17501750
EDIFNet net = topPort.getInternalNet();

src/com/xilinx/rapidwright/interchange/DeviceResourcesVerifier.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device
189189

190190
Reader<SiteType.Reader> stReaders = dReader.getSiteTypeList();
191191
for (SiteType.Reader stReader : stReaders) {
192-
Set<Integer> belPinIndicies = new HashSet<Integer>();
192+
Set<Integer> belPinIndices = new HashSet<Integer>();
193193
SiteTypeEnum siteTypeEnum = SiteTypeEnum.valueOf(allStrings.get(stReader.getName()));
194194

195195
Site site = siteTypes.get(siteTypeEnum);
@@ -212,7 +212,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device
212212
for (int j=0; j < belPins.length; j++) {
213213
BELPin pin = belPins[j];
214214
int belPinIndex = pinsReader.get(j);
215-
belPinIndicies.add(belPinIndex);
215+
belPinIndices.add(belPinIndex);
216216
verifyBelPin(belPinsReader, pin, belPinIndex);
217217
}
218218

@@ -223,11 +223,11 @@ public static boolean verifyDeviceResources(String devResFileName, String device
223223
BELInverter.Reader belInverter = belReader.getInverting();
224224

225225
BELPin nonInverting = bel.getNonInvertingPin();
226-
belPinIndicies.add(belInverter.getNonInvertingPin());
226+
belPinIndices.add(belInverter.getNonInvertingPin());
227227
verifyBelPin(belPinsReader, nonInverting, belInverter.getNonInvertingPin());
228228

229229
BELPin inverting = bel.getInvertingPin();
230-
belPinIndicies.add(belInverter.getInvertingPin());
230+
belPinIndices.add(belInverter.getInvertingPin());
231231
verifyBelPin(belPinsReader, inverting, belInverter.getInvertingPin());
232232
} else {
233233
expect(false, belReader.hasInverting());
@@ -274,7 +274,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device
274274
}
275275

276276
BELPin belPin = belPins[0];
277-
belPinIndicies.add(pinReader.getBelpin());
277+
belPinIndices.add(pinReader.getBelpin());
278278
verifyBelPin(belPinsReader, belPin, pinReader.getBelpin());
279279
}
280280

@@ -297,12 +297,12 @@ public static boolean verifyDeviceResources(String devResFileName, String device
297297
expect(belPins.length, wiresReader.size());
298298

299299
for (int i=0; i < belPins.length; i++) {
300-
belPinIndicies.add(wiresReader.get(i));
300+
belPinIndices.add(wiresReader.get(i));
301301
verifyBelPin(belPinsReader, belPins[i], wiresReader.get(i));
302302
}
303303
}
304304

305-
expect(belPinIndicies.size(), belPinsReader.size());
305+
expect(belPinIndices.size(), belPinsReader.size());
306306

307307
StructList.Reader<DeviceResources.Device.SitePIP.Reader> sitePipsReader = stReader.getSitePIPs();
308308
SitePIP[] sitePIPs = siteInst.getSitePIPs();

src/com/xilinx/rapidwright/interchange/DeviceResourcesWriter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ public static void writeDeviceResourcesFile(String part, Device device, CodePerf
288288
writeAllSiteTypesToBuilder(design, device, devBuilder);
289289

290290
t.stop().start("TileTypes");
291-
Map<TileTypeEnum, Integer> tileTypeIndicies = writeAllTileTypesToBuilder(design, device, devBuilder);
291+
Map<TileTypeEnum, Integer> tileTypeIndices = writeAllTileTypesToBuilder(design, device, devBuilder);
292292
Map<TileTypeEnum, TileType.Builder> tileTypesObj = new HashMap<TileTypeEnum, TileType.Builder>();
293-
for (Map.Entry<TileTypeEnum, Integer> tileType : tileTypeIndicies.entrySet()) {
293+
for (Map.Entry<TileTypeEnum, Integer> tileType : tileTypeIndices.entrySet()) {
294294
tileTypesObj.put(tileType.getKey(), devBuilder.getTileTypeList().get(tileType.getValue()));
295295
}
296296

297297
t.stop().start("Tiles");
298-
writeAllTilesToBuilder(device, devBuilder, tileTypeIndicies);
298+
writeAllTilesToBuilder(device, devBuilder, tileTypeIndices);
299299

300300
t.stop().start("Wires&Nodes");
301301
writeAllWiresAndNodesToBuilder(device, devBuilder, skipRouteResources);
@@ -696,7 +696,7 @@ private static void populateAltSitePins(
696696
public static Map<TileTypeEnum, Integer> writeAllTileTypesToBuilder(Design design, Device device, DeviceResources.Device.Builder devBuilder) {
697697
StructList.Builder<TileType.Builder> tileTypesList = devBuilder.initTileTypeList(tileTypes.size());
698698

699-
Map<TileTypeEnum, Integer> tileTypeIndicies = new HashMap<TileTypeEnum, Integer>();
699+
Map<TileTypeEnum, Integer> tileTypeIndices = new HashMap<TileTypeEnum, Integer>();
700700

701701
// Order tile types by their TILE_TYPE_IDX (may not be contiguous)
702702
Map<Integer, TileTypeEnum> tileTypeIndexMap = new TreeMap<>();
@@ -709,7 +709,7 @@ public static Map<TileTypeEnum, Integer> writeAllTileTypesToBuilder(Design desig
709709
TileTypeEnum type = e.getValue();
710710
Tile tile = tileTypes.get(type);
711711
TileType.Builder tileType = tileTypesList.get(i);
712-
tileTypeIndicies.put(type, i);
712+
tileTypeIndices.put(type, i);
713713
// name
714714
tileType.setName(allStrings.getIndex(type.name()));
715715

@@ -792,10 +792,10 @@ public static Map<TileTypeEnum, Integer> writeAllTileTypesToBuilder(Design desig
792792
i++;
793793
}
794794

795-
return tileTypeIndicies;
795+
return tileTypeIndices;
796796
}
797797

798-
public static void writeAllTilesToBuilder(Device device, DeviceResources.Device.Builder devBuilder, Map<TileTypeEnum, Integer> tileTypeIndicies) {
798+
public static void writeAllTilesToBuilder(Device device, DeviceResources.Device.Builder devBuilder, Map<TileTypeEnum, Integer> tileTypeIndices) {
799799
StructList.Builder<DeviceResources.Device.Tile.Builder> tileBuilders =
800800
devBuilder.initTileList(device.getColumns() * device.getRows());
801801

@@ -804,7 +804,7 @@ public static void writeAllTilesToBuilder(Device device, DeviceResources.Device.
804804
for (Tile tile : tiles) {
805805
DeviceResources.Device.Tile.Builder tileBuilder = tileBuilders.get(i);
806806
tileBuilder.setName(allStrings.getIndex(tile.getName()));
807-
tileBuilder.setType(tileTypeIndicies.get(tile.getTileTypeEnum()));
807+
tileBuilder.setType(tileTypeIndices.get(tile.getTileTypeEnum()));
808808
Site[] sites = tile.getSites();
809809
StructList.Builder<DeviceResources.Device.Site.Builder> siteBuilders = tileBuilder
810810
.initSites(sites.length);

test/src/com/xilinx/rapidwright/design/TestPartitionPin.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,10 @@ public void testPartitionPins() {
8181
int wireIdx = 10;
8282
int count = 0;
8383
for (EDIFPort port : design.getTopEDIFCell().getPorts()) {
84-
if (port.isBus()) {
85-
for (int i : port.getBitBlastedIndicies()) {
86-
Node node = Node.getNode(t, wireIdx++);
87-
PartitionPin ppin = design.createPartitionPin(port, i, node);
88-
testPortPartitionPin(design, ppin, port, i, node);
89-
count++;
90-
}
91-
} else {
84+
for (int i : port.getBitBlastedIndices()) {
9285
Node node = Node.getNode(t, wireIdx++);
93-
PartitionPin ppin = design.createPartitionPin(port, node);
94-
testPortPartitionPin(design, ppin, port, -1, node);
86+
PartitionPin ppin = design.createPartitionPin(port, i, node);
87+
testPortPartitionPin(design, ppin, port, i, node);
9588
count++;
9689
}
9790
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void testRenamePort() {
149149
EDIFPort myNewSignal = topCell.getPort("my_new_signal[");
150150
Assertions.assertNotNull(myNewSignal);
151151

152-
for (int i : myNewSignal.getBitBlastedIndicies()) {
152+
for (int i : myNewSignal.getBitBlastedIndices()) {
153153
EDIFPortInst portInst = myNewSignal.getInternalPortInstFromIndex(i);
154154
Assertions.assertNotNull(portInst);
155155
}
@@ -164,7 +164,7 @@ public void testRenamePort() {
164164
EDIFPort newTestZero = topCell.getPort("new_test_zero[");
165165
Assertions.assertNotNull(newTestZero);
166166

167-
for (int i : newTestZero.getBitBlastedIndicies()) {
167+
for (int i : newTestZero.getBitBlastedIndices()) {
168168
EDIFPortInst portInst = newTestZero.getInternalPortInstFromIndex(i);
169169
Assertions.assertNotNull(portInst);
170170
}
@@ -179,7 +179,7 @@ public void testRenamePort() {
179179
EDIFPort newTestFive = topCell.getPort("new_test_five[");
180180
Assertions.assertNotNull(newTestFive);
181181

182-
for (int i : newTestFive.getBitBlastedIndicies()) {
182+
for (int i : newTestFive.getBitBlastedIndices()) {
183183
EDIFPortInst portInst = newTestFive.getInternalPortInstFromIndex(i);
184184
Assertions.assertNotNull(portInst);
185185
}

0 commit comments

Comments
 (0)