|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--asm.AsmIns
Represents a single assembly instruction. In writing this, I've come to realize that the MIPS instruction set is not so regular after all...
Field Summary | |
(package private) static java.util.Map |
funcMap
Maps mnemonic -> integer (func field) |
(package private) static java.util.Map |
funcValMap
Maps integer -> instruction mnemonic. |
(package private) int |
m_ins
|
(package private) boolean |
m_isJump
|
(package private) java.lang.String |
m_label
|
(package private) java.lang.String |
m_labelRef
|
(package private) int |
m_line
|
(package private) int |
m_num
|
(package private) static java.util.Map |
opMap
Maps mnemonic -> integer (opcode) |
(package private) static java.util.Map |
opValMap
Maps integer -> instruction mnemonic |
(package private) static java.util.Map |
regMap
Maps mnemonic -> integer (register number) |
(package private) static java.util.Map |
regValMap
Maps integer -> register name |
(package private) static java.util.Map |
typeMap
Maps opcode mnemonic (string) -> encoding type. |
Constructor Summary | |
AsmIns(int line,
java.lang.String labelRef)
Create a new instruction |
Method Summary | |
void |
addRefTo(java.util.Map refMap)
If this instruction makes a reference to a label, its index is entered into the reference map. |
static java.lang.String |
decodeIns(int ins)
Decode this instruction. |
void |
enc(java.lang.String op)
|
void |
encBType(java.lang.String op,
java.lang.String rs,
int imm)
Encode a one register branch instruction, eg: BGEZ |
void |
encIType(java.lang.String op,
java.lang.String rt,
java.lang.String rs,
int imm)
Encode as an Itype instruction: two register branches and immediat arithmetic instructions, and loads/stores |
void |
encJRType(java.lang.String op,
java.lang.String reg)
Encode as a JRtype instruction. |
void |
encJType(java.lang.String op,
int imm)
Encode as a Jtype instruction. |
void |
encRType(java.lang.String op,
java.lang.String rd,
java.lang.String rs,
java.lang.String rt)
Encode as an Rtype instruction. |
(package private) static void |
loadDecodeMap(java.util.Map map,
java.lang.String fileName)
DecodeMap must contains bindings Integer->String |
(package private) static void |
loadMap(java.util.Map map,
java.lang.String fileName)
|
void |
setNum(int num)
|
java.lang.String |
toString()
|
(package private) static int |
translateFunc(java.lang.String op)
|
(package private) static int |
translateOp(java.lang.String op)
|
(package private) static int |
translateReg(java.lang.String reg)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
int m_line
int m_ins
int m_num
java.lang.String m_labelRef
java.lang.String m_label
boolean m_isJump
static java.util.Map regMap
static java.util.Map opMap
static java.util.Map funcMap
static java.util.Map regValMap
static java.util.Map opValMap
static java.util.Map funcValMap
static java.util.Map typeMap
Constructor Detail |
public AsmIns(int line, java.lang.String labelRef)
Method Detail |
static void loadMap(java.util.Map map, java.lang.String fileName) throws java.io.IOException
java.io.IOException
static void loadDecodeMap(java.util.Map map, java.lang.String fileName) throws java.io.IOException
java.io.IOException
static int translateOp(java.lang.String op)
static int translateReg(java.lang.String reg)
static int translateFunc(java.lang.String op)
public static java.lang.String decodeIns(int ins)
public void setNum(int num)
public void addRefTo(java.util.Map refMap)
public java.lang.String toString()
toString
in class java.lang.Object
public void encRType(java.lang.String op, java.lang.String rd, java.lang.String rs, java.lang.String rt)
public void encIType(java.lang.String op, java.lang.String rt, java.lang.String rs, int imm)
public void encBType(java.lang.String op, java.lang.String rs, int imm)
public void encJType(java.lang.String op, int imm)
public void encJRType(java.lang.String op, java.lang.String reg)
public void enc(java.lang.String op)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |