byucc.jhdl.apps.Stimulator.functions
Class Random

java.lang.Object
  extended bybyucc.jhdl.apps.Stimulator.functions.Random
All Implemented Interfaces:
BooleanValueProvider, BVValueProvider, IntegerValueProvider, LongValueProvider, ValueProvider

public class Random
extends java.lang.Object
implements BooleanValueProvider, IntegerValueProvider, LongValueProvider, BVValueProvider

This class implements the ValueProvider interface to provide a random value for wire stimulus.

Author:
Anthony L. Slade

Constructor Summary
Random()
          Creates a new Random ValueProvider that uses the current time as the seed for the random values.
Random(long seed)
          Creates a new Random ValueProvider that uses the given value as a seed for the random values.
 
Method Summary
 java.lang.String getForceSchedule(int radix)
          Used by Stimulator to get a nicely printed view of the function or series of values that are scheduled to be put on the wire
 java.lang.String getForceSchedule(java.lang.String format)
          Used by Stimulator to get a nicely printed view of the function or series of values that are scheduled to be put on the wire
 boolean getNextBooleanValue()
           
 BV getNextBVValue(BV bv)
           
 int getNextIntegerValue()
           
 long getNextLongValue()
           
 boolean getResetBooleanValue()
          Resets the random number generator based on the original seed and returns the first boolean value from it.
 BV getResetBVValue(BV bv)
          Resets the random number generator based on the original seed and returns the first boolean value from it.
 int getResetIntegerValue()
          Resets the random number generator based on the original seed and returns the first int value from it.
 long getResetLongValue()
          Resets the random number generator based on the original seed and returns the first boolean value from it.
 boolean isDrivingOutput()
          This method is used if the wire being driven is a tri-state bus wire.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Random

public Random(long seed)
Creates a new Random ValueProvider that uses the given value as a seed for the random values.

Parameters:
seed - the seed for the random values. It is often a good idea to set this seed in order to reproduce simulation results in subsequent runs.

Random

public Random()
Creates a new Random ValueProvider that uses the current time as the seed for the random values.

Method Detail

getNextBooleanValue

public boolean getNextBooleanValue()
Specified by:
getNextBooleanValue in interface BooleanValueProvider
Returns:
a random boolean value

getResetBooleanValue

public boolean getResetBooleanValue()
Resets the random number generator based on the original seed and returns the first boolean value from it.

Specified by:
getResetBooleanValue in interface BooleanValueProvider
Returns:
the value (true|false) for the wire at reset

getNextIntegerValue

public int getNextIntegerValue()
Specified by:
getNextIntegerValue in interface IntegerValueProvider
Returns:
a random int value

getResetIntegerValue

public int getResetIntegerValue()
Resets the random number generator based on the original seed and returns the first int value from it.

Specified by:
getResetIntegerValue in interface IntegerValueProvider
Returns:
the value for the wire at reset

getNextLongValue

public long getNextLongValue()
Specified by:
getNextLongValue in interface LongValueProvider
Returns:
a random boolean value

getResetLongValue

public long getResetLongValue()
Resets the random number generator based on the original seed and returns the first boolean value from it.

Specified by:
getResetLongValue in interface LongValueProvider
Returns:
the value for the wire at reset

getNextBVValue

public BV getNextBVValue(BV bv)
Specified by:
getNextBVValue in interface BVValueProvider
Parameters:
bv - the BV object to place the value in. This object should be modified as necessary, and also returned.
Returns:
a random boolean value

getResetBVValue

public BV getResetBVValue(BV bv)
Resets the random number generator based on the original seed and returns the first boolean value from it.

Specified by:
getResetBVValue in interface BVValueProvider
Parameters:
bv - the BV object to place the value in. This object should be modified as necessary, and also returned.
Returns:
the value for the wire at reset

getForceSchedule

public java.lang.String getForceSchedule(int radix)
Used by Stimulator to get a nicely printed view of the function or series of values that are scheduled to be put on the wire

Specified by:
getForceSchedule in interface ValueProvider
Parameters:
radix - the custom ValueProvider may use this value to change the radix in which values will be shown in the schedule

getForceSchedule

public java.lang.String getForceSchedule(java.lang.String format)
Used by Stimulator to get a nicely printed view of the function or series of values that are scheduled to be put on the wire

Specified by:
getForceSchedule in interface ValueProvider
Parameters:
format - the custom ValueProvider may use this value to change the way values are shown in the schedule. This parameter is meant to be a BV format string.

isDrivingOutput

public boolean isDrivingOutput()
This method is used if the wire being driven is a tri-state bus wire. States whether the cell is driving the tri-state output.

Specified by:
isDrivingOutput in interface ValueProvider
Returns:
true


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.