OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [coreservices/] [isocinfo.h] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      SOC Information interface.
6
 */
7
 
8
#ifndef __DEBUGGER_ISOCINFO_H__
9
#define __DEBUGGER_ISOCINFO_H__
10
 
11
#include "iface.h"
12
#include "attribute.h"
13
 
14
namespace debugger {
15
 
16
static const char *IFACE_SOC_INFO = "ISocInfo";
17
 
18
static const int CFG_NASTI_MASTER_CACHED    = 0;
19
static const int CFG_NASTI_MASTER_UNCACHED  = 1;
20
static const int CFG_NASTI_MASTER_ETHMAC    = 2;
21
static const int CFG_NASTI_MASTER_TOTAL     = 3;
22
 
23
static const uint16_t MST_DID_EMPTY            = 0x7755;
24
static const uint16_t SLV_DID_EMPTY            = 0x5577;
25
 
26
static const uint16_t VENDOR_GNSSSENSOR        = 0x00F1;
27
// Masters IDs
28
static const uint16_t RISCV_CACHED_TILELINK    = 0x0500;
29
static const uint16_t RISCV_UNCACHED_TILELINK  = 0x0501;
30
static const uint16_t GAISLER_ETH_MAC_MASTER   = 0x0502;
31
static const uint16_t GAISLER_ETH_EDCL_MASTER  = 0x0503;
32
static const uint16_t RISCV_RIVER_CPU          = 0x0505;
33
 
34
// Slaves IDs
35
static const uint16_t GNSSSENSOR_ENGINE_STUB   = 0x0068;
36
static const uint16_t GNSSSENSOR_FSE_V2_GPS    = 0x0069;
37
static const uint16_t GNSSSENSOR_FSE_V2_GLO    = 0x006a;
38
static const uint16_t GNSSSENSOR_FSE_V2_GAL    = 0x006c;
39
static const uint16_t GNSSSENSOR_BOOTROM       = 0x0071;
40
static const uint16_t GNSSSENSOR_FWIMAGE       = 0x0072;
41
static const uint16_t GNSSSENSOR_SRAM          = 0x0073;
42
static const uint16_t GNSSSENSOR_PNP           = 0x0074;
43
static const uint16_t GNSSSENSOR_SPI_FLASH     = 0x0075;
44
static const uint16_t GNSSSENSOR_GPIO          = 0x0076;
45
static const uint16_t GNSSSENSOR_RF_CONTROL    = 0x0077;
46
static const uint16_t GNSSSENSOR_ENGINE        = 0x0078;
47
static const uint16_t GNSSSENSOR_UART          = 0x007a;
48
static const uint16_t GNSSSENSOR_ACCELEROMETER = 0x007b;
49
static const uint16_t GNSSSENSOR_GYROSCOPE     = 0x007c;
50
static const uint16_t GNSSSENSOR_IRQCTRL       = 0x007d;
51
static const uint16_t GNSSSENSOR_ETHMAC        = 0x007f;
52
static const uint16_t GNSSSENSOR_DSU           = 0x0080;
53
static const uint16_t GNSSSENSOR_GPTIMERS      = 0x0081;
54
 
55
static const uint32_t PNP_CFG_TYPE_INVALID     = 0;
56
static const uint32_t PNP_CFG_TYPE_MASTER      = 1;
57
static const uint32_t PNP_CFG_TYPE_SLAVE       = 2;
58
 
59
static const uint32_t TECH_INFERRED            = 0;
60
static const uint32_t TECH_VIRTEX6             = 36;
61
static const uint32_t TECH_KINTEX7             = 49;
62
 
63
typedef struct MasterConfigType {
64
    union DescrType {
65
        struct bits_type {
66
            uint32_t descrsize : 8;
67
            uint32_t descrtype : 2;
68
            uint32_t rsrv : 14;
69
            uint32_t xindex : 8;
70
        } bits;
71
        uint32_t val;
72
    } descr;
73
    uint16_t did;
74
    uint16_t vid;
75
} MasterConfigType;
76
 
77
typedef struct SlaveConfigType {
78
    union DescrType {
79
        struct bits_type {
80
            uint32_t descrsize : 8;
81
            uint32_t descrtype : 2;
82
            uint32_t bar_total : 2;
83
            uint32_t rsrv1 : 4;
84
            uint32_t irq_idx : 8;
85
            uint32_t xindex : 8;
86
        } bits;
87
        uint32_t val;
88
    } descr;
89
    uint16_t did;
90
    uint16_t vid;
91
    uint32_t xmask;
92
    uint32_t xaddr;
93
} SlaveConfigType;
94
 
95
typedef struct PnpMapType {
96
    uint32_t hwid;              /// 0xfffff000: RO: HW ID
97
    uint32_t fwid;              /// 0xfffff004: RW: FW ID
98
    union TechType {
99
        struct bits_type {
100
            uint8_t tech;
101
            uint8_t slv_total;
102
            uint8_t mst_total;
103
            uint8_t adc_detect;
104
        } bits;
105
        uint32_t val;
106
    } tech;                     /// 0xfffff008: RO: technology index
107
    uint32_t rsrv1;             /// 0xfffff00c: 
108
    uint64_t idt;               /// 0xfffff010: 
109
    uint64_t malloc_addr;       /// 0xfffff018: RW: debuggind memalloc pointer 0x18
110
    uint64_t malloc_size;       /// 0xfffff020: RW: debugging memalloc size 0x20
111
    uint64_t fwdbg1;            /// 0xfffff028: RW: FW debug register
112
    uint64_t rsrv[2];           /// 0xfffff030, 0xfffff038
113
    uint8_t cfg_table[(1 << 12) - 0x40];/// 0xfffff040: RO: PNP configuration
114
} PnpMapType;
115
 
116
struct GpioType {
117
    union {
118
        struct MapType {
119
            uint32_t led;
120
            uint32_t dip;
121
        } map;
122
        uint64_t val[1];
123
        uint8_t buf[8];
124
    } u;
125
};
126
 
127
struct DsuMapType {
128
    // Base Address + 0x00000 (Region 0)
129
    uint64_t csr[1 << 12];
130
    // Base Address + 0x08000 (Region 1)
131
    union ureg_type {
132
        uint8_t buf[1 << (12 + 3)];
133
        struct regs_type {
134
            uint64_t iregs[32];     // integer registers
135
            uint64_t pc;            // index = 32
136
            uint64_t npc;           // index = 33
137
            uint64_t stack_trace_cnt; // index 34
138
            uint64_t rsrv1[128 - 35];
139
            uint64_t stack_trace_buf[1];
140
            uint64_t rsrv2[128 - 1];
141
            uint64_t instr_buf[4];  // index 256..259: Bits[63:0] (addr,instr)
142
            uint64_t dbg1[4];
143
        } v;
144
    } ureg;
145
    // Base Address + 0x10000 (Region 2)
146
    union udbg_type {
147
        uint8_t buf[1 << (12 + 3)];
148
        struct debug_region_type {
149
            union control_reg {
150
                uint64_t val;
151
                struct {
152
                    uint64_t halt     : 1;
153
                    uint64_t stepping : 1;
154
                    uint64_t breakpoint : 1;
155
                    uint64_t rsv1     : 1;
156
                    uint64_t core_id  : 16;
157
                    uint64_t rsv2     : 12;
158
                    uint64_t istate   : 2;  // [33:32] icache state
159
                    uint64_t rsv3     : 2;  // [35:34] 
160
                    uint64_t dstate   : 2;  // [37:36] dcache state
161
                    uint64_t rsv4     : 2;  // [39:38]
162
                    uint64_t cstate   : 2;  // [41:40] cachetop state
163
                    uint64_t rsv5     : 22;
164
                } bits;
165
            } control;
166
            uint64_t stepping_mode_steps;
167
            uint64_t clock_cnt;
168
            uint64_t executed_cnt;
169
            union breakpoint_control_reg {
170
                uint64_t val;
171
                struct {
172
                    /** Trap on instruction:
173
                     *      0 = Halt pipeline on ECALL instruction
174
                     *      1 = Generate trap on ECALL instruction
175
                     */
176
                    uint64_t trap_on_break : 1;
177
                    uint64_t rsv1          : 63;
178
                } bits;
179
            } br_ctrl;
180
            uint64_t add_breakpoint;
181
            uint64_t remove_breakpoint;
182
            /**
183
             * Don't fetch instruction from this address use specified
184
             * below instead.
185
             */
186
            uint64_t br_address_fetch;
187
            /**
188
             * True instruction value instead of injected one. Use this
189
             * instruction instead of memory.
190
             */
191
            uint64_t br_instr_fetch;
192
        } v;
193
    } udbg;
194
    // Base Address + 0x18000 (Region 3)
195
    union local_regs_type {
196
        uint8_t buf[1 << (12 + 3)];
197
        struct local_region_type {
198
            uint64_t soft_reset;
199
            uint64_t miss_access_cnt;
200
            uint64_t miss_access_addr;
201
            uint64_t rsrv[5];
202
            // Bus utilization registers
203
            struct mst_bus_util_type {
204
                uint64_t w_cnt;
205
                uint64_t r_cnt;
206
            } bus_util[CFG_NASTI_MASTER_TOTAL];
207
        } v;
208
    } ulocal;
209
};
210
 
211
 
212
const uint64_t REG_ADDR_ERROR = 0xFFFFFFFFFFFFFFFFull;
213
 
214
class ISocInfo : public IFace {
215
public:
216
    ISocInfo() : IFace(IFACE_SOC_INFO) {}
217
 
218
    virtual unsigned getMastersTotal() =0;
219
    virtual unsigned getSlavesTotal() =0;
220
    virtual unsigned getRegsTotal() =0;
221
    virtual void getRegsList(AttributeType *lst) =0;
222
    virtual unsigned getCsrTotal() =0;
223
    virtual void getCsrList(AttributeType *lst) =0;
224
    virtual uint64_t csr2addr(const char *name) =0;
225
    virtual uint64_t reg2addr(const char *name) =0;
226
 
227
    virtual DsuMapType *getpDsu() =0;
228
 
229
    virtual uint64_t addressPlugAndPlay() =0;
230
    virtual uint64_t addressGpio() =0;
231
};
232
 
233
}  // namespace debugger
234
 
235
#endif  // __DEBUGGER_ISOCINFO_H__

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.