edu.byu.ece.edif.core
Class EdifPortRef

java.lang.Object
  extended by edu.byu.ece.edif.core.EdifPortRef
All Implemented Interfaces:
java.io.Serializable

public class EdifPortRef
extends java.lang.Object
implements java.io.Serializable

Represents a port reference within an EdifEnvironment. This object contains a reference to an EdifPort, an EdifNet, and an EdifCellInstance. The EdifPort object is a port that is contained by an EdifCell object. The EdifNet object is the parent or "owner" of this object (i.e. this object is contained in the EdifNet list of EdifPortRef objects). The EdifCellInstance object refers to the cell instance that owns the port. If this reference is null, the referenced port is a top-level port found in the EdifCell that owns the EdifNet object.

Version:
$Id:EdifPortRef.java 198 2008-04-16 21:14:21Z jamesfcarroll $
See Also:
EdifPortRef, EdifNet, Serialized Form

Field Summary
private  EdifCellInstance _cellInstance
          The EdifCellInstance Object that this EdifPortRef Object connects to.
private  EdifNet _net
          The EdifNet Object that connects to this EdifPortRef Object.
private  EdifSingleBitPort _refSingleBitPort
          The EdifPort Object this EdifPortRef Object refers to.
 
Constructor Summary
EdifPortRef(EdifNet net, EdifPort port, EdifCellInstance instance)
          Deprecated. Please use EdifPortRef(EdifNet,EdifSingleBitPort,EdifCellInstance) instead
EdifPortRef(EdifNet net, EdifPort port, EdifCellInstance instance, int busMember)
          Deprecated. Please use EdifPortRef(EdifNet,EdifSingleBitPort,EdifCellInstance) instead
EdifPortRef(EdifNet net, EdifSingleBitPort port, EdifCellInstance instance)
          A constructor for the new EdifSingleBitPort.
 
Method Summary
 java.lang.Object clone()
          Copy reference of refPort (DOES NOT COPY PORT!) Copy reference of EdifCellInstance (DOES NOT COPY INSTANCE) Copy reference to EdifNet (DOES NOT COPY NET)
 boolean equalsPortRefWithin(java.util.Collection<EdifPortRef> portRefs)
          Return true if the current port ref's port equals within one of the passed-in collection of EdifPortRef Object's port.
 boolean equalsPortWithin(java.util.Collection<EdifPort> ports)
          Return true if the current port ref equals within one of the passed-in collection of EdifPort Objects.
 int getBusMember()
          Return the index this EdifPortRef Object refers to within a bus.
 EdifCellInstance getCellInstance()
          Return the EdifCellInstance Object that this EdifPortRef Object connects to.
 EdifNet getNet()
          Return the EdifNet Object that this EdifPortRef Object is connected to.
 EdifPort getPort()
          Return the EdifPort Object that this EdifPortRef Object refers to.
 EdifCellInstance getRefCell()
          Deprecated. This method has been deprecated in favor of the EdifPort.getCellInstance() method that contains a more intuitive method name.
 EdifPort getRefPort()
          Deprecated. This method has been deprecated in favor of the EdifPort.getPort() method that contains a more intuitive method name.
 EdifSingleBitPort getSingleBitPort()
          Return the EdifSingleBitPort Object that this EdifPortRef Object refers to.
private  void init(EdifNet net, EdifSingleBitPort port, EdifCellInstance i)
           
 boolean isDriverPortRef()
          Indicate whether the port ref is a "driver" connection rather than a sink connection.
 boolean isSingleBitPortRef()
          Return true if port ref corresponds to a single-bit port (i.e.
 boolean isTopLevelPortRef()
          Indicate whether the EdifPortRef is connected to a top level port.
 boolean matchesWithin(java.util.Collection<EdifPortRef> portRefs)
          Return true if the current port ref matches within the passed-in collection of EdifPortRef Objects.
 java.lang.String toString()
          Return a String representation of this Object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_refSingleBitPort

private EdifSingleBitPort _refSingleBitPort
The EdifPort Object this EdifPortRef Object refers to.


_cellInstance

private EdifCellInstance _cellInstance
The EdifCellInstance Object that this EdifPortRef Object connects to.


_net

private EdifNet _net
The EdifNet Object that connects to this EdifPortRef Object.

Constructor Detail

EdifPortRef

@Deprecated
public EdifPortRef(EdifNet net,
                              EdifPort port,
                              EdifCellInstance instance)
Deprecated. Please use EdifPortRef(EdifNet,EdifSingleBitPort,EdifCellInstance) instead

Construct an atomic EdifPortRef object based on a given net, port, and instance with a bus member = -1 (i.e. hooked up to a single-bit port).

Parameters:
net - The EdifNet Object this EdifPortRef Object is connected to
port - The EdifPort Object that this EdifPortRef refers to
instance - The EdifCellInstance Object this EdifPortRef connects to

EdifPortRef

@Deprecated
public EdifPortRef(EdifNet net,
                              EdifPort port,
                              EdifCellInstance instance,
                              int busMember)
Deprecated. Please use EdifPortRef(EdifNet,EdifSingleBitPort,EdifCellInstance) instead

Construct an atomic EdifPortRef object based on a given net, port, and instance with a bus member.

Parameters:
net - The EdifNet Object this EdifPortRef Object is connected to
port - The EdifPort Object that this EdifPortRef refers to
instance - The EdifCellInstance Object this EdifPortRef connects to
busMember - The position within the EdifPort object to retrieve the EdifSingleBitPort

EdifPortRef

public EdifPortRef(EdifNet net,
                   EdifSingleBitPort port,
                   EdifCellInstance instance)
A constructor for the new EdifSingleBitPort.

Parameters:
net - The EdifNet Object this EdifPortRef Object is connected to
port - The EdifSingleBitPort Object that this EdifPortRef refers to
instance - The EdifCellInstance Object this EdifPortRef connects to.
Method Detail

clone

public java.lang.Object clone()
Copy reference of refPort (DOES NOT COPY PORT!) Copy reference of EdifCellInstance (DOES NOT COPY INSTANCE) Copy reference to EdifNet (DOES NOT COPY NET)

Overrides:
clone in class java.lang.Object
Returns:
an Object that is a copy or clone of this EdifPortRef Object

equalsPortRefWithin

public boolean equalsPortRefWithin(java.util.Collection<EdifPortRef> portRefs)
Return true if the current port ref's port equals within one of the passed-in collection of EdifPortRef Object's port. Equality done by ==.

Parameters:
portRefs - A Collection of EdifPortRef Objects that the port of this EdifPortRef Object will be compared to in order to determine if an EdifPort exists between this EdifPortRef Object, and an EdifPortRef Object within the Collection
Returns:
True if a port exists between this EdifPortRef Object and an EdifPortRef Object within the passed-in Collection of EdifPortRef Objects

equalsPortWithin

public boolean equalsPortWithin(java.util.Collection<EdifPort> ports)
Return true if the current port ref equals within one of the passed-in collection of EdifPort Objects. Equality done by ==.

Parameters:
ports - A Collection of EdifPort Objects that this EdifPortRef Object will be compared to in order to determine if an EdifPort exists between this EdifPortRef Object, and an EdifPort Object within the Collection
Returns:
True if a port exists between this EdifPortRef Object and an EdifPort Object within the passed-in Collection of EdifPort Objects

getBusMember

public int getBusMember()
Return the index this EdifPortRef Object refers to within a bus.

Returns:
An int specifying the index this EdifPortRef Object refers to within a bus

getCellInstance

public EdifCellInstance getCellInstance()
Return the EdifCellInstance Object that this EdifPortRef Object connects to.

Returns:
An EdifCellInstance Object that this EdifPortRef Object connects to

getNet

public EdifNet getNet()
Return the EdifNet Object that this EdifPortRef Object is connected to.

Returns:
An EdifNet Object that this EdifPortRef Object is connected to

getPort

public EdifPort getPort()
Return the EdifPort Object that this EdifPortRef Object refers to.

Returns:
The EdifPort Object referred to by this EdifPortRef Object

getRefCell

@Deprecated
public EdifCellInstance getRefCell()
Deprecated. This method has been deprecated in favor of the EdifPort.getCellInstance() method that contains a more intuitive method name.


getRefPort

@Deprecated
public EdifPort getRefPort()
Deprecated. This method has been deprecated in favor of the EdifPort.getPort() method that contains a more intuitive method name.

Return the EdifPort Object that this EdifPortRef Object refers to.

Returns:
The EdifPort Object referred to by this EdifPortRef Object

getSingleBitPort

public EdifSingleBitPort getSingleBitPort()
Return the EdifSingleBitPort Object that this EdifPortRef Object refers to.

Returns:
The EdifSingleBitPort Object referred to by this EdifPortRef Object

isDriverPortRef

public boolean isDriverPortRef()
Indicate whether the port ref is a "driver" connection rather than a sink connection. If the associated port is a top-level port and the port is a top-level input, this method will return true. If the assocaited port is an internal port and the internal port is an output, this method will return true.

Returns:
If the associated port is a top-level port and the port is a top-level input, this method will return true. If the assocaited port is an internal port and the internal port is an output, this method will return true.

isSingleBitPortRef

public boolean isSingleBitPortRef()
Return true if port ref corresponds to a single-bit port (i.e. bus member = -1).


isTopLevelPortRef

public boolean isTopLevelPortRef()
Indicate whether the EdifPortRef is connected to a top level port.

Returns:
true when associated Port is a top-level port, false when associated Port is an internal port.

matchesWithin

public boolean matchesWithin(java.util.Collection<EdifPortRef> portRefs)
Return true if the current port ref matches within the passed-in collection of EdifPortRef Objects. Equality done by doing a deep compare on the ports.

Parameters:
portRefs - A Collection of EdifPortRef Objects that this EdifPortRef Object will be compared to in order to determine if a match exists between this EdifPortRef Object, and an EdifPortRef Object within the Collection
Returns:
True if a match exists between this EdifPortRef Object and an EdifPortRef Object within the passed-in Collection of EdifPortRef Objects

toString

public java.lang.String toString()
Return a String representation of this Object. The output is as follows:
  
      Top-level port: TOP-<CellName>.<port> 
      Internal port:  <InstanceName>.<port>
 

Overrides:
toString in class java.lang.Object
Returns:
A String representing this object

init

private void init(EdifNet net,
                  EdifSingleBitPort port,
                  EdifCellInstance i)