-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassify.cc
67 lines (65 loc) · 1.92 KB
/
classify.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "mipsim.hpp"
vector<string> opmap = vector<string>(OP_UNDEFINED + 1,
string("OP_UNDEFINED"));
vector<string> spmap = vector<string>(SP_UNDEFINED + 1,
string("SP_UNDEFINED"));
string opToString(const Op op) {
return opmap[op];
}
string spToString(const Special sp) {
return spmap[sp];
}
void op_init() {
opmap[OP_SPECIAL] = "OP_SPECIAL";
opmap[OP_REGIMM] = "OP_REGIMM";
opmap[OP_J] = "OP_J"; //Implemented, not tested
opmap[OP_JAL] = "OP_JAL";
opmap[OP_BEQ] = "OP_BEQ";
opmap[OP_BNE] = "OP_BNE";
opmap[OP_BLEZ] = "OP_BLEZ";
opmap[OP_BGTZ] = "OP_BGTZ";
opmap[OP_ADDI] = "OP_ADDI";
opmap[OP_ADDIU] = "OP_ADDIU"; //Given
opmap[OP_SLTI] = "OP_SLTI";
opmap[OP_SLTIU] = "OP_SLTIU";
opmap[OP_ANDI] = "OP_ANDI";
opmap[OP_ORI] = "OP_ORI";
opmap[OP_XORI] = "OP_XORI";
opmap[OP_LUI] = "OP_LUI";
opmap[OP_LB] = "OP_LB";
opmap[OP_LH] = "OP_LH";
opmap[OP_LW] = "OP_LW"; //Given
opmap[OP_LBU] = "OP_LBU";
opmap[OP_LHU] = "OP_LHU";
opmap[OP_SB] = "OP_SB";
opmap[OP_SH] = "OP_SH";
opmap[OP_SW] = "OP_SW"; //Given
opmap[OP_SBU] = "OP_SBU";
opmap[OP_SHU] = "OP_SHU";
spmap[SP_SLL] = "SP_SLL"; //Given
spmap[SP_SRL] = "SP_SRL";
spmap[SP_SRA] = "SP_SRA";
spmap[SP_SLLV] = "SP_SLLV";
spmap[SP_SRLV] = "SP_SRLV";
spmap[SP_SRAV] = "SP_SRAV";
spmap[SP_JR] = "SP_JR";
spmap[SP_JALR] = "SP_JALR";
spmap[SP_MFHI] = "SP_MFHI";
spmap[SP_MTHI] = "SP_MTHI";
spmap[SP_MFLO] = "SP_MFLO";
spmap[SP_MTLO] = "SP_MTLO";
spmap[SP_MULT] = "SP_MULT";
spmap[SP_MULTU] = "SP_MULTU";
spmap[SP_DIV] = "SP_DIV";
spmap[SP_DIVU] = "SP_DIVU";
spmap[SP_ADD] = "SP_ADD";
spmap[SP_ADDU] = "SP_ADDU"; //Given
spmap[SP_SUB] = "SP_SUB";
spmap[SP_SUBU] = "SP_SUBU";
spmap[SP_AND] = "SP_AND";
spmap[SP_OR] = "SP_OR";
spmap[SP_XOR] = "SP_XOR";
spmap[SP_NOR] = "SP_NOR";
spmap[SP_SLT] = "SP_SLT";
spmap[SP_SLTU] = "SP_SLTU";
}