byucc.jhdl.base
Class HWProcess

java.lang.Object
  extended bybyucc.jhdl.base.Nameable
      extended bybyucc.jhdl.base.Node
          extended bybyucc.jhdl.base.Cell
              extended bybyucc.jhdl.base.HWProcess
All Implemented Interfaces:
BooleanFlags, java.lang.Runnable, TreeListable

public abstract class HWProcess
extends Cell
implements java.lang.Runnable

This file contains the code that comprises most of the javaHDL simulation kernel. The kernel is simple primarly because it exploits the ability to suspend and resume threads. The kernel only supports globally synchronous circuits --one clock only-- although this may be relaxed in the future. Here is how it works in practice. A circuit is constructed of 3 basic kinds of objects: HWProcess objects, CL objects, and Wire objects. HWProcess objecs are used to describe any behavioral descriptions of synchronous hardware, i.e., hardware that is sensitive to the clock. CL objects are used to describe purely combinational circuitry, and these two kinds of objects are "connected" using Wire objects. If a circuit only consists of the structural composition of other HWProcess and CL objects then it can be placed in any user-defined object. Users define synchronous circuitry by defining a new class that extends the HWProcess class. Within this method, a special method, waitUntilClock() is called to make the hardware sensitive to a clock edge. This method is pretty much identical to its VHDL equivalent, wait until .... Users define new combination circuitry by extending the class CL. CL is purely abstract its main effect to force the designer to define a propagate method that contains the actual behavior of the object. Wires are used to convey information between these two objects. Object "output" to a wire by calling its put() method and "input" from a wire by calling the wire's get() method. After defining all of the necessary classes and methods, the designer constructs a global ClockGenerator object and passes it to the constructors of all of the defined HWProcess objects. Simulation is commenced by: 1. getting a CircuitController from the ClockGenerator 2. setting the number of clock cycles CircuitController.setClockCount(). 3. starting the CircuitController thread: CircuitController.start(). 4. If synchronization with the hardware is required, the user can do a CircuitController.join() to detect termination; termination of the CircuitController thread occurs after all of the clock cycles have been simulated. Everthing should proceed transparently to the user. Here is what actually happens. The CircuitController object is a thread, the main controller and the conductor of the entire process. 1. When start is called, first we check to see if this is the first time this has been called and if this is the first time it has been called, we first propagate everything and then start up all the derived HWProcess threads. Propagate first propagates all of the wires, and then for those that have experienced a change on their output, we propagate all of the CL objects connected to the affected wires. This just primes the circuit, getting everything ready for the clocked elements (the extended HWProcess threads) to start. 2. Once the HWProcess threads start up, they will eventually call the waitUntilClock() method, the main access point to the simulation kernel. waitUntilClock() does basic housekeeping: a. it checks to see if there are other HWProcess threads waiting for the current pending clock cycle. If so, it just suspends itself so that the next HWProcess thread can get a clock cycle. b. if there are no other HWProcess threads waiting for the current clock cycle, this last thread just notify()s the CircuitController, signaling that the current clock cycle has completely simulated. c. if there are no other HWProcess threads waiting and there are no more clock cycles (this variable has been decremented to zero) then the CircuitController dies. This is the end of the simulation run. 3. A major simulation cycle consists of propagating all of the wires and then propagating all of the CL objects that are connected to the wires whose outputs have changed. In general, the simulation process looks like the following remembering that a propagation cycle consists of propagating all of the wires and then propagating the fanouts of any wires whose outputs have changed. a. At the onset, a propagation cycle is performed. This primes the circuit. b. A clock cycle is consumed by all of the HWProcess threads. c. A propagation cycle is performed. d. Loop back to (b) until all clock cycles have been consumed.


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
HWProcess(Node parent)
           
HWProcess(Node parent, java.lang.String name)
           
 
Method Summary
abstract  void behavior()
           
 boolean behavioralModelIsAvailable()
          Used to tell if a cell has a behavioral simulation model associated with it.
 boolean hasBehaviorInClockMethod()
          Returns true iff this cell has a Clockable.clock() and Clockable.reset() method that are called as part of the circuit's current behavioral model.
 boolean hasBehaviorInPropagateMethod()
          For now, HWProcess cells have no behavior directly.
 boolean needsToBeAsynchronouslyScheduled()
          This needs to be implemented in the derived class to actually tell if a cell needs to be propagated or not.
 boolean needsToBePropagated()
           
 void run()
           
protected  void subClassDelete()
          Overrides Node to do a more thorough job of deletion.
 void waitUntilClock()
           
 
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, defaultSimulationModelIsBehavioral, 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, hasBeenTraced, hasBeenTraced, hasPort, hasPorts, in, in, inout, inout, isAsynchronouslyScheduled, isAsynchronouslyScheduled, 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, 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

HWProcess

public HWProcess(Node parent)

HWProcess

public HWProcess(Node parent,
                 java.lang.String name)
Method Detail

run

public final void run()
Specified by:
run in interface java.lang.Runnable

behavior

public abstract void behavior()
                       throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

waitUntilClock

public final void waitUntilClock()
                          throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

subClassDelete

protected final void subClassDelete()
Description copied from class: Cell
Overrides Node to do a more thorough job of deletion.

Overrides:
subClassDelete in class Cell

needsToBePropagated

public boolean needsToBePropagated()

hasBehaviorInPropagateMethod

public boolean hasBehaviorInPropagateMethod()
For now, HWProcess cells have no behavior directly. This may need to be updated --EBB

Specified by:
hasBehaviorInPropagateMethod in class Cell
Returns:
true if the propagate() method exists and describes behavior

hasBehaviorInClockMethod

public boolean hasBehaviorInClockMethod()
Description copied from class: Cell
Returns true iff this cell has a Clockable.clock() and Clockable.reset() method that are called as part of the circuit's current behavioral model.

Specified by:
hasBehaviorInClockMethod in class Cell
Returns:
true if the clock() (and reset()) methods exist and describe behavior

behavioralModelIsAvailable

public boolean behavioralModelIsAvailable()
Description copied from class: Cell
Used to tell if a cell has a behavioral simulation model associated with it. Needs to be overloaded if the derived class has a behavioral simulation model available.

Overrides:
behavioralModelIsAvailable in class Cell
Returns:
false unless overridden

needsToBeAsynchronouslyScheduled

public boolean needsToBeAsynchronouslyScheduled()
Description copied from class: Cell
This needs to be implemented in the derived class to actually tell if a cell needs to be propagated or not.

Specified by:
needsToBeAsynchronouslyScheduled in class Cell
Returns:
true if this cell needs to be asynchronously scheduled


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