hades.models.io
Class RandomBitGenerator

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

public class RandomBitGenerator
extends GenericGate
implements Simulatable

RandomBitGenerator: a simulation model which generates a new random 0/1 value on each rising clock-edge. This model is useful for testbenches and automatic selftest of other circuits. Random generator seed and 0/1 probability can be specified. Signals are expected to be StdLogic1164 objects.

See Also:
Serialized Form

Field Summary
protected  StdLogic1164 next_Y
           
protected  PortStdLogic1164 port_C
           
protected  PortStdLogic1164 port_Y
           
 
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
RandomBitGenerator()
          RandomBitGenerator: create a new RandomBitGenerator with its own exclusive java.util.Random instance, and 0.5 probability for 0/1 output values each.
 
Method Summary
 void configure()
          configure: display a dialog with options to specify instance name, C-to-Y propagation delay, probability of a StdLogic1164._1 output, and random generator seed.
 SimObject copy()
          create a copy of the current GenericGate with the same gate delay.
 void evaluate(java.lang.Object arg)
          evaluate: check for a rising edge on the C input and calculate a new random StdLogic1164._0/_1 output value with the selected 1-probability, then schedule to Y after t_delay
 float getProbability()
          return the probability (0.0 ..
 long getSeed()
           
 java.lang.String getToolTip(java.awt.Point position, long millis)
          construct a (short) tool tip message for a logic gate with name, class name, gate delay, seed, and 1-probability.
 boolean initialize(java.lang.String s)
          initialize a RandomBitGenerator from a String that contains the integer version id, the C-to-Y gate propagation delay (in seconds), the random number generator seed, and the 1-probability, e.g.
 void setProbability(float p)
           
 void setProbability(java.lang.String s)
           
 void setSeed(long _seed)
           
 void setSeed(java.lang.String s)
           
 void write(java.io.PrintWriter ps)
          write "versionId", gate delay "t_delay", random generator seed, and 1-probability
 
Methods inherited from class hades.models.gates.GenericGate
elaborate, 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, 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
elaborate, message
 

Field Detail

port_C

protected PortStdLogic1164 port_C

port_Y

protected PortStdLogic1164 port_Y

next_Y

protected StdLogic1164 next_Y
Constructor Detail

RandomBitGenerator

public RandomBitGenerator()
RandomBitGenerator: create a new RandomBitGenerator with its own exclusive java.util.Random instance, and 0.5 probability for 0/1 output values each.

Method Detail

getSeed

public long getSeed()

setSeed

public void setSeed(long _seed)

setSeed

public void setSeed(java.lang.String s)

getProbability

public float getProbability()
return the probability (0.0 .. 1.0) of generating a StdLogic1164._1 value


setProbability

public void setProbability(float p)

setProbability

public void setProbability(java.lang.String s)

initialize

public boolean initialize(java.lang.String s)
initialize a RandomBitGenerator from a String that contains the integer version id, the C-to-Y gate propagation delay (in seconds), the random number generator seed, and the 1-probability, e.g. "1001 0.5E-8 12345678901234 0.3"

Overrides:
initialize in class GenericGate

write

public void write(java.io.PrintWriter ps)
write "versionId", gate delay "t_delay", random generator seed, and 1-probability

Overrides:
write in class GenericGate

evaluate

public void evaluate(java.lang.Object arg)
evaluate: check for a rising edge on the C input and calculate a new random StdLogic1164._0/_1 output value with the selected 1-probability, then schedule to Y after t_delay

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

configure

public void configure()
configure: display a dialog with options to specify instance name, C-to-Y propagation delay, probability of a StdLogic1164._1 output, and random generator seed.

Overrides:
configure in class GenericGate

copy

public SimObject copy()
create a copy of the current GenericGate with the same gate delay.

Overrides:
copy in class GenericGate

getToolTip

public java.lang.String getToolTip(java.awt.Point position,
                                   long millis)
construct a (short) tool tip message for a logic gate with name, class name, gate delay, seed, and 1-probability.

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