hades.models.io
Class Switch

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

public class Switch
extends GenericGate
implements Wakeable

Switch - a not-so-simple class that models a switch (or tgate).

See Also:
Serialized Form

Field Summary
 boolean CLOSED
           
protected  double delay
           
 boolean OPEN
           
protected  StdLogic1164 output_0
           
protected  StdLogic1164 output_1
           
protected  StdLogic1164 output_U
           
protected  StdLogic1164 output_X
           
protected  StdLogic1164 output_Z
           
protected  PortStdLogic1164 port_A
           
protected  PortStdLogic1164 port_B
           
protected  PortStdLogic1164 port_C
           
protected  StdLogic1164 startValue
           
protected  boolean state
           
protected  ClockArm the_arm
           
 
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
Switch()
          Switch(): simple constructor
 
Method Summary
 void configure()
          configure: display a dialog to specify the Switch 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: as interactive Switch events are handled by mousePressed(), this method is only called by the simulation engine whenever our (hidden) toplevel signal changes.
 double getDelay()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message for a logic gate with name, class name, and gate delay.
protected  void initDisplay()
           
 boolean initialize(java.lang.String s)
          initialize an Switch from a String, which contains the integer version id, and optionally the start value of this Switch (the latter encoded via StdLogic1164.getChar() values, 'U' 'X' '0' ...
 void setDelay(java.lang.String s)
           
 void setSymbol(Symbol s)
           
 void showState()
           
 void wakeup(java.lang.Object arg)
          wakeup: this method is currently used to handle "external" events on this Switch via the assign call, which schedules a Wakeup event to update the Switch symbol at the correct simulation time.
 void write(java.io.PrintWriter ps)
          write the versionID and the start value of this Switch (the latter as StdLogic1164.getChar() value), e.g.
 
Methods inherited from class hades.models.gates.GenericGate
copy, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, 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, mousePressed, needsDynamicSymbol, needsExternalResources, setClassLoader, setConsole, setDebug, setEditor, setName, setParent, setPorts, setSimulator, setVersionId, setVisible, tearDown, toString
 
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
 

Field Detail

OPEN

public final boolean OPEN
See Also:
Constant Field Values

CLOSED

public final boolean CLOSED
See Also:
Constant Field Values

state

protected boolean state

port_A

protected PortStdLogic1164 port_A

port_B

protected PortStdLogic1164 port_B

port_C

protected PortStdLogic1164 port_C

output_1

protected StdLogic1164 output_1

output_0

protected StdLogic1164 output_0

output_Z

protected StdLogic1164 output_Z

output_X

protected StdLogic1164 output_X

output_U

protected StdLogic1164 output_U

startValue

protected StdLogic1164 startValue

delay

protected double delay

the_arm

protected ClockArm the_arm
Constructor Detail

Switch

public Switch()
Switch(): simple constructor

Method Detail

getDelay

public double getDelay()
Overrides:
getDelay in class GenericGate

setDelay

public void setDelay(java.lang.String s)
Overrides:
setDelay in class GenericGate

initialize

public boolean initialize(java.lang.String s)
initialize an Switch from a String, which contains the integer version id, and optionally the start value of this Switch (the latter encoded via StdLogic1164.getChar() values, 'U' 'X' '0' ... 'D'), e.g. "1001 U"

Overrides:
initialize in class GenericGate

write

public void write(java.io.PrintWriter ps)
write the versionID and the start value of this Switch (the latter as StdLogic1164.getChar() value), e.g. "1001 Z"

Overrides:
write in class GenericGate

setSymbol

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

initDisplay

protected void initDisplay()

showState

public void showState()

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 GenericGate
Parameters:
arg - This parameter is ignored by Switch

evaluate

public void evaluate(java.lang.Object arg)
evaluate: as interactive Switch events are handled by mousePressed(), this method is only called by the simulation engine whenever our (hidden) toplevel signal changes. Take the toplevel signal value and propagate to our local signal.

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: this method is currently used to handle "external" events on this Switch via the assign call, which schedules a Wakeup event to update the Switch symbol at the correct simulation time. To this end, the "arg" argument is expected to hold a WakeupEvent whose arg member is a StdLogic1164 object.

Specified by:
wakeup in interface Wakeable

configure

public void configure()
configure: display a dialog to specify the Switch instance name, initial output value, and gate propagation delay.

Overrides:
configure in class GenericGate

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
Description copied from class: GenericGate
construct a (short) tool tip message for a logic gate with name, class name, and gate delay.

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