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 4

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

powered by: WebSVN 2.1.0

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