de.cau.cs.kieler.krep.evalbench.comm
Interface ICommunicationProtocol

All Known Implementing Classes:
CommunicationProtocol, KepProtocol, KlpProtocol

public interface ICommunicationProtocol

Interface for communication protocol layers used between the common layer and connection protocols.

Rating yellow
(2010-02-05) review by cmot, msp

Field Summary
static String P_KEP
          Identifier for the KEP protocol.
static String P_KREP
          Identifier for the KReP protocol.
 
Method Summary
 void addCommunicationListener(ICommunicationListener listener)
          Adds a communication listener that is notified of all transferred data.
 void continuousRun()
          When executed the target is set to continuous mode.
 int[] getExecutionTrace()
          Requests an execution trace for the last tick command.
 String getTargetInfo()
          Requests target information from the target and translates the received return string.
 boolean loadProgram(IAssembler program, IProgressMonitor monitor)
          Loads a program onto the connected target.
 void removeCommunicationListener(ICommunicationListener listener)
          Removes a communication listener from the list.
 void reset()
          Resets the current program on the target.
 void stopContinuous()
          Stops continuous mode and returns to single tick mode.
 int tick(int maxSignals, LinkedList<Signal> inputs, LinkedList<Signal> outputs)
          Performs a program tick by sending the global input signal status, executing the tick command and reading the global output signal status.
 boolean verifyCommunication()
          Verifies communication by sending a command and receiving a return string.
 

Field Detail

P_KEP

static final String P_KEP
Identifier for the KEP protocol.

See Also:
Constant Field Values

P_KREP

static final String P_KREP
Identifier for the KReP protocol.

See Also:
Constant Field Values
Method Detail

addCommunicationListener

void addCommunicationListener(ICommunicationListener listener)
Adds a communication listener that is notified of all transferred data.

Parameters:
listener - listener to be added

removeCommunicationListener

void removeCommunicationListener(ICommunicationListener listener)
Removes a communication listener from the list.

Parameters:
listener - listener to be removed

verifyCommunication

boolean verifyCommunication()
                            throws CommunicationException
Verifies communication by sending a command and receiving a return string.

Returns:
true if the correct return string can be received from the processor.
Throws:
CommunicationException - when no return string could be read

getTargetInfo

String getTargetInfo()
                     throws CommunicationException
Requests target information from the target and translates the received return string.

Returns:
readable target information
Throws:
CommunicationException - when the return string is invalid

loadProgram

boolean loadProgram(IAssembler program,
                    IProgressMonitor monitor)
                    throws CommunicationException,
                           LoadException
Loads a program onto the connected target.

Parameters:
program - array of hex encoded instructions
monitor - progress-monitor, null if nothing shall be displayed
Returns:
true iff loading was successful
Throws:
CommunicationException - when the program string has an invalid length
LoadException - cannot execute this program

reset

void reset()
           throws CommunicationException
Resets the current program on the target.

Throws:
CommunicationException - when an invalid reply was received

tick

int tick(int maxSignals,
         LinkedList<Signal> inputs,
         LinkedList<Signal> outputs)
         throws CommunicationException
Performs a program tick by sending the global input signal status, executing the tick command and reading the global output signal status.

Parameters:
maxSignals - number of signals in the current program.
inputs - input signals
outputs - An empty list of output signals, the actual outputs are added by the tick function.
Returns:
number of instruction cycles to compute the tick
Throws:
CommunicationException - when an invalid reply was received

getExecutionTrace

int[] getExecutionTrace()
                        throws CommunicationException
Requests an execution trace for the last tick command.

Returns:
list of addresses of executed instructions
Throws:
CommunicationException - when the received trace is invalid

continuousRun

void continuousRun()
                   throws CommunicationException
When executed the target is set to continuous mode. Only external inputs and outputs are used in this mode.

Throws:
CommunicationException - when an exception occurs while sending the command

stopContinuous

void stopContinuous()
                    throws CommunicationException
Stops continuous mode and returns to single tick mode.

Throws:
CommunicationException - when an invalid reply was received