Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RWRoute preprocessing fixes #1119

Merged
merged 10 commits into from
Dec 9, 2024
128 changes: 69 additions & 59 deletions src/com/xilinx/rapidwright/design/DesignTools.java
Original file line number Diff line number Diff line change
@@ -3312,8 +3312,8 @@ public static void createA1A6ToStaticNets(Design design) {
BEL lut6Bel = (fiveOrSix == '5') ? si.getBEL(belName.charAt(0) + "6LUT") : bel;
Net a6Net = si.getNetFromSiteWire(lut6Bel.getPin("A6").getSiteWireName());

boolean expectGndNet = false;
if ("SRL16E".equals(cell.getType())) {
// SRL16s require A1 to be VCC
String pinName = belName.charAt(0) + "1";
SitePinInst spi = si.getSitePinInst(pinName);
if (spi == null) {
@@ -3322,18 +3322,25 @@ public static void createA1A6ToStaticNets(Design design) {

// SRL16Es that have been transformed from SRLC32E require GND on their A6 pin
if ("SRLC32E".equals(cell.getPropertyValueString("XILINX_LEGACY_PRIM"))) {
expectGndNet = true;
staticNet = gndNet;
// Expect sitewire to be VCC or GND
if (!a6Net.isStaticNet()) {
throw new RuntimeException("ERROR: Site pin " + si.getSiteName() + "/" + belName.charAt(0) + "6 is not a static net");
}
}
}

// Tie A6 to staticNet only if sitewire says so
if (a6Net != staticNet && !expectGndNet) {
continue;
spi = si.getSitePinInst(belName.charAt(0) + "6");
if (spi != null) {
// [A-H]6 input already a static net (which may not match the sitewire)
assert(spi.getNet().isStaticNet());
assert(a6Net.isStaticNet());
continue;
}
} else {
// Tie A6 to staticNet only if sitewire says so
if (a6Net != staticNet) {
continue;
}
}

if (cell.getLogicalPinMapping("O5") != null) {
@@ -3385,74 +3392,77 @@ public static void createCeSrRstPinsToVCC(Design design) {
// In Versal, sitewires for a SLICE's CE pins are not assigned to the VCC net
// Assume that the lack of sitewire for a placed FF indicates VCC
for (SiteInst si : design.getSiteInsts()) {
if (!Utils.isSLICE(si)) {
continue;
}
for (Cell cell : si.getCells()) {
BEL bel = cell.getBEL();
if (bel == null || !bel.isFF()) {
continue;
}

if (!bel.getBELType().equals("FF")) {
assert(bel.getBELType().matches("(SLICE_IMI|SLICE[LM]_IMC)_FF(_T)?"));
continue;
}
if (Utils.isSLICE(si)) {
for (Cell cell : si.getCells()) {
BEL bel = cell.getBEL();
if (bel == null || !bel.isFF()) {
continue;
}

Pair<String, String> sitePinNames = pinMapping.get(bel.getName());
for (String belPinName : belPinNames) {
String sitePinName = (belPinName == CE) ? sitePinNames.getFirst() : sitePinNames.getSecond();
SitePinInst spi = si.getSitePinInst(sitePinName);
if (spi != null) {
if (belPinName == CE) {
// CE
continue;
}
// SR
if (!spi.getNet().isGNDNet()) {
continue;
}
if (!bel.getBELType().equals("FF")) {
assert(bel.getBELType().matches("(SLICE_IMI|SLICE[LM]_IMC)_FF(_T)?"));
continue;
}

Net net = si.getNetFromSiteWire(sitePinName);
if (net != null) {
if (belPinName == CE) {
if (!net.isVCCNet()) {
Pair<String, String> sitePinNames = pinMapping.get(bel.getName());
for (String belPinName : belPinNames) {
String sitePinName = (belPinName == CE) ? sitePinNames.getFirst() : sitePinNames.getSecond();
SitePinInst spi = si.getSitePinInst(sitePinName);
if (spi != null) {
if (belPinName == CE) {
// CE
continue;
}
// CE: it is possible for sitewire to be assigned to a non VCC net, but a SitePinInst to not yet exist
} else {
assert(belPinName == SR);
if (!net.isStaticNet()) {
// SR
if (!spi.getNet().isGNDNet()) {
continue;
}
// SR: it is possible for sitewire to be assigned the GND net, yet still be routed to VCC
}
}

if (assertionsEnabled) {
BELPin belPin = bel.getPin(belPinName);
Net belPinNet = si.getNetFromSiteWire(belPin.getSiteWireName());
if (belPinNet != null) {
Net net = si.getNetFromSiteWire(sitePinName);
if (net != null) {
if (belPinName == CE) {
// CE
assert(belPinNet.isVCCNet());
if (!net.isVCCNet()) {
continue;
}
// CE: it is possible for sitewire to be assigned to a non VCC net, but a SitePinInst to not yet exist
} else {
// SR
assert(belPinNet.isStaticNet());
assert(belPinName == SR);
if (!net.isStaticNet()) {
continue;
}
// SR: it is possible for sitewire to be assigned the GND net, yet still be routed to VCC
}
}
}

if (spi != null) {
assert(belPinName == SR);
// Move the SR pin from GND to VCC
spi.setNet(vccNet);
} else {
spi = new SitePinInst(false, sitePinName, si);
if (assertionsEnabled) {
BELPin belPin = bel.getPin(belPinName);
Net belPinNet = si.getNetFromSiteWire(belPin.getSiteWireName());
if (belPinNet != null) {
if (belPinName == CE) {
// CE
assert(belPinNet.isVCCNet());
} else {
// SR
assert(belPinNet.isStaticNet());
}
}
}

if (spi != null) {
assert(belPinName == SR);
// Move the SR pin from GND to VCC
spi.setNet(vccNet);
} else {
spi = new SitePinInst(false, sitePinName, si);
}
boolean updateSiteRouting = false;
vccNet.addPin(spi, updateSiteRouting);
}
boolean updateSiteRouting = false;
vccNet.addPin(spi, updateSiteRouting);
}
} else if (si.getSiteTypeEnum() == SiteTypeEnum.MMCM) {
for (String sitePinName : new String[]{"CLKFBIN", "CLKIN2"}) {
eddieh-xlnx marked this conversation as resolved.
Show resolved Hide resolved
maybeCreateVccPin(si, sitePinName, vccNet);
}
}
}
4 changes: 3 additions & 1 deletion src/com/xilinx/rapidwright/rwroute/GlobalSignalRouting.java
Original file line number Diff line number Diff line change
@@ -427,7 +427,9 @@ public static void routeStaticNet(List<SitePinInst> pins,
assertIntentCodeOfPoppedNodesOnVcc = EnumSet.of(
IntentCode.NODE_PINFEED,
IntentCode.NODE_PINBOUNCE,
IntentCode.INTENT_DEFAULT);
IntentCode.INTENT_DEFAULT,
IntentCode.NODE_GLOBAL_GCLK // e.g. MMCM_CLKIN2, MMCM_CLKFBIN
);
boolean isVersal = false;
if (series == Series.UltraScale) {
// On UltraScale, certain site pins (e.g. SLICE/CKEN_B1[1-4], SLICE/SRST_B[12])
14 changes: 10 additions & 4 deletions src/com/xilinx/rapidwright/rwroute/RouterHelper.java
Original file line number Diff line number Diff line change
@@ -348,7 +348,8 @@ public static Set<SitePinInst> invertPossibleGndPinsToVccPins(Design design,
List<SitePinInst> pins,
boolean invertLutInputs) {
final boolean isVersal = (design.getSeries() == Series.Versal);
Net gndNet = design.getGndNet();
final Net gndNet = design.getGndNet();
final Net vccNet = design.getVccNet();
Set<SitePinInst> toInvertPins = new HashSet<>();
nextSitePin: for (SitePinInst spi : pins) {
if (!spi.getNet().equals(gndNet))
@@ -408,6 +409,9 @@ public static Set<SitePinInst> invertPossibleGndPinsToVccPins(Design design,
}

toInvertPins.add(spi);
// Re-paint the intra-site routing from GND to VCC
// (no intra site routing will occur during Net.addPin() later)
si.routeIntraSiteNet(vccNet, spi.getBELPin(), spiBelPin);

for (Cell cell : connectedCells) {
// Find the logical pin name
@@ -449,6 +453,8 @@ public static Set<SitePinInst> invertPossibleGndPinsToVccPins(Design design,
continue;
}
toInvertPins.add(spi);
// Unpaint the sitewire ahead of pin being added below
si.unrouteIntraSiteNet(spi.getBELPin(), spi.getBELPin());
}
}
}
@@ -460,10 +466,10 @@ public static Set<SitePinInst> invertPossibleGndPinsToVccPins(Design design,
// as we are simply moving the SPI from one net to another
gndNet.getPins().removeAll(toInvertPins);

Net vccNet = design.getVccNet();
for (SitePinInst toinvert:toInvertPins) {
for (SitePinInst toinvert : toInvertPins) {
assert(toinvert.getSiteInst() != null);
if (!vccNet.addPin(toinvert)) {
boolean updateSiteRouting = false;
if (!vccNet.addPin(toinvert, updateSiteRouting)) {
throw new RuntimeException("ERROR: Couldn't invert site pin " +
toinvert);
}