hades.models.io
Class PulseSwitch

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

public class PulseSwitch
extends Ipin
implements Simulatable, Wakeable, Assignable

PulseSwitch - a simple subclass of Ipin that models an 'pulse' switch. Also, a PulseSwitch object is automatically interpreted as an input for a hierarchical Design - like a standard-CAD 'ipin'.

The default pulse duration is 0.1 seconds.

See Also:
Serialized Form

Field Summary
protected  double t_pulse
           
protected  double t_pulseDefault
           
 
Fields inherited from class hades.models.io.Ipin
bindkey, delay, output_0, output_1, output_U, output_X, output_Z, port_toplevel, port_Y, showOnOff, startValue, state
 
Fields inherited from class hades.models.gates.GenericGate
t_delay
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
PulseSwitch()
          PulseSwitch(): simple constructor
 
Method Summary
 void configure()
          configure: display a dialog to specify the Ipin instance name, initial output value, and gate propagation delay.
 void elaborate(java.lang.Object arg)
          elaborate(): This method is called by the simulation engine to initialize the simulation object.
 void evaluate(java.lang.Object arg)
          evaluate(): called by the simulation engine on all events that concern this object.
 double getPulseDuration()
           
 boolean initialize(java.lang.String s)
          initialize an Ipin from a String, which contains the integer version id, and optionally the pulse width (in seconds).
 void keyPressed(java.awt.event.KeyEvent ke)
          react to a KeyEvent.
 void mouseOrKeyPressed(boolean isShiftDown)
           
 void mousePressed(java.awt.event.MouseEvent me)
          handle a mouse click on this IpinWithBindkey's graphical symbol.
 void setPulseDuration(double t)
           
 void setPulseDuration(java.lang.String s)
           
 java.lang.String toString()
          toString() - the usual info method
 void write(java.io.PrintWriter ps)
          write the versionID and the start value of this Ipin (the latter as StdLogic1164.getChar() value), e.g.
 
Methods inherited from class hades.models.io.Ipin
assign, getBindkey, getDelay, getStartValue, getToolTip, initDisplay, mouseOrKeyEvent, schedule, setBindkey, setDelay, setName, setStartState, setStartValue, setSymbol, setValueAtTime, showState, wakeup
 
Methods inherited from class hades.models.gates.GenericGate
copy, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, setDelay
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getClassLoader, getDebug, getEditor, getExternalResources, getFullName, getName, getParent, getPort, getPorts, getPropertySheet, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, message, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, 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
 
Methods inherited from interface hades.simulator.Wakeable
wakeup
 
Methods inherited from interface hades.simulator.Assignable
assign
 

Field Detail

t_pulseDefault

protected double t_pulseDefault

t_pulse

protected double t_pulse
Constructor Detail

PulseSwitch

public PulseSwitch()
PulseSwitch(): simple constructor

Method Detail

getPulseDuration

public double getPulseDuration()

setPulseDuration

public void setPulseDuration(double t)

setPulseDuration

public void setPulseDuration(java.lang.String s)

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Description copied from class: Ipin
handle a mouse click on this IpinWithBindkey's graphical symbol. Toggle the Ipin output value, schedule a corresponding output event with the new output value, and update the graphical symbol. For a normal mouse-click, the output value toggles between "0-1-0...", while a shift-mouse-click toggles between "0-1-Z-U-0..." states.

Overrides:
mousePressed in class Ipin

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Description copied from class: SimObject
react to a KeyEvent. The base SimObject ignores all KeyEvents. this method is currently only used by a few classes in hades.models.io, e.g. IpinWithBindkey.

At the moment this is actually called from KeyHandler.keyTyped(), but this naming mismatch is not considered critical...

Overrides:
keyPressed in class Ipin

mouseOrKeyPressed

public void mouseOrKeyPressed(boolean isShiftDown)

elaborate

public void elaborate(java.lang.Object arg)
elaborate(): This method is called by the simulation engine to initialize the simulation object.

Specified by:
elaborate in interface Simulatable
Overrides:
elaborate in class Ipin
Parameters:
arg - This parameter is ignored by PulseSwitch

evaluate

public void evaluate(java.lang.Object arg)
evaluate(): called by the simulation engine on all events that concern this object. For a PulseSwitch, these are events from a toplevel design. We simply dispatch to Ipin.evaluate().

Specified by:
evaluate in interface Simulatable
Overrides:
evaluate in class Ipin

configure

public void configure()
Description copied from class: Ipin
configure: display a dialog to specify the Ipin instance name, initial output value, and gate propagation delay.

Overrides:
configure in class Ipin

write

public void write(java.io.PrintWriter ps)
Description copied from class: Ipin
write the versionID and the start value of this Ipin (the latter as StdLogic1164.getChar() value), e.g. "1001 Z"

Overrides:
write in class Ipin

initialize

public boolean initialize(java.lang.String s)
initialize an Ipin from a String, which contains the integer version id, and optionally the pulse width (in seconds).

Overrides:
initialize in class Ipin

toString

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

Overrides:
toString in class SimObject