edu.byu.ece.edif.tools.replicate.nmr
Class AbstractReplicationType

java.lang.Object
  extended by edu.byu.ece.edif.tools.replicate.nmr.AbstractReplicationType
All Implemented Interfaces:
ReplicationType, java.io.Serializable
Direct Known Subclasses:
DWCReplicationType, TMRReplicationType, UnityReplicationType

public abstract class AbstractReplicationType
extends java.lang.Object
implements ReplicationType

In this framework, a ReplicationType represents the number of times to replicate things (replication factor), how to restore signals (i.e. voting), and how to name replicated objects. The class also contains code for performing replications.

See Also:
Serialized Form

Field Summary
protected  int _replicationFactor
           
protected  java.lang.String _replicationName
           
 
Constructor Summary
protected AbstractReplicationType(int replicationFactor, java.lang.String replicationName)
          Initialize a ReplicationType.
 
Method Summary
 int getReplicationFactor()
          Get the replication factor associated with the replication type.
 EdifNameable getReplicationInstanceNameable(EdifNameable origName, int domain)
          Create a new String that incorporates the NMR domain number into the name.
 EdifNameable getReplicationNetNameable(EdifNameable origName, int domain)
          Create an EdifNameable for replicated EdifNets.
 EdifNameable getReplicationPortNameable(EdifNameable name, int domain)
          Create a new EdifNameable object that incorporates the NMR domain number into the name.
protected  java.lang.String getReplicationString(java.lang.String origName, int domain)
          Create a new String that incorporates the NMR domain number into the name.
protected  java.lang.String getReplicationSuffix(int domain)
          Create a new String to be added to the end of a triplicated element that incorporates the NMR domain number.
 java.util.List<EdifCellInstance> replicate(EdifCellInstance oldInstance, EdifCell newCellDefinition, EdifCell newTopCell)
          Create the _replicationFactor copies of the given instance using the naming scheme provided by the replication type.
 java.util.List<EdifPort> replicate(EdifPort oldPort, EdifCell newTopCell)
          Create the _replicationFactor copies of the given port using the naming scheme provided by the replication type.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.byu.ece.edif.tools.replicate.nmr.ReplicationType
antiRestore, defaultRestore, forceRestore, forceRestore
 

Field Detail

_replicationFactor

protected int _replicationFactor

_replicationName

protected java.lang.String _replicationName
Constructor Detail

AbstractReplicationType

protected AbstractReplicationType(int replicationFactor,
                                  java.lang.String replicationName)
Initialize a ReplicationType.

Parameters:
replicationFactor -
replicationSuffixes -
Method Detail

getReplicationFactor

public int getReplicationFactor()
Get the replication factor associated with the replication type.

Specified by:
getReplicationFactor in interface ReplicationType
Returns:
the replication factor of the replication type

getReplicationInstanceNameable

public EdifNameable getReplicationInstanceNameable(EdifNameable origName,
                                                   int domain)
Create a new String that incorporates the NMR domain number into the name.

Specified by:
getReplicationInstanceNameable in interface ReplicationType
Parameters:
origName - The original name
domain - The domain number
Returns:
the new NamedObject with the new name

getReplicationNetNameable

public EdifNameable getReplicationNetNameable(EdifNameable origName,
                                              int domain)
Create an EdifNameable for replicated EdifNets. Handles three different cases.
  1. Single name (i.e. (net xp_out)): could turn into (net xp_out_TMR_0)
  2. Double named, not a bus member (i.e. (net (rename xp_out__ "xp_out_?"))): could turn into (net (rename xp_out___TMR_0 "xp_out_?_TMR_0"))
  3. Double name, bus member (i.e. (net (rename xp_out_5 "xp_out(5)"))): could turn into (net (rename xp_out_TMR_0_5 "xp_out_TMR_0(5)"))

Specified by:
getReplicationNetNameable in interface ReplicationType
Returns:

getReplicationPortNameable

public EdifNameable getReplicationPortNameable(EdifNameable name,
                                               int domain)
Create a new EdifNameable object that incorporates the NMR domain number into the name. This method will identify renamed objects and attempt to create a unique name that incorporates the domain number. Specifically, this will attempt to preserve any bus numbering that is found in the renamed object.

Specified by:
getReplicationPortNameable in interface ReplicationType
Parameters:
name - The original name
domain - The domain number
Returns:
The new NamedObject or the RenamedObject, as appropriate.

getReplicationString

protected java.lang.String getReplicationString(java.lang.String origName,
                                                int domain)
Create a new String that incorporates the NMR domain number into the name. Note that this is NOT necessarily a valid EDIF name. The origName can be invalid and thus the resulting concatenated String could be invalid.

Parameters:
origName - The original name
domain - The domain number
Returns:
the String with the replication suffix and domain number.

getReplicationSuffix

protected java.lang.String getReplicationSuffix(int domain)
Create a new String to be added to the end of a triplicated element that incorporates the NMR domain number.

Parameters:
domain - The domain number
Returns:
the String with the replication suffix and domain number.

replicate

public java.util.List<EdifCellInstance> replicate(EdifCellInstance oldInstance,
                                                  EdifCell newCellDefinition,
                                                  EdifCell newTopCell)
                                           throws EdifNameConflictException
Create the _replicationFactor copies of the given instance using the naming scheme provided by the replication type.

Specified by:
replicate in interface ReplicationType
Returns:
Throws:
EdifNameConflictException

replicate

public java.util.List<EdifPort> replicate(EdifPort oldPort,
                                          EdifCell newTopCell)
                                   throws EdifNameConflictException
Create the _replicationFactor copies of the given port using the naming scheme provided by the replication type.

Specified by:
replicate in interface ReplicationType
Returns:
Throws:
EdifNameConflictException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object