-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnamespace.hpp
89 lines (82 loc) · 2.1 KB
/
namespace.hpp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <deque>
#include <sstream>
namespace yujie6 {
/*
* op_code
*/
const int OP_REG = 0x33; // 0110011
const int OP_IMM = 0x13; // 0010011
const int OP_LUI = 0x37; // 0110100
const int OP_BRANCH = 0x63;// 1100011
const int OP_STORE = 0x23; // 0100011
const int OP_LOAD = 0x03; // 0000011
const int OP_SYSTEM = 0x73;// 1110011
const int OP_AUIPC = 0x17; // 0010111
const int OP_JAL = 0x6F; // 1101111
const int OP_JALR = 0x67; // 1100111
const int OP_IMM32 = 0x1B; // 0011011
const int OP_32 = 0x3B; // 0111011
const char *INSTNAME[]{
"lui", "auipc", "jal", "jalr", "beq", "bne", "blt", "bge", "bltu",
"bgeu", "lb", "lh", "lw", "ld", "lbu", "lhu", "sb", "sh",
"sw", "sd", "addi", "slti", "sltiu", "xori", "ori", "andi", "slli",
"srli", "srai", "add", "sub", "sll", "slt", "sltu", "xor", "srl",
"sra", "or", "and", "ecall", "addiw", "mul", "mulh", "div", "rem",
"lwu", "slliw", "srliw", "sraiw", "addw", "subw", "sllw", "srlw", "sraw",
};
enum Inst {
LUI = 0,
AUIPC = 1,
JAL = 2,
JALR = 3,
BEQ = 4,
BNE = 5,
BLT = 6,
BGE = 7,
BLTU = 8,
BGEU = 9,
LB = 10,
LH = 11,
LW = 12,
LD = 13,
LBU = 14,
LHU = 15,
SB = 16,
SH = 17,
SW = 18,
SD = 19,
ADDI = 20,
SLTI = 21,
SLTIU = 22,
XORI = 23,
ORI = 24,
ANDI = 25,
SLLI = 26,
SRLI = 27,
SRAI = 28,
ADD = 29,
SUB = 30,
SLL = 31,
SLT = 32,
SLTU = 33,
XOR = 34,
SRL = 35,
SRA = 36,
OR = 37,
AND = 38,
ECALL = 39,
ADDIW = 40,
MUL = 41,
MULH = 42,
DIV = 43,
REM = 44,
LWU = 45,
CSRRW = 46,
CSRRS = 47,
CSRRC = 48,
CSRRWI = 49,
CSRRSI = 50,
CSRRCI = 51,
UNKNOWN = -1,
};
}