|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAsm
Inst
public class Inst
Inst class. Represents a generic instruction (ALU, memory, branch, jump, load immediate, system call).
Field Summary | |
---|---|
protected boolean |
limmFlag
Flag indicating whether long immediate field is an immediate (true) or label (false) |
protected int |
limmImm
Long immediate field as an immediate (int). |
protected java.lang.String |
limmLabel
Long immediate field as a label (string). |
protected int |
opcode
Opcode of the instruction. |
protected int |
ra
Register identifier for the destination register (in the RA slot). |
protected int |
rb
Register identifier for the first source register (in the RB slot). |
protected int |
rc
Register identifier for the second source register (in the RC slot). |
protected int |
simm
Short immediate field (int). |
Fields inherited from class Asm |
---|
addr, lineNumber |
Constructor Summary | |
---|---|
Inst(int opcode,
java.lang.String ra,
java.lang.String rb,
java.lang.String rc,
java.lang.String simm,
java.lang.String limm,
int lineNumber)
Instruction constructor. |
Method Summary | |
---|---|
boolean |
getLIMMFlag()
Gets flag indicating whether LIMM is an int or label -- ultimately LIMM needs to be converted to an int. |
int |
getLIMMImm()
Gets LIMM as an immediate (int) for the instruction (note: LIMM is only applicable for certain instructions) See the ISA description for a list of operations and their respective operands. |
java.lang.String |
getLIMMLabel()
Gets LIMM as a label (string) for the instruction (note: LIMM is only applicable for certain instructions) See the ISA description for a list of operations and their respective operands. |
static java.lang.String |
getOp(int opcode)
Gets string representation of the operation (e.g., "add") from opcode See the ISA description for a list of operations and their respective opcodes. |
int |
getOpcode()
Returns the instruction's opcode. |
static int |
getOpcode(java.lang.String op)
Gets opcode from a string representation of the operation (e.g., "add") See the ISA description for a list of operations and their respective opcodes. |
int |
getRA()
Gets RA identifier for the instruction (note: RA is only applicable for certain instructions) See the ISA description for a list of operations and their respective operands. |
int |
getRB()
Gets RB identifier for the instruction (note: RB is only applicable for certain instructions) See the ISA description for a list of operations and their respective operands. |
int |
getRC()
Gets RC identifier for the instruction (note: RC is only applicable for certain instructions) See the ISA description for a list of operations and their respective operands. |
int |
getSIMM()
Gets SIMM immediate (int). |
boolean |
isALU()
Checks if instruction is an ALU instruction |
static boolean |
isALU(int opcode)
Checks if opcode is an ALU opcode |
boolean |
isBranch()
Checks if instruction is a branch instruction |
static boolean |
isBranch(int opcode)
Checks if opcode is a branch opcode |
boolean |
isExtended()
Checks if instruction is an extended instruction |
static boolean |
isExtended(int opcode)
Is this an extended instruction? |
boolean |
isJump()
Checks if instruction is a jump instruction |
static boolean |
isJump(int opcode)
Checks if opcode is a jump opcode |
boolean |
isLoadImm()
Checks if instruction is a load immediate instruction |
static boolean |
isLoadImm(int opcode)
Checks if opcode is a load immediate opcode |
boolean |
isMem()
Checks if instruction is a memory instruction |
static boolean |
isMem(int opcode)
Checks if opcode is a memory opcode |
boolean |
isSysCall()
Checks if instruction is a system call instruction |
static boolean |
isSysCall(int opcode)
Checks if opcode is a system call opcode |
boolean |
isSysRetn()
Checks if instruction is a system return instruction |
static boolean |
isSysRetn(int opcode)
Checks if opcode is a system return opcode |
void |
setLIMMImm(int limmImm)
Sets the LIMM immediate Note: this has to be done for all instructions using labels in place of LIMM immediate |
void |
setSIMMImm(int simm)
Sets the SIMM immediate Note: this may need to be done if supporting extended instructions (for short immediates that don't fit in 4 bits) |
Methods inherited from class Asm |
---|
getAddr, getLineNumber, setAddr |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int opcode
protected int ra
protected int rb
protected int rc
protected int simm
protected boolean limmFlag
protected int limmImm
protected java.lang.String limmLabel
Constructor Detail |
---|
public Inst(int opcode, java.lang.String ra, java.lang.String rb, java.lang.String rc, java.lang.String simm, java.lang.String limm, int lineNumber)
opcode
- numeric opcode for the instruction.ra
- RA register identifier.rb
- RB register identifier.rc
- RC register identifier.simm
- short immediate field (either an immediate or a label).limm
- long immediate field (either an immediate or a label).lineNumber
- line number of instruction.Method Detail |
---|
public int getOpcode()
public static int getOpcode(java.lang.String op)
op
- string representation of the operation
public static java.lang.String getOp(int opcode)
opcode
- opcode of instruction
public int getRA()
public int getRB()
public int getRC()
public int getSIMM()
public void setSIMMImm(int simm)
simm
- short immediatepublic boolean getLIMMFlag()
public int getLIMMImm()
public java.lang.String getLIMMLabel()
public void setLIMMImm(int limmImm)
limmImm
- LIMM as an immediate (int)public static boolean isALU(int opcode)
opcode
- opcode to check
public boolean isALU()
public static boolean isLoadImm(int opcode)
opcode
- opcode to check
public boolean isLoadImm()
public static boolean isBranch(int opcode)
opcode
- opcode to check
public boolean isBranch()
public static boolean isMem(int opcode)
opcode
- opcode to check
public boolean isMem()
public static boolean isJump(int opcode)
opcode
- opcode to check
public boolean isJump()
public static boolean isSysCall(int opcode)
opcode
- opcode to check
public boolean isSysCall()
public static boolean isSysRetn(int opcode)
opcode
- opcode to check
public boolean isSysRetn()
public static boolean isExtended(int opcode)
opcode
- opcode to check
public boolean isExtended()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |