|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.byu.ece.edif.core.EdifLibraryManager
public class EdifLibraryManager
Represents and manages a list of related EDIF libraries (EdifLibrary).
This object has a parent EdifEnvironment object and a list of
EdifLibrary objects. Each library must have a unique name and the uniqueness
of the names is managed by a ArrayListNameSpaceResolver object.
The libraries within this object are related and must be managed according to the "define before use" rules of EDIF. This means that any EdifCell object instanced within a parent EdifCell object must be defined before the parent EdifCell is defined.
This object manages the ordering of EdifCell objects within libraries and the
ordering of the libraries. Major issues:
EdifLibrary,
Serialized Form| Field Summary | |
|---|---|
private EdifEnvironment |
_edifEnvironment
The EdifEnvironment that points to this library manager. |
private EdifNameSpaceList<EdifLibrary> |
_libraries
The EdifLibrary objects of this file. |
| Constructor Summary | |
|---|---|
EdifLibraryManager(EdifEnvironment edifFile)
Construct an EdifLibraryManager Object with the specified EdifEnvironment. |
|
| Method Summary | |
|---|---|
void |
addLibraries(java.util.Collection<EdifLibrary> libraries)
|
boolean |
addLibrary(EdifLibrary library)
Add a library to this library manager, and sets its library manager to 'this' |
EdifLibrary |
containsCell(EdifCell cell)
Search for the given cell among all libraries. |
boolean |
containsLibrary(EdifLibrary lib)
This function only checks the library using the Object.equals() method. |
boolean |
containsLibrary(java.lang.String libraryName)
This version of the function will check the library's name against library names of those it already contains. |
boolean |
deleteCell(EdifCell cell,
boolean force)
Delete a cell from the library manager, and return whether or not the delete was successful. |
java.util.Collection<EdifCell> |
findBlackBoxes()
This method will search through all EdifCells in the current Manager and determine which cells are not defined. |
java.util.Collection<EdifCellInstance> |
findCellInstancesOf(EdifCell cell)
This method will return a list of EdifCellInstances in the entire libraryManager that reference the passed in cell. |
EdifLibrary |
findEarliestLibraryToAdd(EdifCell cell,
boolean addToPrimitiveLibraryOK)
This method returns the earliest library that this cell can be added to. |
int |
findEarliestPositionToAdd(EdifLibrary add)
Return the earliest position to add the library within the collection of libraries, so as to avoid violating the define before use rule. |
EdifLibrary |
findLatestLibraryToAdd(EdifCell cell,
boolean addToPrimitiveLibraryOK)
This method returns the latest library that this cell can be added to. |
int |
findLatestPositionToAdd(EdifLibrary add)
Return the latest position to add the library within the collection of libraries, so as to avoid violating the define before use rule. |
java.util.Collection<EdifCell> |
findNonReferencedCells(EdifCell topCell)
Starting at the top cell, find all cells referenced by it either directly or indirectly through recursion and return a Collection of EdifCells that are not referenced. |
EdifCell |
getCell(java.lang.String name)
Return the first cell whose name matches the give String. |
java.util.List<EdifCell> |
getCells()
This method will return a List of all cells in the library manager. |
java.util.Collection<EdifCell> |
getCells(java.lang.String name)
Return all the EdifCell objects whose name matches the give String. |
java.util.List<java.util.List<EdifLibrary>> |
getDFSForest()
|
EdifEnvironment |
getEdifEnvironment()
Return the file pointing to this library manager. |
EdifLibrary |
getFirstPrimitiveLibrary()
Return the first primitive library in the collection of libraries. |
java.util.List<EdifLibrary> |
getLibraries()
Return the libraries contained by this library manager. |
EdifLibrary |
getLibrary(java.lang.String lib)
Return the library based on the string lib. |
EdifNameable |
getUniqueLibraryNameable(EdifLibrary lib)
|
EdifNameable |
getUniqueLibraryNameable(EdifNameable en)
|
java.util.List<EdifLibrary> |
getValidLibraryOrder()
|
java.util.Iterator<EdifLibrary> |
iterator()
Return iterator of the EdifLibrary objects contained within this object. |
boolean |
nameClash(EdifLibrary lib)
Return true if the library can be added to the library name space, otherwise false. |
void |
pruneNonReferencedCells()
Prune cells that are not referenced (recursively) by the top cell. |
void |
pruneNonReferencedCells(EdifCell topCell)
Prune cells that are not referenced (recursively) by the top cell. |
void |
toEdif(EdifPrintWriter epw)
Print the Edif equivalent of this EdifLibraryManager. |
java.lang.String |
toString()
|
void |
trimToSize()
Trim to size all Trimmable objects in this library manager. |
private void |
visitCell(EdifCell cell,
java.util.Set<EdifCell> visited)
|
private void |
visitLib(EdifLibrary lib,
java.util.List<EdifLibrary> currentTree,
java.util.List<EdifLibrary> unvisitedLibs,
java.util.List<EdifLibrary> finishedLibs)
Visit a library during the depth first search topological sort. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private EdifEnvironment _edifEnvironment
private EdifNameSpaceList<EdifLibrary> _libraries
| Constructor Detail |
|---|
public EdifLibraryManager(EdifEnvironment edifFile)
edifFile - The EdifEnvironment that contains this EdifLibraryManager| Method Detail |
|---|
public boolean addLibrary(EdifLibrary library)
throws EdifNameConflictException
TODO: should this method even exist?
library - The library to add into this manager, defaulted to add at
the earliest position
EdifNameConflictExceptionfindLatestPositionToAdd(EdifLibrary)
public void addLibraries(java.util.Collection<EdifLibrary> libraries)
throws EdifNameConflictException
EdifNameConflictExceptionpublic EdifLibrary containsCell(EdifCell cell)
public boolean containsLibrary(EdifLibrary lib)
lib -
public boolean containsLibrary(java.lang.String libraryName)
libraryName - name of the library to be checked
public boolean deleteCell(EdifCell cell,
boolean force)
cell - The cell to be deleted.force - Forces the cell to be deleted even if it's still referenced
within the library manager.
EdifLibrary.deleteCell(EdifCell,boolean)public java.util.Collection<EdifCell> findBlackBoxes()
The purpose of this method is to identify those EdifCell objects that are "undefined". This may be used to search for other Edif files that describe the given black box.
EdifLibrary.findBlackBoxes()public java.util.Collection<EdifCellInstance> findCellInstancesOf(EdifCell cell)
cell - The cell to check references for
EdifLibrary.findCellInstancesOf(EdifCell)
public EdifLibrary findEarliestLibraryToAdd(EdifCell cell,
boolean addToPrimitiveLibraryOK)
cell - The cell to be added into which library.addToPrimitiveLibraryOK - Specifies whether or not it is ok to add
the cell to a primitive library.
findEarliestPositionToAdd(EdifLibrary)public int findEarliestPositionToAdd(EdifLibrary add)
add - The library to add to the earliest position
findEarliestPositionToAdd(EdifLibrary)
public EdifLibrary findLatestLibraryToAdd(EdifCell cell,
boolean addToPrimitiveLibraryOK)
cell - The cell to be added into which library.addToPrimitiveLibraryOK - Specifies whether or not it is ok to add
the cell to a primitive library.
findLatestPositionToAdd(EdifLibrary)public int findLatestPositionToAdd(EdifLibrary add)
add - The library to add to the latest position
EdifLibraryManager#findPositionToAddpublic java.util.Collection<EdifCell> findNonReferencedCells(EdifCell topCell)
public EdifCell getCell(java.lang.String name)
This method is awkward and likely to cause errors. There may be many cells within a set of libraries of a given name and it doesn't seem safe to have a method that only returns the first element of a given name. Other approachecs should be used and this method should be removed. The user of this method includes: - XilinxLibrary.findOrAddXilinxPrimitive (used to find a Xilinx primitive in the manager) (This method is used by many other methods) - LUTReplace.logicLutRam.Replace (this method should call the xilinx verion).
name - The name of the cell to return
EdifLibrary.getCell(String)public java.util.List<EdifCell> getCells()
public java.util.Collection<EdifCell> getCells(java.lang.String name)
name - The name of the cell to return
EdifLibrary.getCell(String)public java.util.List<java.util.List<EdifLibrary>> getDFSForest()
public EdifEnvironment getEdifEnvironment()
public EdifLibrary getFirstPrimitiveLibrary()
public java.util.List<EdifLibrary> getLibraries()
public EdifLibrary getLibrary(java.lang.String lib)
TODO: lower case compare?
lib - The String that will be used to find the library
public java.util.List<EdifLibrary> getValidLibraryOrder()
public java.util.Iterator<EdifLibrary> iterator()
public boolean nameClash(EdifLibrary lib)
lib - The library to chech to see if there is a name clash with this
libraries of this library manager
public void pruneNonReferencedCells(EdifCell topCell)
topCell - the design's top cellpublic void pruneNonReferencedCells()
public EdifNameable getUniqueLibraryNameable(EdifNameable en)
public EdifNameable getUniqueLibraryNameable(EdifLibrary lib)
public void toEdif(EdifPrintWriter epw)
toEdif in interface EdifOutepw - The EdifPrintWriter Object that the interfacing Object will
write EDIF data topublic java.lang.String toString()
toString in class java.lang.Objectpublic void trimToSize()
trimToSize in interface Trimable
private void visitLib(EdifLibrary lib,
java.util.List<EdifLibrary> currentTree,
java.util.List<EdifLibrary> unvisitedLibs,
java.util.List<EdifLibrary> finishedLibs)
lib - The EdifLibrary to visitcurrentLib - A List of libraries to add libraries tounvisitedLibs - A List of unvisited librariesfinishedLibs - A List of finished libraries
private void visitCell(EdifCell cell,
java.util.Set<EdifCell> visited)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||