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
|
// See LICENSE for license details.
#define DECODE_MACRO_USAGE_LOGGED 1
#include "decode_macros.h"
#include "rocc.h"
#include "trap.h"
#include <cstdlib>
#define customX(n) \
static reg_t c##n(processor_t* p, insn_t insn, reg_t pc) \
{ \
rocc_t* rocc = static_cast<rocc_t*>(p->get_extension()); \
rocc_insn_union_t u; \
u.i = insn; \
reg_t xs1 = u.r.xs1 ? RS1 : -1; \
reg_t xs2 = u.r.xs2 ? RS2 : -1; \
reg_t xd = rocc->custom##n(u.r, xs1, xs2); \
if (u.r.xd) \
WRITE_RD(xd); \
return pc+4; \
} \
\
reg_t rocc_t::custom##n(rocc_insn_t UNUSED insn, reg_t UNUSED xs1, reg_t UNUSED xs2) \
{ \
illegal_instruction(); \
return 0; \
}
customX(0)
customX(1)
customX(2)
customX(3)
std::vector<insn_desc_t> rocc_t::get_instructions()
{
std::vector<insn_desc_t> insns;
insns.push_back((insn_desc_t){0x0b, 0x7f,
&::illegal_instruction, c0, &::illegal_instruction, c0,
&::illegal_instruction, c0, &::illegal_instruction, c0});
insns.push_back((insn_desc_t){0x2b, 0x7f,
&::illegal_instruction, c1, &::illegal_instruction, c1,
&::illegal_instruction, c1, &::illegal_instruction, c1});
insns.push_back((insn_desc_t){0x5b, 0x7f,
&::illegal_instruction, c2, &::illegal_instruction, c2,
&::illegal_instruction, c2, &::illegal_instruction, c2});
insns.push_back((insn_desc_t){0x7b, 0x7f,
&::illegal_instruction, c3, &::illegal_instruction, c3,
&::illegal_instruction, c0, &::illegal_instruction, c3});
return insns;
}
std::vector<disasm_insn_t*> rocc_t::get_disasms()
{
std::vector<disasm_insn_t*> insns;
return insns;
}
|