Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static TileColumnPattern createTileColumnPattern(List<TileTypeEnum> types

/**
* Creates a TileColumnPattern from an existing list of tile types and uses the start and end
* as indicies to get a sublist of filteredTypes.
* as indices to get a sublist of filteredTypes.
* @param filteredTypes The list of tile types to turn into a pattern
* @param start The start index to use to build a subList of filteredTypes
* @param end The end index to use to build a subList of filteredTypes
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
34 changes: 27 additions & 7 deletions src/com/xilinx/rapidwright/edif/EDIFPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ else if (c == '[') {
}
}
if (colonIdx == -1 || leftBracket == -1) {
throw new RuntimeException("ERROR: Interpreting port " + getName() + ", couldn't identify indicies.");
throw new RuntimeException("ERROR: Interpreting port " + getName() + ", couldn't identify indices.");
}

int left = Integer.parseInt(name.substring(leftBracket+1, colonIdx));
Expand Down 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().indexOf(':', lastLeftBracket) != -1 ?
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
6 changes: 3 additions & 3 deletions src/com/xilinx/rapidwright/edif/EDIFTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ else if (c == '[') {
}
}
if (colonIdx == -1 || leftBracket == -1) {
throw new RuntimeException("ERROR: Interpreting port " + name + ", couldn't identify indicies.");
throw new RuntimeException("ERROR: Interpreting port " + name + ", couldn't identify indices.");
}

int left = Integer.parseInt(name.substring(leftBracket+1, colonIdx));
Expand Down Expand Up @@ -1736,15 +1736,15 @@ 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[] indices = flatPort.getBitBlastedIndices();
int i = 0;
for (EDIFNet net : topPort.getInternalNets()) {
if (net == null) continue;
EDIFNet flatNet = flatTop.getNet(net.getName());
if (flatNet == null) {
flatNet = flatTop.createNet(net.getName());
}
flatNet.createPortInst(flatPort, indicies[i++]);
flatNet.createPortInst(flatPort, indices[i++]);
}
} else {
EDIFNet net = topPort.getInternalNet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device

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

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

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

BELPin nonInverting = bel.getNonInvertingPin();
belPinIndicies.add(belInverter.getNonInvertingPin());
belPinIndices.add(belInverter.getNonInvertingPin());
verifyBelPin(belPinsReader, nonInverting, belInverter.getNonInvertingPin());

BELPin inverting = bel.getInvertingPin();
belPinIndicies.add(belInverter.getInvertingPin());
belPinIndices.add(belInverter.getInvertingPin());
verifyBelPin(belPinsReader, inverting, belInverter.getInvertingPin());
} else {
expect(false, belReader.hasInverting());
Expand Down Expand Up @@ -274,7 +274,7 @@ public static boolean verifyDeviceResources(String devResFileName, String device
}

BELPin belPin = belPins[0];
belPinIndicies.add(pinReader.getBelpin());
belPinIndices.add(pinReader.getBelpin());
verifyBelPin(belPinsReader, belPin, pinReader.getBelpin());
}

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

for (int i=0; i < belPins.length; i++) {
belPinIndicies.add(wiresReader.get(i));
belPinIndices.add(wiresReader.get(i));
verifyBelPin(belPinsReader, belPins[i], wiresReader.get(i));
}
}

expect(belPinIndicies.size(), belPinsReader.size());
expect(belPinIndices.size(), belPinsReader.size());

StructList.Reader<DeviceResources.Device.SitePIP.Reader> sitePipsReader = stReader.getSitePIPs();
SitePIP[] sitePIPs = siteInst.getSitePIPs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ public static void writeDeviceResourcesFile(String part, Device device, CodePerf
writeAllSiteTypesToBuilder(design, device, devBuilder);

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

t.stop().start("Tiles");
writeAllTilesToBuilder(device, devBuilder, tileTypeIndicies);
writeAllTilesToBuilder(device, devBuilder, tileTypeIndices);

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

Map<TileTypeEnum, Integer> tileTypeIndicies = new HashMap<TileTypeEnum, Integer>();
Map<TileTypeEnum, Integer> tileTypeIndices = new HashMap<TileTypeEnum, Integer>();

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

Expand Down Expand Up @@ -792,10 +792,10 @@ public static Map<TileTypeEnum, Integer> writeAllTileTypesToBuilder(Design desig
i++;
}

return tileTypeIndicies;
return tileTypeIndices;
}

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

Expand All @@ -804,7 +804,7 @@ public static void writeAllTilesToBuilder(Device device, DeviceResources.Device.
for (Tile tile : tiles) {
DeviceResources.Device.Tile.Builder tileBuilder = tileBuilders.get(i);
tileBuilder.setName(allStrings.getIndex(tile.getName()));
tileBuilder.setType(tileTypeIndicies.get(tile.getTileTypeEnum()));
tileBuilder.setType(tileTypeIndices.get(tile.getTileTypeEnum()));
Site[] sites = tile.getSites();
StructList.Builder<DeviceResources.Device.Site.Builder> siteBuilders = tileBuilder
.initSites(sites.length);
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