byucc.jhdl.synth
Class CFVertex

java.lang.Object
  extended bybyucc.jhdl.synth.graph.NamedObject
      extended bybyucc.jhdl.synth.graph.Vertex
          extended bybyucc.jhdl.synth.CFVertex
All Implemented Interfaces:
Nameable

public class CFVertex
extends Vertex

The basic vertex for any ControlFlowGraph. This class supports two different types of vertices: blocks and decisions. Block vertices represent basic blocks of a method. Decision vertices are always located at the end of a basic block and represent the possible control paths between blocks. Also, each CFVertex which is a block contains a DataFlowGraph which represents all of the dataflow within the given block.

See Also:
CFEdge, ControlFlowGraph, DataFlowGraph

Field Summary
 
Fields inherited from class byucc.jhdl.synth.graph.Vertex
inEdgeVector, outEdgeVector, parent, visited
 
Fields inherited from class byucc.jhdl.synth.graph.NamedObject
name
 
Constructor Summary
CFVertex(Graph g, java.lang.String name)
          Construct a new CFVertex of the given name within the given graph.
 
Method Summary
 void execute(GraphStack gs)
          Execute a CFVertex block.
 boolean executionIsComplete()
          Is this block's execution complete?
 void executionIsComplete(boolean value)
          Declare this blocks execution as complete or not.
 java.lang.String getBlockName()
          Get this block's name.
 DFVertex getDecisionSignal()
          Get the decision signal corresponding to this vertex.
 DFSubGraph getDFSubGraph()
          Get this block's corresponding DFSubGraph.
 java.lang.String getProperty(java.lang.String key)
          Returns the value associated with the given key.
 DFVertex getSink()
          Get this block's corresponding sink vertex in the DataFlowGraph.
 DFVertex getSource()
          Get this block's corresponding source vertex in the DataFlowGraph.
 SynthBlock getSynthBlock()
          Get this block's corresponding SynthBlock.
 java.lang.String getTypeString()
           
 boolean isBlock()
          Is the current vertex a block.
 boolean isDecision()
          Is the current vertex a decision.
 void setProperty(java.lang.String key, java.lang.String value)
          Set a property, (a key->value pair), for this vertex.
 java.lang.String toString()
          Generate a String representation of this CFVertex.
protected  java.lang.String vertexDotProperties()
           
 
Methods inherited from class byucc.jhdl.synth.graph.Vertex
findEdgeTo, getInEdges, getOutEdges, getParent, getSingleHead, getSingleTail, getVisited, inDegree, isAdjacent, isVisited, outDegree, resetVisit, toDot, vertexDotLabels, visit, visit
 
Methods inherited from class byucc.jhdl.synth.graph.NamedObject
getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CFVertex

public CFVertex(Graph g,
                java.lang.String name)
Construct a new CFVertex of the given name within the given graph.

Parameters:
g - The graph (ControlFlowGraph) in which this CFVertex should be created.
name - The name for the new CFVertex.
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Set a property, (a key->value pair), for this vertex. This method is called by the graph parser when reading in a .dot file. CFVertex supports arbitrary key->value pairs via a hashtable. The key "type" is handled specially in that its value can only be "block" or "decision" and it will be stored as a single int.

Overrides:
setProperty in class Vertex
Parameters:
key - A string representing the key for this property.
value - A string representing the value associated with key.

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns the value associated with the given key. (Associations are formed through calls to setProperty).

Parameters:
key - The key of the property of interest.
Returns:
The value currently associated with the given key.
See Also:
setProperty(java.lang.String, java.lang.String)

isBlock

public boolean isBlock()
Is the current vertex a block.

Returns:
true if the current vertex is a block, false otherwise.

isDecision

public boolean isDecision()
Is the current vertex a decision.

Returns:
true if the current vertex is a decision, false otherwise.

getSynthBlock

public SynthBlock getSynthBlock()
Get this block's corresponding SynthBlock.

Returns:
this block's SynthBlock if this is a BLOCK, null otherwise.

getDFSubGraph

public DFSubGraph getDFSubGraph()
Get this block's corresponding DFSubGraph.

Returns:
If this vertex is a block this method returns its DFSubGraph. If this vertex is not a block this method returns null.

getSource

public DFVertex getSource()
Get this block's corresponding source vertex in the DataFlowGraph.

Returns:
this block's source in the DataFlowGraph if this is a BLOCK, null otherwise.

getSink

public DFVertex getSink()
Get this block's corresponding sink vertex in the DataFlowGraph.

Returns:
this block's sink in the DataFlowGraph if this is a BLOCK, null otherwise.

getBlockName

public java.lang.String getBlockName()
Get this block's name.

Returns:
this block's name if this is a BLOCK, null otherwise.

executionIsComplete

public boolean executionIsComplete()
Is this block's execution complete?

Returns:
true if this block's execution has been declared complete, false otherwise

executionIsComplete

public void executionIsComplete(boolean value)
Declare this blocks execution as complete or not.

Parameters:
value - the value to be assigned to the executionIsComplete flag for this block.

execute

public void execute(GraphStack gs)
Execute a CFVertex block. (Throw an excpetion if this vertex is a decision)

Executing a CFVertex block starts out by executing its underlying SynthBlock. After completing this execution, we also connect all vertices with 0 inDegree to this block's source vertex and all vertices with 0 outDegree to this block's sink vertex.

Parameters:
gs - a GraphStack in whose context this block will be executed

getDecisionSignal

public DFVertex getDecisionSignal()
Get the decision signal corresponding to this vertex. If this vertex is a block then this method will search the corresponding portion of the DataFlowGraph for a signal named DataFlowGraph.DECISION_VERTEX_NAME and return it. If this vertex is a decision then this method will return the result of getDecisionSignal when called on the previous block in the graph.

Returns:
this decision signal corresponding to this vertex.

getTypeString

public java.lang.String getTypeString()

vertexDotProperties

protected java.lang.String vertexDotProperties()
Overrides:
vertexDotProperties in class Vertex

toString

public java.lang.String toString()
Generate a String representation of this CFVertex. I'll just use the name. See toDot for complete information.

Overrides:
toString in class Vertex
Returns:
a String representing this vertex.
See Also:
toDot


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