de.cau.cs.kieler.krep.evalbench.trace
Class TraceList

java.lang.Object
  extended by de.cau.cs.kieler.krep.evalbench.trace.TraceList

public class TraceList
extends Object

A list of different independent traces, as they are for example stored in esi files.

Rating proposed yellow
(2010-01-28) ctr

Constructor Summary
TraceList()
          generate an empty trace list.
TraceList(IAssembler asm, String baseName)
          Read a trace list from a trace file.
 
Method Summary
static void addListener(ITraceListener listener)
          Adds a new trace listener that is notified of tick events.
 boolean executeStep(ICommunicationProtocol krep)
          Execute one step of the current trace.
 LinkedList<String[]> getTable()
           
 int getTablePos()
           
 String getWCRT()
           
 boolean hasNext()
           
 boolean isValid()
           
 Tick next()
           
 int nextIndex()
           
static void notifyListeners(boolean newTrace)
          notify all listeners, that the status of the trace has changed.
static void removeListener(ITraceListener listener)
          remove a trace listener.
 void reset()
          reset current position to first tick in first trace, delete all output.
 void setOutput(Tick output)
           
 int size()
           
 boolean validateCurrent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceList

public TraceList(IAssembler asm,
                 String baseName)
Read a trace list from a trace file. Supported file types are esi, eso and rif.

Parameters:
asm - Assembler, for which the test is. This is needed to generate signal indices.
baseName - name of the trace file without the file suffix

TraceList

public TraceList()
generate an empty trace list.

Method Detail

hasNext

public boolean hasNext()
Returns:
true if another tick or trace exists

next

public Tick next()
Returns:
next tick, null if a new trace is started

nextIndex

public int nextIndex()
Returns:
index of the next tick

reset

public void reset()
reset current position to first tick in first trace, delete all output.


getTablePos

public int getTablePos()
Returns:
get absolute index of the current position, including all preceding traces

getTable

public LinkedList<String[]> getTable()
Returns:
textual representation of the current trace, including input, outputs, reaction time and additional remarks when an error occurred during simulation

addListener

public static void addListener(ITraceListener listener)
Adds a new trace listener that is notified of tick events.

Parameters:
listener - listener to be added

removeListener

public static void removeListener(ITraceListener listener)
remove a trace listener.

Parameters:
listener - to remove

notifyListeners

public static void notifyListeners(boolean newTrace)
notify all listeners, that the status of the trace has changed.

Parameters:
newTrace - true if the complete trace has changed, false if only the current step changed

setOutput

public void setOutput(Tick output)
Parameters:
output - the new output for this tick

validateCurrent

public boolean validateCurrent()
Returns:
true when the current tick matches the reference output

executeStep

public boolean executeStep(ICommunicationProtocol krep)
                    throws CommunicationException
Execute one step of the current trace.

Parameters:
krep - connection to a processor. It is assumed that the program was already loaded on the processor.
Returns:
when the outputs match the reference output
Throws:
CommunicationException - thrown for any communication errors

isValid

public final boolean isValid()
Returns:
true if the output of all ticks matches the reference output

getWCRT

public String getWCRT()
Returns:
String that contains minimal, average and maximal reaction time

size

public int size()
Returns:
complete size of all traces, including reset steps