Package mars.mips.instructions
Class ExtendedInstruction
java.lang.Object
mars.mips.instructions.Instruction
mars.mips.instructions.ExtendedInstruction
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:
-
Field Summary
Fields inherited from class mars.mips.instructions.Instruction
BYTES_PER_INSTRUCTION, INSTRUCTION_LENGTH_BITS
-
Constructor Summary
ConstructorsConstructorDescriptionExtendedInstruction
(String mnemonic, List<OperandType> operandTypes, String title, String description) Create a newExtendedInstruction
. -
Method Summary
Modifier and TypeMethodDescriptionGet ArrayList of Strings that represent list of templates for basic instructions generated by the "compact" or 16-bit version of this extended instruction.int
Get length in bytes that this extended instruction requires in its binary form.Get ArrayList of Strings that represent list of templates for basic instructions generated by this extended instruction.boolean
Determine whether or not this pseudo-instruction has a second translation optimized for 16 bit address space: a compact version.void
setCompactExpansionTemplate
(ExpansionTemplate template) void
Methods inherited from class mars.mips.instructions.Instruction
acceptsOperands, acceptsOperandsLoosely, formatOperands, formatSyntax, generateExampleOperands, getAlignedExampleSyntax, getDescription, getExampleOperands, getExampleSyntax, getMnemonic, getOperandTypes, getTitle
-
Constructor Details
-
ExtendedInstruction
public ExtendedInstruction(String mnemonic, List<OperandType> operandTypes, String title, String description) Create a newExtendedInstruction
.- 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
Get ArrayList of Strings that represent list of templates for basic instructions generated by this extended instruction.- Returns:
- ArrayList of Strings.
-
setStandardExpansionTemplate
-
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
-
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 classInstruction
- Returns:
- int length in bytes of corresponding binary instruction(s).
-