Package mars.mips.instructions
Class InstructionSet
java.lang.Object
mars.mips.instructions.InstructionSet
The list of Instruction objects, each of which represents a MIPS instruction.
The instruction may either be basic (translates into binary machine code) or
extended (translates into sequence of one or more basic instructions).
- Version:
- August 2003-5
- Author:
- Pete Sanderson and Ken Vollmar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindByBinaryCode(int binaryInstr)Retrieve the current instruction set.matchOperator(String name)Given an operator mnemonic, will return the corresponding Instruction object(s) from the instruction set.voidpopulate()Adds all instructions to the set.prefixMatchOperator(String name)Given a string, will return the Instruction object(s) from the instruction set whose operator mnemonic prefix matches it.
-
Constructor Details
-
InstructionSet
public InstructionSet()Creates a new InstructionSet object.
-
-
Method Details
-
getInstructionList
Retrieve the current instruction set. -
populate
public void populate()Adds all instructions to the set. A given extended instruction may have more than one Instruction object, depending on how many formats it can have.- See Also:
Instruction,BasicInstruction,ExtendedInstruction
-
findByBinaryCode
-
matchOperator
Given an operator mnemonic, will return the corresponding Instruction object(s) from the instruction set. Uses straight linear search technique.- Parameters:
name- operator mnemonic (e.g. addi, sw,...)- Returns:
- list of corresponding Instruction object(s), or null if not found.
-
prefixMatchOperator
Given a string, will return the Instruction object(s) from the instruction set whose operator mnemonic prefix matches it. Case-insensitive. For example "s" will match "sw", "sh", "sb", etc. Uses straight linear search technique.- Parameters:
name- a string- Returns:
- list of matching Instruction object(s), or null if none match.
-