avrora.sim
Class Simulator.InstructionCountTimeout

java.lang.Object
  extended byavrora.sim.Simulator.InstructionCountTimeout
All Implemented Interfaces:
Simulator.Probe
Enclosing class:
Simulator

public static class Simulator.InstructionCountTimeout
extends java.lang.Object
implements Simulator.Probe

The InstructionCountTimeout class is a probe that simply counts down and throws a TimeoutException when the count reaches zero. It is useful for ensuring termination of the simulator, for performance testing, or for profiling and stopping after a specified number of invocations.


Field Summary
protected  long left
           
 long timeout
           
 
Constructor Summary
Simulator.InstructionCountTimeout(long t)
          The constructor for InstructionCountTimeout creates with the specified initial value.
 
Method Summary
 void fireAfter(Instr i, int address, State state)
          The fireAfter() method is called after the probed instruction executes.
 void fireBefore(Instr i, int address, State state)
          The fireBefore() method is called before the probed instruction executes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeout

public final long timeout

left

protected long left
Constructor Detail

Simulator.InstructionCountTimeout

public Simulator.InstructionCountTimeout(long t)
The constructor for InstructionCountTimeout creates with the specified initial value.

Parameters:
t - the number of clock cycles before timeout should occur
Method Detail

fireBefore

public void fireBefore(Instr i,
                       int address,
                       State state)
The fireBefore() method is called before the probed instruction executes. In the implementation of the timeout, it does nothing.

Specified by:
fireBefore in interface Simulator.Probe
Parameters:
i - the instruction being probed
address - the address at which this instruction resides
state - the state of the simulation

fireAfter

public void fireAfter(Instr i,
                      int address,
                      State state)
The fireAfter() method is called after the probed instruction executes. In the implementation of the timeout, it simply decrements the timeout and and throws a TimeoutException when the count reaches zero.

Specified by:
fireAfter in interface Simulator.Probe
Parameters:
i - the instruction being probed
address - the address at which this instruction resides
state - the state of the simulation