Package mars.mips.instructions
Class Instruction
java.lang.Object
mars.mips.instructions.Instruction
- Direct Known Subclasses:
BasicInstruction
,ExtendedInstruction
Base class to represent member of MIPS instruction set.
- Version:
- August 2003
- Author:
- Pete Sanderson and Ken Vollmar
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Length in bytes of a machine instruction.static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Instruction
(String mnemonic, List<OperandType> operandTypes, String title, String description) -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsOperands
(List<OperandType> givenTypes) boolean
acceptsOperandsLoosely
(List<OperandType> givenTypes) static String
formatOperands
(List<OperandType> operandTypes, List<String> operands) static String
formatSyntax
(String mnemonic, List<OperandType> operandTypes, List<String> operands, boolean align) generateExampleOperands
(String mnemonic, List<OperandType> operandTypes) Get string describing the instruction.Get operation mnemonicabstract int
Get length in bytes that this instruction requires in its binary form.getTitle()
-
Field Details
-
BYTES_PER_INSTRUCTION
public static final int BYTES_PER_INSTRUCTIONLength in bytes of a machine instruction.- See Also:
-
INSTRUCTION_LENGTH_BITS
public static final int INSTRUCTION_LENGTH_BITS- See Also:
-
-
Constructor Details
-
Instruction
protected Instruction(String mnemonic, List<OperandType> operandTypes, String title, String description)
-
-
Method Details
-
getMnemonic
Get operation mnemonic- Returns:
- operation mnemonic (e.g. addi, sw)
-
getOperandTypes
-
getTitle
-
getDescription
Get string describing the instruction. This is not used internally by MARS, but is for display to the user.- Returns:
- String describing the instruction.
-
getExampleOperands
-
getAlignedExampleSyntax
-
getExampleSyntax
-
getSizeBytes
public abstract int getSizeBytes()Get length in bytes that this instruction requires in its binary form.- Returns:
- int length in bytes of corresponding binary instruction(s).
-
acceptsOperands
-
acceptsOperandsLoosely
-
formatSyntax
-
formatOperands
-
generateExampleOperands
-