Skip to content

Commit

Permalink
[Interchange] PhysNetlistReader to create STATIC_SOURCE SiteInsts
Browse files Browse the repository at this point in the history
for BELPins and SitePIPs, not just SitePins
  • Loading branch information
eddieh-xlnx committed Jul 21, 2023
1 parent 0136ca3 commit 912e920
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/com/xilinx/rapidwright/interchange/PhysNetlistReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ private void readRouteBranch(Set<Wire> stubWires,
}
case BEL_PIN:{
PhysBelPin.Reader bpReader = segment.getBelPin();
SiteInst siteInst = getPlacedSiteInst(bpReader.getSite());
SiteInst siteInst = getOrCreatePlacedSiteInst(bpReader.getSite(), net);
BELPin belPin = getBELPin(siteInst, bpReader.getBel(), bpReader.getPin());

// Examine LUT input pins only
Expand Down Expand Up @@ -631,28 +631,15 @@ private void readRouteBranch(Set<Wire> stubWires,
}
case SITE_P_I_P:{
PhysSitePIP.Reader spReader = segment.getSitePIP();
SiteInst siteInst = getPlacedSiteInst(spReader.getSite());
SiteInst siteInst = getOrCreatePlacedSiteInst(spReader.getSite(), et);
BELPin belPin = getBELPin(siteInst, spReader.getBel(), spReader.getPin());
SitePIP sitePIP = siteInst.getSitePIP(belPin);
addSitePIPToSiteInst(sitePIP, siteInst);
break;
}
case SITE_PIN: {
PhysSitePin.Reader spReader = segment.getSitePin();
SiteInst siteInst = siteInsts.computeIfAbsent(spReader.getSite(), (k) -> {
Site site = device.getSite(strings.get(k));
if (!net.isStaticNet()) {
throw new RuntimeException("ERROR: SiteInst for Site " + site.getName() + " not found.");
}
// Create a dummy TIEOFF SiteInst
String name = SiteInst.STATIC_SOURCE + "_" + site.getName();
SiteInst si = new SiteInst(name, site.getSiteTypeEnum());
si.place(site);
// Ensure it is not attached to the design
assert(si.getDesign() == null);
return si;
});

SiteInst siteInst = getOrCreatePlacedSiteInst(spReader.getSite(), net);
createSitePin(spReader.getPin(), siteInst, net);
assert(routeThruLutInput == null);
break;
Expand Down Expand Up @@ -689,8 +676,20 @@ protected SiteInst getSiteInst(int stringIdx) {
return siteInsts.get(stringIdx);
}

private SiteInst getPlacedSiteInst(int stringIdx) {
SiteInst siteInst = getSiteInst(stringIdx);
private SiteInst getOrCreatePlacedSiteInst(int siteIdx, Net net) {
SiteInst siteInst = siteInsts.computeIfAbsent(siteIdx, (k) -> {
Site site = device.getSite(strings.get(k));
if (!net.isStaticNet()) {
throw new RuntimeException("ERROR: SiteInst for Site " + site.getName() + " not found.");
}
// Create a dummy TIEOFF SiteInst
String name = SiteInst.STATIC_SOURCE + "_" + site.getName();
SiteInst si = new SiteInst(name, site.getSiteTypeEnum());
si.place(site);
// Ensure it is not attached to the design
assert(si.getDesign() == null);
return si;
});
assert(siteInst != null && siteInst.isPlaced());
return siteInst;
}
Expand Down

0 comments on commit 912e920

Please sign in to comment.