blob: 26e49f39e3c150a98da4bad8c1be5e433ec10cb3 (
plain)
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
|
#ifndef _RISCV_PROCESSOR_H
#define _RISCV_PROCESSOR_H
#include "decode.h"
#include <cstring>
#include "trap.h"
#include "mmu.h"
class sim_t;
class processor_t
{
public:
processor_t(sim_t* _sim, char* _mem, size_t _memsz);
void init(uint32_t _id);
void step(size_t n, bool noisy);
private:
sim_t* sim;
// architected state
reg_t R[NGPR];
freg_t FR[NFPR];
// privileged control registers
reg_t pc;
reg_t epc;
reg_t badvaddr;
reg_t ebase;
reg_t pcr_k0;
reg_t pcr_k1;
uint32_t id;
uint32_t sr;
// unprivileged control registers
uint32_t tid;
uint32_t fsr;
// 32-bit or 64-bit mode (redundant with sr)
int gprlen;
// shared memory
mmu_t mmu;
// counters
reg_t counters[32];
// functions
void set_sr(uint32_t val);
void set_fsr(uint32_t val);
void take_trap(trap_t t, bool noisy);
void disasm(insn_t insn, reg_t pc);
friend class sim_t;
};
#endif
|