forked from pulp-platform/debug_bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_if.h
53 lines (37 loc) · 1.05 KB
/
debug_if.h
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
#ifndef DEBUG_IF_H
#define DEBUG_IF_H
#include "mem.h"
#include "log.h"
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#define DBG_CTRL_REG 0x0
#define DBG_HIT_REG 0x4
#define DBG_IE_REG 0x8
#define DBG_CAUSE_REG 0xC
#define DBG_NPC_REG 0x2000
#define DBG_PPC_REG 0x2004
#define DBG_CAUSE_BP 0x3
class DbgIF {
public:
DbgIF(MemIF* mem, unsigned int base_addr, LogIF *log);
void flush();
bool halt();
bool resume(bool step);
bool is_stopped();
bool write(unsigned int addr, uint32_t wdata);
bool read(unsigned int addr, uint32_t* rdata);
bool gpr_write(unsigned int addr, uint32_t wdata);
bool gpr_read_all(uint32_t* data);
bool gpr_read(unsigned int addr, uint32_t* data);
bool csr_write(unsigned int addr, uint32_t wdata);
bool csr_read(unsigned int addr, uint32_t* rdata);
unsigned int get_thread_id() { return m_thread_id; }
void get_name(char* str, size_t len);
private:
unsigned int m_base_addr;
unsigned int m_thread_id;
MemIF* m_mem;
LogIF *log;
};
#endif