-
Notifications
You must be signed in to change notification settings - Fork 112
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
Adds a tieoff method for module instances with unconnected inputs #811
base: master
Are you sure you want to change the base?
Changes from all commits
f5d8264
c288051
143a4fa
c6ae430
75b073e
2483b43
59cabc1
f319fde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
import com.xilinx.rapidwright.device.Site; | ||
import com.xilinx.rapidwright.device.SiteTypeEnum; | ||
import com.xilinx.rapidwright.device.Tile; | ||
import com.xilinx.rapidwright.edif.EDIFCell; | ||
import com.xilinx.rapidwright.edif.EDIFNet; | ||
import com.xilinx.rapidwright.edif.EDIFPortInst; | ||
import com.xilinx.rapidwright.edif.EDIFTools; | ||
|
@@ -501,7 +502,11 @@ private SitePinInst getCorrespondingPin(SitePinInst modulePin) { | |
if (newSiteInst == null) { | ||
throw new RuntimeException("Did not find corresponding Site Inst for "+modulePin.getSiteInst().getName()+" in "+getName()); | ||
} | ||
return newSiteInst.getSitePinInst(modulePin.getName()); | ||
SitePinInst pin = newSiteInst.getSitePinInst(modulePin.getName()); | ||
if (pin == null) { | ||
pin = new SitePinInst(modulePin.getName(), newSiteInst); | ||
} | ||
return pin; | ||
} | ||
|
||
/** | ||
|
@@ -759,6 +764,80 @@ public void connect(String portName, int busIndex0, ModuleInst other, String oth | |
} | ||
} | ||
|
||
/** | ||
* Connects unconnected SitePinInst inputs on the module instance to either GND | ||
* or VCC (some reset inputs can accept VCC as an input and use its built-in | ||
* inverter to drive GND). | ||
*/ | ||
public void tieOffUnconnectedInputs(boolean verbose) { | ||
for (Port port : getModule().getPorts()) { | ||
if (port.isOutPort()) | ||
continue; | ||
|
||
for (SitePinInst pin : getCorrespondingPins(port)) { | ||
if (pin == null) { | ||
System.err.println("ERROR: Problem encountered with finding corresponding SitePinInst on port " | ||
+ getName() + "/" + port.getName() + " skipping..."); | ||
} | ||
if (pin != null && (pin.getNet() == null || pin.getNet().getSource() == null)) { | ||
// If a port has a RST inverter, drive it with VCC to get GND | ||
boolean connectToVCC = pin.getName().contains("RST"); | ||
if (verbose) { | ||
System.out.println(getName() + "/" + port.getName() + " SitePinInst=[" + pin | ||
+ "] has no source, connecting to " + (connectToVCC ? "VCC" : "GND")); | ||
} | ||
|
||
connectToStaticNet(port.getName(), connectToVCC); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know if simply connecting the SPI to VCC does what we expect? Does any intra-site routing/SitePIPs need to be set? |
||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Connects a port (all of its corresponding SitePinInsts) to either the GND or | ||
* VCC net. | ||
* | ||
* @param portName Name of the port to connect to GND or VCC | ||
* @param connectToVCC True to connect to VCC, False for GND | ||
*/ | ||
public void connectToStaticNet(String portName, boolean connectToVCC) { | ||
NetType type = connectToVCC ? NetType.VCC : NetType.GND; | ||
Net staticNet = getDesign().getStaticNet(type); | ||
|
||
Port inPort = getPort(portName); | ||
if (inPort.isOutPort()) { | ||
throw new RuntimeException("ERROR: Attempting to connnect output port " | ||
+ getName() + "/" + portName + " to " + staticNet); | ||
} | ||
|
||
// Connect logically | ||
EDIFCell parent = getCellInst().getParentCell(); | ||
EDIFNet logicalStaticNet = EDIFTools.getStaticNet(type, parent, getDesign().getNetlist()); | ||
EDIFPortInst portInst = getCellInst().getPortInst(portName); | ||
if (portInst == null) { | ||
logicalStaticNet.createPortInst(portName, getCellInst()); | ||
} else { | ||
portInst.getNet().removePortInst(portInst); | ||
logicalStaticNet.addPortInst(portInst); | ||
} | ||
Comment on lines
+814
to
+823
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When |
||
|
||
// Connect physically | ||
for (SitePinInst inPin : getCorrespondingPins(inPort)) { | ||
if (inPin == null) { | ||
System.err.println("ERROR: Problem encountered with finding corresponding SitePinInst on port " | ||
+ getName() + "/" + inPort.getName() + " skipping..."); | ||
continue; | ||
} | ||
|
||
Net oldPhysicalNet = inPin.getNet(); | ||
if (oldPhysicalNet != null) { | ||
oldPhysicalNet.removePin(inPin, true); | ||
} | ||
staticNet.addPin(inPin); | ||
} | ||
} | ||
|
||
@Override | ||
public RelocatableTileRectangle getBoundingBox() { | ||
return module.getBoundingBox().getCorresponding(getAnchor().getTile(), module.getAnchor().getTile()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm beginning to think this is a little risky. You are connecting all module (not primitive) inputs containing
RST
to VCC which means you can't rely on all fanouts of thisRST
port to have inverters. It may even be driving LUTs.I think it's safer to rely on the
RouterHelper.invertPossibleGndPinsToVccPins()
method (called by default duringRWRoute.preprocess()
) to make this transformation on a primitive level.