avrora.actions
Class SimAction

java.lang.Object
  extended byavrora.actions.Action
      extended byavrora.actions.SimAction
Direct Known Subclasses:
BenchmarkAction, MultiSimulateAction, SimulateAction

public abstract class SimAction
extends Action

The SimAction is an abstract class that collects many of the options common to single node and multiple-node simulations into one place.


Field Summary
 Option.Str CHIP
           
 Option.Long ICOUNT
           
protected  java.util.LinkedList monitorFactoryList
           
protected  java.util.HashMap monitorListMap
           
protected  ClassMap monitorMap
           
 Option.List MONITORS
           
 Option.Str PLATFORM
           
 Option.Bool REPORT_SECONDS
           
 Option.Double SECONDS
           
 Option.Long SECONDS_PRECISION
           
 Option.Long TIMEOUT
           
 Option.Str VISUAL
           
 
Fields inherited from class avrora.actions.Action
help, options, shortName
 
Constructor Summary
protected SimAction(java.lang.String sn, java.lang.String h)
           
 
Method Summary
static java.util.List getLocationList(Program program, java.util.List v)
          The getLocationList() method is to used to parse a list of program locations and turn them into a list of Main.Location instances.
protected  MicrocontrollerFactory getMicrocontroller()
          The getMicrocontroller() method is used to get the current microcontroller from the library of implemented ones, based on the command line option that was specified (-chip=xyz).
protected  PlatformFactory getPlatform()
          The getPlatform() method is used to get the current platform from the library of implemented ones, based on the command line option that was specified (-platform=xyz).
protected  boolean hasMonitors(Simulator s)
           
protected  void initializeSimulatorStatics()
          The initializeSimulatorStatics() method simply checks a few command line parameters and initializes the Simulator class's static variables that relate to reporting time, etc.
protected  Simulator newSimulator(InterpreterFactory factory, Program p)
          The newSimulator() method is a simple utility used by actions deriving from this class that creates a new Simulator with the correct configuration, with the specified program, and then applies timeouts, breakpoints, and monitors to it.
protected  Simulator newSimulator(Program p)
          The newSimulator() method is used by subclasses of this action to create a new instance of a simulator with the correct platform.
protected  void printSeparator()
           
protected  void printSimHeader()
          The printSimHeader() method simply prints the first line of output that names the columns for the events outputted by the rest of the simulation.
protected  void processMonitorList()
          The processMonitorList() method builds a list of MonitorFactory instances from the list of strings given as an option at the command line.
protected  void processTimeout(Simulator s)
          The processTimeout() method simply checks the command line arguments that correspond to timeouts (such as clock cycles, seconds, or instructions) and inserts the appropriate probes into the simulator.
protected  void reportMonitors(Simulator s)
          The reportMonitors() method gets a list of Monitor instances attached to the simulator and calls each of their report() methods.
protected  void reportQuantity(java.lang.String name, float val, java.lang.String units)
          The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.
protected  void reportQuantity(java.lang.String name, long val, java.lang.String units)
          The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.
protected  void reportQuantity(java.lang.String name, java.lang.String val, java.lang.String units)
          The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.
 
Methods inherited from class avrora.actions.Action
getHelp, getShortName, newOption, newOption, newOption, newOption, newOption, newOptionList, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICOUNT

public final Option.Long ICOUNT

SECONDS

public final Option.Double SECONDS

TIMEOUT

public final Option.Long TIMEOUT

CHIP

public final Option.Str CHIP

PLATFORM

public final Option.Str PLATFORM

MONITORS

public final Option.List MONITORS

REPORT_SECONDS

public final Option.Bool REPORT_SECONDS

SECONDS_PRECISION

public final Option.Long SECONDS_PRECISION

VISUAL

public final Option.Str VISUAL

monitorMap

protected ClassMap monitorMap

monitorFactoryList

protected java.util.LinkedList monitorFactoryList

monitorListMap

protected java.util.HashMap monitorListMap
Constructor Detail

SimAction

protected SimAction(java.lang.String sn,
                    java.lang.String h)
Method Detail

getMicrocontroller

protected MicrocontrollerFactory getMicrocontroller()
The getMicrocontroller() method is used to get the current microcontroller from the library of implemented ones, based on the command line option that was specified (-chip=xyz).

Returns:
an instance of MicrocontrollerFactory for the microcontroller specified on the command line.

getPlatform

protected PlatformFactory getPlatform()
The getPlatform() method is used to get the current platform from the library of implemented ones, based on the command line option that was specified (-platform=xyz).

Returns:
an instance of PlatformFactory for the platform specified on the command line

reportQuantity

protected void reportQuantity(java.lang.String name,
                              long val,
                              java.lang.String units)
The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.

Parameters:
name - the name of the quantity as a string
val - the value of the quantity as a long integer
units - the name of the units as a string

reportQuantity

protected void reportQuantity(java.lang.String name,
                              float val,
                              java.lang.String units)
The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.

Parameters:
name - the name of the quantity as a string
val - the value of the quantity as a floating point number
units - the name of the units as a string

reportQuantity

protected void reportQuantity(java.lang.String name,
                              java.lang.String val,
                              java.lang.String units)
The reportQuantity() method is a simply utility to print out a quantity's name (such as "Number of instructions executed", the value (such as 2002), and the units (such as cycles) in a colorized and standardized way.

Parameters:
name - the name of the quantity as a string
val - the value of the quantity as a string
units - the name of the units as a string

processMonitorList

protected void processMonitorList()
The processMonitorList() method builds a list of MonitorFactory instances from the list of strings given as an option at the command line. The list of MonitorFactory instances is used to create monitors for each simulator as it is created.


newSimulator

protected Simulator newSimulator(Program p)
The newSimulator() method is used by subclasses of this action to create a new instance of a simulator with the correct platform. This method also creates monitors for the simulator instance as specified from the command line.

Parameters:
p - the program to load onto the simulator
Returns:
an instance of the Simulator class that has the specified programs loaded onto it and has monitors attached to as specified on the command line

newSimulator

protected Simulator newSimulator(InterpreterFactory factory,
                                 Program p)
The newSimulator() method is a simple utility used by actions deriving from this class that creates a new Simulator with the correct configuration, with the specified program, and then applies timeouts, breakpoints, and monitors to it.

Parameters:
factory - the factory that creates the interpreter for the simulator
p - the program to load onto the simulator
Returns:
a new Simulator instance

processTimeout

protected void processTimeout(Simulator s)
The processTimeout() method simply checks the command line arguments that correspond to timeouts (such as clock cycles, seconds, or instructions) and inserts the appropriate probes into the simulator.

Parameters:
s -

reportMonitors

protected void reportMonitors(Simulator s)
The reportMonitors() method gets a list of Monitor instances attached to the simulator and calls each of their report() methods.

Parameters:
s - the simulator for which to report all the monitors

hasMonitors

protected boolean hasMonitors(Simulator s)

getLocationList

public static java.util.List getLocationList(Program program,
                                             java.util.List v)
The getLocationList() method is to used to parse a list of program locations and turn them into a list of Main.Location instances.

Parameters:
program - the program to look up labels in
v - the list of strings that are program locations
Returns:
a list of program locations

printSimHeader

protected void printSimHeader()
The printSimHeader() method simply prints the first line of output that names the columns for the events outputted by the rest of the simulation.


printSeparator

protected void printSeparator()

initializeSimulatorStatics

protected void initializeSimulatorStatics()
The initializeSimulatorStatics() method simply checks a few command line parameters and initializes the Simulator class's static variables that relate to reporting time, etc.