public class EDIFTools
extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DONT_TOUCH |
static String |
EDIF_HIER_SEP |
static String |
EDIF_LIBRARY_HDI_PRIMITIVES_NAME |
static String |
EDIF_LIBRARY_WORK_NAME |
static String |
EDIF_PART_PROP |
static Set<String> |
edifKeywordSet |
static String |
LOAD_TCL_SUFFIX |
static String |
LOGICAL_GND_NET_NAME |
static String |
LOGICAL_VCC_NET_NAME |
static String |
MACRO_PRIMITIVES_LIB |
static boolean |
RW_ENABLE_EDIF_BINARY_CACHING
Flag to set a feature where any .edf file that is attempted to be loaded will check if an
existing binary EDIF has already been generated and will load that instead (faster).
|
static AtomicInteger |
UNIQUE_COUNT |
Constructor and Description |
---|
EDIFTools() |
Modifier and Type | Method and Description |
---|---|
static EDIFPortInst |
addDebugPort(EDIFNet net,
EDIFCell topCell,
EDIFPortInst currPort,
EDIFCellInst debugCore)
Adds the debug port to the debug core in the EDIF netlist
|
static EDIFNet |
addDebugPortAndNet(String newDebugNetName,
EDIFCell topCell,
EDIFPortInst currPort,
EDIFCellInst debugCore)
Specialized function to add enable a debug probe connection.
|
static EDIFNet |
addNet(EDIFNetlist e,
String hierarchicalName) |
static void |
addTopLevelPort(Design d,
String name,
EDIFCellInst i,
PinType dir)
Creates (or gets) a top level port by the specified name.
|
static String[] |
bitBlast(String bussedSignal)
Bit blasts the shorthand bus name (ex:
"data[0:2]" --> ["data0", "data1", "data2"] ) |
static int[] |
bitBlastBus(String busSuffix) |
static void |
connectDebugProbe(EDIFNet topPortNet,
String routedNetName,
String newPortName,
EDIFHierCellInst parentInst,
EDIFNetlist netlist,
HashMap<EDIFCell,ArrayList<EDIFCellInst>> instMap)
Specialized function to connect a debug port within an EDIF netlist.
|
static void |
connectPortBus(EDIFCell topCell,
EDIFCellInst src,
EDIFCellInst snk,
String srcPrefix,
String snkPrefix,
int width) |
static void |
connectPortInstsThruHier(EDIFHierNet net,
EDIFHierPortInst pin,
String newName)
Connects an existing logical net and logical port inst together by creating new ports and
nets on all cells instantiated between their levels of hierarchy.
|
static void |
connectPortInstsThruHier(EDIFHierPortInst src,
EDIFHierPortInst snk,
String newName)
Connects two existing logical port insts together by creating new ports and nets on all cells
instantiated between their levels of hierarchy.
|
static void |
consolidateLibraries(EDIFNetlist edif) |
static Map<EDIFLibrary,Map<EDIFCell,List<EDIFHierCellInst>>> |
createCellInstanceMap(EDIFNetlist netlist)
Creates a map of all cells in the netlist and a mapping to a list of all the hierarchical
instances of that cell.
|
static EDIFNetlist |
createFlatNetlist(EDIFNetlist netlist,
String partName)
Creates a flattened version of the provided netlist.
|
static EDIFNetlist |
createNewNetlist(EDIFCellInst cellInst)
Creates a new netlist from an existing EDIFCellInst in a netlist.
|
static EDIFNetlist |
createNewNetlist(String topName) |
static EDIFNetlist |
createNewNetlist(String topName,
boolean addINV) |
static EDIFPortInst[] |
createPortInsts(EDIFCell parent,
String name,
EDIFDirection dir,
int width)
Creates a top level port (if it doesn't already exist) and an array of corresponding
EDIFPortInst s
to be used to connect to an array of EDIFNets |
static EDIFPortInst[] |
createPortInsts(String name,
EDIFDirection dir,
int width,
EDIFCellInst eci)
Creates an array of
EDIFPortInst s from an existing port on an EDIFCellInst . |
static EDIFPortInst |
createTopLevelPortInst(Design d,
String name,
PinType dir)
Creates (or gets if it already exists) a top level port instance.
|
static EDIFNet |
createUniqueNet(EDIFCell parentCell,
String netName)
Create a unique net in the provided parent EDIFCell with the preferred provided
name.
|
static EDIFPort |
createUniquePort(EDIFCell parentCell,
String portName,
EDIFDirection dir,
int width)
Create a unique port in the provided parent EDIFCell with the preferred provided
name.
|
static boolean |
ensureCellInLibraries(EDIFNetlist e,
EDIFCell c) |
static void |
ensureCorrectPartInEDIF(EDIFNetlist edif,
String partName) |
static ArrayList<EDIFHierPortInst> |
findSinks(EDIFHierPortInst startingInput)
Traverse all connected EDIFNets to find all leaf sink portrefs as part of the physical net.
|
static HashMap<EDIFCell,ArrayList<EDIFCellInst>> |
generateCellInstMap(EDIFCellInst topCellInst)
Creates a map for each EDIF cell type to all its instances, starting with the top cell instance.
|
static Path |
getEDIFParentDir(Path edifFileName) |
static List<String> |
getEDNFiles(Path parent) |
static List<String> |
getMacroLeafCellNames(EDIFCell cell) |
static EDIFNet |
getNet(EDIFNetlist e,
String hierarchicalName)
Gets the EDIFNet corresponding to the hierarchical name of a net.
|
static String |
getPartName(EDIFNetlist edif)
Helper method to get the part name from an EDIF netlist.
|
static int |
getPortIndexFromName(String name) |
static String |
getRootBusName(String name)
Strips off bracket index in a bussed name (ex:
"data[0]" --> "data[" ). |
static String |
getRootBusName(String name,
boolean includeOpenBracket)
Strips off bracket index in a bussed name (ex:
"data[0]" --> "data" ). |
static EDIFNet |
getStaticNet(NetType type,
EDIFCell cell,
EDIFNetlist netlist)
Creates and/or gets the static net (GND/VCC) in the specified cell.
|
static EDIFNet |
getStaticNet(NetType type,
EDIFCell cell,
EDIFNetlist netlist,
String netName)
Creates and/or gets the static net (GND/VCC) in the specified cell.
|
static EDIFHierNet |
getStaticNet(NetType type,
EDIFHierCellInst cellInst,
EDIFNetlist netlist)
Creates and/or gets the static net (GND/VCC) in the specified cell.
|
static String |
getUniqueSuffix() |
static int |
getWidthOfPortFromName(String name) |
static int |
lengthOfNameWithoutBus(char[] name)
Determines if the char[] ends with the pattern [#:#] where # are positive
bus values (e.g., [7:0]) and then returns the length of the string without
the bus suffix (if it exists).
|
static int |
lengthOfNameWithoutBus(char[] name,
boolean keepOpenBracket)
Determines if the char[] ends with the pattern [#:#] where # are positive bus
values (e.g., [7:0]) and then returns the length of the string without the
bus suffix (if it exists).
|
static EDIFNetlist |
loadEDIFFile(Path fileName) |
static EDIFNetlist |
loadEDIFFile(Path fileName,
int maxThreads) |
static EDIFNetlist |
loadEDIFFile(String fileName) |
static EDIFNetlist |
loadEDIFStream(InputStream is,
long size) |
static void |
lockNetlist(EDIFNetlist netlist)
Locks the netlist by applying the DONT_TOUCH property to instances and nets
so that Vivado won't make changes to it during opt_design, place_design,
phys_opt_design, or route_design.
|
static void |
main(String[] args) |
static String |
makeNameEDIFCompatible(String currName)
Tries to make a string EDIF compatible by replacing invalid characters
with an underscore.
|
static void |
printHierSepNames(EDIFNetlist netlist) |
static void |
printLibraries(EDIFNetlist netlist) |
static EDIFNetlist |
readEdifFile(Path edifFileName) |
static EDIFNetlist |
readEdifFile(Path edifFileName,
int maxThreads) |
static EDIFNetlist |
readEdifFile(String edifFileName) |
static EDIFNetlist |
readEdifFromZipFile(String zipFileName) |
static <T extends EDIFName> |
sortIfStable(Collection<T> collection,
boolean stable) |
static <T> Iterable<T> |
sortIfStable(Collection<T> collection,
Comparator<T> comparator,
boolean stable) |
static <T extends Comparable<T>,U> |
sortIfStable(Map<T,U> collection,
boolean stable) |
static Boolean |
uniqueifyNetlist(Design design)
Duplicates EDIFCells such that each EDIFCellInst only instantiates an EDIFCell once
(except primitives and macros).
|
static void |
unlockNetlist(EDIFNetlist netlist)
Unlocks the netlist by removing the DONT_TOUCH property on instances and nets
so that Vivado won't make changes to it during opt_design, place_design,
phys_opt_design, or route_design.
|
static void |
writeEDIFFile(OutputStream out,
EDIFNetlist edif,
String partName) |
static void |
writeEDIFFile(OutputStream out,
Path dcpFileName,
EDIFNetlist edif,
String partName)
Write out EDIF to a stream.
|
static void |
writeEDIFFile(OutputStream out,
String dcpFileName,
EDIFNetlist edif,
String partName)
Write out EDIF to a stream.
|
static void |
writeEDIFFile(Path fileName,
EDIFNetlist edif,
String partName) |
static void |
writeEDIFFile(String fileName,
EDIFNetlist edif,
String partName) |
static void |
writeTclLoadScriptForPartialEncryptedDesigns(EDIFNetlist edif,
Path dcpFileName,
String partName) |
public static String EDIF_HIER_SEP
public static final String EDIF_LIBRARY_HDI_PRIMITIVES_NAME
public static final String MACRO_PRIMITIVES_LIB
public static final String EDIF_LIBRARY_WORK_NAME
public static final String EDIF_PART_PROP
public static final String DONT_TOUCH
public static final Set<String> edifKeywordSet
public static final String LOGICAL_VCC_NET_NAME
public static final String LOGICAL_GND_NET_NAME
public static final String LOAD_TCL_SUFFIX
public static final AtomicInteger UNIQUE_COUNT
public static final boolean RW_ENABLE_EDIF_BINARY_CACHING
public static String getUniqueSuffix()
public static String getPartName(EDIFNetlist edif)
edif
- The EDIF netlist from which to extract the part name.public static boolean ensureCellInLibraries(EDIFNetlist e, EDIFCell c)
public static void consolidateLibraries(EDIFNetlist edif)
public static void connectPortBus(EDIFCell topCell, EDIFCellInst src, EDIFCellInst snk, String srcPrefix, String snkPrefix, int width)
public static HashMap<EDIFCell,ArrayList<EDIFCellInst>> generateCellInstMap(EDIFCellInst topCellInst)
topCellInst
- The top cell instance from which to start the search.public static EDIFNet getNet(EDIFNetlist e, String hierarchicalName)
hierarchicalName
- The full path name to the hetpublic static EDIFNet addNet(EDIFNetlist e, String hierarchicalName)
public static String makeNameEDIFCompatible(String currName)
currName
- Existing name to be made legalpublic static String getRootBusName(String name)
"data[0]" --> "data["
). Leaves open bracket by default as this is the
key for bussed ports in the port map of EDIFCell
name
- Bracketed bussed name.public static String getRootBusName(String name, boolean includeOpenBracket)
"data[0]" --> "data"
).name
- Bracketed bussed name.includeOpenBracket
- If true, the result will include the open square
bracket ("data[")public static int lengthOfNameWithoutBus(char[] name)
name
- public static int lengthOfNameWithoutBus(char[] name, boolean keepOpenBracket)
name
- keepOpenBracket
- In the case of a bussed name, this will return the
index of the string including the open square bracket
(useful for port the bus name keyed map in EDIFCell).public static int getPortIndexFromName(String name)
public static int getWidthOfPortFromName(String name)
name
- public static EDIFNet createUniqueNet(EDIFCell parentCell, String netName)
parentCell
- EDIFCell in which new net is to be created.netName
- Preferred net name.public static EDIFPort createUniquePort(EDIFCell parentCell, String portName, EDIFDirection dir, int width)
parentCell
- EDIFCell in which new port is to be created.portName
- Preferred port name.dir
- EDIFDirection.width
- Bit width.public static void connectPortInstsThruHier(EDIFHierPortInst src, EDIFHierPortInst snk, String newName)
EDIFTools.uniqueifyNetlist(Design)
. If the src or snk
port insts do net have nets connected, it will create them and connect them in their parent
cell definition.src
- The logical port inst driver or sourcesnk
- The logical port inst sinknewName
- A unique name to be used in creating the ports and netspublic static void connectPortInstsThruHier(EDIFHierNet net, EDIFHierPortInst pin, String newName)
EDIFTools.connectPortInstsThruHier(EDIFHierPortInst,EDIFHierPortInst,String)
for identifying the correct source and sink pins to be provided to this, according to
whether the provided pin argument is an input or output pin (and finding the appropriate
pin from the provided net).net
- The logical netpin
- The logical port inst source or sinknewName
- A unique name to be used in creating the ports and netspublic static void connectDebugProbe(EDIFNet topPortNet, String routedNetName, String newPortName, EDIFHierCellInst parentInst, EDIFNetlist netlist, HashMap<EDIFCell,ArrayList<EDIFCellInst>> instMap)
topPortNet
- The top-level net that connects to the debug core's input port.routedNetName
- The name of the routed net who's source is the net we need to connect tonewPortName
- The name of the port to be added at each level of hierarchyparentInst
- The instance where topPortNet residesnetlist
- The current netlistinstMap
- The map of the design created by EDIFTools.generateCellInstMap(EDIFCellInst)
public static EDIFNet addDebugPortAndNet(String newDebugNetName, EDIFCell topCell, EDIFPortInst currPort, EDIFCellInst debugCore)
newDebugNetName
- Name of the debug net to add at the top leveltopCell
- Name of the cell where the net and port should existscurrPort
- The existing port on the debug coredebugCore
- The instance of the debug core already within the EDIF designpublic static EDIFPortInst addDebugPort(EDIFNet net, EDIFCell topCell, EDIFPortInst currPort, EDIFCellInst debugCore)
net
- The net to which the port should connecttopCell
- The top cell which has the debug core as a subcellcurrPort
- The current port to adddebugCore
- The debug coreEDIFPortInst
public static EDIFHierNet getStaticNet(NetType type, EDIFHierCellInst cellInst, EDIFNetlist netlist)
type
- The type of net to get or createcellInst
- The hier cell inst that should have a static netnetlist
- The netlist of interestpublic static EDIFNet getStaticNet(NetType type, EDIFCell cell, EDIFNetlist netlist)
type
- The type of net to get or createcell
- The cell that should have a static netnetlist
- The netlist of interestpublic static EDIFNet getStaticNet(NetType type, EDIFCell cell, EDIFNetlist netlist, String netName)
type
- The type of net to get or createcell
- The cell that should have a static netnetlist
- The netlist of interestnetName
- If the net is to be created, what is the desired namepublic static void main(String[] args)
public static EDIFNetlist loadEDIFStream(InputStream is, long size) throws IOException
IOException
public static EDIFNetlist loadEDIFFile(Path fileName)
public static EDIFNetlist loadEDIFFile(Path fileName, int maxThreads)
public static EDIFNetlist loadEDIFFile(String fileName)
public static void ensureCorrectPartInEDIF(EDIFNetlist edif, String partName)
public static EDIFNetlist readEdifFile(Path edifFileName)
public static List<String> getEDNFiles(Path parent)
public static Path getEDIFParentDir(Path edifFileName)
public static EDIFNetlist readEdifFile(Path edifFileName, int maxThreads)
public static EDIFNetlist readEdifFile(String edifFileName)
public static void writeEDIFFile(Path fileName, EDIFNetlist edif, String partName)
public static void writeEDIFFile(String fileName, EDIFNetlist edif, String partName)
public static void writeEDIFFile(OutputStream out, EDIFNetlist edif, String partName)
public static void writeEDIFFile(OutputStream out, Path dcpFileName, EDIFNetlist edif, String partName)
out
- The output streamdcpFileName
- The name of the DCP file associated with this netlistedif
- The netlist of the designpartName
- The target part for this designpublic static void writeEDIFFile(OutputStream out, String dcpFileName, EDIFNetlist edif, String partName)
out
- The output streamdcpFileName
- The name of the DCP file associated with this netlistedif
- The netlist of the designpartName
- The target part for this designpublic static void writeTclLoadScriptForPartialEncryptedDesigns(EDIFNetlist edif, Path dcpFileName, String partName)
public static EDIFNetlist readEdifFromZipFile(String zipFileName) throws IOException
IOException
public static EDIFNetlist createNewNetlist(String topName)
public static EDIFNetlist createNewNetlist(String topName, boolean addINV)
public static EDIFNetlist createNewNetlist(EDIFCellInst cellInst)
cellInst
- The new top cell/top cell inst in the netlist.public static int[] bitBlastBus(String busSuffix)
public static String[] bitBlast(String bussedSignal)
"data[0:2]" --> ["data0", "data1", "data2"]
)bussedSignal
- The bussed name with bracketed indicespublic static EDIFPortInst[] createPortInsts(EDIFCell parent, String name, EDIFDirection dir, int width)
EDIFPortInst
s
to be used to connect to an array of EDIFNetsparent
- Top level cell to which the port should be createdname
- Root name of the port to create and corresponding EDIFPortInst
s (no brackets)dir
- Direction of the port.width
- Width of the portpublic static EDIFPortInst[] createPortInsts(String name, EDIFDirection dir, int width, EDIFCellInst eci)
EDIFPortInst
s from an existing port on an EDIFCellInst
.name
- Root name of the port (no brackets)dir
- Direction of the portwidth
- Width of the porteci
- The existing cell instance with the port to create the EDIFPortInst
s.EDIFPortInst
s corresponding the port and EDIFCellInst
.public static ArrayList<EDIFHierPortInst> findSinks(EDIFHierPortInst startingInput)
startingInput
- Search begins at this portref and searches below in inner levels of hierarchy. Doesn't search backwards.public static EDIFPortInst createTopLevelPortInst(Design d, String name, PinType dir)
d
- Current design with the netlistname
- Name of the top level portdir
- The desired port directionalitypublic static void addTopLevelPort(Design d, String name, EDIFCellInst i, PinType dir)
EDIFCellInst
which should be part of an IBUF or OBUF.d
- Current design with netlistname
- Name of the port (and net if none exists)i
- IBUF (or INBUF in UltraScale devices) or OBUF instancesdir
- Direction of the pin on the IBUF/INBUF/OBUF instance to connect.public static List<String> getMacroLeafCellNames(EDIFCell cell)
public static Map<EDIFLibrary,Map<EDIFCell,List<EDIFHierCellInst>>> createCellInstanceMap(EDIFNetlist netlist)
netlist
- The netlist to build the map from.public static Boolean uniqueifyNetlist(Design design)
design
- The design containing the netlist to uniqueify.public static void printHierSepNames(EDIFNetlist netlist)
public static void printLibraries(EDIFNetlist netlist)
public static <T> Iterable<T> sortIfStable(Collection<T> collection, Comparator<T> comparator, boolean stable)
public static <T extends EDIFName> Iterable<T> sortIfStable(Collection<T> collection, boolean stable)
public static <T extends Comparable<T>,U> Iterable<Map.Entry<T,U>> sortIfStable(Map<T,U> collection, boolean stable)
public static void lockNetlist(EDIFNetlist netlist)
netlist
- The netlist to lockpublic static void unlockNetlist(EDIFNetlist netlist)
netlist
- The netlist to unlockpublic static EDIFNetlist createFlatNetlist(EDIFNetlist netlist, String partName)
netlist
- The netlist to flatten.partName
- The target part of the netlist.