byucc.jhdl.base
Class Structural

java.lang.Object
  extended bybyucc.jhdl.base.Nameable
      extended bybyucc.jhdl.base.Node
          extended bybyucc.jhdl.base.Cell
              extended bybyucc.jhdl.base.Structural
All Implemented Interfaces:
BooleanFlags, Clockable, byucc.jhdl.base.Propagateable, TreeListable
Direct Known Subclasses:
DefaultSubCell, LogicGates, temp_cell

public abstract class Structural
extends Cell
implements Clockable, byucc.jhdl.base.Propagateable

If the node only contains instantiations of other kinds of nodes, this is the container class to use. It supports hierarchy and also allows the designer to provide a behavioral model for higher simulation performance. In addition, the Structural class provides blank methods to satisfy both Clockable and Propagateable, then uses reflection to see if the user actually implements either. In this way, a Cell can be just combinational or synchronous; making Structural the ideal superclass for Logic.

Author:
Brad L. Hutchings

Field Summary
 
Fields inherited from class byucc.jhdl.base.Cell
BOOLEAN, CELL_NAME_DECLARATION, CellInterfaceDeterminesUniqueNetlistStructure, DETERMINE_FROM_STRING, GENERICS_DECLARATION, implicit_interface, IMPLICIT_INTERFACE_DECLARATION, INTEGER, INTERFACE_DECLARATION, LONG, PORT_IOS_DECLARATION, PORT_NAMES_DECLARATION, PORT_NET_NAMES_DECLARATION, PORT_PROPERTIES, PORT_WIDTHS_DECLARATION, SIGN_EXT, STRING, ZERO_PAD
 
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
protected Structural(Node parent)
          Checks to see if the Structural cell is being behaviorally modeled and has a behavior method implemented by the user.
protected Structural(Node parent, java.lang.String name)
          Checks to see if the Structual class is being behaviorally modeled.
 
Method Summary
 boolean behavioralModelIsAvailable()
          Convenience method to check whether the behavioral model has been implemented by the user.
 void clock()
          Users define synchronous behavior in this method using standard JHDL constructs.
 boolean clockMethodIsDisabled()
          Use this to check the status of the behavior method (enabled or disabled).
 boolean clockMethodIsDisabled(boolean flag)
          Use this to disable the behavior method.
 boolean clockMethodIsEnabled()
          Use this to check the status of the behavior method (enabled or disabled).
 boolean clockMethodIsEnabled(boolean flag)
          Short for !clockMethodIsDisabled(!flag).
protected  boolean defaultSimulationModelIsBehavioral()
          The default simulation model is structural for Structural cells.
 boolean hasBeenTraced()
          Used to mark if something has been traced, to avoid infinite tracing loops.
 boolean hasBeenTraced(boolean flag)
          Used to set whether something has been traced, to avoid infinite tracing loops.
 boolean hasBehaviorInClockMethod()
          A Structural cell is behaviorally modelled in methods if the method is implemented by the user, and the cell currently has behavior modelling enabled.
 boolean hasBehaviorInPropagateMethod()
          A Structural cell is behaviorally modelled in methods if the method is implemented by the user, and the cell currently has behavior modelling enabled.
 boolean isAsynchronouslyScheduled()
          The levelized simulator uses this to keep track of what has been levelized (put on the propagate list thus far.
 boolean isAsynchronouslyScheduled(boolean is_scheduled)
          Used to mark something as put on the propagate list.
 boolean isFallingEdgeTriggered()
          The default behavior assumes a clock of schedule "01", and that this is rising-edge triggered.
 boolean isReadyToBeAsynchronouslyScheduled()
          A Propagatable node is ready to put on the list when all of its source wires are marked (on the Propagate list).
 boolean isRisingEdgeTriggered()
          The default behavior assumes a clock of schedule "01", and that this is rising-edge triggered.
 boolean needsToBeAsynchronouslyScheduled()
          Unless it is being behaviorally modelled, it does not need to be propagated.
 boolean needsToBeClocked()
          Structural cells need to be clocked if they are being behaviorally modelled, the user has implemented a clock method, and finally, if they will not be HWUpdated.
 void propagate()
          Users defined propagatable behavior using standard JHDL constructs.
 boolean propagateMethodIsDisabled()
          Use this to check the status of the propagate method (enabled or disabled).
 boolean propagateMethodIsDisabled(boolean flag)
          Use this to disable the propagate method.
 boolean propagateMethodIsEnabled()
          Use this to check the status of the propagate method (enabled or disabled).
 boolean propagateMethodIsEnabled(boolean flag)
          Short for !propagateMethodIsDisabled(!flag).
 void reset()
          If you define a behavior, you must also define a reset method for resetting the synchonous part of your model.
 boolean willUseHWUpdate()
          Simple flag tells the cell that it is being behaviorally modeled.
 boolean willUseHWUpdate(boolean flag)
          Used to set or clear the HWUpdate flag, which controls whether the simulation model or hardware is used to update the cell.
 
Methods inherited from class byucc.jhdl.base.Cell
addPort, addPorts, addProperties, addProperties, addProperty, addProperty, addProperty, addProperty, antecedantIsBehaviorallyModeled, antecedantIsBehaviorallyModeled, bind, bind, bind, bind, cellInterfaceDeterminesUniqueNetlistStructure, clk, connect, connectAllWires, connectOptional, constructSubCell, constructSubCellNoImplicitPorts, disableAllBehavioralModels, disableBehavioralModel, enableBehavioralModel, getArgument, getAttachedPort, getAttachedWire, getAttachedWireNoException, getCellName, getCellNetlist, getCellNetList, getCellNetlist, getCellNetlist, getDescendents, getFlatNetlist, getFlatNetlistableChildren, getGeneric, getHeight, getNetlistableChildren, getPlacementInfo, getPortProperties, getPortRecord, getPortRecords, getProperties, getProperty, getPropertyValue, getSinkWires, getSourceWires, getSubCellClass, getUniqueCellName, getWidth, getX, getY, hasPort, hasPorts, in, in, inout, inout, isAsynchronousSourceSinkResolved, isBehaviorallyModeled, isBehaviorallyModeledBranch, isInput, isLeafCell, isNetlistable, isNetlistable, isNetlistablePort, isNetlistLeaf, isNotNetlistable, isNotNetlistablePort, isNotVisible, isOutput, isPlaceable, isPlaceable, isPlaced, isPlaced, isPlacementLocked, isRoot, isSimulateable, isSimulateable, isSink, isSource, isVisible, isVisible, join, lockPlacement, nc, out, out, param, popHierarchy, port, port, port, postorderCheck, preorderCheck, pushHierarchy, pushHierarchy, pushHierarchy, pushHierarchy, pushHierarchyNoImplicitPorts, pushHierarchyNoImplicitPorts, removeAllUnconnectedPorts, removePort, removeProperty, replaceProperty, replaceProperty, resetBehavioralModelsToDefaults, setAsynchronousSourceSinkResolved, setGeneric, setHeight, setNotNetlistable, setNotNetlistable, setNotVisible, setNotVisible, setPlacementInfo, setPortNotNetlistable, setPortNotNetlistable, setProperty, setWidth, subClassDelete, toString, uniquifyCell, userDefinedClockCount, verifyAndCleanup
 
Methods inherited from class byucc.jhdl.base.Node
addObservable, addSimulatorCallback, checkAll, delete, getBuildingFlag, getChildren, getChildrenEnumeration, getDefaultClock, getInstanceName, getParent, getParentCell, getRelatives, getSystem, getWires, optimize, orphanAllowed, printAllChildren, printTree, removeSimulatorCallback, setDefaultClock
 
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

Structural

protected Structural(Node parent,
                     java.lang.String name)
Checks to see if the Structual class is being behaviorally modeled.

Parameters:
parent - your parent.
name - user-specified name.

Structural

protected Structural(Node parent)
Checks to see if the Structural cell is being behaviorally modeled and has a behavior method implemented by the user. If so, it is added to the global clock list.

Parameters:
parent - your parent.
Method Detail

propagateMethodIsDisabled

public final boolean propagateMethodIsDisabled(boolean flag)
Use this to disable the propagate method. Note: you are only allowed to disable either the propagate method or the behavior method, not both. If you attempt to disable both of them a BuildException is thrown.

Parameters:
flag - this should be true if you want to disable the propagate method, false otherwise.
Returns:
the prior value of the flag, useful for caching and restoration
Throws:
BuildException - if this cannot be disabled because it would leave the cell with no simulation model
UnimplementedException - if this cannot be enabled because there is no model

propagateMethodIsEnabled

public final boolean propagateMethodIsEnabled(boolean flag)
Short for !propagateMethodIsDisabled(!flag).

Parameters:
flag - this should be true to enable the propagate method, false otherwise.
Returns:
the prior value of the flag, useful for caching and restoration
Throws:
BuildException - if this cannot be disabled because it would leave the cell with no simulation model
UnimplementedException - if this cannot be enabled because there is no model

propagateMethodIsDisabled

public final boolean propagateMethodIsDisabled()
Use this to check the status of the propagate method (enabled or disabled).

Returns:
true if the method is disabled, false if it is enabled (default false)

propagateMethodIsEnabled

public final boolean propagateMethodIsEnabled()
Use this to check the status of the propagate method (enabled or disabled).

Returns:
true if the method is enabled (default true)

clockMethodIsDisabled

public final boolean clockMethodIsDisabled(boolean flag)
Use this to disable the behavior method. Note: you are only allowed to disable either the propagate method or the behavior method, not both. If you attempt to disable both of them a BuildException is thrown.

Parameters:
flag - this should be true if you want to disable the behavior method, false otherwise.
Returns:
the prior value of the flag, useful for caching and restoration
Throws:
BuildException - if this cannot be disabled because it would leave the cell with no simulation model
UnimplementedException - if this cannot be enabled because there is no model

clockMethodIsEnabled

public final boolean clockMethodIsEnabled(boolean flag)
Short for !clockMethodIsDisabled(!flag).

Parameters:
flag - this should be true if you want to enable the behavioral method
Returns:
the prior value of the flag, useful for caching and restoration
Throws:
BuildException - if this cannot be disabled because it would leave the cell with no simulation model
UnimplementedException - if this cannot be enabled because there is no model

clockMethodIsDisabled

public final boolean clockMethodIsDisabled()
Use this to check the status of the behavior method (enabled or disabled).

Returns:
true if the method is disabled, false if it is enabled (default false)

clockMethodIsEnabled

public final boolean clockMethodIsEnabled()
Use this to check the status of the behavior method (enabled or disabled).

Returns:
true if the method is enabled (default true)

defaultSimulationModelIsBehavioral

protected boolean defaultSimulationModelIsBehavioral()
The default simulation model is structural for Structural cells. If the default should be behavioral, the user will need to overload this method to return true in cases besides TestBenches or leaf cells.

Overrides:
defaultSimulationModelIsBehavioral in class Cell
Returns:
true if TestBench or leafCell, false otherwise.

behavioralModelIsAvailable

public boolean behavioralModelIsAvailable()
Convenience method to check whether the behavioral model has been implemented by the user.

Overrides:
behavioralModelIsAvailable in class Cell
Returns:
true if either a clock or propagate method was implemented by the user and is currently enabled

clock

public void clock()
Users define synchronous behavior in this method using standard JHDL constructs. The simulator detects whether clock() has been implemented by calling this function directly and checking for an exception.

Specified by:
clock in interface Clockable
Throws:
UnimplementedException - Unless the user overrides this

propagate

public void propagate()
Users defined propagatable behavior using standard JHDL constructs. The simulator detects whether propagate() has been implemented by calling function directly and checking for an exception.

Specified by:
propagate in interface byucc.jhdl.base.Propagateable
Throws:
UnimplementedException - Unless the user overrides this

hasBehaviorInClockMethod

public final boolean hasBehaviorInClockMethod()
A Structural cell is behaviorally modelled in methods if the method is implemented by the user, and the cell currently has behavior modelling enabled.

Specified by:
hasBehaviorInClockMethod in class Cell
Returns:
true if the clock method is implemented and enabled

hasBehaviorInPropagateMethod

public final boolean hasBehaviorInPropagateMethod()
A Structural cell is behaviorally modelled in methods if the method is implemented by the user, and the cell currently has behavior modelling enabled.

Specified by:
hasBehaviorInPropagateMethod in class Cell
Returns:
true if the propagate method is implemented and enabled

reset

public void reset()
If you define a behavior, you must also define a reset method for resetting the synchonous part of your model. If the user forgets to implement this, he will be reminded at simulation time.

Specified by:
reset in interface Clockable
Throws:
UnimplementedException - Unless the user overrides this

isReadyToBeAsynchronouslyScheduled

public boolean isReadyToBeAsynchronouslyScheduled()
A Propagatable node is ready to put on the list when all of its source wires are marked (on the Propagate list). Or, it can go on the list anytime if there is no behavioral model, or if behavioral modeling is disabled.

Specified by:
isReadyToBeAsynchronouslyScheduled in interface byucc.jhdl.base.Propagateable
Returns:
true if the cell is ready to schedule

needsToBeAsynchronouslyScheduled

public boolean needsToBeAsynchronouslyScheduled()
Unless it is being behaviorally modelled, it does not need to be propagated. Also, if it is a child and its parent is being behaviorally modelled, it does not need to be propagated but this will be handled by the topological sort.

Specified by:
needsToBeAsynchronouslyScheduled in interface byucc.jhdl.base.Propagateable
Specified by:
needsToBeAsynchronouslyScheduled in class Cell
Returns:
true if this cell is being behaviorally modeled.

needsToBeClocked

public boolean needsToBeClocked()
Structural cells need to be clocked if they are being behaviorally modelled, the user has implemented a clock method, and finally, if they will not be HWUpdated.

Specified by:
needsToBeClocked in interface Clockable
Returns:
true if this cell is being behaviorally modeled, has a clock() method and will not be HWUpdated.

willUseHWUpdate

public final boolean willUseHWUpdate(boolean flag)
Used to set or clear the HWUpdate flag, which controls whether the simulation model or hardware is used to update the cell.

Specified by:
willUseHWUpdate in interface Clockable
Parameters:
flag - the new value of the flag
Returns:
the prior value of the flag

willUseHWUpdate

public final boolean willUseHWUpdate()
Simple flag tells the cell that it is being behaviorally modeled.

Specified by:
willUseHWUpdate in interface Clockable
Returns:
true if the cell is updated by hardware, false if by software simulation

isRisingEdgeTriggered

public boolean isRisingEdgeTriggered()
The default behavior assumes a clock of schedule "01", and that this is rising-edge triggered. Override this method if different.

Specified by:
isRisingEdgeTriggered in interface Clockable
Returns:
true if this needs to be clocked, false otherwise

isFallingEdgeTriggered

public boolean isFallingEdgeTriggered()
The default behavior assumes a clock of schedule "01", and that this is rising-edge triggered. Override this method if different.

Specified by:
isFallingEdgeTriggered in interface Clockable
Returns:
false

isAsynchronouslyScheduled

public boolean isAsynchronouslyScheduled()
The levelized simulator uses this to keep track of what has been levelized (put on the propagate list thus far.

Returns:
true if it is on the list

isAsynchronouslyScheduled

public boolean isAsynchronouslyScheduled(boolean is_scheduled)
Used to mark something as put on the propagate list.

Returns:
the prior value of the flag

hasBeenTraced

public boolean hasBeenTraced()
Used to mark if something has been traced, to avoid infinite tracing loops.

Returns:
true if has been traced, false otherwise

hasBeenTraced

public boolean hasBeenTraced(boolean flag)
Used to set whether something has been traced, to avoid infinite tracing loops.

Parameters:
flag - value to set flag to
Returns:
the prior value of the flag, useful for caching and restoring


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