byucc.jhdl.base
Class Node

java.lang.Object
  extended bybyucc.jhdl.base.Nameable
      extended bybyucc.jhdl.base.Node
All Implemented Interfaces:
BooleanFlags, TreeListable
Direct Known Subclasses:
Cell, HWSystem

public abstract class Node
extends Nameable
implements BooleanFlags, TreeListable

Abstract class that implements a Node in a circuit graph that consists of Nodes and Wires. Provides basic functionality for connecting Wires and Nodes and general graph maintenance. Anything that serves as a connection between Nodes must subclass Node.

Author:
Brad Hutchings

Field Summary
 
Fields inherited from interface byucc.jhdl.base.BooleanFlags
ANTECEDANT_IS_BEHAVIORALLY_MODELED, ASYNC_PORT, ASYNCHRONOUS_RESOLVED, ATOMICALLY_PLACEABLE, ATOMICALLY_UNMAPPABLE, BEHAVIORALLY_MODELED_BRANCH, CLK_PORT, CLOCK_METHOD_IMPLEMENTED_BY_USER, CLOCK_METHOD_IS_DISABLED, CLOCKABLE_IS_SCHEDULED, DANGLING_IS_OK, DELETE_MARK, FATAL_BUILD_ERROR_OCCURED, HAS_BEEN_TRACED, HAS_USER_SPECIFIED_NAME, HWUPDATE, IMPLICIT_PORT, IN_CLK_PORT, IN_PORT, INOUT_PORT, IO_TYPE_FLAGS, IS_BEHAVIORALLY_MODELED, IS_ON_BUILD_STACK, IS_ON_PROP_LIST, IS_PLACED, METHODS_IMPLEMENTED_BY_USER, NETLISTABLE, ORIG_WIRE_IS_ATOMIC, OUT_PORT, PLACEMENT_IS_LOCKED, PROPAGATE_METHOD_IMPLEMENTED_BY_USER, PROPAGATE_METHOD_IS_DISABLED, RECURSION_FLAG, RESET_METHOD_IMPLEMENTED_BY_USER, SIMULATEABLE, SOURCELESS_IS_OK, SYNC_PORT, VISIBLE
 
Constructor Summary
Node(Node parent)
          Constructor that only allows the parent as an argument.
Node(Node parent, java.lang.String user_name)
          Base constructor.
 
Method Summary
 void addObservable(Observable o)
          This method will add the specified Observable to the Observable list for the current HWSystem.
 void addSimulatorCallback(SimulatorCallback sc)
          This method will add the specified SimulatorCallback to the HWSystem.
 boolean checkAll()
          General routine for depth-first traversing the circuit graph and checking it for various problems.
 void delete()
          Deletes a node from the circuit.
static boolean getBuildingFlag()
          Returns the current status of whether JHDL is building or simulating
 NodeList getChildren()
          Returns the children of this node
 java.util.Enumeration getChildrenEnumeration()
          Returns an enumerator for the children
 Wire getDefaultClock()
          This returns the default clock of this level of hierarchy.
 java.lang.String getInstanceName()
          Deprecated. Use Nameable.getFullName().
 Node getParent()
          Returns the parent of this Node
 Cell getParentCell()
          Returns the parent of this Node, cast as a Cell if possible
 TreeList getRelatives()
          Returns the relatives (the children and the next sibling)
 HWSystem getSystem()
          Returns the system.
 WireList getWires()
          Returns the wires created by this node
protected  void optimize()
          Redefine in derived classes to improve the circuit.
 boolean orphanAllowed()
          Orphan nodes are never allowed.
protected  boolean postorderCheck()
          Redefine in derived class for any checks to be performed after recursing to children.
protected  boolean preorderCheck()
          Redefine in derived class for any checks to be performed before recursing to children.
 void printAllChildren(java.io.OutputStream os, int spacing)
          For use in debugging - prints the tree
 java.lang.String printTree()
          for debugging, returns the subtree of this node
 void removeSimulatorCallback(SimulatorCallback sc)
           
 Wire setDefaultClock(Wire clock)
          This sets the default clock to be used by this level of hierarchy and below
protected  void subClassDelete()
          Does nothing here.
 java.lang.String toString()
          Prints the name of this node.
 
Methods inherited from class byucc.jhdl.base.Nameable
caseSensitivity, caseSensitivity, disableNameClashChecking, getFullName, getFullNameNoTestBench, getHierNameNoTestBench, getInstanceNo, getInstanceNumber, getLeafName, getLeafName, getRelativeName, getUserName, getUserName, hasUserSpecifiedName, isDescendantOf, setInstanceNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(Node parent)
Constructor that only allows the parent as an argument. No user-specified name.

Parameters:
parent - the parent of this Node.

Node

public Node(Node parent,
            java.lang.String user_name)
Base constructor. A Node must know who his parent is unless he is the root. Names must be set before adding node to BuildStack.

Parameters:
parent - the parent of this node.
user_name - the name of this node.
Method Detail

getInstanceName

public java.lang.String getInstanceName()
Deprecated. Use Nameable.getFullName().

Returns the instance name.


toString

public java.lang.String toString()
Prints the name of this node.

Returns:
the description of this

printTree

public java.lang.String printTree()
for debugging, returns the subtree of this node

Returns:
a string containing this node's subtree's contents

subClassDelete

protected void subClassDelete()
Does nothing here. Provided for other subclasses that may need to do some extra cleanup when they get deleted. HWProcess, for example is a thread that needs to be stopped when deleted.


delete

public final void delete()
Deletes a node from the circuit.


addObservable

public void addObservable(Observable o)
This method will add the specified Observable to the Observable list for the current HWSystem. This method allows observables to be added to the HWSystem ObservableList without a reference to the HWSystem. Instead, all they need is a reference to a Node. - MJW

Parameters:
o - The Observable that is going to observe this cell.

addSimulatorCallback

public void addSimulatorCallback(SimulatorCallback sc)
This method will add the specified SimulatorCallback to the HWSystem. This method allows SimulatorCallbacks to be added to the HWSystem without a reference to the HWSystem. Instead, all they need is a reference to a Node. - MJW


removeSimulatorCallback

public void removeSimulatorCallback(SimulatorCallback sc)

getParent

public final Node getParent()
Returns the parent of this Node

Returns:
a Node that is the parent of this one

getParentCell

public final Cell getParentCell()
Returns the parent of this Node, cast as a Cell if possible

Returns:
a Cell that is the parent of this one
Throws:
java.lang.ClassCastException - if the parent of this Node is not a cell

getBuildingFlag

public static boolean getBuildingFlag()
Returns the current status of whether JHDL is building or simulating

Returns:
true if building.

getSystem

public final HWSystem getSystem()
Returns the system. If the circuit is currently being built, this uses a static variable for speed, but during simulation, it bubbles up the tree for simultaneous systems.

Returns:
the system of this Node

setDefaultClock

public Wire setDefaultClock(Wire clock)
This sets the default clock to be used by this level of hierarchy and below

Returns:
the default clock wire just set

getDefaultClock

public Wire getDefaultClock()
This returns the default clock of this level of hierarchy. This is inherited from the parent cell unless set at this level; and can be null. Override this version to allow for registration of a default clock.

Returns:
the default clock for this cell, or null if none has been set

getChildren

public final NodeList getChildren()
Returns the children of this node

Returns:
the children

getRelatives

public final TreeList getRelatives()
Returns the relatives (the children and the next sibling)

Specified by:
getRelatives in interface TreeListable
Returns:
the children for iterating over

getChildrenEnumeration

public final java.util.Enumeration getChildrenEnumeration()
Returns an enumerator for the children

Returns:
an iterator over the children

getWires

public final WireList getWires()
Returns the wires created by this node

Returns:
the non-orphan wires created at this level

checkAll

public final boolean checkAll()
General routine for depth-first traversing the circuit graph and checking it for various problems. The trick in returning the boolean was to create a wide and of all of the returned values from checkNode(). If errors are found, they are printed to the "builder" JHDLOutput error stream, but execution continues so that all errors in the tree can be detected.

Returns:
true if circuit checked ok.

preorderCheck

protected boolean preorderCheck()
Redefine in derived class for any checks to be performed before recursing to children.

Returns:
true if this node checked ok.

postorderCheck

protected boolean postorderCheck()
Redefine in derived class for any checks to be performed after recursing to children.

Returns:
true if this node checked ok.

optimize

protected void optimize()
Redefine in derived classes to improve the circuit. This will be called before simulation.


orphanAllowed

public final boolean orphanAllowed()
Orphan nodes are never allowed.

Returns:
false.

printAllChildren

public void printAllChildren(java.io.OutputStream os,
                             int spacing)
For use in debugging - prints the tree

Parameters:
os - where to print
spacing - how far to indent levels


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