ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
RV32IMACFDGDBCore.h
Go to the documentation of this file.
1
10#ifndef ETISS_RV32IMACFDArch_RV32IMACFDGDBCORE_H_
11#define ETISS_RV32IMACFDArch_RV32IMACFDGDBCORE_H_
12
14#include <sstream>
15
34{
35 public:
36 std::string mapRegister(unsigned index)
37 {
38 if (index < 32)
39 {
40 std::stringstream ss;
41 ss << "X" << index;
42 return ss.str();
43 }
44 if ((32 < index) && (index < 65))
45 {
46 std::stringstream ss;
47 ss << "F" << (index - 33);
48 return ss.str();
49 }
50 if ((64 < index) && (index < 69))
51 { // FCSR
52 std::stringstream ss;
53 ss << "CSR" << (index - 65);
54 return ss.str();
55 }
56 switch (index)
57 {
58 case 0:
59 return "X0"; // zero
60 case 1:
61 return "X1"; // ra
62 case 2:
63 return "X2"; // sp
64 case 3:
65 return "X3"; // gp
66 case 4:
67 return "X4"; // tp
68 case 5:
69 return "X5"; // t0
70 case 6:
71 return "X6"; // t1
72 case 7:
73 return "X7"; // t2
74 case 8:
75 return "X8"; // fp
76 case 9:
77 return "X9"; // s1
78 case 10:
79 return "X10"; // a0
80 case 11:
81 return "X11"; // a1
82 case 12:
83 return "X12"; // a2
84 case 13:
85 return "X13"; // a3
86 case 14:
87 return "X14"; // a4
88 case 15:
89 return "X15"; // a5
90 case 16:
91 return "X16"; // a6
92 case 17:
93 return "X17"; // a7
94 case 18:
95 return "X18"; // s2
96 case 19:
97 return "X19"; // s3
98 case 20:
99 return "X20"; // s4
100 case 21:
101 return "X21"; // s5
102 case 22:
103 return "X22"; // s6
104 case 23:
105 return "X23"; // s7
106 case 24:
107 return "X24"; // s8
108 case 25:
109 return "X25"; // s9
110 case 26:
111 return "X26"; // s10
112 case 27:
113 return "X27"; // s11
114 case 28:
115 return "X28"; // t3
116 case 29:
117 return "X29"; // t4
118 case 30:
119 return "X30"; // t5
120 case 31:
121 return "X31"; // t6
122 case 32:
123 return "instructionPointer"; // pc
124 case 33:
125 return "F0"; // ft0
126 case 34:
127 return "F1"; // ft1
128 case 35:
129 return "F2"; // ft2
130 case 36:
131 return "F3"; // ft3
132 case 37:
133 return "F4"; // ft4
134 case 38:
135 return "F5"; // ft5
136 case 39:
137 return "F6"; // ft6
138 case 40:
139 return "F7"; // ft7
140 case 41:
141 return "F8"; // fs0
142 case 42:
143 return "F9"; // fs1
144 case 43:
145 return "F10"; // fa0
146 case 44:
147 return "F11"; // fa1
148 case 45:
149 return "F12"; // fa2
150 case 46:
151 return "F13"; // fa3
152 case 47:
153 return "F14"; // fa4
154 case 48:
155 return "F15"; // fa5
156 case 49:
157 return "F16"; // fa6
158 case 50:
159 return "F17"; // fa7
160 case 51:
161 return "F18"; // fs2
162 case 52:
163 return "F19"; // fs3
164 case 53:
165 return "F20"; // fs4
166 case 54:
167 return "F21"; // fs5
168 case 55:
169 return "F22"; // fs6
170 case 56:
171 return "F23"; // fs7
172 case 57:
173 return "F24"; // fs8
174 case 58:
175 return "F25"; // fs9
176 case 59:
177 return "F26"; // fs10
178 case 60:
179 return "F27"; // fs11
180 case 61:
181 return "F28"; // ft8
182 case 62:
183 return "F29"; // ft9
184 case 63:
185 return "F30"; // ft10
186 case 64:
187 return "F31"; // ft11
188 case 66:
189 return "CSR1"; // fflags
190 case 67:
191 return "CSR2"; // frm
192 case 68:
193 return "CSR3"; // fcsr
194 case 3923:
195 return "CSR3858"; // marchid
196 case 3924:
197 return "CSR3859"; // mimpid
198 case 3925:
199 return "CSR3860"; // mhartid
200 case 833:
201 return "CSR768"; // mstatus
202 case 834:
203 return "CSR769"; // misa
204 case 835:
205 return "CSR770"; // medeleg
206 case 836:
207 return "CSR771"; // mideleg
208 case 837:
209 return "CSR772"; // mie
210 case 838:
211 return "CSR773"; // mtvec
212 case 839:
213 return "CSR774"; // mcounteren
214 case 897:
215 return "CSR832"; // mscratch
216 case 898:
217 return "CSR833"; // mepc
218 case 899:
219 return "CSR834"; // mcause
220 case 900:
221 return "CSR835"; // mtval
222 case 901:
223 return "CSR836"; // mip
224 case 2881:
225 return "CSR2816"; // mcycle
226 case 3009:
227 return "CSR2944"; // mcycleh
228 case 2883:
229 return "CSR2818"; // minstret
230 case 3011:
231 return "CSR2946"; // minstreth
232 case 3137:
233 return "CSR3072"; // cycle
234 case 3265:
235 return "CSR3200"; // cycleh
236 case 3138:
237 return "CSR3073"; // time
238 case 3266:
239 return "CSR3201"; // timeh
240 case 3139:
241 return "CSR3074"; // instret
242 case 3267:
243 return "CSR3202"; // instreth
244 /**************************************************************************
245 * Further register should be added here to send data over gdbserver *
246 **************************************************************************/
247 }
248 return "";
249 }
250
251 unsigned mapRegister(std::string name) { return INVALIDMAPPING; }
252
254 {
255 // Modify according to sent register number
256 return 33;
257 }
258
259 etiss::uint64 getInstructionPointer(ETISS_CPU *cpu) { return cpu->instructionPointer; }
260
262 {
263 // Modify according to RV32IMACFD manual
264 return true;
265 }
266};
267
268#endif
Generated on Fri, 19 Jun 2026 11:48:00 +0000.
unsigned mapRegister(std::string name)
returns the index of the given register name in the list of registers as defined by gdb.
unsigned mappedRegisterCount()
returns the number of registers in the gdb defined register list
etiss::uint64 getInstructionPointer(ETISS_CPU *cpu)
allows to calculate the index of the instruction to be executed for breakpoint checks.
bool isLittleEndian()
returns true if the values are expected to be little endian
std::string mapRegister(unsigned index)
the returned string identifies the register at the given index as defined by gdb.
provides to architecture dependent registers as defined by gdb
Definition GDBCore.h:39
static const unsigned INVALIDMAPPING
Definition GDBCore.h:70
basic cpu state structure needed for execution of any cpu architecture.
Definition CPU.h:51
etiss_uint64 instructionPointer
pointer to next instruction.
Definition CPU.h:54