hades.models.stimuli
Class StimuliParser

java.lang.Object
  extended byhades.models.stimuli.StimuliParser
All Implemented Interfaces:
StimuliParserConstants

public class StimuliParser
extends java.lang.Object
implements StimuliParserConstants

StimuliParser reads Hades stimuli files and generates the corresponding simulation events.

WARNING: due to my still insufficient knowledge of the JavaCC tokenizer specification options, the parser cannot not handle all legal Hades signal or component names correctly. You should not use names that include

If you really need such names, use the Unicode-escaped form, for example "/a name with spaces" instead of "/a name with spaces".

WARNING: avoid events at time t=0.0, because those assignments may conflict with initialization assignments (usually U or X values). Due to the default resolution function and the random order of multiple assignments at the same time, results may be non-deterministic in such cases. Instead, use assignments at very small times (e.g., a few ps).


Nested Class Summary
(package private)  class StimuliParser.ClockGen
          internal adapter class to generate the specified clock events.
(package private) static class StimuliParser.JJCalls
           
(package private)  class StimuliParser.Pause
           
 
Field Summary
(package private)  boolean debug
           
(package private)  Design design
           
(package private)  ASCII_CharStream jj_input_stream
           
 Token jj_nt
           
 boolean lookingAhead
           
(package private)  DesignHierarchyNavigator navigator
           
(package private)  int processID
           
(package private)  java.lang.String processName
           
(package private)  double processTime
           
(package private)  SimKernel simulator
           
 Token token
           
 StimuliParserTokenManager token_source
           
 
Fields inherited from interface hades.models.stimuli.StimuliParserConstants
ABSOLUTE_NAME, ASSIGN, CONSTANT, DEBUG, DEFAULT, DEFCLOCK, DIGIT, ENDPROC, EOF, EOL, FLOAT, HEXDIGIT, ID, INTEGER, LETTER, PAUSE, PROCESS, SINGLE_LINE_COMMENT, TIMESCALE, tokenImage, TRACE, UNTIL, WAIT
 
Constructor Summary
StimuliParser(java.io.InputStream stream)
           
StimuliParser(java.io.Reader stream)
           
StimuliParser(StimuliParserTokenManager tm)
           
 
Method Summary
 void assign_or_wait()
           
 void assignment()
           
 java.lang.String constant_or_ID()
           
 void createClockGenerator(java.lang.String name, double period, double dutycycle, double offset)
          create an (internal class) clock generator component with the specified name and timing parameters.
 void define_clock()
           
 void disable_tracing()
           
 void do_pause()
           
 void do_wait()
           
 void enable_debug()
           
 void enable_tracing()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
static double getTimeScale(java.lang.String s)
          convert a string into a timescale.
 Token getToken(int index)
           
 void handleAssignStatement(java.lang.String targetName, java.lang.String valueString)
          create the simulation event for a single assign statement.
 void handlePauseStatement()
          tell the simulation engine to change to "pause" mode at the simulation time corresponding to the "current process" time.
static void main(java.lang.String[] argv)
          create a StimuliParser for the Design specified by argv[0] and parse the stimuli file specified by argv[1]
static void msg(java.lang.String s)
          print string s to stdout
static double parseDouble(java.lang.String s)
           
 void process()
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.Reader stream)
           
 void ReInit(StimuliParserTokenManager tm)
           
 void setDebug(boolean b)
           
 void setDesign(Design _design)
          set the 'current working' design for this parser and create a DesignHierarchyNavigator for that design.
 void setSimulator(SimKernel _simulator)
          set the simulation engine to be used by this StimuliParser.
 java.lang.String signal_name()
           
 void statement()
           
 void stimuli_file()
           
 void trace_signal()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

simulator

SimKernel simulator

design

Design design

navigator

DesignHierarchyNavigator navigator

processTime

double processTime

processName

java.lang.String processName

processID

int processID

debug

boolean debug

token_source

public StimuliParserTokenManager token_source

jj_input_stream

ASCII_CharStream jj_input_stream

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

StimuliParser

public StimuliParser(java.io.InputStream stream)

StimuliParser

public StimuliParser(java.io.Reader stream)

StimuliParser

public StimuliParser(StimuliParserTokenManager tm)
Method Detail

setSimulator

public void setSimulator(SimKernel _simulator)
set the simulation engine to be used by this StimuliParser.


setDesign

public void setDesign(Design _design)
set the 'current working' design for this parser and create a DesignHierarchyNavigator for that design.


setDebug

public void setDebug(boolean b)

main

public static void main(java.lang.String[] argv)
                 throws ParseException,
                        java.lang.Exception
create a StimuliParser for the Design specified by argv[0] and parse the stimuli file specified by argv[1]

Throws:
ParseException
java.lang.Exception

handleAssignStatement

public void handleAssignStatement(java.lang.String targetName,
                                  java.lang.String valueString)
create the simulation event for a single assign statement. This method first checks "targetName" parameter to look-up the specified simulation component (SimObject) or signal. (Note that a simulation component shadows a signal of the same name.)


handlePauseStatement

public void handlePauseStatement()
tell the simulation engine to change to "pause" mode at the simulation time corresponding to the "current process" time.


createClockGenerator

public void createClockGenerator(java.lang.String name,
                                 double period,
                                 double dutycycle,
                                 double offset)
create an (internal class) clock generator component with the specified name and timing parameters.


getTimeScale

public static double getTimeScale(java.lang.String s)
convert a string into a timescale. Supported arguments are as in VHDL, namely "fs" "ps" "ns" "us" "ms" "sec" "min" "hr". For example, when called with the argument "ms" this method returns the value 1.0E-3


parseDouble

public static double parseDouble(java.lang.String s)

msg

public static void msg(java.lang.String s)
print string s to stdout


stimuli_file

public final void stimuli_file()
                        throws ParseException
Throws:
ParseException

statement

public final void statement()
                     throws ParseException
Throws:
ParseException

process

public final void process()
                   throws ParseException
Throws:
ParseException

assign_or_wait

public final void assign_or_wait()
                          throws ParseException
Throws:
ParseException

assignment

public final void assignment()
                      throws ParseException
Throws:
ParseException

do_wait

public final void do_wait()
                   throws ParseException
Throws:
ParseException

do_pause

public final void do_pause()
                    throws ParseException
Throws:
ParseException

define_clock

public final void define_clock()
                        throws ParseException
Throws:
ParseException

trace_signal

public final void trace_signal()
                        throws ParseException
Throws:
ParseException

constant_or_ID

public final java.lang.String constant_or_ID()
                                      throws ParseException
Throws:
ParseException

signal_name

public final java.lang.String signal_name()
                                   throws ParseException
Throws:
ParseException

enable_debug

public final void enable_debug()
                        throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(StimuliParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()