hades.models.flipflops
Class LatchMetastable

java.lang.Object
  extended byhades.simulator.SimObject
      extended byhades.models.flipflops.GenericFlipflop
          extended byhades.models.flipflops.LatchMetastable
All Implemented Interfaces:
Assignable, java.lang.Cloneable, ContextToolTip, java.io.Serializable, Simulatable

public class LatchMetastable
extends GenericFlipflop
implements Simulatable, java.io.Serializable

LatchMetastable: a level-sensitive metastable D-latch

This class models a simple level-sensistive D-type metastable latch. Unlike class Latch, this simulation component will never generate 'X' or 'U' values at its outputs. Instead, random '0' or '1' values will be generated at initialization or whenever the value of the flipflop becomes undefined, e.g. due to a hazard condition.

Note that the delay for the propagation of this random value is random, too, with a delay of up to fifty times the usual flipflop propagation delay, t_pass.

Signals are expected to be StdLogic1164 objects.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class hades.models.flipflops.GenericFlipflop
port_NQ, port_Q, t_hold, t_pass, t_setup
 
Fields inherited from class hades.simulator.SimObject
classloader, console, debug, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
LatchMetastable()
           
 
Method Summary
 void elaborate(java.lang.Object arg)
          elaborate: store a reference to our simulator, then call evaluate() to set a random 0/1 initial state for this latch.
 void evaluate(java.lang.Object arg)
          evaluate: check the C and D inputs and calculate Q and NQ.
 int getRandom01Value()
          get a random 0 or 1 value, with probability 0.5 each.
 double getRandomDelay()
          get a random propagation delay time in the range 0 ..
 
Methods inherited from class hades.models.flipflops.GenericFlipflop
assign, configure, getDelay, getHoldTime, getSetupTime, getToolTip, initialize, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, setDelay, setDelay, setHoldTime, setHoldTime, setSetupTime, setSetupTime, write
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, copy, 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, setSymbol, 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
 

Constructor Detail

LatchMetastable

public LatchMetastable()
Method Detail

elaborate

public void elaborate(java.lang.Object arg)
elaborate: store a reference to our simulator, then call evaluate() to set a random 0/1 initial state for this latch.

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

evaluate

public void evaluate(java.lang.Object arg)
evaluate: check the C and D inputs and calculate Q and NQ. If either input is undefined or a timing violation is detected, the latch enters a random 0/1 state after an also random delay (which may be much larger than the usual latch propagation delay).

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

getRandom01Value

public int getRandom01Value()
get a random 0 or 1 value, with probability 0.5 each.


getRandomDelay

public double getRandomDelay()
get a random propagation delay time in the range 0 .. 50*t_pass.