edu.byu.ece.edif.tools.sterilize.lutreplace
Class EdifEnvironmentCopy

java.lang.Object
  extended by edu.byu.ece.edif.tools.sterilize.lutreplace.EdifEnvironmentCopy
Direct Known Subclasses:
AbstractEdifEnvironmentCopyReplace, EdifEnvironmentReplicate

public class EdifEnvironmentCopy
extends java.lang.Object

This class copies an EdifEnvironment and maintains an association between the objects in the old EdifEnvironment and the objects in the new EdifEnvironment.

This class was intended to be extended by overriding some of the methods. Custom "copy" classes can be created that actually copy and modify.

Author:
Mike Wirthlin

Field Summary
protected  java.util.HashMap<EdifCell,EdifCell> _cellMap
           
protected  java.util.HashMap<EdifCellInstance,EdifCellInstance> _instanceMap
           
protected  java.util.HashMap<EdifLibrary,EdifLibrary> _libMap
           
protected  java.util.HashMap<EdifNet,EdifNet> _netMap
           
protected  EdifEnvironment _newEnv
           
protected  EdifEnvironment _origEnv
           
protected  java.util.HashMap<EdifPort,EdifPort> _portMap
           
 
Constructor Summary
EdifEnvironmentCopy(EdifEnvironment env)
          This constructor will create a copy of the EdifEnvironmentCopy object.
 
Method Summary
protected  void addChildEdifCellInstance(EdifCell origCell, EdifCell newCell, EdifCellInstance oldChildInstance)
           
protected  void addChildEdifCellInstances(EdifCell origCell, EdifCell newCell)
           
protected  void addEdifPortRef(EdifNet newNet, EdifPortRef oldRef)
           
protected  void addEdifPorts(EdifCell origCell, EdifCell newCell)
           
protected  EdifNet addNet(EdifCell origCell, EdifCell newCell, EdifNet oldNet)
           
protected  void addNets(EdifCell origCell, EdifCell newCell)
           
protected  EdifCell copyEdifCell(EdifCell origCell)
          Finds associated library in new environment and uses it as well as the old name.
protected  EdifCell copyEdifCell(EdifCell origCell, EdifLibrary destLibrary)
          Uses name of original EdifCell for name of new cell.
 EdifCell copyEdifCell(EdifCell origCell, EdifLibrary destLibrary, EdifNameable name)
          Copy the given EdifCell from the original Environment and add it to the new environment.
protected  EdifLibrary copyEdifLibrary(EdifLibrary origLib)
          Create library using same name as in old library.
protected  EdifLibrary copyEdifLibrary(EdifLibrary origLib, EdifNameable libName)
          Copies a new library based on the old library.
 EdifEnvironment createEdifEnvironment()
          Initiates the copying of the old environment and the creation of a new environment.
 EdifEnvironment createEdifEnvironment(EdifNameable name)
          Initiates the copying of the old environment and the creation of a new environment.
protected  EdifCell createTopCell(EdifCell oldTopCell)
          Create the top-level EdifCell (recursive)
protected  void createTopDesign()
          This method creates the top-level design for the new environment.
 EdifEnvironment getNewEnvironment()
           
protected  void setEdifEnvironmentDateAuthorProgramVersion()
          Copy the date, author, program, and version of the old environment into the new environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_instanceMap

protected java.util.HashMap<EdifCellInstance,EdifCellInstance> _instanceMap

_portMap

protected java.util.HashMap<EdifPort,EdifPort> _portMap

_netMap

protected java.util.HashMap<EdifNet,EdifNet> _netMap

_cellMap

protected java.util.HashMap<EdifCell,EdifCell> _cellMap

_libMap

protected java.util.HashMap<EdifLibrary,EdifLibrary> _libMap

_newEnv

protected EdifEnvironment _newEnv

_origEnv

protected EdifEnvironment _origEnv
Constructor Detail

EdifEnvironmentCopy

public EdifEnvironmentCopy(EdifEnvironment env)
                    throws EdifNameConflictException
This constructor will create a copy of the EdifEnvironmentCopy object.

Parameters:
env - Environment to copy
Throws:
EdifNameConflictException
Method Detail

createEdifEnvironment

public EdifEnvironment createEdifEnvironment()
                                      throws EdifNameConflictException
Initiates the copying of the old environment and the creation of a new environment. This will perform a "deep" copy and copy all elements needed for the top-level design.

The name of the new environment will be assigned to the name of the old environment.

Returns:
Throws:
EdifNameConflictException

createEdifEnvironment

public EdifEnvironment createEdifEnvironment(EdifNameable name)
                                      throws EdifNameConflictException
Initiates the copying of the old environment and the creation of a new environment. This will perform a "deep" copy and copy all elements needed for the top-level design.

The name of the new environment is determined by the name parameter.

This method performs three steps: - Create new environment - Copy the properties of the environment - Copy Date, Author, Program, and Version of Environment - Create the top-level design and all EdifCells needed for design (recursive call)

Returns:
Throws:
EdifNameConflictException

getNewEnvironment

public EdifEnvironment getNewEnvironment()
Returns:
The copied EdifEnvironment

setEdifEnvironmentDateAuthorProgramVersion

protected void setEdifEnvironmentDateAuthorProgramVersion()
Copy the date, author, program, and version of the old environment into the new environment. These parameters are not immutable so they can be changed at a later time. This method can also be extended to change the default behavior.


createTopDesign

protected void createTopDesign()
                        throws EdifNameConflictException
This method creates the top-level design for the new environment. It performs the following steps:
  1. Copies the top-level EdifCell that represents the top-level design (it does this recursively and will thus add all the libraries, cells, etc. for this top-level Cell)
  2. Creates new top-level instance
  3. Creates new EdifDesign
  4. Copies EdifDesign properties

Throws:
EdifNameConflictException

createTopCell

protected EdifCell createTopCell(EdifCell oldTopCell)
                          throws EdifNameConflictException
Create the top-level EdifCell (recursive)

Parameters:
oldTopCell -
Returns:
Throws:
EdifNameConflictException

copyEdifCell

public EdifCell copyEdifCell(EdifCell origCell,
                             EdifLibrary destLibrary,
                             EdifNameable name)
                      throws EdifNameConflictException
Copy the given EdifCell from the original Environment and add it to the new environment. Create all the libraries and children cells necessary to build the EdifCell.

This method performs the following steps:

  1. Create new cell and place in map
  2. Add ports to cell
  3. add instances to cell (including sub-cells through recursion)
  4. add nets and wire them up.

Parameters:
origCell -
Throws:
EdifNameConflictException

copyEdifCell

protected EdifCell copyEdifCell(EdifCell origCell,
                                EdifLibrary destLibrary)
                         throws EdifNameConflictException
Uses name of original EdifCell for name of new cell.

Throws:
EdifNameConflictException

copyEdifCell

protected EdifCell copyEdifCell(EdifCell origCell)
                         throws EdifNameConflictException
Finds associated library in new environment and uses it as well as the old name.

Throws:
EdifNameConflictException

copyEdifLibrary

protected EdifLibrary copyEdifLibrary(EdifLibrary origLib,
                                      EdifNameable libName)
                               throws EdifNameConflictException
Copies a new library based on the old library.

This is a "shallow" copy that does not copy the cells. Instead, it creates an empty library. EdifCells are added to the library during the copyEdifCell methods.

  1. Create new library
  2. Add library to environment
  3. copy properties
  4. Add to the map

Parameters:
origLib -
libName -
Returns:
Throws:
EdifNameConflictException

copyEdifLibrary

protected EdifLibrary copyEdifLibrary(EdifLibrary origLib)
                               throws EdifNameConflictException
Create library using same name as in old library.

Parameters:
origLib -
Returns:
Throws:
EdifNameConflictException

addEdifPorts

protected void addEdifPorts(EdifCell origCell,
                            EdifCell newCell)
                     throws EdifNameConflictException
Throws:
EdifNameConflictException

addChildEdifCellInstances

protected void addChildEdifCellInstances(EdifCell origCell,
                                         EdifCell newCell)
                                  throws EdifNameConflictException
Throws:
EdifNameConflictException

addChildEdifCellInstance

protected void addChildEdifCellInstance(EdifCell origCell,
                                        EdifCell newCell,
                                        EdifCellInstance oldChildInstance)
                                 throws EdifNameConflictException
Throws:
EdifNameConflictException

addNets

protected void addNets(EdifCell origCell,
                       EdifCell newCell)
                throws EdifNameConflictException
Throws:
EdifNameConflictException

addNet

protected EdifNet addNet(EdifCell origCell,
                         EdifCell newCell,
                         EdifNet oldNet)
                  throws EdifNameConflictException
Throws:
EdifNameConflictException

addEdifPortRef

protected void addEdifPortRef(EdifNet newNet,
                              EdifPortRef oldRef)