hades.models.io
Class Stimulus

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

public class Stimulus
extends GenericGate
implements Wakeable

Stimulus: simple stimulus generator with 8 outputs and fixed-length period. No pause/rewind function yet. The underlying data structure for this class is a two-dimensional array of int-values: data[output][cycle]

See Also:
Serialized Form

Field Summary
(package private)  Circle circleOnOff
           
(package private)  int[][] data
           
(package private)  java.lang.String dataResourceName
           
(package private)  boolean debug
           
(package private)  int n_cycles
           
(package private)  int n_outputs
           
(package private)  StdLogic1164 output_0
           
(package private)  StdLogic1164 output_1
           
(package private)  StdLogic1164 output_U
           
(package private)  double period
           
(package private)  boolean running
           
(package private)  StimuliEditor stimuliEditor
           
 
Fields inherited from class hades.models.gates.GenericGate
t_delay
 
Fields inherited from class hades.simulator.SimObject
classloader, console, editor, name, parent, ports, propertySheet, simulator, symbol, versionId, visible
 
Constructor Summary
Stimulus()
           
 
Method Summary
 void changeLength(int n_cycles)
           
 void configure()
          create and display a 'ConfigDialog' to set the parameters for a SimObject.
 SimObject copy()
          copy(): icreate a clone of the current Stimulus generator.
 void deleteValueFromRow(int r, int c)
           
 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)
          Should not be called: a Stimulus doesn't react to external events (yet)
 void expandRow(int rowindex, int startindex)
          expand one row: repeat all values from cycles 0 to startindex until the array is filled.
 int[][] getData()
           
 int getDataAt(int r, int c)
           
 java.lang.String getDataResourceName()
           
 java.lang.String[] getExternalResources()
          return a String[] array of length 1 with our current hst stimuli file.
 int getIndexFromTime(double time)
           
 int getNumberOfCycles()
           
 int getNumberOfOutputs()
           
 double getPeriod()
           
 java.awt.Component getPropertySheet()
          return a reference to the 'property sheet' or configuration window for this SimObject.
(package private)  java.lang.String getSecondToken(java.io.BufferedReader BR)
           
 java.lang.String getSignalName(int i)
           
 StdLogic1164 getStdLogic1164(int r, int c)
           
(package private)  void initConstants()
           
 void initData()
          initialize all cycles in all outputs with value StdLogic1164._U
(package private)  void initDisplay()
           
 boolean initialize(java.lang.String s)
          initialize a Stimulus instance from a String which contains the integer version id and the resource/file name for the actual stimulus data.
(package private)  void initPorts()
           
 void initRestOfRow(int index, int startpos, int value)
           
 void initRow(int index, int value)
          initialize one output (one row of the data matrix) with 'value', which should be a valid StdLogic1164 value.
 void initRowWithClock(int r)
           
 void initRowWithRandomData(int r)
           
 void insertValueIntoRow(int r, int c, int value)
           
 void invertRow(int index)
          change 0->1, 1->0, and leave other values intact
 boolean needsExternalResources()
          we use one external resource: the hst file to initialize our stimuli data.
 void parseData()
           
(package private)  void scheduleData()
          schedule the data corresponding to the current simulation time at our outputs.
 void setDataAt(int r, int c, int value)
           
 void setDataResourceName(java.lang.String s)
           
 void setNumberOfOutputs(int N)
           
 void setPeriod(double period)
           
 void setSymbol(Symbol s)
           
 java.lang.String toString()
          toString: generate a text description for this SimObject.
 void wakeup(java.lang.Object arg)
          One cycle period has elapsed, schedule the next period's data.
 void write(java.io.PrintWriter ps)
          write "versionId" and gate delay "t_delay"
 void writeData()
           
 
Methods inherited from class hades.models.gates.GenericGate
getDelay, getToolTip, scheduleEvent, scheduleEventAfter, scheduleOutputValue, scheduleOutputValueAfter, setDelay, setDelay
 
Methods inherited from class hades.simulator.SimObject
constructDynamicSymbol, getBindkey, getClassLoader, getDebug, getEditor, getFullName, getName, getParent, getPort, getPorts, getResourceAsStream, getSimulator, getSymbol, getSymbolResourceName, getVersionId, isVisible, keyPressed, message, mousePressed, needsDynamicSymbol, setClassLoader, setConsole, setDebug, setEditor, setName, 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
 

Field Detail

n_outputs

int n_outputs

n_cycles

int n_cycles

data

int[][] data

period

double period

running

boolean running

debug

boolean debug

dataResourceName

java.lang.String dataResourceName

circleOnOff

Circle circleOnOff

output_0

StdLogic1164 output_0

output_1

StdLogic1164 output_1

output_U

StdLogic1164 output_U

stimuliEditor

StimuliEditor stimuliEditor
Constructor Detail

Stimulus

public Stimulus()
Method Detail

needsExternalResources

public boolean needsExternalResources()
we use one external resource: the hst file to initialize our stimuli data.

Overrides:
needsExternalResources in class SimObject

getExternalResources

public java.lang.String[] getExternalResources()
return a String[] array of length 1 with our current hst stimuli file.

Overrides:
getExternalResources in class SimObject

setSymbol

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

getDataResourceName

public java.lang.String getDataResourceName()

setDataResourceName

public void setDataResourceName(java.lang.String s)

getSignalName

public java.lang.String getSignalName(int i)

getNumberOfOutputs

public int getNumberOfOutputs()

setNumberOfOutputs

public void setNumberOfOutputs(int N)

getNumberOfCycles

public int getNumberOfCycles()

getData

public int[][] getData()

initPorts

void initPorts()

initConstants

void initConstants()

initDisplay

void initDisplay()

write

public void write(java.io.PrintWriter ps)
Description copied from class: GenericGate
write "versionId" and gate delay "t_delay"

Overrides:
write in class GenericGate

initialize

public boolean initialize(java.lang.String s)
initialize a Stimulus instance from a String which contains the integer version id and the resource/file name for the actual stimulus data. The file, in turn, contains the number of outputs, number of cycles, cycle length, and all data.

Overrides:
initialize in class GenericGate

elaborate

public void elaborate(java.lang.Object arg)
Description copied from interface: Simulatable
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

evaluate

public void evaluate(java.lang.Object arg)
Should not be called: a Stimulus doesn't react to external events (yet)

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)
One cycle period has elapsed, schedule the next period's data.

Specified by:
wakeup in interface Wakeable
Parameters:
arg - unused WakeupEvent

scheduleData

void scheduleData()
schedule the data corresponding to the current simulation time at our outputs.


initRow

public void initRow(int index,
                    int value)
initialize one output (one row of the data matrix) with 'value', which should be a valid StdLogic1164 value.


initRestOfRow

public void initRestOfRow(int index,
                          int startpos,
                          int value)

initData

public void initData()
initialize all cycles in all outputs with value StdLogic1164._U


invertRow

public void invertRow(int index)
change 0->1, 1->0, and leave other values intact


expandRow

public void expandRow(int rowindex,
                      int startindex)
expand one row: repeat all values from cycles 0 to startindex until the array is filled.


initRowWithClock

public void initRowWithClock(int r)

initRowWithRandomData

public void initRowWithRandomData(int r)

setDataAt

public void setDataAt(int r,
                      int c,
                      int value)

getDataAt

public int getDataAt(int r,
                     int c)

getStdLogic1164

public StdLogic1164 getStdLogic1164(int r,
                                    int c)

insertValueIntoRow

public void insertValueIntoRow(int r,
                               int c,
                               int value)

deleteValueFromRow

public void deleteValueFromRow(int r,
                               int c)

writeData

public void writeData()
               throws java.lang.Exception
Throws:
java.lang.Exception

getSecondToken

java.lang.String getSecondToken(java.io.BufferedReader BR)
                          throws java.lang.Exception
Throws:
java.lang.Exception

parseData

public void parseData()
               throws java.lang.Exception
Throws:
java.lang.Exception

changeLength

public void changeLength(int n_cycles)

setPeriod

public void setPeriod(double period)

getPeriod

public double getPeriod()

getIndexFromTime

public int getIndexFromTime(double time)

copy

public SimObject copy()
copy(): icreate a clone of the current Stimulus generator.

Overrides:
copy in class GenericGate

getPropertySheet

public java.awt.Component getPropertySheet()
Description copied from class: SimObject
return a reference to the 'property sheet' or configuration window for this SimObject. We cast the return value to an AWT Component, but typically you can expect either a hades.gui.PropertySheet or an java.awt.Window (Dialog or Frame).

Overrides:
getPropertySheet in class SimObject

configure

public void configure()
Description copied from class: SimObject
create and display a 'ConfigDialog' to set the parameters for a SimObject. The default ConfigDialog for the base class (SimObject) itself is empty except for the 'instance name' of the SimObject.

Overrides:
configure in class GenericGate

toString

public java.lang.String toString()
Description copied from class: SimObject
toString: generate a text description for this SimObject. This method currently combines the class name for the SimObject (or subclass) and its full name in the current Hades Design, e.g. "hades.models.gates.And2: /uut/adder16/adder1/i3".

Overrides:
toString in class SimObject