aboutsummaryrefslogtreecommitdiff
path: root/c_emulator/riscv_sail.h
blob: 721f1802d08a63ca43b6c43941d333cf8d5ebd69 (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
/* Top-level interfaces to the Sail model.
   Ideally, this would be autogenerated.
 */

typedef int unit;
#define UNIT 0
typedef uint64_t mach_bits;

struct zMisa {mach_bits zMisa_chunk_0;};
struct zMisa zmisa;

void model_init(void);
void model_fini(void);

unit zinit_platform(unit);
unit zinit_sys(unit);
bool zstep(sail_int);
unit ztick_clock(unit);
unit ztick_platform(unit);
unit z_set_Misa_C(struct zMisa*, mach_bits);

#ifdef RVFI_DII
unit zrvfi_set_instr_packet(mach_bits);
mach_bits zrvfi_get_cmd(unit);
bool zrvfi_step(sail_int);
unit zrvfi_zzero_exec_packet(unit);
unit zrvfi_halt_exec_packet(unit);
void zrvfi_get_exec_packet(sail_bits *rop, unit);
#endif

extern mach_bits zxlen_val;
extern bool zhtif_done;
extern mach_bits zhtif_exit_code;
extern bool have_exception;

/* machine state */

extern uint32_t zcur_privilege;

extern mach_bits zPC;

extern mach_bits
        zx1,  zx2,  zx3,  zx4,  zx5,  zx6,  zx7,
  zx8,  zx9,  zx10, zx11, zx12, zx13, zx14, zx15,
  zx16, zx17, zx18, zx19, zx20, zx21, zx22, zx23,
  zx24, zx25, zx26, zx27, zx28, zx29, zx30, zx31;

extern mach_bits zmstatus;
extern mach_bits zmepc, zmtval;
extern mach_bits zsepc, zstval;

struct zMcause {mach_bits zMcause_chunk_0;};
struct zMcause zmcause, zscause;

extern mach_bits zminstret;