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] Do not pin swap SRL (shift register) cells #939

Merged
merged 5 commits into from
Jan 11, 2024
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
28 changes: 20 additions & 8 deletions src/com/xilinx/rapidwright/design/tools/LUTTools.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
*
* Copyright (c) 2018-2022, Xilinx, Inc.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Author: Chris Lavin, Xilinx Research Labs.
Expand Down Expand Up @@ -36,6 +36,7 @@
import java.util.Queue;
import java.util.Set;

import com.xilinx.rapidwright.design.AltPinMapping;
import com.xilinx.rapidwright.design.Cell;
import com.xilinx.rapidwright.design.Design;
import com.xilinx.rapidwright.design.DesignTools;
Expand Down Expand Up @@ -503,11 +504,14 @@ public static int swapMultipleLutPins(Map<SitePinInst, String> oldPinToNewPins)
continue;
}

// Either this is a LUT cell or a routethru ...
assert(cell.getType().startsWith("LUT") ||
cell.isRoutethru() ||
// ... or a distributed RAM cell not on a "H" BEL
cell.getType().startsWith("RAM") && !bel.getName().startsWith("H"));
// Only consider LUT cell or a routethru ...
if (!cell.getType().startsWith("LUT") && !cell.isRoutethru() &&
// ... or distributed RAM cells not on a "H" BEL
(!cell.getType().startsWith("RAM") || bel.getName().startsWith("H"))) {
// SRL cells do not support pin swapping
assert(cell.getType().startsWith("SRL"));
continue;
}

String oldPhysicalPinName = "A" + oldSinkSpi.getName().charAt(1);
String oldLogicalPinName = cell.getLogicalPinMapping(oldPhysicalPinName);
Expand Down Expand Up @@ -649,7 +653,15 @@ public static void swapSingleLutPins(String key, Collection<PinSwap> pinSwaps) {

// Perform the actual swap on cell pin mappings
for (PinSwap ps : copyOnWritePinSwaps) {
ps.getCell().addPinMapping(ps.getNewPhysicalName(), ps.getLogicalName());
Cell cell = ps.getCell();
cell.addPinMapping(ps.getNewPhysicalName(), ps.getLogicalName());
if (cell.isRoutethru() && cell.hasAltPinMappings()) {
Map<String, AltPinMapping> altPinMappings = cell.getAltPinMappings();
assert(altPinMappings.size() == 1);
AltPinMapping apm = altPinMappings.remove(ps.getOldPhysicalName());
assert(apm != null);
cell.addAltPinMapping(ps.getNewPhysicalName(), apm);
}
if (ps.getCompanionCell() != null) {
ps.getCompanionCell().addPinMapping(ps.getNewPhysicalName(), ps.getCompanionLogicalName());
}
Expand All @@ -658,7 +670,7 @@ public static void swapSingleLutPins(String key, Collection<PinSwap> pinSwaps) {
continue;
}
pinToMove.setPinName(ps.getNewNetPinName());
pinToMove.setSiteInst(ps.getCell().getSiteInst());
pinToMove.setSiteInst(cell.getSiteInst());
}

assert(q.isEmpty());
Expand Down
12 changes: 9 additions & 3 deletions src/com/xilinx/rapidwright/rwroute/RWRoute.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
*
* Copyright (c) 2021 Ghent University.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Author: Yun Zhou, Ghent University.
Expand Down Expand Up @@ -574,20 +574,26 @@ protected NetWrapper createNetWrapperAndConnections(Net net) {
BEL bel = cell.getBEL();
assert(bel.isLUT());
String belName = bel.getName();
String cellType = cell.getType();
if (belName.charAt(0) != lutLetter) {
assert(cell.getType().startsWith("RAM"));
assert(cellType.startsWith("RAM"));
// This pin connects to other LUTs! (e.g. SLICEM.H[1-6] also serves
// as the WA for A-G LUTs used as distributed RAM) -- do not allow any swapping
// TODO: Relax this when https://github.com/Xilinx/RapidWright/issues/901 is fixed
numberOfSwappablePins = 0;
break;
}
if (bel.getName().startsWith("H") && cell.getType().startsWith("RAM")) {
if (bel.getName().startsWith("H") && cellType.startsWith("RAM")) {
// Similarly, disallow swapping of any RAMs on the "H" BELs since their
// "A" and "WA" inputs are shared and require extra care to keep in sync
numberOfSwappablePins = 0;
break;
}
if (cellType.startsWith("SRL")) {
// SRL* cells cannot support any pin swaps
numberOfSwappablePins = 0;
break;
}
if (belName.charAt(1) == '5') {
// Since a 5LUT cell exists, only allow bottom 5 pins to be swapped
numberOfSwappablePins = 5;
Expand Down
Loading