OpenASIP  2.0
RISCVFields.hh
Go to the documentation of this file.
1 #ifndef RISCV_FIELDS_HH
2 #define RISCV_FIELDS_HH
3 
4 #include <map>
5 
6 const std::map<std::string, int> riscvRTypeOperations = {
7  {"add", 0b00000000000110011}, {"sub", 0b01000000000110011},
8  {"xor", 0b00000001000110011}, {"or", 0b00000001100110011},
9  {"and", 0b00000001110110011}, {"sll", 0b00000000010110011},
10  {"srl", 0b00000001010110011}, {"sra", 0b01000001010110011},
11  {"slt", 0b00000000100110011}, {"sltu", 0b00000000110110011},
12  {"mul", 0b00000010000110011}, {"mulh", 0b00000010010110011},
13  {"mulhu", 0b00000010110110011}, {"mulhsu", 0b00000010100110011},
14  {"div", 0b00000011000110011}, {"divu", 0b00000011010110011},
15  {"rem", 0b00000011100110011}, {"remu", 0b00000011110110011}};
16 
17 const std::map<std::string, int> riscvITypeOperations = {
18  {"addi", 0b0000010011}, {"xori", 0b1000010011},
19  {"ori", 0b1100010011}, {"andi", 0b1110010011},
20  {"slli", 0b00000000010010011}, {"srli", 0b00000001010010011},
21  {"srai", 0b01000001010010011}, {"slti", 0b0100010011},
22  {"sltiu", 0b0110010011}, {"lb", 0b0000000011},
23  {"lh", 0b0010000011}, {"lw", 0b0100000011},
24  {"lbu", 0b1000000011}, {"lhu", 0b1010000011},
25  {"jalr", 0b0001100111}};
26 
27 const std::map<std::string, int> riscvSTypeOperations = {
28  {"sb", 0b0000100011}, {"sh", 0b0010100011}, {"sw", 0b0100100011}};
29 
30 const std::map<std::string, int> riscvBTypeOperations = {
31  {"beq", 0b0001100011}, {"bne", 0b0011100011}, {"blt", 0b1001100011},
32  {"bge", 0b1011100011}, {"bltu", 0b1101100011}, {"bgeu", 0b1111100011}};
33 
34 const std::map<std::string, int> riscvUTypeOperations = {
35  {"lui", 0b0110111}, {"auipc", 0b0010111}};
36 
37 const std::map<std::string, int> riscvJTypeOperations = {{"jal", 0b1101111}};
38 
39 const std::map<std::string, std::string> operationNameTable = {
40  {"add", "add"}, {"sub", "sub"}, {"xor", "xor"},
41  {"or", "ior"}, {"sll", "shl"}, {"srl", "shru"},
42  {"sra", "shr"}, {"slt", "lt"}, {"sltu", "ltu"},
43  {"addi", "add"}, {"xori", "xor"}, {"ori", "ior"},
44  {"andi", "and"}, {"slli", "shl"}, {"srli", "shru"},
45  {"srai", "shr"}, {"slti", "lt"}, {"sltiu", "ltu"},
46  {"lb", "ald8"}, {"lh", "ald16"}, {"lw", "ald32"},
47  {"lbu", "aldu8"}, {"lhu", "aldu16"}, {"sb", "ast8"},
48  {"sh", "ast16"}, {"sw", "ast32"}, {"beq", "beqr"},
49  {"bne", "bner"}, {"blt", "bltr"}, {"bge", "bger"},
50  {"bltu", "bltur"}, {"bgeu", "bgeur"}, {"jal", "callr"},
51  {"jalr", "calla"}, {"lui", "move"}, {"auipc", "apc"},
52  {"mul", "mul"}, {"mulh", "mulhi"}, {"mulhsu", "mulhisu"},
53  {"mulhu", "mulhiu"}, {"rem", "rem"}, {"remu", "remu"},
54  {"div", "div"}, {"divu", "divu"}};
55 
56 const std::vector<std::string> mExtensionOps = {
57  "mul", "mulh", "mulhu", "mulhsu", "div", "divu", "rem", "remu"};
58 
59 #endif
riscvRTypeOperations
const std::map< std::string, int > riscvRTypeOperations
Definition: RISCVFields.hh:6
riscvSTypeOperations
const std::map< std::string, int > riscvSTypeOperations
Definition: RISCVFields.hh:27
mExtensionOps
const std::vector< std::string > mExtensionOps
Definition: RISCVFields.hh:56
riscvJTypeOperations
const std::map< std::string, int > riscvJTypeOperations
Definition: RISCVFields.hh:37
operationNameTable
const std::map< std::string, std::string > operationNameTable
Definition: RISCVFields.hh:39
riscvUTypeOperations
const std::map< std::string, int > riscvUTypeOperations
Definition: RISCVFields.hh:34
riscvBTypeOperations
const std::map< std::string, int > riscvBTypeOperations
Definition: RISCVFields.hh:30
riscvITypeOperations
const std::map< std::string, int > riscvITypeOperations
Definition: RISCVFields.hh:17