Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.core
Interface InstrPrototype

All Known Implementing Classes:
  Instr

public interface InstrPrototype

The `InstrPrototype` interface represents an object that is capable of building `Instr` instances given an array of `Operand` instances. It also contains methods that describe the instructions such as their name, their variant name, and their size in bytes.

Method Summary
`Instr` | `build(int pc, Operand[] ops)` The `build()` method constructs a new `Instr` instance with the given operands, checking the operands against the constraints that are specific to each instruction.
`java.lang.String` | `getName()` The `getName()` method returns the name of the instruction as a string.
`int` | `getSize()` The `getSize()` method returns the size of the instruction in bytes.
`java.lang.String` | `getVariant()` The `getVariant()` method returns the variant name of the instruction as a string.

Method Detail

### build

    public Instr build(int pc,
                       Operand[] ops)

  The `build()` method constructs a new `Instr` instance with the given operands, checking the operands against the constraints that are specific to each instruction.

  Parameters:
    `pc` - the address at which the instruction will be located
    `ops` - the operands to the instruction
  Returns:
    a new `Instr` instance representing the instruction with the given operands

### getSize

    public int getSize()

  The `getSize()` method returns the size of the instruction in bytes. Since each prototype corresponds to exactly one instruction variant, all instructions built by this prototype will have the same size.

  Returns:
    the size of the instruction in bytes

### getVariant

    public java.lang.String getVariant()

  The `getVariant()` method returns the variant name of the instruction as a string. Since instructions like load and store have multiple variants, they each have specific variant names to distinguish them internally in the core of Avrora. For example, for "ld x+, (addr)", the variant is "ldpi" (load with post increment), but the actual instruction is "ld", so this method will return "ldpi".

  Returns:
    the variant of the instruction that this prototype represents

### getName

    public java.lang.String getName()

  The `getName()` method returns the name of the instruction as a string. For instructions that are variants of instructions, this method returns the actual name of the instruction. For example, for "ld x+, (addr)", the variant is "ldpi" (load with post increment), but the actual instruction is "ld", so this method will return "ld".

  Returns:
    the name of the instruction

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD