|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbyucc.edif.tools.merge.EdifMergeParser
public class EdifMergeParser
Provides Edif parsing capability as well as the ability to "merge" edif definitions from more than one edif file. This class contains a number of static methods that are used together to provide the merging capability.
TODO: Describe the control flow for "matching" (i.e. the order the methods are called).
TODO: This class is probably mis-named. It is not a parser but a set of classes that are used to match. A better name might be EdifCellMatching.
EdifParser| Field Summary | |
|---|---|
static boolean |
DEBUG
|
static java.lang.String[] |
EDIF_EXTENSIONS
The types of acceptable extensions for EDIF files. |
| Constructor Summary | |
|---|---|
EdifMergeParser()
|
|
| Method Summary | |
|---|---|
static boolean |
containsArgument(java.lang.String[] args,
java.lang.String arg)
|
static EdifCell |
copyCellDeep(EdifCell cellToCopy,
EdifLibrary targetLib,
EdifLibraryManager elm,
EdifMergingPolicy mergingPolicy)
Recursively copy an EdifCell from one EdifLibraryManager to another. |
static java.util.Set<java.lang.String> |
createDefaultDirs()
Create a Collection of "default" directories that should be searched for black box definitions. |
static EdifCell |
findMatchingCell(EdifCell blackBox,
EdifEnvironment env)
Searches for a matching EdifCell definition in an existing, unrelated EdifEnvironment object. |
static EdifCell |
findMatchingCellInDir(EdifCell blackBox,
java.lang.String dir,
java.io.PrintStream outstream)
Searches a given directory for an Edif file with a name that is the same as the Cell name. |
static EdifCell |
findMatchingCellInFile(EdifCell blackBox,
java.lang.String filename,
java.io.PrintStream outstream)
Searches for a matching EdifCell definition in an external file. |
static EdifCell |
findMatchingEdifCellInterface(EdifLibrary lib,
EdifCell cell)
Searches for an EdifCell object in a given library whose interface matches the interface of the EdifCell parameter. |
static EdifCell |
findMatchingEdifCellInterface(EdifLibraryManager elm,
EdifCell cell)
Searches the EdifLibraryManager parameter for an EdifCell that matches the EdifCell parameter. |
static EdifLibrary |
findMatchingLibrary(EdifLibrary inputLibrary,
EdifLibraryManager elm)
This method will investigate all EdifCell objects found within each library in the group and compare it with the passed in library (the passed in library is not necessarily a member of the manager). |
static java.util.Collection<EdifPort> |
getMatchingBusPorts(EdifCellInterface cellInt,
EdifPort port)
Returns an unordered Collection of EdifPorts in the cellInt interface that match the multi-bit bus port "port". |
static java.util.Map |
getMatchingMultiBitPorts(EdifCellInterface ref,
EdifCellInterface compare)
The key of the Map is a multi-bit EdifPort in "ref" and the value is a Collection of single-bit EdifPort objects in "compare" that match the "ref" multi-bit EdifPort. |
static EdifEnvironment |
getMergedEdifEnvironment(java.lang.String filename,
java.util.Collection<java.lang.String> dirs,
java.util.Collection<java.lang.String> files,
EdifLibrary primLib,
java.io.PrintStream outstream,
java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv)
Parse an edif file and recursively merge in all black boxes encountered. |
static EdifEnvironment |
getMergedEdifEnvironment(java.lang.String filename,
java.lang.String[] args)
This static method will parse the top-level Edif file and merge the appropriate EdifFiles into this object. |
static java.util.Map<EdifPort,java.util.Collection<EdifPort>> |
getOneToManyPortMatches(EdifCell c1,
EdifCell c2)
This method will compare the cell interfaces of c1 and c2 to see if there are any multi-bit ports in C1 that match a group of single-bit ports in C2. |
static java.util.Map |
getOneToOnePortMatches(EdifCell c1,
EdifCell c2)
Returns a Map between matching ports in the two different EdifCell objects. |
static void |
main(java.lang.String[] args)
Sample "main" to demonstrate the merging of edif files. |
static boolean |
matchingCellInterfaceBusExpansion(EdifCell cell1,
EdifCell cell2)
Performs a comparison between the port interfaces of two EdifCell objects. |
static void |
modifyPortRefsEqualize(EdifCellInstance eci,
java.util.Map definitionExpandedPorts,
java.util.Map blackBoxExpandedPorts,
java.util.Map oneToOnePorts,
java.io.PrintStream outstream)
This method will modify all of the port refs to the black box to properly reflect the change in the interface of the definition. |
static EdifEnvironment |
parseAndMerge(java.lang.String[] args,
EdifLibrary primLib)
This method will parse a given Edif filename and merge any appropriate EDIF files as specified by arguments in the args parameter. |
static EdifEnvironment |
parseAndMergeEdif(java.lang.String topFilename,
java.util.Collection<java.lang.String> dirs,
java.util.Collection files,
EdifLibrary primLib,
java.io.PrintStream outstream)
This method will parse a given Edif filename and merge any appropriate EDIF files if necessary. |
static java.util.Set<java.lang.String> |
parseArguments(java.lang.String[] args,
java.lang.String flag)
A simple method for parsing arguments. |
static java.util.Set |
parseArguments(java.lang.String[] args,
java.lang.String flag,
int numValues)
|
static void |
replaceBlackBox(EdifCell blackBox,
EdifCell definition,
java.io.PrintStream outstream,
EdifMergingPolicy mergingPolicy)
This method will replace the "blackBox" EdifCell object with the "definition" EdifCell object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[] EDIF_EXTENSIONS
public static final boolean DEBUG
| Constructor Detail |
|---|
public EdifMergeParser()
| Method Detail |
|---|
public static EdifCell copyCellDeep(EdifCell cellToCopy,
EdifLibrary targetLib,
EdifLibraryManager elm,
EdifMergingPolicy mergingPolicy)
cellToCopy - the EdifCell object to copytargetLib - the EdifLibrary to copy the cell into. If no EdifLibrary is
specified (null), the EdifCell will be placed in an
EdifLibrary with the same name (or a new unique name if there
is a clash) as it's old EdifLibraryelm - the EdifLibraryManager to copy the cell into
public static java.util.Map getOneToOnePortMatches(EdifCell c1,
EdifCell c2)
public static java.util.Map<EdifPort,java.util.Collection<EdifPort>> getOneToManyPortMatches(EdifCell c1,
EdifCell c2)
public static java.util.Collection<EdifPort> getMatchingBusPorts(EdifCellInterface cellInt,
EdifPort port)
port - The multi-bit edif port used for the referencepolicy - The naming policy used to perform the match
public static java.util.Map getMatchingMultiBitPorts(EdifCellInterface ref,
EdifCellInterface compare)
public static EdifCell findMatchingEdifCellInterface(EdifLibrary lib,
EdifCell cell)
EdifCell.equalsInterface(EdifCell) will be
called to perform an exact match on the ports. If this fails,
matchingCellInterfaceBusExpansion(EdifCell, EdifCell) will be
called to see if the interfaces match when busses are expanded in either
of the cells.
lib - EdifLibrary in which to search for a matchcell - EdifCell to match
public static EdifCell findMatchingEdifCellInterface(EdifLibraryManager elm,
EdifCell cell)
findMatchingEdifCellInterface(EdifLibrary, EdifCell) to perform
this search.
elm - EdifLibraryManager to search.cell - EdifCell to match
public static EdifCell findMatchingCell(EdifCell blackBox,
EdifEnvironment env)
findMatchingEdifCellInterface(EdifLibraryManager, EdifCell) to
perform this search.
blackBox - env -
public static EdifCell findMatchingCellInFile(EdifCell blackBox,
java.lang.String filename,
java.io.PrintStream outstream)
findMatchingCell(EdifCell,EdifEnvironment) to
perform this search.
blackBox - EdifCell object that this method is trying to matchfilename - The filename to open and search for a matching EdifCell.
public static EdifCell findMatchingCellInDir(EdifCell blackBox,
java.lang.String dir,
java.io.PrintStream outstream)
public static EdifLibrary findMatchingLibrary(EdifLibrary inputLibrary,
EdifLibraryManager elm)
public static void replaceBlackBox(EdifCell blackBox,
EdifCell definition,
java.io.PrintStream outstream,
EdifMergingPolicy mergingPolicy)
blackBox - The "blackBox" EdifCell object that will be replaced. This
EdifCell should contain NO contents.definition - The EdifCell object that provides a "definition" for the black
Box EdifCell. This EdifCell MUST contain contents.
public static void modifyPortRefsEqualize(EdifCellInstance eci,
java.util.Map definitionExpandedPorts,
java.util.Map blackBoxExpandedPorts,
java.util.Map oneToOnePorts,
java.io.PrintStream outstream)
eci - EdifCellInstanceblackBox - EdifCell to be modifieddefinition -
public static boolean matchingCellInterfaceBusExpansion(EdifCell cell1,
EdifCell cell2)
EdifCell.equalsInterface(EdifCell)
method, this method will perform a match while allowing busses in one
EdifCell interface to be expanded into individual bits and remain as a
complete bus in the original EdifCell.
cell1 - cell2 -
public static EdifEnvironment parseAndMerge(java.lang.String[] args,
EdifLibrary primLib)
java <main class> <EDIF filename> -L <search dir #1> -L <search dir #2> \
-f <external EDIF filename>
The arguments are interpreted as follows:
parseAndMergeEdif(String, Collection, Collection, EdifLibrary, PrintStream).
If there are any errors, this method will exit rather than throwing an
exception.
args - String arguments that contain the filename, libraries, and
external files needed for parsing.primLib - Primitive library to use for primitive tagging. If the
library is null, do not tag library elements for primitives
public static EdifEnvironment parseAndMergeEdif(java.lang.String topFilename,
java.util.Collection<java.lang.String> dirs,
java.util.Collection files,
EdifLibrary primLib,
java.io.PrintStream outstream)
throws ParseException,
java.io.FileNotFoundException
EdifLibraryManager.findBlackBoxes()findMatchingCell(EdifCell, EdifEnvironment).findMatchingCellInDir(EdifCell, String, PrintStream) will search
the directory specified by the string parameter for an edif file that
matches the blackbox.replaceBlackBox(EdifCell, EdifCell, PrintStream, EdifMergingPolicy).
topFilename - Filename of "top" edif environmentdirs - A Collection of String directory names used to search for
black box definitions. If this is null, no directories will be
searched.files - A Collection of String filenames that contain EdifCell
definitions. These files will be parsed and searched when black
box definitions are found.primLib - Primitive library to use for primitive tagging. If the
library is null, do not tag library elements for primitivesoutstream - PrintStream to which output during the merge process
should be directed.
ParseException
java.io.FileNotFoundExceptionpublic static java.util.Set<java.lang.String> createDefaultDirs()
public static java.util.Set<java.lang.String> parseArguments(java.lang.String[] args,
java.lang.String flag)
. Each time the flag
is used, the successor is added to a Collection of
Strings. A null will be returned if no parsed arguments are found.
This method uses a TreeSet to make sure that copies of the argument are
not included in the set.
public static java.util.Set parseArguments(java.lang.String[] args,
java.lang.String flag,
int numValues)
args - An array of String objects, the arguments to be parsedflag - numValues -
public static boolean containsArgument(java.lang.String[] args,
java.lang.String arg)
public static EdifEnvironment getMergedEdifEnvironment(java.lang.String filename,
java.lang.String[] args)
filename - Filename of the top-level EDIF fileargs - The command line arguments (looking for -L directory searches
and -f file searches
public static EdifEnvironment getMergedEdifEnvironment(java.lang.String filename,
java.util.Collection<java.lang.String> dirs,
java.util.Collection<java.lang.String> files,
EdifLibrary primLib,
java.io.PrintStream outstream,
java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv)
throws java.io.FileNotFoundException,
ParseException
filename - Filename of the EDIF filedirs - A collection of directories to search for black boxesfiles - A collection of files to search for black boxesprimLib - A primitive library to use for tagging all primitives in
the design. Leave null for no primitive tagging.outstream - A PrintStream to direct output to.fileNameToEnv - A map of filenames to parsed EdifEnvironments used
for recursive processing. Leave null for the top-level file.
java.io.FileNotFoundException
ParseExceptionpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||