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] Further fix/cleanup around alternate source pins #830

Merged
merged 1 commit into from
Oct 4, 2023
Merged
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
31 changes: 18 additions & 13 deletions src/com/xilinx/rapidwright/rwroute/RWRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.xilinx.rapidwright.design.DesignTools;
import com.xilinx.rapidwright.design.Net;
import com.xilinx.rapidwright.design.NetType;
import com.xilinx.rapidwright.design.SiteInst;
import com.xilinx.rapidwright.design.SitePinInst;
import com.xilinx.rapidwright.device.IntentCode;
import com.xilinx.rapidwright.device.Node;
Expand Down Expand Up @@ -532,6 +533,7 @@ protected NetWrapper createNetWrapperAndConnections(Net net) {
if (altSource == null) {
altSource = DesignTools.getLegalAlternativeOutputPin(net);
if (altSource != null) {
// Add this SitePinInst to the net, but not to the SiteInst
net.addPin(altSource);
DesignTools.routeAlternativeOutputSitePin(net, altSource);
}
Expand Down Expand Up @@ -836,10 +838,12 @@ protected void postRouteProcess() {
Net net = e.getKey();
SitePinInst source = net.getSource();
SitePinInst altSource = net.getAlternateSource();
SiteInst si = source.getSiteInst();
boolean altSourcePreviouslyRouted = altSource != null ? altSource.isRouted() : false;
for (SitePinInst spi : Arrays.asList(source, altSource)) {
if (spi != null) {
spi.setRouted(false);
assert(spi.getSiteInst() == si);
}
}

Expand All @@ -856,21 +860,22 @@ protected void postRouteProcess() {
// Set the routed state of the used source node
// and if used and not already present, add it to the SiteInst
Node sourceNode = nodes.get(nodes.size() - 1);
if (sourceNode.equals(connection.getSource().getConnectedNode())) {
SitePinInst src = connection.getSource();
src.setRouted(true);
if (src.getSiteInst().getSitePinInst(src.getName()) == null) {
src.getSiteInst().addPin(src);
}
} else {
// Source used must have been the Net's alternate source
assert(!altSource.equals(connection.getSource()));
assert(sourceNode.equals(altSource.getConnectedNode()));
altSource.setRouted(true);
if (altSource.getSiteInst().getSitePinInst(altSource.getName()) == null) {
altSource.getSiteInst().addPin(altSource);
SitePinInst usedSpi = null;
for (SitePinInst spi : Arrays.asList(source, altSource)) {
if (spi != null && sourceNode.equals(spi.getConnectedNode())) {
usedSpi = spi;
}
}
if (usedSpi == null) {
throw new RuntimeException("ERROR: Unknown source node " + sourceNode + " on net " + net.getName());
}

// Now that we know this SitePinInst is used, make sure it exists in
// the SiteInst
usedSpi.setRouted(true);
if (si.getSitePinInst(usedSpi.getName()) == null) {
si.addPin(usedSpi);
}

if (source.isRouted() && (altSource == null || altSource.isRouted())) {
// Break if all sources have been set to be routed
Expand Down