byucc.jhdl.platforms.util
Class VirtualPort

java.lang.Object
  extended bybyucc.jhdl.platforms.util.VirtualPort
All Implemented Interfaces:
UtilConstants

public class VirtualPort
extends java.lang.Object
implements UtilConstants

This class is used to contain all the information necessary to represent a virtual port that the user can link to.


Field Summary
 
Fields inherited from interface byucc.jhdl.platforms.util.UtilConstants
directions, IN, NONE, OUT, TRISTATE, UNASSIGNED
 
Constructor Summary
VirtualPort(java.lang.String name, int width, Wire in, Wire out)
          Constructs a new VirtualPort.
 
Method Summary
 VirtualPort addAttribute(java.lang.String attrib)
          Adds known attributes to the Virtual Port.
 void addDefaultProperty(PortProperty property)
          Adds a default property for all bits of this VirtualPort
 void addDefaultProperty(java.lang.String property)
          Adds a default property for all bits of this VirtualPort
 java.util.Vector getDefaultProperties()
          Used to get a list of all default properties.
 PortProperty getDefaultProperty(java.lang.String property)
          Get a specific default property.
 BV getDefaultState()
          Returns a copy of the default state.
 Wire getEnableWire(int index)
          Gets the entire enable wire associated with the UserPort which covers the indicated bit.
 PortProperty getInAttribute(int index, java.lang.String property)
          Retrieves the specified attribute associated with the UserPort for the IN direction for the specified bit.
 PortProperty[] getInAttributes(int index)
          Retrieves all attributes associated with the UserPort for the IN direction for the specified bit.
 java.lang.String getName()
          Get the name of the virtual port.
 PortProperty getOutAttribute(int index, java.lang.String prop)
          Retrieves the specified attribute associated with the UserPort for the OUT direction for the specified bit.
 PortProperty[] getOutAttributes(int index)
          Retrieves all attributes associated with the UserPort for the OUT direction for the specified bit.
 Wire getOutputWire()
          Returns the output wire.
 Wire getSingleEnable(int index)
          Gets the single bit enable wire associated with the specified bit.
 UserPortInfo[] getUserPorts()
          Get an Array of all UserPorts.
 int getWidth()
          Get the width of the virtual port.
 Wire getWireForPort(VPortInfo vpi, java.lang.String portName)
          Used to get the wire for the port specified by the parameters.
 boolean hasDefaultState()
          Checks whether or not a default state has been set.
 boolean hasInPort(int index)
          Find out if a given bit has a UserPort associated with the IN direction.
 boolean hasOutPort(int index)
          Find out if a given bit has a UserPort associated with the OUT direction.
 boolean isUsed()
          Tells whether any bits in this virtual port are currently used.
 boolean isUsed(int bit)
          Tells whether a specific bit in this virtual port is currently used.
 boolean isValidAttribute(java.lang.String attrib)
          Find out if an attribute is valid for this VirtualPort.
 boolean setDefaultState(BV state)
          Allows the board-model writer to set a default state for this signal.
 void setImplicitEnable(Wire enable)
          Sets the implicit enable for this virtual port.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualPort

public VirtualPort(java.lang.String name,
                   int width,
                   Wire in,
                   Wire out)
Constructs a new VirtualPort.

Parameters:
name - Name of the VirtualPort
width - Width of the virtualPort
in - Wire associated with in direction of this port. Pass a null if this port has no in direction.
out - Wire associated with out direction of this port. Pass a null if this port has no out direction.
Method Detail

addAttribute

public VirtualPort addAttribute(java.lang.String attrib)
Adds known attributes to the Virtual Port. All attributes passed by users will be checked against the known attributes. If a user attribute is unknown a BuildException will be thrown.

Parameters:
attrib - Name of the attribute.

setDefaultState

public boolean setDefaultState(BV state)
Allows the board-model writer to set a default state for this signal. Default values only make sense for outputs. If the user does not use all the bits on this port, all unused bits will be driven to the default value.

Parameters:
state - State to drive on undriven bits. Please note that the width of the BV must be the same as the width of the wire. Each bit in the BV will match with the corresponding bit in the VirtualPort.
Returns:
True if default state was added, false otherwise.

hasDefaultState

public boolean hasDefaultState()
Checks whether or not a default state has been set.

Returns:
true if default state was set, false otherwise.

getDefaultState

public BV getDefaultState()
Returns a copy of the default state.

Returns:
Copy of the default state if it was set, null otherwise.

getOutputWire

public Wire getOutputWire()
Returns the output wire.


isValidAttribute

public boolean isValidAttribute(java.lang.String attrib)
Find out if an attribute is valid for this VirtualPort. Please note that attributes are case insensitive.

Parameters:
attrib - Attribute to check
Returns:
True if the attribute is valid, false otherwise.

addDefaultProperty

public void addDefaultProperty(PortProperty property)
Adds a default property for all bits of this VirtualPort

Parameters:
property - Property to add.

addDefaultProperty

public void addDefaultProperty(java.lang.String property)
Adds a default property for all bits of this VirtualPort

Parameters:
property - Property to add.

getDefaultProperties

public java.util.Vector getDefaultProperties()
Used to get a list of all default properties.

Returns:
Vector containing all the default properties which are valid for all bits.

getDefaultProperty

public PortProperty getDefaultProperty(java.lang.String property)
Get a specific default property.

Parameters:
property - Property to retrieve.
Returns:
PortProperty object associated with the requested property or null if the property does not exist.

setImplicitEnable

public void setImplicitEnable(Wire enable)
Sets the implicit enable for this virtual port. If the port has an implicit enable, the user cannot specify an enable for this port. This is designed to be used when it is desirable to have the enable wire for a port be used for other signals as well. A common case for this is in memories where the Data output enable wire will also drive the write enable signal to the memory. The implicit enable wire will automatically be added as the enable for any wire connected to this port having the out direction. For now, the enable wire can only be a single bit. This may change in the future if the need arises.

Parameters:
enable - Wire to use as the implicit enable.

getName

public java.lang.String getName()
Get the name of the virtual port.

Returns:
Name of the virtual port.

getWidth

public int getWidth()
Get the width of the virtual port.

Returns:
Width of the virtual port.

isUsed

public boolean isUsed()
Tells whether any bits in this virtual port are currently used.

Returns:
True if any of the bits are used, false otherwise.

isUsed

public boolean isUsed(int bit)
Tells whether a specific bit in this virtual port is currently used.

Parameters:
bit - Index of bit to check.
Returns:
True if the bit is used, false otherwise.

getWireForPort

public Wire getWireForPort(VPortInfo vpi,
                           java.lang.String portName)
Used to get the wire for the port specified by the parameters. A side effect of calling this method is to record all the user information about the port. This information is used later to decide what types of pads or dropins to instance.

Parameters:
vpi - VPortInfo object containing information about the port. Generally, this is created by the user with a call to wa() in GenericUserCore.
portName - User's name for the port.
Returns:
Correct bits of the wire requested by the parameters.

hasInPort

public boolean hasInPort(int index)
Find out if a given bit has a UserPort associated with the IN direction.

Parameters:
index - Index of bit to check
Returns:
True if the bit has a UserPort associated with the IN direction, false otherwise.

hasOutPort

public boolean hasOutPort(int index)
Find out if a given bit has a UserPort associated with the OUT direction.

Parameters:
index - Index of bit to check
Returns:
True if the bit has a UserPort associated with the OUT direction, false otherwise.

getEnableWire

public Wire getEnableWire(int index)
Gets the entire enable wire associated with the UserPort which covers the indicated bit.

Parameters:
index - Index of bit
Returns:
Enable wire for bit

getSingleEnable

public Wire getSingleEnable(int index)
Gets the single bit enable wire associated with the specified bit.

Parameters:
index - Index of bit
Returns:
Single bit enable wire.

getInAttributes

public PortProperty[] getInAttributes(int index)
Retrieves all attributes associated with the UserPort for the IN direction for the specified bit.

Parameters:
index - Index of bit.
Returns:
Array of PortProperty elements representing all the attributes. This method will return an empty array if there are no attributes or if there is no UserPort associated with that bit for the IN direction.

getInAttribute

public PortProperty getInAttribute(int index,
                                   java.lang.String property)
Retrieves the specified attribute associated with the UserPort for the IN direction for the specified bit.

Parameters:
index - Index of bit.
property - Property to retrieve.
Returns:
PortProperty element representing the specified attribute. This method will return null if the attribute does not exist for the UserPort associated with that bit for the IN direction.

getOutAttributes

public PortProperty[] getOutAttributes(int index)
Retrieves all attributes associated with the UserPort for the OUT direction for the specified bit.

Parameters:
index - Index of bit.
Returns:
Array of PortProperty elements representing all the attributes. This method will return an empty array if there are no attributes or if there is no UserPort associated with that bit for the OUT direction.

getOutAttribute

public PortProperty getOutAttribute(int index,
                                    java.lang.String prop)
Retrieves the specified attribute associated with the UserPort for the OUT direction for the specified bit.

Parameters:
index - Index of bit.
Returns:
PortProperty element representing the specified attribute. This method will return null if the attribute does not exist for the UserPort associated with that bit for the OUT direction.

getUserPorts

public UserPortInfo[] getUserPorts()
Get an Array of all UserPorts.

Returns:
Array of all UserPorts.


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.