Class ExtendedInstruction

java.lang.Object
mars.mips.instructions.Instruction
mars.mips.instructions.ExtendedInstruction

public class ExtendedInstruction extends Instruction
Representation of an extended instruction, also known as a pseudo-instruction. Unlike basic instructions, extended instructions do not exist at the hardware level. Instead, the assembler expands them into one or more basic instructions which carry out the intended behavior.
Author:
Pete Sanderson, August 2003
See Also:
  • Constructor Details

    • ExtendedInstruction

      public ExtendedInstruction(String mnemonic, List<OperandType> operandTypes, String title, String description)
      Create a new ExtendedInstruction.
      Parameters:
      mnemonic - The instruction mnemonic used in assembly code (case-insensitive).
      operandTypes - The list of operand types for this instruction, which is used to select a specific instruction from the group of instructions sharing a mnemonic.
      title - The "long name" of this instruction, which should relate to the mnemonic.
      description - A short human-readable description of what this instruction does when executed.
  • Method Details

    • hasCompactVariant

      public boolean hasCompactVariant()
      Determine whether or not this pseudo-instruction has a second translation optimized for 16 bit address space: a compact version.
    • getStandardExpansionTemplate

      public ExpansionTemplate getStandardExpansionTemplate()
      Get ArrayList of Strings that represent list of templates for basic instructions generated by this extended instruction.
      Returns:
      ArrayList of Strings.
    • setStandardExpansionTemplate

      public void setStandardExpansionTemplate(ExpansionTemplate template)
    • getCompactExpansionTemplate

      public ExpansionTemplate getCompactExpansionTemplate()
      Get ArrayList of Strings that represent list of templates for basic instructions generated by the "compact" or 16-bit version of this extended instruction.
      Returns:
      ArrayList of Strings. Returns null if the instruction does not have a compact alternative.
    • setCompactExpansionTemplate

      public void setCompactExpansionTemplate(ExpansionTemplate template)
    • getExpansionTemplate

      public ExpansionTemplate getExpansionTemplate()
    • getSizeBytes

      public int getSizeBytes()
      Get length in bytes that this extended instruction requires in its binary form. The answer depends on how many basic instructions it expands to. This may vary, if expansion includes a nop, depending on whether or not delayed branches are enabled. Each requires 4 bytes.
      Specified by:
      getSizeBytes in class Instruction
      Returns:
      int length in bytes of corresponding binary instruction(s).