edu.byu.ece.edif.util.merge
Class EdifMergeParser

java.lang.Object
  extended by edu.byu.ece.edif.util.merge.EdifMergeParser

public class EdifMergeParser
extends java.lang.Object

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.

Version:
$Id: EdifMergeParser.java 293 2009-07-09 22:17:27Z brianpratt $
Author:
Mike Wirthlin
See Also:
EdifParser

Field Summary
static boolean DEBUG
           
static java.lang.String[] EDIF_BB_UTILIZE_EXTENSIONS
           
static java.lang.String[] EDIF_BINARY_EXTENSIONS
           
static java.lang.String[] EDIF_EXTENSIONS
          The types of acceptable extensions for EDIF files.
private static int error_code
           
private static int INFER_OPEN_INPUT_PINS
           
private static int INFER_OPEN_OUTPUT_PINS
           
private static int MATCH_FOUND
           
private static int MATCHING_BINARY_FILE
           
private static int MATCHING_UTILIZATION_FILE
           
private static int NO_MATCHING_INSTANCE_NAME
           
private static int NO_MATCHING_INTERFACE
           
 
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.
private static boolean filename_exists(java.lang.String dName, java.lang.String file)
           
private static void findBinaryBlackBoxes(java.util.Collection<java.lang.String> dirs, EdifCell blackBox, EdifCell definition)
          Find Xilinx Binary file, and tell the user that they have a possible BlackBox match
private static void findBlackBoxUtilization(java.util.Collection<java.lang.String> dirs, EdifCell blackBox, EdifCell definition)
          Find Utilization file and add it to the Utilization list on the EdifCell
static EdifCell findLooseMatchingCell(EdifCell blackBox, EdifEnvironment env)
          Searches for a matching EdifCell, but allows unconnected pins on lower level definition, This method will call #findMatchingEdifCellInterface(EdifLibraryManager, EdifCell) to perform this search.
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, boolean open)
          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, java.lang.Boolean open)
          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).
private static EdifCell findOpenPinBlackBoxes(java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv, boolean openPins, java.util.Map<EdifCell,EdifCell> blackBoxToDefinition, EdifCell blackBox, EdifCell definition)
          Find open pins and allow them to match as blackboxes, per Xilinx rules.
private static java.lang.String getErrorString(boolean quitOnFailure)
           
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<EdifPort,java.util.Collection<EdifPort>> 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.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.util.Collection<java.lang.String> dirs, java.util.Iterator<java.lang.String> files_i, EdifLibrary primLib, java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv_param, boolean openPins, boolean quitOnError)
          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<EdifPort,EdifPort> 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 boolean matchingCellInterfaceBusExpansion(EdifCell cell1, EdifCell cell2, boolean open)
          Performs a comparison between the port interfaces of two EdifCell objects.
static void modifyPortRefsEqualize(EdifCellInstance eci, java.util.Map<EdifPort,java.util.Collection<EdifPort>> definitionExpandedPorts, java.util.Map<EdifPort,java.util.Collection<EdifPort>> blackBoxExpandedPorts, java.util.Map<EdifPort,EdifPort> 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<java.lang.String> files, EdifLibrary primLib)
           
static EdifEnvironment parseAndMergeEdif(java.lang.String topFilename, java.util.Collection<java.lang.String> dirs, java.util.Collection<java.lang.String> files, EdifLibrary primLib, boolean allowOpenPins, boolean quitOnError)
          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<java.lang.String> parseArguments(java.lang.String[] args, java.lang.String flag, int numValues)
           
private static void parseBlackBoxInfoFile(EdifCell blackBox, java.lang.String filename)
          Parses a file named EdifCell.bb to find out information about the resources for a blackbox, that we don't have the source for.
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

EDIF_EXTENSIONS

public static final java.lang.String[] EDIF_EXTENSIONS
The types of acceptable extensions for EDIF files.

Note that the current extensions do not include upper-case versions for windows compatibility. This should be augmented to check for the OS and add upper case extensions if necessary


EDIF_BINARY_EXTENSIONS

public static final java.lang.String[] EDIF_BINARY_EXTENSIONS

EDIF_BB_UTILIZE_EXTENSIONS

public static final java.lang.String[] EDIF_BB_UTILIZE_EXTENSIONS

error_code

private static int error_code

MATCH_FOUND

private static final int MATCH_FOUND
See Also:
Constant Field Values

NO_MATCHING_INSTANCE_NAME

private static final int NO_MATCHING_INSTANCE_NAME
See Also:
Constant Field Values

NO_MATCHING_INTERFACE

private static final int NO_MATCHING_INTERFACE
See Also:
Constant Field Values

MATCHING_BINARY_FILE

private static final int MATCHING_BINARY_FILE
See Also:
Constant Field Values

MATCHING_UTILIZATION_FILE

private static final int MATCHING_UTILIZATION_FILE
See Also:
Constant Field Values

INFER_OPEN_OUTPUT_PINS

private static final int INFER_OPEN_OUTPUT_PINS
See Also:
Constant Field Values

INFER_OPEN_INPUT_PINS

private static final int INFER_OPEN_INPUT_PINS
See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

EdifMergeParser

public EdifMergeParser()
Method Detail

copyCellDeep

public static EdifCell copyCellDeep(EdifCell cellToCopy,
                                    EdifLibrary targetLib,
                                    EdifLibraryManager elm,
                                    EdifMergingPolicy mergingPolicy)
Recursively copy an EdifCell from one EdifLibraryManager to another. During the copy, cells (instanced by the cell to be copied) may be added to other libraries within the EdifLibraryManager. This method is not placed in EdifCell because of its need to manage libraries. This method is probably best placed in EdifLibrary or EdifLibraryManager.

Parameters:
cellToCopy - the EdifCell object to copy
targetLib - 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 EdifLibrary
elm - the EdifLibraryManager to copy the cell into
Returns:
a reference to the new copy of the EdifCell object

getOneToOnePortMatches

public static java.util.Map<EdifPort,EdifPort> getOneToOnePortMatches(EdifCell c1,
                                                                      EdifCell c2)
Returns a Map between matching ports in the two different EdifCell objects. In order for these ports to match, it is first checked if they return true on a call to the method EdifPort.equals(EdifPort). This is a strict match between the two ports. If false is returned, there may still be a match if the names of the two different EdifPorts differ slightly. For example, a port named "port0" will match a port named "port_0_". The key of the Map is a Port from c1 and the value is a Port from c2.


getOneToManyPortMatches

public 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.

Returns:
A map whose key is an EdifPort in c1 and whose value is a Collection of EdifPort objects in c2 that match.

getMatchingBusPorts

public 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". The goal is to try and find a set of single-bit ports in this interface that can be combined to match a reference multi-bit port. In order for a match to occur, there must be N single-bit ports whose basenames match the multi-bit port. The multi-bit port width must be N.

If no match can be found, a null will be returned.

Parameters:
port - The multi-bit edif port used for the reference
policy - The naming policy used to perform the match
Returns:
A collection of EdifPort objects that when combined will match the given EdifPort object. Returns a null if no match is found

getMatchingMultiBitPorts

public static java.util.Map<EdifPort,java.util.Collection<EdifPort>> 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. Note: This method is not currently used by any other method in this class.


findMatchingEdifCellInterface

public static EdifCell findMatchingEdifCellInterface(EdifLibrary lib,
                                                     EdifCell cell,
                                                     boolean open)
Searches for an EdifCell object in a given library whose interface matches the interface of the EdifCell parameter. In order for this method to return a matching EdifCell object, the following conditions must hold:
  1. The name of the EdifCell in the library must match the name of the EdifCell parameter
  2. The port interface of the EdifCell must match the port interface of the parameter. Note that two different methods will be used to check this interface. First, 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.

Parameters:
lib - EdifLibrary in which to search for a match
cell - EdifCell to match
open - Whether to allow open pins on matching cell
Returns:
The matching EdifCell object. This method will return a null if no match is found.

findMatchingEdifCellInterface

public static EdifCell findMatchingEdifCellInterface(EdifLibraryManager elm,
                                                     EdifCell cell,
                                                     java.lang.Boolean open)
Searches the EdifLibraryManager parameter for an EdifCell that matches the EdifCell parameter. This method calls #findMatchingEdifCellInterface(EdifLibrary, EdifCell, Boolean) to perform this search.

Parameters:
elm - EdifLibraryManager to search.
cell - EdifCell to match
open - Whether to allow unmatched pins on matching cell
Returns:
The matching EdifCell object. This method will return a null if no match is found.

findMatchingCell

public static EdifCell findMatchingCell(EdifCell blackBox,
                                        EdifEnvironment env)
Searches for a matching EdifCell definition in an existing, unrelated EdifEnvironment object. This method will call #findMatchingEdifCellInterface(EdifLibraryManager, EdifCell) to perform this search.

Parameters:
blackBox -
env -
Returns:
The matching EdifCell object. This method will return a null if no match is found.

findLooseMatchingCell

public static EdifCell findLooseMatchingCell(EdifCell blackBox,
                                             EdifEnvironment env)
Searches for a matching EdifCell, but allows unconnected pins on lower level definition, This method will call #findMatchingEdifCellInterface(EdifLibraryManager, EdifCell) to perform this search.

Parameters:
blackBox -
env -
Returns:
The matching EdifCell object. This method will return a null if no match is found.

findMatchingCellInFile

public static EdifCell findMatchingCellInFile(EdifCell blackBox,
                                              java.lang.String filename,
                                              java.io.PrintStream outstream)
Searches for a matching EdifCell definition in an external file. This method will call findMatchingCell(EdifCell,EdifEnvironment) to perform this search.

Parameters:
blackBox - EdifCell object that this method is trying to match
filename - The filename to open and search for a matching EdifCell.
Returns:
The EdifCell object found within this file that matches the blackBox EdifCell parameter. This method returns a null if no match is found.

findMatchingCellInDir

public 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. Multiple extensions will be searched if necessary.


findMatchingLibrary

public 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). This method will return the library within the manager that contains the most number of matches with the library that was passed in.

Returns:
The matching library

replaceBlackBox

public 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. Port interfaces will be equalized if necessary.

Parameters:
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.

modifyPortRefsEqualize

public static void modifyPortRefsEqualize(EdifCellInstance eci,
                                          java.util.Map<EdifPort,java.util.Collection<EdifPort>> definitionExpandedPorts,
                                          java.util.Map<EdifPort,java.util.Collection<EdifPort>> blackBoxExpandedPorts,
                                          java.util.Map<EdifPort,EdifPort> 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.

Parameters:
eci - EdifCellInstance
blackBox - EdifCell to be modified
definition -

matchingCellInterfaceBusExpansion

public static boolean matchingCellInterfaceBusExpansion(EdifCell cell1,
                                                        EdifCell cell2)
Performs a comparison between the port interfaces of two EdifCell objects. Unlike the strict 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.

Xilinx tools allow an upper level cell to match even though the upper level cell may not reference all the ports in the lower level. It is infered that Xilix then ties these ports "open"

Parameters:
cell1-upper - level
cell2-lower - level
Returns:
true if the cell interfaces of the two cells match. False if there is no match.

matchingCellInterfaceBusExpansion

public static boolean matchingCellInterfaceBusExpansion(EdifCell cell1,
                                                        EdifCell cell2,
                                                        boolean open)
Performs a comparison between the port interfaces of two EdifCell objects. Unlike the strict 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.

Xilinx tools allow an upper level cell to match even though the upper level cell may not reference all the ports in the lower level. It is infered that Xilix then ties these ports "open"

Parameters:
cell1-upper - level- allowed to have less ports
cell2-lower - level
open- - whether to allow cell1 to have less ports than cell2
Returns:
true if the cell interfaces of the two cells match. False if there is no match.

parseAndMerge

public 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. This method can be used by main methods to parse arguments and provide an EdifEnvironment in return.

The following invocation of this method demonstrates the use of appropriate arguments:

        java <main class> <EDIF filename> -L <search dir #1> -L <search dir #2> \
                      -f <external EDIF filename>
 
The arguments are interpreted as follows: Once the arguments have been parsed, this method will call EdifMergeParser#parseAndMergeEdif(String, Collection, Collection, EdifLibrary, PrintStream). If there are any errors, this method will exit rather than throwing an exception.

Parameters:
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
Returns:
The merged EdifEnvironment

parseAndMergeEdif

public static EdifEnvironment parseAndMergeEdif(java.lang.String topFilename,
                                                java.util.Collection<java.lang.String> dirs,
                                                java.util.Collection<java.lang.String> files,
                                                EdifLibrary primLib,
                                                boolean allowOpenPins,
                                                boolean quitOnError)
                                         throws ParseException,
                                                java.io.FileNotFoundException
This method will parse a given EDIF filename and merge any appropriate EDIF files if necessary. If successful, the result is returned as an EdifEnvironment object. The files to be merged are found in the directories contained by the dirs parameter, as well as the files contained in the files parameter. This task is accomplished by: This method can be used by main methods to parse arguments and provide an EdifEnvironment in return. TODO: - Use Javadoc "link" and "see" tags to highlight the key methods called from this method.

Parameters:
topFilename - Filename of "top" edif environment
dirs - 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 primitives
outstream - PrintStream to which output during the merge process should be directed.
Returns:
The merged EdifEnvironment
Throws:
ParseException
java.io.FileNotFoundException

parseAndMergeEdif

public static EdifEnvironment parseAndMergeEdif(java.lang.String topFilename,
                                                java.util.Collection<java.lang.String> dirs,
                                                java.util.Collection<java.lang.String> files,
                                                EdifLibrary primLib)
                                         throws ParseException,
                                                java.io.FileNotFoundException
Throws:
ParseException
java.io.FileNotFoundException

createDefaultDirs

public static java.util.Set<java.lang.String> createDefaultDirs()
Create a Collection of "default" directories that should be searched for black box definitions. This method will include the directory "."

Returns:

parseArguments

public static java.util.Set<java.lang.String> parseArguments(java.lang.String[] args,
                                                             java.lang.String flag)
A simple method for parsing arguments. This method will search for arguments in the form . 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.


parseArguments

public static java.util.Set<java.lang.String> parseArguments(java.lang.String[] args,
                                                             java.lang.String flag,
                                                             int numValues)
Parameters:
args - An array of String objects, the arguments to be parsed
flag -
numValues -
Returns:
A Set of List values

containsArgument

public static boolean containsArgument(java.lang.String[] args,
                                       java.lang.String arg)

getMergedEdifEnvironment

public 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. This method will support a search path as well as the parsing of specific auxilliary EDIF files.

This particular method is currently hard coded to expect the XilinxLibrary.

Parameters:
filename - Filename of the top-level EDIF file
args - The command line arguments (looking for -L directory searches and -f file searches
Returns:
The merged EdifEnvironment object.

getMergedEdifEnvironment

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.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv)
                                                throws java.io.FileNotFoundException,
                                                       ParseException
Parse an EDIF file and recursively merge in all black boxes encountered.

Parameters:
filename - Filename of the EDIF file
dirs - A collection of directories to search for black boxes
files - A collection of files to search for black boxes
primLib - 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.
Returns:
The merged EdifEnvironment object.
Throws:
java.io.FileNotFoundException
ParseException

getMergedEdifEnvironment

public static EdifEnvironment getMergedEdifEnvironment(java.lang.String filename,
                                                       java.util.Collection<java.lang.String> dirs,
                                                       java.util.Iterator<java.lang.String> files_i,
                                                       EdifLibrary primLib,
                                                       java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv_param,
                                                       boolean openPins,
                                                       boolean quitOnError)
                                                throws java.io.FileNotFoundException,
                                                       ParseException
Parse an EDIF file and recursively merge in all black boxes encountered.

Parameters:
filename - Filename of the EDIF file
dirs - A collection of directories to search for black boxes
files - A collection of files to search for black boxes
primLib - 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.
openPins - whether or not to allow matching on open pins.
Returns:
The merged EdifEnvironment object.
Throws:
java.io.FileNotFoundException
ParseException

filename_exists

private static boolean filename_exists(java.lang.String dName,
                                       java.lang.String file)

findBinaryBlackBoxes

private static void findBinaryBlackBoxes(java.util.Collection<java.lang.String> dirs,
                                         EdifCell blackBox,
                                         EdifCell definition)
Find Xilinx Binary file, and tell the user that they have a possible BlackBox match

Parameters:
dirs -
blackBox -
definition -

findBlackBoxUtilization

private static void findBlackBoxUtilization(java.util.Collection<java.lang.String> dirs,
                                            EdifCell blackBox,
                                            EdifCell definition)
Find Utilization file and add it to the Utilization list on the EdifCell

Parameters:
dirs -
blackBox -
definition -

parseBlackBoxInfoFile

private static void parseBlackBoxInfoFile(EdifCell blackBox,
                                          java.lang.String filename)
Parses a file named EdifCell.bb to find out information about the resources for a blackbox, that we don't have the source for. The file format is: PRIMATIVE_NAME:num_of_primatives For example: BRAM:1 LUT:100 FF:50

Parameters:
blackBox -
filename -

findOpenPinBlackBoxes

private static EdifCell findOpenPinBlackBoxes(java.util.Map<java.lang.String,EdifEnvironment> fileNameToEnv,
                                              boolean openPins,
                                              java.util.Map<EdifCell,EdifCell> blackBoxToDefinition,
                                              EdifCell blackBox,
                                              EdifCell definition)
Find open pins and allow them to match as blackboxes, per Xilinx rules. i.e. the blackbox can have open outputs, but not open inputs.

Parameters:
fileNameToEnv -
openPins -
blackBoxToDefinition -
blackBox -
definition -
Returns:

getErrorString

private static java.lang.String getErrorString(boolean quitOnFailure)
                                        throws ParseException
Throws:
ParseException

main

public static void main(java.lang.String[] args)
Sample "main" to demonstrate the merging of edif files.