edu.uci.eecs.doc.clepsydra.timing
Class JOPInstructionTimingStrategy

java.lang.Object
  extended by edu.uci.eecs.doc.clepsydra.timing.JOPInstructionTimingStrategy
All Implemented Interfaces:
InstructionTimingStrategy

public class JOPInstructionTimingStrategy
extends Object
implements InstructionTimingStrategy

Provides a model of the timing behavior for the Java Optimized Processor (JOP). It is based on the JOP Instruction Set data sheet.

Author:
Trevor Harmon

Constructor Summary
JOPInstructionTimingStrategy()
          Creates a new JOPInstructionTimingStrategy object.
 
Method Summary
 int getCycles(Instruction instruction)
          Returns the number of cycles required to execute the given Java bytecode instruction.
 int getCycles(InvokeInstruction instruction)
          Returns the number of cycles required to execute the given invocation instruction.
 int getCycles(InvokeInstruction instruction, boolean cacheHit, int methodSize)
          Returns the number of cycles required to execute the given invocation instruction.
 int getCycles(ReturnInstruction instruction, boolean cacheHit, int methodSize)
          Returns the number of cycles required to execute the given return instruction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JOPInstructionTimingStrategy

public JOPInstructionTimingStrategy()
Creates a new JOPInstructionTimingStrategy object. The read and write wait states of the memory system are loaded from the system properties jop.readWaitStates and jop.writeWaitStates. If these properties are not set, a default value of 1 is used for both wait states.

Method Detail

getCycles

public int getCycles(Instruction instruction)
              throws UnknownTimingException
Returns the number of cycles required to execute the given Java bytecode instruction.

Specified by:
getCycles in interface InstructionTimingStrategy
Parameters:
instruction - a bytecode instruction whose cycle count is to be determined. Must not be of type ReturnInstruction nor InvokeInstruction.
Returns:
the number of cycles required to execute the instruction.
Throws:
UnknownTimingException - if the opcode is invalid or its cycle count is unknown

getCycles

public int getCycles(InvokeInstruction instruction,
                     boolean cacheHit,
                     int methodSize)
              throws UnknownTimingException
Returns the number of cycles required to execute the given invocation instruction.

Specified by:
getCycles in interface InstructionTimingStrategy
Parameters:
instruction - an invocation instruction whose cycle count is to be determined.
cacheHit - true if the method being invoked is guaranteed to be in the method cache; false otherwise
methodSize - the size, in bytes, of the method that the instruction invokes
Returns:
the number of cycles required to execute the instruction.
Throws:
UnknownTimingException - if the opcode is invalid or its cycle count is unknown

getCycles

public int getCycles(InvokeInstruction instruction)
              throws UnknownTimingException
Returns the number of cycles required to execute the given invocation instruction. It assumes that the method to be invoked is already in the method cache and that its invocation will result in a cache hit.

Specified by:
getCycles in interface InstructionTimingStrategy
Parameters:
instruction - an invocation instruction whose cycle count is to be determined.
Returns:
the number of cycles required to execute the instruction.
Throws:
UnknownTimingException - if the opcode is invalid or its cycle count is unknown

getCycles

public int getCycles(ReturnInstruction instruction,
                     boolean cacheHit,
                     int methodSize)
              throws UnknownTimingException
Returns the number of cycles required to execute the given return instruction.

Specified by:
getCycles in interface InstructionTimingStrategy
Parameters:
instruction - a return instruction whose cycle count is to be determined.
cacheHit - true if the method being returned to is guaranteed to be in the method cache; false otherwise
methodSize - the size, in bytes, of the method that is being returned to
Returns:
the number of cycles required to execute the instruction.
Throws:
UnknownTimingException - if the opcode is invalid or its cycle count is unknown