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

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.flatten.FlattenedEdifCell
              extended by edu.byu.ece.edif.tools.sterilize.halflatch.HalfLatchFlattenedEdifCell
All Implemented Interfaces:
EdifOut, Properties, Trimable, java.io.Serializable

public class HalfLatchFlattenedEdifCell
extends FlattenedEdifCell

See Also:
Serialized Form

Field Summary
static boolean _debug
           
protected  boolean _fixed
           
protected  HalfLatchArchitecture _hlArchitecture
           
protected  EdifCellInstance _inputBufferCellInstance
           
protected  int _numConstantPortsToDriveWithSafeConstant
           
protected  EdifCellInstance _safeConstantGeneratorCell
           
protected  EdifCellInstance _safeConstantInverterInstance
           
protected  EdifNet _safeConstantNetInv
           
protected  EdifNet _safeConstantNetNorm
           
protected  EdifPortRef _safeConstantNetSafeConstantPortEPR
           
static java.lang.String _safeConstantOneNetName
           
static java.lang.String _safeConstantOnePortName
           
protected  int _safeConstantPolarity
           
protected  EdifPort _safeConstantPort
           
static java.lang.String _safeConstantZeroNetName
           
static java.lang.String _safeConstantZeroPortName
           
 
Fields inherited from class edu.byu.ece.edif.tools.flatten.FlattenedEdifCell
_hierarchyNetsToFlatNets, _naming, _nodesToFlatInstances, _noFlatten, _originalCell, _topFlatteningNode
 
Fields inherited from class edu.byu.ece.edif.core.EdifCell
serialVersionUID
 
Constructor Summary
HalfLatchFlattenedEdifCell(EdifLibrary lib, FlattenedEdifCell flatCell, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Construct a new HalfLatchFlattenedEdifCell based on the given FlattenedEdifCell and in the given library
HalfLatchFlattenedEdifCell(FlattenedEdifCell flatCell, HalfLatchArchitecture hlArchitecture, int safeConstantPolarity)
          Construct a new HalfLatchFlattenedEdifCell based on the given FlattenedEdifCell and in the same library as the original.
 
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.
 boolean addSubCell(EdifCellInstance cellInstance)
          When adding a sub cell to a HalfLatchFlattenedEdifCell, the instance should be added to the instanceNode as well.
 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.
protected  void copyCellAndRemoveHalfLatches(FlattenedEdifCell flatCell)
           
private  void copyInstances(FlattenedEdifCell flatCell, java.util.Map<EdifPort,EdifPort> oldToNewPorts, java.util.Map<FlattenedEdifCellInstance,FlattenedEdifCellInstance> oldToNewInstances)
           
private  void copyNets(FlattenedEdifCell flatCell, java.util.Map<EdifPort,EdifPort> oldToNewPorts, java.util.Map<FlattenedEdifCellInstance,FlattenedEdifCellInstance> oldToNewInstances, java.util.Map<EdifNet,EdifNet> oldToNewNets)
           
private  void deleteSafeConstantNetSafeConstantPortEPR()
           
 EdifNet findOrAddSafeConstantNet()
           
 EdifNet findOrAddSafeConstantNet(int polarity)
           
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()
           
protected static java.util.List<EdifPortRef> getConstantPrimitiveEPRs(EdifNet net, HalfLatchArchitecture hlArch)
          Checks the drivers of the given EdifNet and returns a Collection of the EdifPortRef objects of any constant primitives that drive this Net.
 EdifCellInstance getSafeConstantGeneratorCell()
           
 EdifNet getSafeConstantNet(int polarity)
           
 EdifCellInstance getSafeConstantPortBufferInstance()
           
protected static boolean isConstantNet(EdifNet net, HalfLatchArchitecture hlArch)
          Checks the drivers of the given EdifNet and returns true if one of these is a constant primitive.
static void main(java.lang.String[] args)
           
private  void removeSafeConstantPort()
           
 EdifPort renameSafeConstantPort(java.lang.String portName)
           
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.tools.flatten.FlattenedEdifCell
flatten, getAllHierarchicalInstances, getFlatCell, getFlatInstance, getFlatInstance, getFlatNet, getFlatNet, getHierarchicalInstance, getHierarchicalNet, getHierarchyNaming, getInstanceHierarchyMap, getInstancesWithin, getInstancesWithinCellTypes, getInstancesWithinNode, getNetHierarchyMap, getOriginalCell, getTopFlatteningNode, getTopInstanceNode, processSubCells
 
Methods inherited from class edu.byu.ece.edif.core.EdifCell
addBlackBoxResource, addNet, addPort, addPort, addPortUniqueName, addPortUniqueName, 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

_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

_debug

public static final boolean _debug
See Also:
Constant Field Values

_safeConstantPort

protected EdifPort _safeConstantPort

_safeConstantNetNorm

protected EdifNet _safeConstantNetNorm

_safeConstantNetInv

protected EdifNet _safeConstantNetInv

_safeConstantInverterInstance

protected EdifCellInstance _safeConstantInverterInstance

_safeConstantNetSafeConstantPortEPR

protected EdifPortRef _safeConstantNetSafeConstantPortEPR

_safeConstantGeneratorCell

protected EdifCellInstance _safeConstantGeneratorCell

_inputBufferCellInstance

protected EdifCellInstance _inputBufferCellInstance

_hlArchitecture

protected HalfLatchArchitecture _hlArchitecture

_safeConstantPolarity

protected int _safeConstantPolarity

_fixed

protected boolean _fixed

_numConstantPortsToDriveWithSafeConstant

protected int _numConstantPortsToDriveWithSafeConstant
Constructor Detail

HalfLatchFlattenedEdifCell

public HalfLatchFlattenedEdifCell(FlattenedEdifCell flatCell,
                                  HalfLatchArchitecture hlArchitecture,
                                  int safeConstantPolarity)
                           throws EdifNameConflictException,
                                  InvalidEdifNameException
Construct a new HalfLatchFlattenedEdifCell based on the given FlattenedEdifCell and in the same library as the original. The new Cell will have the suffix "_hl" to prevent name conflicts.

Parameters:
flatCell - the FlattenedEdifCell to remove half-latches from
Throws:
EdifNameConflictException
InvalidEdifNameException

HalfLatchFlattenedEdifCell

public HalfLatchFlattenedEdifCell(EdifLibrary lib,
                                  FlattenedEdifCell flatCell,
                                  HalfLatchArchitecture hlArchitecture,
                                  int safeConstantPolarity)
                           throws EdifNameConflictException,
                                  InvalidEdifNameException
Construct a new HalfLatchFlattenedEdifCell based on the given FlattenedEdifCell and in the given library

Parameters:
lib - the library to construct the HalfLatchFlattenedEdifCell in
flatCell - the FlattenedEdifCell to remove half-latches from
Throws:
EdifNameConflictException
InvalidEdifNameException
Method Detail

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.


addSubCell

public boolean addSubCell(EdifCellInstance cellInstance)
                   throws EdifNameConflictException
When adding a sub cell to a HalfLatchFlattenedEdifCell, the instance should be added to the instanceNode as well.

Overrides:
addSubCell in class EdifCell
Parameters:
cellInstance - EdifCellInstance object to add to the EdifCell
Throws:
EdifNameConflictException

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.


findOrAddSafeConstantNet

public EdifNet findOrAddSafeConstantNet()

findOrAddSafeConstantNet

public EdifNet findOrAddSafeConstantNet(int polarity)

findOrAddSafeConstantNetSafeConstantPortEPR

public EdifPortRef findOrAddSafeConstantNetSafeConstantPortEPR()

findOrAddSafeConstantPort

public EdifPort findOrAddSafeConstantPort()

getSafeConstantGeneratorCell

public EdifCellInstance getSafeConstantGeneratorCell()

getSafeConstantNet

public EdifNet getSafeConstantNet(int polarity)

getSafeConstantPortBufferInstance

public EdifCellInstance getSafeConstantPortBufferInstance()

renameSafeConstantPort

public EdifPort renameSafeConstantPort(java.lang.String portName)

copyCellAndRemoveHalfLatches

protected void copyCellAndRemoveHalfLatches(FlattenedEdifCell flatCell)

copyNets

private void copyNets(FlattenedEdifCell flatCell,
                      java.util.Map<EdifPort,EdifPort> oldToNewPorts,
                      java.util.Map<FlattenedEdifCellInstance,FlattenedEdifCellInstance> oldToNewInstances,
                      java.util.Map<EdifNet,EdifNet> oldToNewNets)

copyInstances

private void copyInstances(FlattenedEdifCell flatCell,
                           java.util.Map<EdifPort,EdifPort> oldToNewPorts,
                           java.util.Map<FlattenedEdifCellInstance,FlattenedEdifCellInstance> oldToNewInstances)

getConstantPrimitiveEPRs

protected static java.util.List<EdifPortRef> getConstantPrimitiveEPRs(EdifNet net,
                                                                      HalfLatchArchitecture hlArch)
Checks the drivers of the given EdifNet and returns a Collection of the EdifPortRef objects of any constant primitives that drive this Net.

Parameters:
net - The EdifNet object to examine
hlArch - The HalfLatchArchitecture object which determines which cells are constant cells
Returns:
A Collection of EPRs of constant primitives driving this Net, or an empty Collection if there are none.

isConstantNet

protected static boolean isConstantNet(EdifNet net,
                                       HalfLatchArchitecture hlArch)
Checks the drivers of the given EdifNet and returns true if one of these is a constant primitive.

Parameters:
net - The EdifNet object to examine
hlArch - The HalfLatchArchitecture object which determines which cells are constant cells
Returns:
true if the given EdifNet is driven by a constant, false otherwise

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.


addSafeConstantNetInvPolarity

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


addSafeConstantNetNormPolarity

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


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.


deleteSafeConstantNetSafeConstantPortEPR

private void deleteSafeConstantNetSafeConstantPortEPR()

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.


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.


removeSafeConstantPort

private void removeSafeConstantPort()

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)