hades.models.io
Class ClockGenWithAutoStop

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.gates.GenericGate
          extended byhades.models.io.ClockGenWithAutoStop
All Implemented Interfaces:
java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable, Wakeable

public class ClockGenWithAutoStop
extends GenericGate
implements Simulatable, Wakeable, java.io.Serializable

ClockGenWithAutoStop: a clock generator which stops after a predefined number of clock cycles.

Properties include clock frequency, duty cycle, clock phase, and the number of clock cycles. Default is a symmetric 1 Hz clock signal which stops after 1000 cycles. Signals are expected to be StdLogic1164 objects.

   UUUUUUUUUUUUUUUUU+    +-----+    +-----+    +-----+
   +----------------+----+     +----+     +----+     + .... +---------
   |                |          |          |          |      |
   |< offset       >|< period >|<  >|     |                 <#count cycles>
                                 dutycycle 
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class hades.models.gates.GenericGate
t_delay
 
Fields inherited from class hades.simulator.SimObject
classloader, console, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
ClockGenWithAutoStop()
          ClockGenWithAutoStop: simple constructor.
 
Method Summary
 void configure()
          configure: display a dialog window with options to specify instance name, clock period, clock duty-cycle, clock phase (offset), and the number of cycles to stop after.
 void elaborate(java.lang.Object arg)
          elaborate: store a reference to our simulator, then schedule the events for the initial "U" phase, the first "1" phase, and the first wakeup.
 void evaluate(java.lang.Object arg)
          evaluate: as the ClockGen has no input signals, this method should never be called.
 int getAutoStopCycles()
           
 double getDutycycle()
           
 double getOffset()
           
 double getPeriod()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a tool tip message (with the timing parameters)
 boolean initialize(java.lang.String s)
          initialize a ClockGenWithAutoStop'erator from a String.
 void mousePressed(java.awt.event.MouseEvent me)
          start or stop this ClockGenWithAutoStop
 double parse(java.lang.String s)
           
 void setAutoStopCycles(int n)
          set the number of cycles to stop after.
 void setAutoStopCycles(java.lang.String s)
           
 void setDutycycle(double d)
           
 void setDutycycle(java.lang.String s)
           
 void setOffset(double d)
           
 void setOffset(java.lang.String s)
           
 void setPeriod(double d)
           
 void setPeriod(java.lang.String s)
           
 void setSymbol(Symbol s)
           
 java.lang.String toString()
          toString() - the usual info method
 void wakeup(java.lang.Object arg)
          wakeup(): Called by the simulator as a reaction to our own scheduleWakeup()-calls.
 void write(java.io.PrintWriter ps)
          write the integer version ID, the clock period (in seconds), the clock 1-value dutycycle, the clock phase (offset, in seconds), and the number of cycles to stop after.
 
Methods inherited from class hades.models.gates.GenericGate
copy, getDelay, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, setDelay, setDelay
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hades.simulator.Simulatable
message
 

Constructor Detail

ClockGenWithAutoStop

public ClockGenWithAutoStop()
ClockGenWithAutoStop: simple constructor.

Method Detail

setSymbol

public void setSymbol(Symbol s)
Overrides:
setSymbol in class SimObject

getPeriod

public double getPeriod()

getOffset

public double getOffset()

getDutycycle

public double getDutycycle()

getAutoStopCycles

public int getAutoStopCycles()

setPeriod

public void setPeriod(double d)

setOffset

public void setOffset(double d)

setDutycycle

public void setDutycycle(double d)

setAutoStopCycles

public void setAutoStopCycles(int n)
set the number of cycles to stop after.


setPeriod

public void setPeriod(java.lang.String s)

setOffset

public void setOffset(java.lang.String s)

setDutycycle

public void setDutycycle(java.lang.String s)

setAutoStopCycles

public void setAutoStopCycles(java.lang.String s)

parse

public double parse(java.lang.String s)

initialize

public boolean initialize(java.lang.String s)
initialize a ClockGenWithAutoStop'erator from a String. The String should contain the integer version ID, the double values for clock period (in seconds), dutycycle (fraction 0.0 .. 1.0), and offset (in seconds), and the number of clock cycles to stop after, e.g. "1001 1.0E-9 0.5 0.3E-9 1000" for a 1nsec symmetric clock which stops after 1000 cycles.

Overrides:
initialize in class GenericGate

write

public void write(java.io.PrintWriter ps)
write the integer version ID, the clock period (in seconds), the clock 1-value dutycycle, the clock phase (offset, in seconds), and the number of cycles to stop after.

Overrides:
write in class GenericGate

configure

public void configure()
configure: display a dialog window with options to specify instance name, clock period, clock duty-cycle, clock phase (offset), and the number of cycles to stop after.

Overrides:
configure in class GenericGate

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
start or stop this ClockGenWithAutoStop

Overrides:
mousePressed in class SimObject

elaborate

public void elaborate(java.lang.Object arg)
elaborate: store a reference to our simulator, then schedule the events for the initial "U" phase, the first "1" phase, and the first wakeup.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class GenericGate

evaluate

public void evaluate(java.lang.Object arg)
evaluate: as the ClockGen has no input signals, this method should never be called.

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class SimObject
Parameters:
arg - an arbitrary object argument

wakeup

public void wakeup(java.lang.Object arg)
wakeup(): Called by the simulator as a reaction to our own scheduleWakeup()-calls. One period of the clock has expired, calculate new values.

Specified by:
wakeup in interface Wakeable
Parameters:
arg - - unsued argument

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
construct a tool tip message (with the timing parameters)

Specified by:
getToolTip in interface ContextToolTip
Overrides:
getToolTip in class GenericGate

toString

public java.lang.String toString()
toString() - the usual info method

Overrides:
toString in class SimObject