gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
isa.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 RISC-V Foundation
3 * Copyright (c) 2016 The University of Virginia
4 * Copyright (c) 2020 Barkhausen Institut
5 * Copyright (c) 2022 Google LLC
6 * Copyright (c) 2024 University of Rostock
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are
11 * met: redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer;
13 * redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution;
16 * neither the name of the copyright holders nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include "arch/riscv/isa.hh"
34
35#include <ctime>
36#include <set>
37#include <sstream>
38
39#include "arch/riscv/faults.hh"
42#include "arch/riscv/mmu.hh"
44#include "arch/riscv/pmp.hh"
45#include "arch/riscv/pcstate.hh"
50#include "base/bitfield.hh"
51#include "base/compiler.hh"
52#include "base/logging.hh"
53#include "base/trace.hh"
54#include "cpu/base.hh"
55#include "debug/Checkpoint.hh"
56#include "debug/LLSC.hh"
57#include "debug/MatRegs.hh"
58#include "debug/RiscvMisc.hh"
59#include "debug/VecRegs.hh"
60#include "mem/packet.hh"
61#include "mem/request.hh"
62#include "params/RiscvISA.hh"
63#include "sim/pseudo_inst.hh"
64
65namespace gem5
66{
67
68namespace RiscvISA
69{
70
71[[maybe_unused]] const std::array<const char *, NUM_MISCREGS> MiscRegNames = {{
72 [MISCREG_PRV] = "PRV",
73 [MISCREG_ISA] = "ISA",
74 [MISCREG_VENDORID] = "VENDORID",
75 [MISCREG_ARCHID] = "ARCHID",
76 [MISCREG_IMPID] = "IMPID",
77 [MISCREG_HARTID] = "HARTID",
78 [MISCREG_STATUS] = "STATUS",
79 [MISCREG_IP] = "IP",
80 [MISCREG_IE] = "IE",
81 [MISCREG_CYCLE] = "CYCLE",
82 [MISCREG_TIME] = "TIME",
83 [MISCREG_INSTRET] = "INSTRET",
84 [MISCREG_HPMCOUNTER03] = "HPMCOUNTER03",
85 [MISCREG_HPMCOUNTER04] = "HPMCOUNTER04",
86 [MISCREG_HPMCOUNTER05] = "HPMCOUNTER05",
87 [MISCREG_HPMCOUNTER06] = "HPMCOUNTER06",
88 [MISCREG_HPMCOUNTER07] = "HPMCOUNTER07",
89 [MISCREG_HPMCOUNTER08] = "HPMCOUNTER08",
90 [MISCREG_HPMCOUNTER09] = "HPMCOUNTER09",
91 [MISCREG_HPMCOUNTER10] = "HPMCOUNTER10",
92 [MISCREG_HPMCOUNTER11] = "HPMCOUNTER11",
93 [MISCREG_HPMCOUNTER12] = "HPMCOUNTER12",
94 [MISCREG_HPMCOUNTER13] = "HPMCOUNTER13",
95 [MISCREG_HPMCOUNTER14] = "HPMCOUNTER14",
96 [MISCREG_HPMCOUNTER15] = "HPMCOUNTER15",
97 [MISCREG_HPMCOUNTER16] = "HPMCOUNTER16",
98 [MISCREG_HPMCOUNTER17] = "HPMCOUNTER17",
99 [MISCREG_HPMCOUNTER18] = "HPMCOUNTER18",
100 [MISCREG_HPMCOUNTER19] = "HPMCOUNTER19",
101 [MISCREG_HPMCOUNTER20] = "HPMCOUNTER20",
102 [MISCREG_HPMCOUNTER21] = "HPMCOUNTER21",
103 [MISCREG_HPMCOUNTER22] = "HPMCOUNTER22",
104 [MISCREG_HPMCOUNTER23] = "HPMCOUNTER23",
105 [MISCREG_HPMCOUNTER24] = "HPMCOUNTER24",
106 [MISCREG_HPMCOUNTER25] = "HPMCOUNTER25",
107 [MISCREG_HPMCOUNTER26] = "HPMCOUNTER26",
108 [MISCREG_HPMCOUNTER27] = "HPMCOUNTER27",
109 [MISCREG_HPMCOUNTER28] = "HPMCOUNTER28",
110 [MISCREG_HPMCOUNTER29] = "HPMCOUNTER29",
111 [MISCREG_HPMCOUNTER30] = "HPMCOUNTER30",
112 [MISCREG_HPMCOUNTER31] = "HPMCOUNTER31",
113 [MISCREG_HPMEVENT03] = "HPMEVENT03",
114 [MISCREG_HPMEVENT04] = "HPMEVENT04",
115 [MISCREG_HPMEVENT05] = "HPMEVENT05",
116 [MISCREG_HPMEVENT06] = "HPMEVENT06",
117 [MISCREG_HPMEVENT07] = "HPMEVENT07",
118 [MISCREG_HPMEVENT08] = "HPMEVENT08",
119 [MISCREG_HPMEVENT09] = "HPMEVENT09",
120 [MISCREG_HPMEVENT10] = "HPMEVENT10",
121 [MISCREG_HPMEVENT11] = "HPMEVENT11",
122 [MISCREG_HPMEVENT12] = "HPMEVENT12",
123 [MISCREG_HPMEVENT13] = "HPMEVENT13",
124 [MISCREG_HPMEVENT14] = "HPMEVENT14",
125 [MISCREG_HPMEVENT15] = "HPMEVENT15",
126 [MISCREG_HPMEVENT16] = "HPMEVENT16",
127 [MISCREG_HPMEVENT17] = "HPMEVENT17",
128 [MISCREG_HPMEVENT18] = "HPMEVENT18",
129 [MISCREG_HPMEVENT19] = "HPMEVENT19",
130 [MISCREG_HPMEVENT20] = "HPMEVENT20",
131 [MISCREG_HPMEVENT21] = "HPMEVENT21",
132 [MISCREG_HPMEVENT22] = "HPMEVENT22",
133 [MISCREG_HPMEVENT23] = "HPMEVENT23",
134 [MISCREG_HPMEVENT24] = "HPMEVENT24",
135 [MISCREG_HPMEVENT25] = "HPMEVENT25",
136 [MISCREG_HPMEVENT26] = "HPMEVENT26",
137 [MISCREG_HPMEVENT27] = "HPMEVENT27",
138 [MISCREG_HPMEVENT28] = "HPMEVENT28",
139 [MISCREG_HPMEVENT29] = "HPMEVENT29",
140 [MISCREG_HPMEVENT30] = "HPMEVENT30",
141 [MISCREG_HPMEVENT31] = "HPMEVENT31",
142 [MISCREG_TSELECT] = "TSELECT",
143 [MISCREG_TDATA1] = "TDATA1",
144 [MISCREG_TDATA2] = "TDATA2",
145 [MISCREG_TDATA3] = "TDATA3",
146 [MISCREG_DCSR] = "DCSR",
147 [MISCREG_DPC] = "DPC",
148 [MISCREG_DSCRATCH] = "DSCRATCH",
149
150 [MISCREG_MEDELEG] = "MEDELEG",
151 [MISCREG_MIDELEG] = "MIDELEG",
152 [MISCREG_MTVEC] = "MTVEC",
153 [MISCREG_MCOUNTEREN] = "MCOUNTEREN",
154 [MISCREG_MSCRATCH] = "MSCRATCH",
155 [MISCREG_MEPC] = "MEPC",
156 [MISCREG_MCAUSE] = "MCAUSE",
157 [MISCREG_MTVAL] = "MTVAL",
158 [MISCREG_PMPCFG0] = "PMPCFG0",
159 [MISCREG_PMPCFG1] = "PMPCFG1", // pmpcfg1 is rv32 only
160 [MISCREG_PMPCFG2] = "PMPCFG2",
161 [MISCREG_PMPCFG3] = "PMPCFG3", // pmpcfg3 is rv32 only
162 [MISCREG_PMPADDR00] = "PMPADDR00",
163 [MISCREG_PMPADDR01] = "PMPADDR01",
164 [MISCREG_PMPADDR02] = "PMPADDR02",
165 [MISCREG_PMPADDR03] = "PMPADDR03",
166 [MISCREG_PMPADDR04] = "PMPADDR04",
167 [MISCREG_PMPADDR05] = "PMPADDR05",
168 [MISCREG_PMPADDR06] = "PMPADDR06",
169 [MISCREG_PMPADDR07] = "PMPADDR07",
170 [MISCREG_PMPADDR08] = "PMPADDR08",
171 [MISCREG_PMPADDR09] = "PMPADDR09",
172 [MISCREG_PMPADDR10] = "PMPADDR10",
173 [MISCREG_PMPADDR11] = "PMPADDR11",
174 [MISCREG_PMPADDR12] = "PMPADDR12",
175 [MISCREG_PMPADDR13] = "PMPADDR13",
176 [MISCREG_PMPADDR14] = "PMPADDR14",
177 [MISCREG_PMPADDR15] = "PMPADDR15",
178
179 [MISCREG_SEDELEG] = "SEDELEG",
180 [MISCREG_SIDELEG] = "SIDELEG",
181 [MISCREG_STVEC] = "STVEC",
182 [MISCREG_SCOUNTEREN] = "SCOUNTEREN",
183 [MISCREG_SSCRATCH] = "SSCRATCH",
184 [MISCREG_SEPC] = "SEPC",
185 [MISCREG_SCAUSE] = "SCAUSE",
186 [MISCREG_STVAL] = "STVAL",
187 [MISCREG_SATP] = "SATP",
188 [MISCREG_SENVCFG] = "SENVCFG",
189
190 [MISCREG_UTVEC] = "UTVEC",
191 [MISCREG_USCRATCH] = "USCRATCH",
192 [MISCREG_UEPC] = "UEPC",
193 [MISCREG_UCAUSE] = "UCAUSE",
194 [MISCREG_UTVAL] = "UTVAL",
195 [MISCREG_FFLAGS] = "FFLAGS",
196 [MISCREG_FRM] = "FRM",
197
198 [MISCREG_VSTART] = "VSTART",
199 [MISCREG_VXSAT] = "VXSAT",
200 [MISCREG_VXRM] = "VXRM",
201 [MISCREG_VCSR] = "VCSR",
202 [MISCREG_VL] = "VL",
203 [MISCREG_VTYPE] = "VTYPE",
204 [MISCREG_VLENB] = "VLENB",
205
206 [MISCREG_NMIVEC] = "NMIVEC",
207 [MISCREG_NMIE] = "NMIE",
208 [MISCREG_NMIP] = "NMIP",
209 [MISCREG_MNSCRATCH] = "MNSCRATCH",
210 [MISCREG_MNEPC] = "MNEPC",
211 [MISCREG_MNCAUSE] = "MNCAUSE",
212 [MISCREG_MNSTATUS] = "MNSTATUS",
213
214 // following are rv32 only registers
215 [MISCREG_MSTATUSH] = "MSTATUSH",
216
217 [MISCREG_CYCLEH] = "CYCLEH",
218 [MISCREG_TIMEH] = "TIMEH",
219 [MISCREG_INSTRETH] = "INSTRETH",
220 [MISCREG_HPMCOUNTER03H] = "HPMCOUNTER03H",
221 [MISCREG_HPMCOUNTER04H] = "HPMCOUNTER04H",
222 [MISCREG_HPMCOUNTER05H] = "HPMCOUNTER05H",
223 [MISCREG_HPMCOUNTER06H] = "HPMCOUNTER06H",
224 [MISCREG_HPMCOUNTER07H] = "HPMCOUNTER07H",
225 [MISCREG_HPMCOUNTER08H] = "HPMCOUNTER08H",
226 [MISCREG_HPMCOUNTER09H] = "HPMCOUNTER09H",
227 [MISCREG_HPMCOUNTER10H] = "HPMCOUNTER10H",
228 [MISCREG_HPMCOUNTER11H] = "HPMCOUNTER11H",
229 [MISCREG_HPMCOUNTER12H] = "HPMCOUNTER12H",
230 [MISCREG_HPMCOUNTER13H] = "HPMCOUNTER13H",
231 [MISCREG_HPMCOUNTER14H] = "HPMCOUNTER14H",
232 [MISCREG_HPMCOUNTER15H] = "HPMCOUNTER15H",
233 [MISCREG_HPMCOUNTER16H] = "HPMCOUNTER16H",
234 [MISCREG_HPMCOUNTER17H] = "HPMCOUNTER17H",
235 [MISCREG_HPMCOUNTER18H] = "HPMCOUNTER18H",
236 [MISCREG_HPMCOUNTER19H] = "HPMCOUNTER19H",
237 [MISCREG_HPMCOUNTER20H] = "HPMCOUNTER20H",
238 [MISCREG_HPMCOUNTER21H] = "HPMCOUNTER21H",
239 [MISCREG_HPMCOUNTER22H] = "HPMCOUNTER22H",
240 [MISCREG_HPMCOUNTER23H] = "HPMCOUNTER23H",
241 [MISCREG_HPMCOUNTER24H] = "HPMCOUNTER24H",
242 [MISCREG_HPMCOUNTER25H] = "HPMCOUNTER25H",
243 [MISCREG_HPMCOUNTER26H] = "HPMCOUNTER26H",
244 [MISCREG_HPMCOUNTER27H] = "HPMCOUNTER27H",
245 [MISCREG_HPMCOUNTER28H] = "HPMCOUNTER28H",
246 [MISCREG_HPMCOUNTER29H] = "HPMCOUNTER29H",
247 [MISCREG_HPMCOUNTER30H] = "HPMCOUNTER30H",
248 [MISCREG_HPMCOUNTER31H] = "HPMCOUNTER31H",
249
250 [MISCREG_JVT] = "JVT",
251
252 [MISCREG_FFLAGS_EXE] = "FFLAGS_EXE",
253}};
254
255namespace
256{
257
258/* Not applicable to RISCV */
261 debug::IntRegs);
263RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
264
265} // anonymous namespace
266
267ISA::ISA(const Params &p) : BaseISA(p, "riscv"),
268 _rvType(p.riscv_type), enableRvv(p.enable_rvv), vlen(p.vlen), elen(p.elen),
269 _privilegeModeSet(p.privilege_mode_set),
270 _wfiResumeOnPending(p.wfi_resume_on_pending), _enableZcd(p.enable_Zcd),
271 _enableSmrnmi(p.enable_Smrnmi)
272{
273 _regClasses.push_back(&intRegClass);
274 _regClasses.push_back(&floatRegClass);
275 _regClasses.push_back(&vecRegClass);
276 _regClasses.push_back(&vecElemClass);
277 _regClasses.push_back(&vecPredRegClass);
278 _regClasses.push_back(&matRegClass);
279 _regClasses.push_back(&ccRegClass);
280 _regClasses.push_back(&miscRegClass);
281
282 fatal_if( p.vlen < p.elen,
283 "VLEN should be greater or equal",
284 "than ELEN. Ch. 2RISC-V vector spec.");
285
286 inform("RVV enabled, VLEN = %d bits, ELEN = %d bits",
287 p.vlen, p.elen);
288
289
291 clear();
292}
293
294bool ISA::inUserMode() const
295{
296 return miscRegFile[MISCREG_PRV] == PRV_U;
297}
298
299void
301{
302 // First loop through the integer registers.
303 for (auto &id: intRegClass)
304 tc->setReg(id, src->getReg(id));
305
306 // Second loop through the float registers.
307 for (auto &id: floatRegClass)
308 tc->setReg(id, src->getReg(id));
309
310 // Third loop through the vector registers.
312 for (auto &id: vecRegClass) {
313 src->getReg(id, &vc);
314 tc->setReg(id, &vc);
315 }
316
317 // Copying Misc Regs
318 for (int i = 0; i < NUM_PHYS_MISCREGS; i++)
319 tc->setMiscRegNoEffect(i, src->readMiscRegNoEffect(i));
320
321 // Lastly copy PC/NPC
322 tc->pcState(src->pcState());
323}
324
326{
327 std::fill(miscRegFile.begin(), miscRegFile.end(), 0);
328
333
334 MISA misa = 0;
335 STATUS status = 0;
336
337 // default config arch isa string is rv64(32)imafdc
338 misa.rvi = misa.rvm = misa.rva = misa.rvf = misa.rvd = misa.rvc = 1;
339
340 switch (getPrivilegeModeSet()) {
341 case enums::M:
342 break;
343 case enums::MU:
344 misa.rvu = 1;
345 break;
346 case enums::MNU:
347 misa.rvu = misa.rvn = 1;
348 break;
349 case enums::MSU:
350 misa.rvs = misa.rvu = 1;
351 break;
352 case enums::MNSU:
353 misa.rvs = misa.rvu = misa.rvn = 1;
354 break;
355 default:
356 panic("Privilege mode set config should not reach here");
357 }
358
359 // mark FS is initial
360 status.fs = INITIAL;
361
362 // _rvType dependent init.
363 switch (_rvType) {
364 case RV32:
365 misa.rv32_mxl = 1;
366 break;
367 case RV64:
368 misa.rv64_mxl = 2;
369 status.uxl = status.sxl = 2;
370 if (getEnableRvv()) {
372 misa.rvv = 1;
373 }
374 break;
375 default:
376 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
377 }
378
379 miscRegFile[MISCREG_ISA] = misa;
383 // don't set it to zero; software may try to determine the supported
384 // triggers, starting at zero. simply set a different value here.
387}
388
389bool
391{
392 int hpmcounter = 0;
393 if (misc_reg >= MISCREG_CYCLEH) {
394 hpmcounter = misc_reg - MISCREG_CYCLEH;
395 } else {
396 hpmcounter = misc_reg - MISCREG_CYCLE;
397 }
398
399 if (hpmcounter < 0 || hpmcounter > 31)
400 panic("Illegal HPM counter %d\n", hpmcounter);
401 int counteren;
403 case PRV_M:
404 return true;
405 case PRV_S:
406 counteren = MISCREG_MCOUNTEREN;
407 break;
408 case PRV_U:
409 counteren = MISCREG_SCOUNTEREN;
410 break;
411 default:
412 panic("Unknown privilege level %d\n", miscRegFile[MISCREG_PRV]);
413 return false;
414 }
415 return (miscRegFile[counteren] & (1ULL << (hpmcounter))) > 0;
416}
417
418RegVal
420{
421 // Illegal CSR
422 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
423 DPRINTF(RiscvMisc, "Reading MiscReg %s (%d): %#x.\n",
424 MiscRegNames[idx], idx, miscRegFile[idx]);
425 return miscRegFile[idx];
426}
427
428RegVal
430{
431 switch (idx) {
432 case MISCREG_HARTID:
433 return tc->contextId();
434 case MISCREG_CYCLE:
436 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
437 tc->getCpuPtr()->curCycle());
438 return static_cast<RegVal>(tc->getCpuPtr()->curCycle());
439 } else {
440 warn("Cycle counter disabled.\n");
441 return 0;
442 }
443 case MISCREG_CYCLEH:
445 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
446 tc->getCpuPtr()->curCycle());
447 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
448 } else {
449 warn("Cycle counter disabled.\n");
450 return 0;
451 }
452 case MISCREG_TIME:
454 DPRINTF(RiscvMisc, "Wall-clock counter at: %llu.\n",
455 std::time(nullptr));
457 } else {
458 warn("Wall clock disabled.\n");
459 return 0;
460 }
461 case MISCREG_TIMEH:
463 DPRINTF(RiscvMisc, "Wall-clock counter at: %llu.\n",
464 std::time(nullptr));
466 } else {
467 warn("Wall clock disabled.\n");
468 return 0;
469 }
470 case MISCREG_INSTRET:
472 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
473 tc->getCpuPtr()->totalInsts());
474 return static_cast<RegVal>(tc->getCpuPtr()->totalInsts());
475 } else {
476 warn("Instruction counter disabled.\n");
477 return 0;
478 }
479 case MISCREG_INSTRETH:
481 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
482 tc->getCpuPtr()->totalInsts());
483 return bits<RegVal>(tc->getCpuPtr()->totalInsts(), 63, 32);
484 } else {
485 warn("Instruction counter disabled.\n");
486 return 0;
487 }
488 case MISCREG_IP:
489 {
490 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
491 tc->getCpuPtr()->getInterruptController(tc->threadId()));
492 return ic->readIP();
493 }
494 case MISCREG_UIP:
495 {
498 return readMiscReg(MISCREG_IP) & mask;
499 }
500 case MISCREG_SIP:
501 {
503 return readMiscReg(MISCREG_IP) & mask;
504 }
505 case MISCREG_IE:
506 {
507 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
508 tc->getCpuPtr()->getInterruptController(tc->threadId()));
509 return ic->readIE();
510 }
511 case MISCREG_UIE:
512 {
515 return readMiscReg(MISCREG_IE) & mask;
516 }
517 case MISCREG_SIE:
518 {
520 return readMiscReg(MISCREG_IE) & mask;
521 }
522 case MISCREG_SEPC:
523 case MISCREG_MEPC:
524 case MISCREG_MNEPC:
525 {
526 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
527 auto val = readMiscRegNoEffect(idx);
528 // if compressed instructions are disabled, epc[1] is set to 0
529 if (misa.rvc == 0)
530 return mbits(val, 63, 2);
531 // epc[0] is always 0
532 else
533 return mbits(val, 63, 1);
534 }
535 case MISCREG_STATUS:
536 {
537 // Updating the SD bit.
538 // . Per RISC-V ISA Manual, vol II, section 3.1.6.6, page 26,
539 // the SD bit is a read-only bit indicating whether any of
540 // FS, VS, and XS fields being in the respective dirty state.
541 // . Per section 3.1.6, page 20, the SD bit is the most
542 // significant bit of the MSTATUS CSR for both RV32 and RV64.
543 // . Per section 3.1.6.6, page 29, the explicit formula for
544 // updating the SD is,
545 // SD = ((FS==DIRTY) | (XS==DIRTY) | (VS==DIRTY))
546 // . Ideally, we want to update the SD after every relevant
547 // instruction, however, lazily updating the Status register
548 // upon its read produces the same effect as well.
549 STATUS status = readMiscRegNoEffect(idx);
550 uint64_t sd_bit = \
551 (status.xs == 3) || (status.fs == 3) || (status.vs == 3);
552 // For RV32, the SD bit is at index 31
553 // For RV64, the SD bit is at index 63.
554 switch (_rvType) {
555 case RV32:
556 status.rv32_sd = sd_bit;
557 break;
558 case RV64:
559 status.rv64_sd = sd_bit;
560 break;
561 default:
562 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
563 }
564 // Check status.mpp
565 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
566 switch(status.mpp) {
567 case PRV_U:
568 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
569 break;
570 case PRV_S:
571 if (misa.rvs)
572 status.mpp = PRV_S;
573 else
574 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
575 break;
576 case PRV_M:
577 break;
578 default:
579 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
580 }
581
583
584 return readMiscRegNoEffect(idx);
585 }
586 case MISCREG_USTATUS:
587 {
590 }
591 case MISCREG_SSTATUS:
592 {
595 }
596 case MISCREG_VLENB:
597 {
598 return getVecLenInBytes();
599 }
600 case MISCREG_VTYPE:
601 {
602 auto rpc = tc->pcState().as<PCState>();
603 return rpc.vtype();
604 }
605 case MISCREG_VL:
606 {
607 auto rpc = tc->pcState().as<PCState>();
608 return (RegVal)rpc.vl();
609 }
610 case MISCREG_VCSR:
611 {
614 }
615 break;
616 case MISCREG_MNSTATUS:
617 {
618 NSTATUS nstatus = readMiscRegNoEffect(idx);
619 nstatus.nmie = readMiscRegNoEffect(MISCREG_NMIE);
620 // Check nstatus.mnpp
621 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
622 switch(nstatus.mnpp) {
623 case PRV_U:
624 nstatus.mnpp = (misa.rvu) ? PRV_U : PRV_M;
625 break;
626 case PRV_S:
627 if (misa.rvs)
628 nstatus.mnpp = PRV_S;
629 else
630 nstatus.mnpp = (misa.rvu) ? PRV_U : PRV_M;
631 break;
632 case PRV_M:
633 break;
634 default:
635 nstatus.mnpp = (misa.rvu) ? PRV_U : PRV_M;
636 }
637 return nstatus;
638 }
640 {
642 }
643 case MISCREG_FCSR:
644 {
647 }
648 default:
649 // Try reading HPM counters
650 // As a placeholder, all HPM counters are just cycle counters
651 if (idx >= MISCREG_HPMCOUNTER03 &&
652 idx <= MISCREG_HPMCOUNTER31) {
653 if (hpmCounterEnabled(idx)) {
654 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
655 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
656 return tc->getCpuPtr()->curCycle();
657 } else {
658 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
659 return 0;
660 }
661 } else if (idx >= MISCREG_HPMCOUNTER03H &&
662 idx <= MISCREG_HPMCOUNTER31H) {
663 if (hpmCounterEnabled(idx)) {
664 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
665 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
666 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
667 } else {
668 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
669 return 0;
670 }
671 }
672 return readMiscRegNoEffect(idx);
673 }
674}
675
676void
678{
679 // Illegal CSR
680 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
681 DPRINTF(RiscvMisc, "Setting MiscReg %s (%d) to %#x.\n",
682 MiscRegNames[idx], idx, val);
683 miscRegFile[idx] = val;
684}
685
686void
688{
689 if (idx >= MISCREG_CYCLE && idx <= MISCREG_HPMCOUNTER31) {
690 // Ignore writes to HPM counters for now
691 warn("Ignoring write to miscreg %s.\n", MiscRegNames[idx]);
692 } else {
693 switch (idx) {
694
695 // From section 3.7.1 of RISCV priv. specs
696 // V1.12, the odd-numbered configuration
697 // registers are illegal for RV64 and
698 // each 64 bit CFG register hold configurations
699 // for 8 PMP entries.
700
701 case MISCREG_PMPCFG0:
702 case MISCREG_PMPCFG1:
703 case MISCREG_PMPCFG2:
704 case MISCREG_PMPCFG3:
705 {
706 // PMP registers should only be modified in M mode
708
709 int regSize = 0;
710 switch (_rvType) {
711 case RV32:
712 regSize = 4;
713 break;
714 case RV64:
715 regSize = 8;
716 break;
717 default:
718 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
719 }
720
721 // Specs do not seem to mention what should be
722 // configured first, cfg or address regs!
723 // qemu seems to update the tables when
724 // pmp addr regs are written (with the assumption
725 // that cfg regs are already written)
726 RegVal res = 0;
727 RegVal old_val = readMiscRegNoEffect(idx);
728
729 for (int i=0; i < regSize; i++) {
730
731 uint8_t cfg_val = (val >> (8*i)) & 0xff;
732 auto mmu = dynamic_cast<RiscvISA::MMU *>
733 (tc->getMMUPtr());
734
735 // Form pmp_index using the index i and
736 // PMPCFG register number
737 uint32_t pmp_index = i+(4*(idx-MISCREG_PMPCFG0));
738 bool result = mmu->getPMP()->pmpUpdateCfg(pmp_index,cfg_val);
739 if (result) {
740 res |= ((RegVal)cfg_val << (8*i));
741 } else {
742 res |= (old_val & (0xFF << (8*i)));
743 }
744 }
745
746 setMiscRegNoEffect(idx, res);
747 }
748 break;
750 {
751 // PMP registers should only be modified in M mode
753
754 auto mmu = dynamic_cast<RiscvISA::MMU *>
755 (tc->getMMUPtr());
756 uint32_t pmp_index = idx-MISCREG_PMPADDR00;
757 if (mmu->getPMP()->pmpUpdateAddr(pmp_index, val)) {
759 }
760 }
761 break;
762 case MISCREG_MIDELEG:
763 {
766 }
767 break;
768 case MISCREG_SIDELEG:
769 {
772 }
773 break;
774 case MISCREG_IP:
775 {
777 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
778 tc->getCpuPtr()->getInterruptController(tc->threadId()));
779 val = (val & mask) | (ic->readIP() & ~mask);
780 ic->setIP(val);
781 }
782 break;
783 case MISCREG_UIP:
784 {
787 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
789 }
790 break;
791 case MISCREG_SIP:
792 {
795 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
797 }
798 break;
799 case MISCREG_IE:
800 {
802 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
803 tc->getCpuPtr()->getInterruptController(tc->threadId()));
804 ic->setIE(val);
805 }
806 break;
807 case MISCREG_UIE:
808 {
811 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
813 }
814 break;
815 case MISCREG_SIE:
816 {
818 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
820 }
821 break;
822 case MISCREG_SATP:
823 {
824 // we only support bare and Sv39 mode; setting a different mode
825 // shall have no effect (see 4.1.12 in priv ISA manual)
826 SATP cur_val = readMiscRegNoEffect(idx);
827 SATP new_val = val;
828 if (new_val.mode != AddrXlateMode::BARE &&
829 new_val.mode != AddrXlateMode::SV39)
830 new_val.mode = cur_val.mode;
831 setMiscRegNoEffect(idx, new_val);
832 }
833 break;
834 case MISCREG_SENVCFG:
835 {
836 // panic on write to bitfields that aren't implemented in gem5
837 SENVCFG panic_mask = 0;
838 panic_mask.pmm = 3;
839
840 SENVCFG wpri_mask = 0;
841 wpri_mask.wpri_1 = ~wpri_mask.wpri_1;
842 wpri_mask.wpri_2 = ~wpri_mask.wpri_2;
843 wpri_mask.wpri_3 = ~wpri_mask.wpri_3;
844
845 if ((panic_mask & val) != 0) {
846 panic("Tried to write to an unimplemented bitfield in the "
847 "senvcfg CSR!\nThe attempted write was:\n %" PRIu64 "\n",
848 val);
849 }
850
851 setMiscRegNoEffect(idx, val & ~wpri_mask);
852 }
853 break;
854 case MISCREG_TSELECT:
855 {
856 // we don't support debugging, so always set a different value
857 // than written
858 setMiscRegNoEffect(idx, val + 1);
859 }
860 break;
861 case MISCREG_ISA:
862 {
863 MISA cur_misa = (MISA)readMiscRegNoEffect(MISCREG_ISA);
864 MISA new_misa = (MISA)val;
865 // only allow to disable compressed instructions
866 // if the following instruction is 4-byte aligned
867 if (new_misa.rvc == 0 &&
868 bits(tc->pcState().as<RiscvISA::PCState>().npc(),
869 2, 0) != 0) {
870 new_misa.rvc = new_misa.rvc | cur_misa.rvc;
871 }
872 if (!getEnableRvv()) {
873 new_misa.rvv = 0;
874 }
875 new_misa.rvn = cur_misa.rvn;
876 new_misa.rvs = cur_misa.rvs;
877 new_misa.rvu = cur_misa.rvu;
878 setMiscRegNoEffect(idx, new_misa);
879 }
880 break;
881 case MISCREG_STATUS:
882 {
884 if (_rvType != RV32) {
885 // SXL and UXL are hard-wired to 64 bit
886 auto cur = readMiscRegNoEffect(idx);
889 }
890 if (!getEnableRvv()) {
891 // Always OFF is rvv is disabled.
893 }
895 }
896 break;
897 case MISCREG_USTATUS:
898 {
900 val = (val & mask) |
903 }
904 break;
905 case MISCREG_SSTATUS:
906 {
908 val = (val & mask) |
911 }
912 break;
913 case MISCREG_VXSAT:
914 {
915 setMiscRegNoEffect(idx, val & 0x1);
916 }
917 break;
918 case MISCREG_VXRM:
919 {
920 setMiscRegNoEffect(idx, val & 0x3);
921 }
922 break;
923 case MISCREG_VCSR:
924 {
926 setMiscRegNoEffect(MISCREG_VXRM, (val & 0x6) >> 1);
927 }
928 break;
930 {
932 new_val |= (val & FFLAGS_MASK);
934 }
935 break;
936 case MISCREG_FFLAGS:
937 {
939 }
940 break;
941 case MISCREG_FRM:
942 {
944 }
945 break;
946 case MISCREG_FCSR:
947 {
950 }
951 break;
952 case MISCREG_MNSTATUS:
953 {
954 NSTATUS nstatus = val;
956 (RegVal)nstatus.nmie | readMiscRegNoEffect(MISCREG_NMIE));
958 }
959 break;
960 case MISCREG_JVT:
961 {
963 }
964 break;
965 default:
967 }
968 }
969}
970
971void
973{
975
976 DPRINTF(Checkpoint, "Serializing Riscv Misc Registers\n");
978}
979
980void
982{
983 DPRINTF(Checkpoint, "Unserializing Riscv Misc Registers\n");
985}
986
987void
989{
990 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
991
992 if (load_reservation_addr == INVALID_RESERVATION_ADDR)
993 return;
994 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
995 DPRINTF(LLSC, "Locked snoop on address %x.\n", snoop_addr);
996 if ((load_reservation_addr & cacheBlockMask) == snoop_addr)
997 load_reservation_addr = INVALID_RESERVATION_ADDR;
998}
999
1000
1001void
1003{
1004 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
1005
1006 load_reservation_addr = req->getPaddr();
1007 DPRINTF(LLSC, "[cid:%d]: Reserved address %x.\n",
1008 req->contextId(), req->getPaddr());
1009}
1010
1011bool
1012ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
1013{
1014 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
1015 bool lr_addr_empty = (load_reservation_addr == INVALID_RESERVATION_ADDR);
1016
1017 // Normally RISC-V uses zero to indicate success and nonzero to indicate
1018 // failure (right now only 1 is reserved), but in gem5 zero indicates
1019 // failure and one indicates success, so here we conform to that (it should
1020 // be switched in the instruction's implementation)
1021
1022 DPRINTF(LLSC, "[cid:%d]: load_reservation_addrs empty? %s.\n",
1023 req->contextId(),
1024 lr_addr_empty ? "yes" : "no");
1025 if (!lr_addr_empty) {
1026 DPRINTF(LLSC, "[cid:%d]: addr = %x.\n", req->contextId(),
1027 req->getPaddr() & cacheBlockMask);
1028 DPRINTF(LLSC, "[cid:%d]: last locked addr = %x.\n", req->contextId(),
1029 load_reservation_addr & cacheBlockMask);
1030 }
1031 if (lr_addr_empty ||
1032 (load_reservation_addr & cacheBlockMask)
1033 != ((req->getPaddr() & cacheBlockMask))) {
1034 req->setExtraData(0);
1035 int stCondFailures = tc->readStCondFailures();
1036 tc->setStCondFailures(++stCondFailures);
1037 if (stCondFailures % WARN_FAILURE == 0) {
1038 warn("%i: context %d: %d consecutive SC failures.\n",
1039 curTick(), tc->contextId(), stCondFailures);
1040 }
1041
1042 // Must clear any reservations
1043 load_reservation_addr = INVALID_RESERVATION_ADDR;
1044
1045 return false;
1046 }
1047 if (req->isUncacheable()) {
1048 req->setExtraData(2);
1049 }
1050
1051 // Must clear any reservations
1052 load_reservation_addr = INVALID_RESERVATION_ADDR;
1053
1054 DPRINTF(LLSC, "[cid:%d]: SC success! Current locked addr = %x.\n",
1055 req->contextId(), load_reservation_addr & cacheBlockMask);
1056 return true;
1057}
1058
1059void
1061{
1062 tc->getCpuPtr()->wakeup(tc->threadId());
1063 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
1064 load_reservation_addr = INVALID_RESERVATION_ADDR;
1065}
1066
1067void
1069{
1070 Reset().invoke(tc);
1071}
1072
1073Addr
1074ISA::getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
1075{
1076 auto vec = tc->readMiscRegNoEffect(idx);
1077 Addr addr = mbits(vec, 63, 2);
1078 if (intr && bits(vec, 1, 0) == 1)
1079 addr += 4 * cause;
1080 return addr;
1081}
1082
1083} // namespace RiscvISA
1084} // namespace gem5
1085
1086std::ostream &
1087operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)
1088{
1089 switch (pm) {
1091 return os << "PRV_U";
1093 return os << "PRV_S";
1095 return os << "PRV_M";
1096 }
1097 return os << "PRV_<invalid>";
1098}
#define DPRINTF(x,...)
Definition trace.hh:209
ThreadContext * tc
Definition isa.hh:68
RegClasses _regClasses
Definition isa.hh:70
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.hh:136
BaseISA(const SimObjectParams &p, const std::string &name)
Definition isa.hh:64
virtual std::string name() const
Definition named.hh:60
Addr getAddr() const
Definition packet.hh:807
const bool _wfiResumeOnPending
The WFI instruction can halt the execution of a hart.
Definition isa.hh:109
void setMiscReg(RegIndex idx, RegVal val) override
Definition isa.cc:687
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:988
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:429
void globalClearExclusive() override
Definition isa.cc:1060
const int WARN_FAILURE
Definition isa.hh:83
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.cc:972
void resetThread() override
Definition isa.cc:1068
PrivilegeModeSet _privilegeModeSet
The combination of privilege modes in Privilege Levels section of RISC-V privileged spec.
Definition isa.hh:100
bool enableSmrnmi()
Definition isa.hh:200
Addr rvSext(Addr addr) const
Definition isa.hh:205
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:677
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:419
bool hpmCounterEnabled(int counter) const
Definition isa.cc:390
unsigned elen
Length of each vector element in bits.
Definition isa.hh:95
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:300
RiscvType rvType() const
Definition isa.hh:176
bool handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask) override
Definition isa.cc:1012
unsigned vlen
Length of each vector register in bits.
Definition isa.hh:90
void clear() override
Definition isa.cc:325
bool getEnableRvv() const
Definition isa.hh:178
bool _enableSmrnmi
Resumable non-maskable interrupt Set true to make NMI recoverable.
Definition isa.hh:123
std::vector< RegVal > miscRegFile
Definition isa.hh:77
bool inUserMode() const override
Definition isa.cc:294
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:981
const Addr INVALID_RESERVATION_ADDR
Definition isa.hh:84
bool _enableZcd
Enable Zcd extensions.
Definition isa.hh:117
virtual Addr getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
Definition isa.cc:1074
unsigned getVecLenInBytes()
Definition isa.hh:189
std::unordered_map< int, Addr > load_reservation_addrs
Definition isa.hh:85
RiscvType _rvType
Definition isa.hh:76
PrivilegeModeSet getPrivilegeModeSet()
Definition isa.hh:194
RiscvISAParams Params
Definition isa.hh:126
ISA(const Params &p)
Definition isa.cc:267
void handleLockedRead(const RequestPtr &req) override
Definition isa.cc:1002
void vtype(VTYPE v)
Definition pcstate.hh:114
void vl(uint32_t v)
Definition pcstate.hh:117
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:189
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId &reg) const
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition bitfield.hh:79
constexpr T mbits(T val, unsigned first, unsigned last)
Mask off the given bits in place like bits() but without shifting.
Definition bitfield.hh:106
#define panic(...)
This implements a cprintf based panic() function.
Definition logging.hh:220
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition logging.hh:268
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:246
#define UNSERIALIZE_CONTAINER(member)
Definition serialize.hh:651
#define SERIALIZE_CONTAINER(member)
Definition serialize.hh:643
#define warn(...)
Definition logging.hh:288
#define inform(...)
Definition logging.hh:289
constexpr RegClass matRegClass
Definition mat.hh:92
constexpr RegClass vecElemClass
Definition vec.hh:105
Bitfield< 5, 0 > status
constexpr RegClass vecPredRegClass
Definition vec.hh:109
constexpr RegClass ccRegClass
Definition cc.hh:87
Bitfield< 25 > vec
Definition misc.hh:113
const RegVal SIDELEG_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1583
Bitfield< 0 > p
constexpr enums::RiscvType RV32
Definition pcstate.hh:56
const RegVal FRM_MASK
Definition misc.hh:1591
constexpr RegClass floatRegClass(FloatRegClass, FloatRegClassName, float_reg::NumRegs, debug::FloatRegs)
gem5::VecRegContainer< MaxVecLenInBytes > VecRegContainer
Definition vector.hh:50
const RegVal MIP_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1534
Bitfield< 2 > i
const RegVal SSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1466
const RegVal STATUS_VS_MASK
Definition misc.hh:1383
const RegVal STATUS_SXL_MASK
Definition misc.hh:1372
const RegVal FFLAGS_MASK
Definition misc.hh:1590
const RegVal STATUS_UXL_MASK
Definition misc.hh:1373
const RegVal USTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1497
const RegVal SIP_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1553
constexpr RegClass intRegClass(IntRegClass, IntRegClassName, int_reg::NumRegs, debug::IntRegs)
const std::array< const char *, NUM_MISCREGS > MiscRegNames
Definition isa.cc:71
constexpr RegClass vecRegClass
Definition vector.hh:71
constexpr enums::RiscvType RV64
Definition pcstate.hh:57
@ MISCREG_PMPADDR11
Definition misc.hh:171
@ MISCREG_HPMCOUNTER16H
Definition misc.hh:239
@ MISCREG_USTATUS
Definition misc.hh:266
@ MISCREG_HPMCOUNTER09
Definition misc.hh:88
@ MISCREG_HPMEVENT31
Definition misc.hh:139
@ MISCREG_IMPID
Definition misc.hh:74
@ MISCREG_HPMEVENT07
Definition misc.hh:115
@ MISCREG_HPMCOUNTER16
Definition misc.hh:95
@ MISCREG_HPMCOUNTER13H
Definition misc.hh:236
@ MISCREG_SENVCFG
Definition misc.hh:186
@ MISCREG_HPMCOUNTER19
Definition misc.hh:98
@ MISCREG_PMPADDR12
Definition misc.hh:172
@ MISCREG_HPMCOUNTER07
Definition misc.hh:86
@ MISCREG_HPMEVENT29
Definition misc.hh:137
@ MISCREG_HPMCOUNTER26
Definition misc.hh:105
@ MISCREG_PMPADDR05
Definition misc.hh:165
@ MISCREG_HPMCOUNTER13
Definition misc.hh:92
@ MISCREG_PMPADDR10
Definition misc.hh:170
@ MISCREG_SIDELEG
Definition misc.hh:178
@ MISCREG_PMPADDR14
Definition misc.hh:174
@ MISCREG_PMPCFG3
Definition misc.hh:159
@ NUM_PHYS_MISCREGS
Definition misc.hh:258
@ MISCREG_HPMCOUNTER22H
Definition misc.hh:245
@ MISCREG_PMPADDR09
Definition misc.hh:169
@ MISCREG_HPMEVENT06
Definition misc.hh:114
@ MISCREG_TSELECT
Definition misc.hh:140
@ MISCREG_MSCRATCH
Definition misc.hh:152
@ MISCREG_HPMCOUNTER04H
Definition misc.hh:227
@ MISCREG_MNCAUSE
Definition misc.hh:217
@ MISCREG_HPMEVENT21
Definition misc.hh:129
@ MISCREG_HPMCOUNTER12H
Definition misc.hh:235
@ MISCREG_STATUS
Definition misc.hh:76
@ MISCREG_HPMEVENT12
Definition misc.hh:120
@ MISCREG_HPMCOUNTER25
Definition misc.hh:104
@ MISCREG_PMPADDR04
Definition misc.hh:164
@ MISCREG_INSTRETH
Definition misc.hh:225
@ MISCREG_MCOUNTEREN
Definition misc.hh:151
@ MISCREG_PMPADDR00
Definition misc.hh:160
@ MISCREG_HPMCOUNTER22
Definition misc.hh:101
@ MISCREG_HPMEVENT17
Definition misc.hh:125
@ MISCREG_HPMEVENT20
Definition misc.hh:128
@ MISCREG_HPMCOUNTER03H
Definition misc.hh:226
@ MISCREG_HPMCOUNTER15H
Definition misc.hh:238
@ MISCREG_MEDELEG
Definition misc.hh:148
@ MISCREG_USCRATCH
Definition misc.hh:189
@ MISCREG_HPMEVENT25
Definition misc.hh:133
@ MISCREG_HPMCOUNTER31H
Definition misc.hh:254
@ MISCREG_HPMCOUNTER11
Definition misc.hh:90
@ MISCREG_HPMCOUNTER17H
Definition misc.hh:240
@ MISCREG_HPMEVENT03
Definition misc.hh:111
@ MISCREG_PMPCFG1
Definition misc.hh:157
@ MISCREG_SSTATUS
Definition misc.hh:269
@ MISCREG_HPMEVENT13
Definition misc.hh:121
@ MISCREG_PMPADDR13
Definition misc.hh:173
@ MISCREG_FFLAGS_EXE
Definition misc.hh:264
@ MISCREG_HPMCOUNTER12
Definition misc.hh:91
@ MISCREG_HPMCOUNTER29H
Definition misc.hh:252
@ MISCREG_HPMEVENT04
Definition misc.hh:112
@ MISCREG_HPMEVENT08
Definition misc.hh:116
@ MISCREG_HPMEVENT19
Definition misc.hh:127
@ MISCREG_DSCRATCH
Definition misc.hh:146
@ MISCREG_HPMEVENT30
Definition misc.hh:138
@ MISCREG_SEDELEG
Definition misc.hh:177
@ MISCREG_PMPADDR06
Definition misc.hh:166
@ MISCREG_HPMCOUNTER21
Definition misc.hh:100
@ MISCREG_HPMCOUNTER21H
Definition misc.hh:244
@ MISCREG_PMPADDR03
Definition misc.hh:163
@ MISCREG_SCOUNTEREN
Definition misc.hh:180
@ MISCREG_HPMCOUNTER18H
Definition misc.hh:241
@ MISCREG_HPMCOUNTER06
Definition misc.hh:85
@ MISCREG_HPMCOUNTER20H
Definition misc.hh:243
@ MISCREG_HPMCOUNTER28
Definition misc.hh:107
@ MISCREG_PMPADDR02
Definition misc.hh:162
@ MISCREG_MIDELEG
Definition misc.hh:149
@ MISCREG_HPMCOUNTER30
Definition misc.hh:109
@ MISCREG_HPMCOUNTER14
Definition misc.hh:93
@ MISCREG_MSTATUSH
Definition misc.hh:221
@ MISCREG_HPMEVENT10
Definition misc.hh:118
@ MISCREG_HPMEVENT26
Definition misc.hh:134
@ MISCREG_HPMEVENT18
Definition misc.hh:126
@ MISCREG_HPMEVENT23
Definition misc.hh:131
@ MISCREG_INSTRET
Definition misc.hh:81
@ MISCREG_HARTID
Definition misc.hh:75
@ MISCREG_MNSTATUS
Definition misc.hh:218
@ MISCREG_HPMCOUNTER05H
Definition misc.hh:228
@ MISCREG_HPMCOUNTER20
Definition misc.hh:99
@ MISCREG_HPMEVENT09
Definition misc.hh:117
@ MISCREG_HPMCOUNTER04
Definition misc.hh:83
@ MISCREG_HPMCOUNTER25H
Definition misc.hh:248
@ MISCREG_HPMCOUNTER27H
Definition misc.hh:250
@ MISCREG_HPMCOUNTER06H
Definition misc.hh:229
@ MISCREG_PMPADDR07
Definition misc.hh:167
@ MISCREG_HPMCOUNTER08H
Definition misc.hh:231
@ MISCREG_HPMEVENT16
Definition misc.hh:124
@ MISCREG_HPMCOUNTER18
Definition misc.hh:97
@ MISCREG_SSCRATCH
Definition misc.hh:181
@ MISCREG_HPMCOUNTER19H
Definition misc.hh:242
@ MISCREG_HPMEVENT14
Definition misc.hh:122
@ MISCREG_HPMCOUNTER10H
Definition misc.hh:233
@ MISCREG_HPMCOUNTER05
Definition misc.hh:84
@ MISCREG_HPMCOUNTER30H
Definition misc.hh:253
@ MISCREG_HPMCOUNTER17
Definition misc.hh:96
@ MISCREG_HPMCOUNTER09H
Definition misc.hh:232
@ MISCREG_HPMCOUNTER27
Definition misc.hh:106
@ MISCREG_HPMCOUNTER24
Definition misc.hh:103
@ MISCREG_HPMCOUNTER28H
Definition misc.hh:251
@ MISCREG_HPMCOUNTER14H
Definition misc.hh:237
@ MISCREG_HPMCOUNTER23
Definition misc.hh:102
@ MISCREG_CYCLE
Definition misc.hh:79
@ MISCREG_HPMCOUNTER07H
Definition misc.hh:230
@ MISCREG_MNSCRATCH
Definition misc.hh:215
@ MISCREG_HPMCOUNTER15
Definition misc.hh:94
@ MISCREG_HPMEVENT24
Definition misc.hh:132
@ MISCREG_HPMCOUNTER10
Definition misc.hh:89
@ MISCREG_HPMCOUNTER29
Definition misc.hh:108
@ MISCREG_VENDORID
Definition misc.hh:72
@ MISCREG_PMPADDR01
Definition misc.hh:161
@ MISCREG_HPMEVENT27
Definition misc.hh:135
@ MISCREG_HPMEVENT15
Definition misc.hh:123
@ MISCREG_HPMEVENT05
Definition misc.hh:113
@ MISCREG_ARCHID
Definition misc.hh:73
@ MISCREG_HPMCOUNTER24H
Definition misc.hh:247
@ MISCREG_HPMEVENT11
Definition misc.hh:119
@ MISCREG_HPMCOUNTER31
Definition misc.hh:110
@ MISCREG_HPMCOUNTER23H
Definition misc.hh:246
@ MISCREG_HPMCOUNTER11H
Definition misc.hh:234
@ MISCREG_PMPADDR08
Definition misc.hh:168
@ MISCREG_HPMCOUNTER03
Definition misc.hh:82
@ MISCREG_PMPADDR15
Definition misc.hh:175
@ MISCREG_HPMEVENT28
Definition misc.hh:136
@ MISCREG_HPMEVENT22
Definition misc.hh:130
@ MISCREG_PMPCFG0
Definition misc.hh:156
@ MISCREG_HPMCOUNTER08
Definition misc.hh:87
@ MISCREG_HPMCOUNTER26H
Definition misc.hh:249
@ MISCREG_PMPCFG2
Definition misc.hh:158
const off_t FRM_OFFSET
Definition misc.hh:1346
const RegVal MI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1542
const RegVal MIDELEG_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1568
const RegVal MSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1392
constexpr RegClass miscRegClass(MiscRegClass, MiscRegClassName, NUM_MISCREGS, debug::MiscRegs)
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t RegVal
Definition types.hh:173
constexpr char CCRegClassName[]
Definition reg_class.hh:81
constexpr char VecPredRegClassName[]
Definition reg_class.hh:79
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Packet * PacketPtr
constexpr char MatRegClassName[]
Definition reg_class.hh:80
@ VecPredRegClass
Definition reg_class.hh:67
@ MatRegClass
Matrix Register.
Definition reg_class.hh:68
@ CCRegClass
Condition-code register.
Definition reg_class.hh:69
@ VecElemClass
Vector Register Native Elem lane.
Definition reg_class.hh:66
constexpr char VecElemClassName[]
Definition reg_class.hh:78
Declaration of the Packet class.
PMP header file.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::ostream & operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)
Definition isa.cc:1087

Generated on Mon May 26 2025 09:19:05 for gem5 by doxygen 1.13.2