Update to new privileged spec
[riscv-isa-sim.git] / riscv / rocc.cc
1 #include "rocc.h"
2 #include "trap.h"
3 #include <cstdlib>
4
5 #define customX(n) \
6 static reg_t c##n(processor_t* p, insn_t insn, reg_t pc) \
7 { \
8 rocc_t* rocc = static_cast<rocc_t*>(p->get_extension()); \
9 rocc_insn_union_t u; \
10 u.i = insn; \
11 reg_t xs1 = u.r.xs1 ? RS1 : -1; \
12 reg_t xs2 = u.r.xs2 ? RS2 : -1; \
13 reg_t xd = rocc->custom##n(u.r, xs1, xs2); \
14 if (u.r.xd) \
15 WRITE_RD(xd); \
16 return pc+4; \
17 } \
18 \
19 reg_t rocc_t::custom##n(rocc_insn_t insn, reg_t xs1, reg_t xs2) \
20 { \
21 illegal_instruction(); \
22 return 0; \
23 }
24
25 customX(0)
26 customX(1)
27 customX(2)
28 customX(3)
29
30 std::vector<insn_desc_t> rocc_t::get_instructions()
31 {
32 std::vector<insn_desc_t> insns;
33 insns.push_back((insn_desc_t){0x0b, 0x7f, &::illegal_instruction, c0});
34 insns.push_back((insn_desc_t){0x2b, 0x7f, &::illegal_instruction, c1});
35 insns.push_back((insn_desc_t){0x5b, 0x7f, &::illegal_instruction, c2});
36 insns.push_back((insn_desc_t){0x7b, 0x7f, &::illegal_instruction, c3});
37 return insns;
38 }
39
40 std::vector<disasm_insn_t*> rocc_t::get_disasms()
41 {
42 std::vector<disasm_insn_t*> insns;
43 return insns;
44 }