edu.byu.ece.edif.tools.sterilize.halflatch
Class HalfLatchEdifCell

java.lang.Object
  extended by edu.byu.ece.edif.core.NamedPropertyObject
      extended by edu.byu.ece.edif.core.EdifCell
          extended by edu.byu.ece.edif.tools.sterilize.halflatch.HalfLatchEdifCell
All Implemented Interfaces:
EdifOut, Properties, Trimable, java.io.Serializable

public class HalfLatchEdifCell
extends EdifCell

See Also:
Serialized Form

Field Summary
private static boolean _debug
           
private  boolean _fixed
           
private  EdifCellInstanceGraph _graph
           
private  HalfLatchArchitecture _hlArchitecture
           
private  EdifCellInstance _inputBufferCellInstance
           
private  java.util.Collection<EdifCellInstance> _nonPrimitiveSubCellList
           
private  int _numConstantPortsToDriveWithSafeConstant
           
private  java.util.Collection<EdifCellInstance> _primitiveSubCellList
           
private  EdifCellInstance _safeConstantGeneratorCell
           
private  EdifCellInstance _safeConstantInverterInstance
           
private  EdifNet _safeConstantNetInv
           
private  EdifNet _safeConstantNetNorm
           
private  EdifPortRef _safeConstantNetSafeConstantPortEPR
           
static java.lang.String _safeConstantOneNetName
           
static java.lang.String _safeConstantOnePortName
           
private  int _safeConstantPolarity
           
private  EdifPort _safeConstantPort
           
static java.lang.String _safeConstantZeroNetName
           
static java.lang.String _safeConstantZeroPortName
           
static java.lang.String SENSITIVE_SUFFIX
           
 
Fields inherited from class edu.byu.ece.edif.core.EdifCell
serialVersionUID
 
Constructor Summary
HalfLatchEdifCell(EdifLibrary lib, EdifCell cell, EdifNameable name, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Copy constructor
HalfLatchEdifCell(EdifLibrary lib, EdifCell cell, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Copy constructor
HalfLatchEdifCell(EdifLibrary lib, EdifCell cell, java.lang.String name, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Copy constructor
HalfLatchEdifCell(EdifLibrary lib, EdifNameable name, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Full constructor
HalfLatchEdifCell(EdifLibrary lib, java.lang.String name, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Full constructor
 
Method Summary
 void addSafeConstantGeneratorCell()
          Create a safe constant generating element to be added to 'this' cell.
private  void addSafeConstantInverter()
          If the safe constant net with *normal* polarity for 'this' cell has not already been created and added, then this method call will first create and add the net to 'this' cell.
private  EdifNet addSafeConstantNetInvPolarity()
          This method should NOT be directly called.
private  EdifNet addSafeConstantNetNormPolarity()
          This method should NOT be directly called.
private  EdifPort addSafeConstantPort()
          This method should NOT be called directly.
private  EdifPort addSafeConstantPort(java.lang.String portName)
          This method should NOT be called directly.
 void bufferSafeConstantPort()
          This method should be called on the top-level cell if an internal constant cell is not going to be generated to drive the safe constant distribution network.
 void connectNonPrimitiveToSafeConstant(EdifCellInstance eci)
          Connect 'safe constant' net in the current cell to safe constant port in cell instance passed in.
 void deleteSafeConstantNetSafeConstantPortEPR()
           
 EdifNet findOrAddSafeConstantNet()
           
 EdifNet findOrAddSafeConstantNet(int polarity)
           
 EdifNet findOrAddSafeConstantNetInv()
           
private  EdifNet findOrAddSafeConstantNetInvPolarity()
          If the safe constant inverter and or the safe constant net with inverted polarity for 'this' cell have not already been created and added, then this method call will first create and add the inverter and net (attached to the output of the inverter) to 'this' cell before returning a reference to the inverted polarity net.
private  EdifNet findOrAddSafeConstantNetNormPolarity()
          If the safe constant net with normal polarity for 'this' cell has not already been created and added, then this method call will first create and add the net to 'this' cell before returning a reference to it.
 EdifPortRef findOrAddSafeConstantNetSafeConstantPortEPR()
           
 EdifPort findOrAddSafeConstantPort()
           
 HalfLatchArchitecture getHalfLatchArchitecture()
           
 java.util.Collection getNonPrimitiveSubCellList()
           
 int getNumConstantPortsToDriveWithSafeConstant()
           
 java.util.Collection getPrimitiveSubCellList()
           
 EdifCellInstance getSafeConstantGeneratorCell()
           
 EdifNet getSafeConstantNet()
           
 EdifNet getSafeConstantNet(int polarity)
           
 EdifNet getSafeConstantNetInv()
           
 EdifPortRef getSafeConstantNetSafeConstantPortEPR()
           
 int getSafeConstantPolarity()
           
 EdifPort getSafeConstantPort()
           
 EdifCellInstance getSafeConstantPortBufferInstance()
           
private  void initSubCellLists()
          Create a collection of the primitive and non-primitive sub-cell instances BHP: Include BlackBox sub-cells in the list of primitives? They should be treated exactly the same, I believe.
 boolean isFixed()
           
static void main(java.lang.String[] args)
           
 void modifyInstanceCellReference(EdifCellInstance eci, java.util.Map origCellToHalfLatchCellMap)
          This function modifies the passed in cell instance eci so that the cell it references (in other words, the cell of which it is an instance) is actually now the EdifHalfLatchCell version.
 void removeSafeConstantGeneratorCell()
           
private  void removeSafeConstantPort()
           
 void removeSafeConstantPortBuffer()
          TODO: This should probably automatically call the removeSafeConstantGeneratorCell method.
 EdifPort renameSafeConstantPort(java.lang.String portName)
           
 int replaceConstantPrimitive(EdifCellInstance eci)
          Connect everything the constant primitive drives to the 'safe constant' net.
 int replaceConstantPrimitiveUsingGraph(EdifCellInstance eci)
          Connect everything the constant primitive drives to the 'safe constant' net.
 int replaceConstantPrimitiveWithoutGraph(EdifCellInstance eci)
          Connect everything the constant primitive drives to the 'safe constant' net.
 int replaceSensitivePrimitive(EdifCellInstance eci)
          This function replaces the sub-cell instance passed in with the half-latch safe version.
 void setNumConstantPortsToDriveWithSafeConstant(int num)
           
static int test(java.lang.String inputEdifFilename, java.lang.String outputEdifFilename)
           
private static boolean testHasSafeNet(EdifCell cell, java.lang.String safeConstantNetName)
           
private static boolean testHasSafePort(EdifCell cell, java.lang.String safeConstantPortName)
           
 
Methods inherited from class edu.byu.ece.edif.core.EdifCell
addBlackBoxResource, addNet, addPort, addPort, addPortUniqueName, addPortUniqueName, addSubCell, addSubCellUniqueName, cellInstanceIterator, contains, contains, contains, copyCellInternals, deleteNet, deletePort, deleteSubCell, deleteSubCell, equalsInterface, equalsName, findCellInstancesOf, getBlackBoxResources, getCellInstance, getCellInstanceList, getDanglingNets, getDanglingNets, getHierarchicalPrimitiveList, getInnerCells, getInputPorts, getInstance, getInstancedCellTypes, getInstancePortNet, getInterface, getLibrary, getMatchingPort, getNet, getNetList, getOutputPorts, getPort, getPortList, getPortRefs, getSafeCellInstanceList, getSortedNetList, getSortedPortList, getSortedPropertyList, getSortedSubCellList, getSubCellList, getUnconnectedInnerPorts, getUnconnectedInstances, getUnconnectedOuterPorts, getUniqueInstanceNameable, getUniqueInstanceNameable, getUniqueNetNameable, getUniqueNetNameable, isBlackBox, isFlat, isLeafCell, isPrimitive, modifyCellType, netListIterator, setInterface, setPrimitive, tagAsPrimitive, toEdif, toString, trimToSize
 
Methods inherited from class edu.byu.ece.edif.core.NamedPropertyObject
addProperty, addProperty, addPropertyList, copyProperties, equals, equalsProperties, getEdifNameable, getName, getOldName, getProperty, getPropertyList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_graph

private EdifCellInstanceGraph _graph

_primitiveSubCellList

private java.util.Collection<EdifCellInstance> _primitiveSubCellList

_nonPrimitiveSubCellList

private java.util.Collection<EdifCellInstance> _nonPrimitiveSubCellList

_safeConstantPort

private EdifPort _safeConstantPort

_safeConstantNetNorm

private EdifNet _safeConstantNetNorm

_safeConstantNetInv

private EdifNet _safeConstantNetInv

_safeConstantInverterInstance

private EdifCellInstance _safeConstantInverterInstance

_safeConstantNetSafeConstantPortEPR

private EdifPortRef _safeConstantNetSafeConstantPortEPR

_safeConstantGeneratorCell

private EdifCellInstance _safeConstantGeneratorCell

_inputBufferCellInstance

private EdifCellInstance _inputBufferCellInstance

_hlArchitecture

private HalfLatchArchitecture _hlArchitecture

_safeConstantPolarity

private int _safeConstantPolarity

_fixed

private boolean _fixed

_numConstantPortsToDriveWithSafeConstant

private int _numConstantPortsToDriveWithSafeConstant

_safeConstantZeroNetName

public static final java.lang.String _safeConstantZeroNetName
See Also:
Constant Field Values

_safeConstantOneNetName

public static final java.lang.String _safeConstantOneNetName
See Also:
Constant Field Values

_safeConstantZeroPortName

public static final java.lang.String _safeConstantZeroPortName
See Also:
Constant Field Values

_safeConstantOnePortName

public static final java.lang.String _safeConstantOnePortName
See Also:
Constant Field Values

SENSITIVE_SUFFIX

public static final java.lang.String SENSITIVE_SUFFIX
See Also:
Constant Field Values

_debug

private static final boolean _debug
See Also:
Constant Field Values
Constructor Detail

HalfLatchEdifCell

public HalfLatchEdifCell(EdifLibrary lib,
                         java.lang.String name,
                         HalfLatchArchitecture hlArchitecture,
                         int safeConstantPolarity)
                  throws EdifNameConflictException,
                         InvalidEdifNameException
Full constructor

Throws:
InvalidEdifNameException
EdifNameConflictException

HalfLatchEdifCell

public HalfLatchEdifCell(EdifLibrary lib,
                         EdifNameable name,
                         HalfLatchArchitecture hlArchitecture,
                         int safeConstantPolarity)
                  throws EdifNameConflictException
Full constructor

Throws:
EdifNameConflictException

HalfLatchEdifCell

public HalfLatchEdifCell(EdifLibrary lib,
                         EdifCell cell,
                         HalfLatchArchitecture hlArchitecture,
                         int safeConstantPolarity)
                  throws EdifNameConflictException,
                         InvalidEdifNameException
Copy constructor

Throws:
InvalidEdifNameException
EdifNameConflictException

HalfLatchEdifCell

public HalfLatchEdifCell(EdifLibrary lib,
                         EdifCell cell,
                         java.lang.String name,
                         HalfLatchArchitecture hlArchitecture,
                         int safeConstantPolarity)
                  throws EdifNameConflictException,
                         InvalidEdifNameException
Copy constructor

Throws:
InvalidEdifNameException
EdifNameConflictException

HalfLatchEdifCell

public HalfLatchEdifCell(EdifLibrary lib,
                         EdifCell cell,
                         EdifNameable name,
                         HalfLatchArchitecture hlArchitecture,
                         int safeConstantPolarity)
                  throws EdifNameConflictException,
                         InvalidEdifNameException
Copy constructor

Throws:
InvalidEdifNameException
EdifNameConflictException
Method Detail

initSubCellLists

private void initSubCellLists()
Create a collection of the primitive and non-primitive sub-cell instances BHP: Include BlackBox sub-cells in the list of primitives? They should be treated exactly the same, I believe.


modifyInstanceCellReference

public void modifyInstanceCellReference(EdifCellInstance eci,
                                        java.util.Map origCellToHalfLatchCellMap)
This function modifies the passed in cell instance eci so that the cell it references (in other words, the cell of which it is an instance) is actually now the EdifHalfLatchCell version.


replaceSensitivePrimitive

public int replaceSensitivePrimitive(EdifCellInstance eci)
This function replaces the sub-cell instance passed in with the half-latch safe version. i.e. An FD flip-flop gets replaced with an FDCPE


connectNonPrimitiveToSafeConstant

public void connectNonPrimitiveToSafeConstant(EdifCellInstance eci)
Connect 'safe constant' net in the current cell to safe constant port in cell instance passed in.


replaceConstantPrimitive

public int replaceConstantPrimitive(EdifCellInstance eci)
Connect everything the constant primitive drives to the 'safe constant' net. Disconnect all connections to the constant primitive. Delete the constant primitive.


replaceConstantPrimitiveWithoutGraph

public int replaceConstantPrimitiveWithoutGraph(EdifCellInstance eci)
Connect everything the constant primitive drives to the 'safe constant' net. Disconnect all connections to the constant primitive. Delete the constant primitive.


replaceConstantPrimitiveUsingGraph

public int replaceConstantPrimitiveUsingGraph(EdifCellInstance eci)
Connect everything the constant primitive drives to the 'safe constant' net. Disconnect all connections to the constant primitive. Delete the constant primitive.


addSafeConstantGeneratorCell

public void addSafeConstantGeneratorCell()
Create a safe constant generating element to be added to 'this' cell. The element is architecture specific (for example, in a Xilinx architecture an all 0 LUT will be used). Disconnect the 'safe constant' port and drive everything it was driving with the new 'safe constant' generator. TODO: This should probably automatically call the removeSafeConstantPortBuffer method.


getSafeConstantGeneratorCell

public EdifCellInstance getSafeConstantGeneratorCell()

removeSafeConstantGeneratorCell

public void removeSafeConstantGeneratorCell()

bufferSafeConstantPort

public void bufferSafeConstantPort()
This method should be called on the top-level cell if an internal constant cell is not going to be generated to drive the safe constant distribution network. The top-level port needs to be buffered so it will be kept.


getSafeConstantPortBufferInstance

public EdifCellInstance getSafeConstantPortBufferInstance()

removeSafeConstantPortBuffer

public void removeSafeConstantPortBuffer()
TODO: This should probably automatically call the removeSafeConstantGeneratorCell method.


getSafeConstantPort

public EdifPort getSafeConstantPort()

renameSafeConstantPort

public EdifPort renameSafeConstantPort(java.lang.String portName)

findOrAddSafeConstantPort

public EdifPort findOrAddSafeConstantPort()

addSafeConstantPort

private EdifPort addSafeConstantPort()
This method should NOT be called directly. It is meant only as a utility function for findOrAddSafeConstantPort(). This method pre-determines the safeConstantPort's name. If the safe constant port for 'this' cell has not already been created and added, then this method call will first create and add the port to 'this' cell before returning a reference to it.


addSafeConstantPort

private EdifPort addSafeConstantPort(java.lang.String portName)
This method should NOT be called directly. It is meant only as a utility function for addSafeConstantPort(). If the safe constant port for 'this' cell has not already been created and added, then this method call will first create and add the port to 'this' cell before returning a reference to it.


removeSafeConstantPort

private void removeSafeConstantPort()

getSafeConstantNet

public EdifNet getSafeConstantNet(int polarity)

findOrAddSafeConstantNet

public EdifNet findOrAddSafeConstantNet(int polarity)

getSafeConstantNet

public EdifNet getSafeConstantNet()

findOrAddSafeConstantNet

public EdifNet findOrAddSafeConstantNet()

findOrAddSafeConstantNetNormPolarity

private EdifNet findOrAddSafeConstantNetNormPolarity()
If the safe constant net with normal polarity for 'this' cell has not already been created and added, then this method call will first create and add the net to 'this' cell before returning a reference to it.


addSafeConstantNetNormPolarity

private EdifNet addSafeConstantNetNormPolarity()
This method should NOT be directly called. It is meant as a utility function for the function findOrAddSafeConstantNetNormPolarity()


getSafeConstantNetInv

public EdifNet getSafeConstantNetInv()

findOrAddSafeConstantNetInv

public EdifNet findOrAddSafeConstantNetInv()

findOrAddSafeConstantNetInvPolarity

private EdifNet findOrAddSafeConstantNetInvPolarity()
If the safe constant inverter and or the safe constant net with inverted polarity for 'this' cell have not already been created and added, then this method call will first create and add the inverter and net (attached to the output of the inverter) to 'this' cell before returning a reference to the inverted polarity net.


addSafeConstantNetInvPolarity

private EdifNet addSafeConstantNetInvPolarity()
This method should NOT be directly called. It is meant as a utility function for the function findOrAddSafeConstantNetInvPolarity()


addSafeConstantInverter

private void addSafeConstantInverter()
If the safe constant net with *normal* polarity for 'this' cell has not already been created and added, then this method call will first create and add the net to 'this' cell. By default, this method will create a net which is attached to the output of the inverter this method is supposed to create.


getSafeConstantPolarity

public int getSafeConstantPolarity()

getHalfLatchArchitecture

public HalfLatchArchitecture getHalfLatchArchitecture()

getSafeConstantNetSafeConstantPortEPR

public EdifPortRef getSafeConstantNetSafeConstantPortEPR()

findOrAddSafeConstantNetSafeConstantPortEPR

public EdifPortRef findOrAddSafeConstantNetSafeConstantPortEPR()

deleteSafeConstantNetSafeConstantPortEPR

public void deleteSafeConstantNetSafeConstantPortEPR()

getPrimitiveSubCellList

public java.util.Collection getPrimitiveSubCellList()

getNonPrimitiveSubCellList

public java.util.Collection getNonPrimitiveSubCellList()

isFixed

public boolean isFixed()

setNumConstantPortsToDriveWithSafeConstant

public void setNumConstantPortsToDriveWithSafeConstant(int num)

getNumConstantPortsToDriveWithSafeConstant

public int getNumConstantPortsToDriveWithSafeConstant()

test

public static int test(java.lang.String inputEdifFilename,
                       java.lang.String outputEdifFilename)

testHasSafeNet

private static boolean testHasSafeNet(EdifCell cell,
                                      java.lang.String safeConstantNetName)

testHasSafePort

private static boolean testHasSafePort(EdifCell cell,
                                       java.lang.String safeConstantPortName)

main

public static void main(java.lang.String[] args)