gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
210 // following are rv32 only registers
211 [MISCREG_MSTATUSH] = "MSTATUSH",
212
213 [MISCREG_CYCLEH] = "CYCLEH",
214 [MISCREG_TIMEH] = "TIMEH",
215 [MISCREG_INSTRETH] = "INSTRETH",
216 [MISCREG_HPMCOUNTER03H] = "HPMCOUNTER03H",
217 [MISCREG_HPMCOUNTER04H] = "HPMCOUNTER04H",
218 [MISCREG_HPMCOUNTER05H] = "HPMCOUNTER05H",
219 [MISCREG_HPMCOUNTER06H] = "HPMCOUNTER06H",
220 [MISCREG_HPMCOUNTER07H] = "HPMCOUNTER07H",
221 [MISCREG_HPMCOUNTER08H] = "HPMCOUNTER08H",
222 [MISCREG_HPMCOUNTER09H] = "HPMCOUNTER09H",
223 [MISCREG_HPMCOUNTER10H] = "HPMCOUNTER10H",
224 [MISCREG_HPMCOUNTER11H] = "HPMCOUNTER11H",
225 [MISCREG_HPMCOUNTER12H] = "HPMCOUNTER12H",
226 [MISCREG_HPMCOUNTER13H] = "HPMCOUNTER13H",
227 [MISCREG_HPMCOUNTER14H] = "HPMCOUNTER14H",
228 [MISCREG_HPMCOUNTER15H] = "HPMCOUNTER15H",
229 [MISCREG_HPMCOUNTER16H] = "HPMCOUNTER16H",
230 [MISCREG_HPMCOUNTER17H] = "HPMCOUNTER17H",
231 [MISCREG_HPMCOUNTER18H] = "HPMCOUNTER18H",
232 [MISCREG_HPMCOUNTER19H] = "HPMCOUNTER19H",
233 [MISCREG_HPMCOUNTER20H] = "HPMCOUNTER20H",
234 [MISCREG_HPMCOUNTER21H] = "HPMCOUNTER21H",
235 [MISCREG_HPMCOUNTER22H] = "HPMCOUNTER22H",
236 [MISCREG_HPMCOUNTER23H] = "HPMCOUNTER23H",
237 [MISCREG_HPMCOUNTER24H] = "HPMCOUNTER24H",
238 [MISCREG_HPMCOUNTER25H] = "HPMCOUNTER25H",
239 [MISCREG_HPMCOUNTER26H] = "HPMCOUNTER26H",
240 [MISCREG_HPMCOUNTER27H] = "HPMCOUNTER27H",
241 [MISCREG_HPMCOUNTER28H] = "HPMCOUNTER28H",
242 [MISCREG_HPMCOUNTER29H] = "HPMCOUNTER29H",
243 [MISCREG_HPMCOUNTER30H] = "HPMCOUNTER30H",
244 [MISCREG_HPMCOUNTER31H] = "HPMCOUNTER31H",
245
246 [MISCREG_FFLAGS_EXE] = "FFLAGS_EXE",
247}};
248
249namespace
250{
251
252/* Not applicable to RISCV */
255 debug::IntRegs);
257RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
258
259} // anonymous namespace
260
261ISA::ISA(const Params &p) : BaseISA(p, "riscv"),
262 _rvType(p.riscv_type), enableRvv(p.enable_rvv), vlen(p.vlen), elen(p.elen),
263 _privilegeModeSet(p.privilege_mode_set),
264 _wfiResumeOnPending(p.wfi_resume_on_pending), _enableZcd(p.enable_Zcd)
265{
266 _regClasses.push_back(&intRegClass);
267 _regClasses.push_back(&floatRegClass);
268 _regClasses.push_back(&vecRegClass);
269 _regClasses.push_back(&vecElemClass);
270 _regClasses.push_back(&vecPredRegClass);
271 _regClasses.push_back(&matRegClass);
272 _regClasses.push_back(&ccRegClass);
273 _regClasses.push_back(&miscRegClass);
274
275 fatal_if( p.vlen < p.elen,
276 "VLEN should be greater or equal",
277 "than ELEN. Ch. 2RISC-V vector spec.");
278
279 inform("RVV enabled, VLEN = %d bits, ELEN = %d bits",
280 p.vlen, p.elen);
281
282
284 clear();
285}
286
287bool ISA::inUserMode() const
288{
289 return miscRegFile[MISCREG_PRV] == PRV_U;
290}
291
292void
294{
295 // First loop through the integer registers.
296 for (auto &id: intRegClass)
297 tc->setReg(id, src->getReg(id));
298
299 // Second loop through the float registers.
300 for (auto &id: floatRegClass)
301 tc->setReg(id, src->getReg(id));
302
303 // Third loop through the vector registers.
305 for (auto &id: vecRegClass) {
306 src->getReg(id, &vc);
307 tc->setReg(id, &vc);
308 }
309
310 // Copying Misc Regs
311 for (int i = 0; i < NUM_PHYS_MISCREGS; i++)
313
314 // Lastly copy PC/NPC
315 tc->pcState(src->pcState());
316}
317
319{
320 std::fill(miscRegFile.begin(), miscRegFile.end(), 0);
321
326
327 MISA misa = 0;
328 STATUS status = 0;
329
330 // default config arch isa string is rv64(32)imafdc
331 misa.rvi = misa.rvm = misa.rva = misa.rvf = misa.rvd = misa.rvc = 1;
332
333 switch (getPrivilegeModeSet()) {
334 case enums::M:
335 break;
336 case enums::MU:
337 misa.rvu = 1;
338 break;
339 case enums::MNU:
340 misa.rvu = misa.rvn = 1;
341 break;
342 case enums::MSU:
343 misa.rvs = misa.rvu = 1;
344 break;
345 case enums::MNSU:
346 misa.rvs = misa.rvu = misa.rvn = 1;
347 break;
348 default:
349 panic("Privilege mode set config should not reach here");
350 }
351
352 // mark FS is initial
353 status.fs = INITIAL;
354
355 // _rvType dependent init.
356 switch (_rvType) {
357 case RV32:
358 misa.rv32_mxl = 1;
359 break;
360 case RV64:
361 misa.rv64_mxl = 2;
362 status.uxl = status.sxl = 2;
363 if (getEnableRvv()) {
365 misa.rvv = 1;
366 }
367 break;
368 default:
369 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
370 }
371
372 miscRegFile[MISCREG_ISA] = misa;
376 // don't set it to zero; software may try to determine the supported
377 // triggers, starting at zero. simply set a different value here.
379 // NMI is always enabled.
381}
382
383bool
384ISA::hpmCounterEnabled(int misc_reg) const
385{
386 int hpmcounter = 0;
387 if (misc_reg >= MISCREG_CYCLEH) {
388 hpmcounter = misc_reg - MISCREG_CYCLEH;
389 } else {
390 hpmcounter = misc_reg - MISCREG_CYCLE;
391 }
392
393 if (hpmcounter < 0 || hpmcounter > 31)
394 panic("Illegal HPM counter %d\n", hpmcounter);
395 int counteren;
397 case PRV_M:
398 return true;
399 case PRV_S:
400 counteren = MISCREG_MCOUNTEREN;
401 break;
402 case PRV_U:
403 counteren = MISCREG_SCOUNTEREN;
404 break;
405 default:
406 panic("Unknown privilege level %d\n", miscRegFile[MISCREG_PRV]);
407 return false;
408 }
409 return (miscRegFile[counteren] & (1ULL << (hpmcounter))) > 0;
410}
411
412RegVal
414{
415 // Illegal CSR
416 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
417 DPRINTF(RiscvMisc, "Reading MiscReg %s (%d): %#x.\n",
418 MiscRegNames[idx], idx, miscRegFile[idx]);
419 return miscRegFile[idx];
420}
421
422RegVal
424{
425 switch (idx) {
426 case MISCREG_HARTID:
427 return tc->contextId();
428 case MISCREG_CYCLE:
430 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
431 tc->getCpuPtr()->curCycle());
432 return static_cast<RegVal>(tc->getCpuPtr()->curCycle());
433 } else {
434 warn("Cycle counter disabled.\n");
435 return 0;
436 }
437 case MISCREG_CYCLEH:
439 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
440 tc->getCpuPtr()->curCycle());
441 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
442 } else {
443 warn("Cycle counter disabled.\n");
444 return 0;
445 }
446 case MISCREG_TIME:
448 DPRINTF(RiscvMisc, "Wall-clock counter at: %llu.\n",
449 std::time(nullptr));
451 } else {
452 warn("Wall clock disabled.\n");
453 return 0;
454 }
455 case MISCREG_TIMEH:
457 DPRINTF(RiscvMisc, "Wall-clock counter at: %llu.\n",
458 std::time(nullptr));
460 } else {
461 warn("Wall clock disabled.\n");
462 return 0;
463 }
464 case MISCREG_INSTRET:
466 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
467 tc->getCpuPtr()->totalInsts());
468 return static_cast<RegVal>(tc->getCpuPtr()->totalInsts());
469 } else {
470 warn("Instruction counter disabled.\n");
471 return 0;
472 }
473 case MISCREG_INSTRETH:
475 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
476 tc->getCpuPtr()->totalInsts());
477 return bits<RegVal>(tc->getCpuPtr()->totalInsts(), 63, 32);
478 } else {
479 warn("Instruction counter disabled.\n");
480 return 0;
481 }
482 case MISCREG_IP:
483 {
484 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
486 return ic->readIP();
487 }
488 case MISCREG_UIP:
489 {
491 }
492 case MISCREG_SIP:
493 {
495 }
496 case MISCREG_IE:
497 {
498 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
500 return ic->readIE();
501 }
502 case MISCREG_UIE:
503 {
505 }
506 case MISCREG_SIE:
507 {
509 }
510 case MISCREG_SEPC:
511 case MISCREG_MEPC:
512 {
513 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
514 auto val = readMiscRegNoEffect(idx);
515 // if compressed instructions are disabled, epc[1] is set to 0
516 if (misa.rvc == 0)
517 return mbits(val, 63, 2);
518 // epc[0] is always 0
519 else
520 return mbits(val, 63, 1);
521 }
522 case MISCREG_STATUS:
523 {
524 // Updating the SD bit.
525 // . Per RISC-V ISA Manual, vol II, section 3.1.6.6, page 26,
526 // the SD bit is a read-only bit indicating whether any of
527 // FS, VS, and XS fields being in the respective dirty state.
528 // . Per section 3.1.6, page 20, the SD bit is the most
529 // significant bit of the MSTATUS CSR for both RV32 and RV64.
530 // . Per section 3.1.6.6, page 29, the explicit formula for
531 // updating the SD is,
532 // SD = ((FS==DIRTY) | (XS==DIRTY) | (VS==DIRTY))
533 // . Ideally, we want to update the SD after every relevant
534 // instruction, however, lazily updating the Status register
535 // upon its read produces the same effect as well.
536 STATUS status = readMiscRegNoEffect(idx);
537 uint64_t sd_bit = \
538 (status.xs == 3) || (status.fs == 3) || (status.vs == 3);
539 // For RV32, the SD bit is at index 31
540 // For RV64, the SD bit is at index 63.
541 switch (_rvType) {
542 case RV32:
543 status.rv32_sd = sd_bit;
544 break;
545 case RV64:
546 status.rv64_sd = sd_bit;
547 break;
548 default:
549 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
550 }
551 // Check status.mpp
552 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
553 switch(status.mpp) {
554 case PRV_U:
555 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
556 break;
557 case PRV_S:
558 if (misa.rvs)
559 status.mpp = PRV_S;
560 else
561 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
562 break;
563 case PRV_M:
564 break;
565 default:
566 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
567 }
568
570
571 return readMiscRegNoEffect(idx);
572 }
573 case MISCREG_USTATUS:
574 {
577 }
578 case MISCREG_SSTATUS:
579 {
582 }
583 case MISCREG_VLENB:
584 {
585 return getVecLenInBytes();
586 }
587 case MISCREG_VTYPE:
588 {
589 auto rpc = tc->pcState().as<PCState>();
590 return rpc.vtype();
591 }
592 case MISCREG_VL:
593 {
594 auto rpc = tc->pcState().as<PCState>();
595 return (RegVal)rpc.vl();
596 }
597 case MISCREG_VCSR:
598 {
601 }
602 break;
604 {
606 }
607 case MISCREG_FCSR:
608 {
611 }
612 default:
613 // Try reading HPM counters
614 // As a placeholder, all HPM counters are just cycle counters
615 if (idx >= MISCREG_HPMCOUNTER03 &&
616 idx <= MISCREG_HPMCOUNTER31) {
617 if (hpmCounterEnabled(idx)) {
618 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
619 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
620 return tc->getCpuPtr()->curCycle();
621 } else {
622 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
623 return 0;
624 }
625 } else if (idx >= MISCREG_HPMCOUNTER03H &&
626 idx <= MISCREG_HPMCOUNTER31H) {
627 if (hpmCounterEnabled(idx)) {
628 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
629 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
630 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
631 } else {
632 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
633 return 0;
634 }
635 }
636 return readMiscRegNoEffect(idx);
637 }
638}
639
640void
642{
643 // Illegal CSR
644 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
645 DPRINTF(RiscvMisc, "Setting MiscReg %s (%d) to %#x.\n",
646 MiscRegNames[idx], idx, val);
647 miscRegFile[idx] = val;
648}
649
650void
652{
653 if (idx >= MISCREG_CYCLE && idx <= MISCREG_HPMCOUNTER31) {
654 // Ignore writes to HPM counters for now
655 warn("Ignoring write to miscreg %s.\n", MiscRegNames[idx]);
656 } else {
657 switch (idx) {
658
659 // From section 3.7.1 of RISCV priv. specs
660 // V1.12, the odd-numbered configuration
661 // registers are illegal for RV64 and
662 // each 64 bit CFG register hold configurations
663 // for 8 PMP entries.
664
665 case MISCREG_PMPCFG0:
666 case MISCREG_PMPCFG1:
667 case MISCREG_PMPCFG2:
668 case MISCREG_PMPCFG3:
669 {
670 // PMP registers should only be modified in M mode
672
673 int regSize = 0;
674 switch (_rvType) {
675 case RV32:
676 regSize = 4;
677 break;
678 case RV64:
679 regSize = 8;
680 break;
681 default:
682 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
683 }
684
685 // Specs do not seem to mention what should be
686 // configured first, cfg or address regs!
687 // qemu seems to update the tables when
688 // pmp addr regs are written (with the assumption
689 // that cfg regs are already written)
690 RegVal res = 0;
691 RegVal old_val = readMiscRegNoEffect(idx);
692
693 for (int i=0; i < regSize; i++) {
694
695 uint8_t cfg_val = (val >> (8*i)) & 0xff;
696 auto mmu = dynamic_cast<RiscvISA::MMU *>
697 (tc->getMMUPtr());
698
699 // Form pmp_index using the index i and
700 // PMPCFG register number
701 uint32_t pmp_index = i+(4*(idx-MISCREG_PMPCFG0));
702 bool result = mmu->getPMP()->pmpUpdateCfg(pmp_index,cfg_val);
703 if (result) {
704 res |= ((RegVal)cfg_val << (8*i));
705 } else {
706 res |= (old_val & (0xFF << (8*i)));
707 }
708 }
709
710 setMiscRegNoEffect(idx, res);
711 }
712 break;
714 {
715 // PMP registers should only be modified in M mode
717
718 auto mmu = dynamic_cast<RiscvISA::MMU *>
719 (tc->getMMUPtr());
720 uint32_t pmp_index = idx-MISCREG_PMPADDR00;
721 if (mmu->getPMP()->pmpUpdateAddr(pmp_index, val)) {
723 }
724 }
725 break;
726
727 case MISCREG_IP:
728 {
730 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
732 ic->setIP(val);
733 }
734 break;
735 case MISCREG_UIP:
736 {
738 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
740 }
741 break;
742 case MISCREG_SIP:
743 {
745 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
747 }
748 break;
749 case MISCREG_IE:
750 {
752 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
754 ic->setIE(val);
755 }
756 break;
757 case MISCREG_UIE:
758 {
760 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
762 }
763 break;
764 case MISCREG_SIE:
765 {
767 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
769 }
770 break;
771 case MISCREG_SATP:
772 {
773 // we only support bare and Sv39 mode; setting a different mode
774 // shall have no effect (see 4.1.12 in priv ISA manual)
775 SATP cur_val = readMiscRegNoEffect(idx);
776 SATP new_val = val;
777 if (new_val.mode != AddrXlateMode::BARE &&
778 new_val.mode != AddrXlateMode::SV39)
779 new_val.mode = cur_val.mode;
780 setMiscRegNoEffect(idx, new_val);
781 }
782 break;
783 case MISCREG_SENVCFG:
784 {
785 // panic on write to bitfields that aren't implemented in gem5
786 SENVCFG panic_mask = 0;
787 panic_mask.pmm = 3;
788
789 SENVCFG wpri_mask = 0;
790 wpri_mask.wpri_1 = ~wpri_mask.wpri_1;
791 wpri_mask.wpri_2 = ~wpri_mask.wpri_2;
792 wpri_mask.wpri_3 = ~wpri_mask.wpri_3;
793
794 if ((panic_mask & val) != 0) {
795 panic("Tried to write to an unimplemented bitfield in the "
796 "senvcfg CSR!\nThe attempted write was:\n %" PRIu64 "\n",
797 val);
798 }
799
800 setMiscRegNoEffect(idx, val & ~wpri_mask);
801 }
802 break;
803 case MISCREG_TSELECT:
804 {
805 // we don't support debugging, so always set a different value
806 // than written
807 setMiscRegNoEffect(idx, val + 1);
808 }
809 break;
810 case MISCREG_ISA:
811 {
812 MISA cur_misa = (MISA)readMiscRegNoEffect(MISCREG_ISA);
813 MISA new_misa = (MISA)val;
814 // only allow to disable compressed instructions
815 // if the following instruction is 4-byte aligned
816 if (new_misa.rvc == 0 &&
817 bits(tc->pcState().as<RiscvISA::PCState>().npc(),
818 2, 0) != 0) {
819 new_misa.rvc = new_misa.rvc | cur_misa.rvc;
820 }
821 if (!getEnableRvv()) {
822 new_misa.rvv = 0;
823 }
824 new_misa.rvn = cur_misa.rvn;
825 new_misa.rvs = cur_misa.rvs;
826 new_misa.rvu = cur_misa.rvu;
827 setMiscRegNoEffect(idx, new_misa);
828 }
829 break;
830 case MISCREG_STATUS:
831 {
833 if (_rvType != RV32) {
834 // SXL and UXL are hard-wired to 64 bit
835 auto cur = readMiscRegNoEffect(idx);
838 }
839 if (!getEnableRvv()) {
840 // Always OFF is rvv is disabled.
841 val &= ~STATUS_VS_MASK;
842 }
844 }
845 break;
846 case MISCREG_USTATUS:
847 {
849 val = (val & mask) |
852 }
853 break;
854 case MISCREG_SSTATUS:
855 {
857 val = (val & mask) |
860 }
861 break;
862 case MISCREG_VXSAT:
863 {
864 setMiscRegNoEffect(idx, val & 0x1);
865 }
866 break;
867 case MISCREG_VXRM:
868 {
869 setMiscRegNoEffect(idx, val & 0x3);
870 }
871 break;
872 case MISCREG_VCSR:
873 {
875 setMiscRegNoEffect(MISCREG_VXRM, (val & 0x6) >> 1);
876 }
877 break;
879 {
881 new_val |= (val & FFLAGS_MASK);
883 }
884 break;
885 case MISCREG_FFLAGS:
886 {
888 }
889 break;
890 case MISCREG_FRM:
891 {
893 }
894 break;
895 case MISCREG_FCSR:
896 {
899 }
900 break;
901 default:
903 }
904 }
905}
906
907void
909{
911
912 DPRINTF(Checkpoint, "Serializing Riscv Misc Registers\n");
914}
915
916void
918{
919 DPRINTF(Checkpoint, "Unserializing Riscv Misc Registers\n");
921}
922
923void
925{
926 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
927
928 if (load_reservation_addr == INVALID_RESERVATION_ADDR)
929 return;
930 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
931 DPRINTF(LLSC, "Locked snoop on address %x.\n", snoop_addr);
932 if ((load_reservation_addr & cacheBlockMask) == snoop_addr)
933 load_reservation_addr = INVALID_RESERVATION_ADDR;
934}
935
936
937void
939{
940 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
941
942 load_reservation_addr = req->getPaddr();
943 DPRINTF(LLSC, "[cid:%d]: Reserved address %x.\n",
944 req->contextId(), req->getPaddr());
945}
946
947bool
948ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
949{
950 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
951 bool lr_addr_empty = (load_reservation_addr == INVALID_RESERVATION_ADDR);
952
953 // Normally RISC-V uses zero to indicate success and nonzero to indicate
954 // failure (right now only 1 is reserved), but in gem5 zero indicates
955 // failure and one indicates success, so here we conform to that (it should
956 // be switched in the instruction's implementation)
957
958 DPRINTF(LLSC, "[cid:%d]: load_reservation_addrs empty? %s.\n",
959 req->contextId(),
960 lr_addr_empty ? "yes" : "no");
961 if (!lr_addr_empty) {
962 DPRINTF(LLSC, "[cid:%d]: addr = %x.\n", req->contextId(),
963 req->getPaddr() & cacheBlockMask);
964 DPRINTF(LLSC, "[cid:%d]: last locked addr = %x.\n", req->contextId(),
965 load_reservation_addr & cacheBlockMask);
966 }
967 if (lr_addr_empty ||
968 (load_reservation_addr & cacheBlockMask)
969 != ((req->getPaddr() & cacheBlockMask))) {
970 req->setExtraData(0);
971 int stCondFailures = tc->readStCondFailures();
972 tc->setStCondFailures(++stCondFailures);
973 if (stCondFailures % WARN_FAILURE == 0) {
974 warn("%i: context %d: %d consecutive SC failures.\n",
975 curTick(), tc->contextId(), stCondFailures);
976 }
977
978 // Must clear any reservations
979 load_reservation_addr = INVALID_RESERVATION_ADDR;
980
981 return false;
982 }
983 if (req->isUncacheable()) {
984 req->setExtraData(2);
985 }
986
987 // Must clear any reservations
988 load_reservation_addr = INVALID_RESERVATION_ADDR;
989
990 DPRINTF(LLSC, "[cid:%d]: SC success! Current locked addr = %x.\n",
991 req->contextId(), load_reservation_addr & cacheBlockMask);
992 return true;
993}
994
995void
997{
998 tc->getCpuPtr()->wakeup(tc->threadId());
999 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
1000 load_reservation_addr = INVALID_RESERVATION_ADDR;
1001}
1002
1003void
1005{
1006 Reset().invoke(tc);
1007}
1008
1009Addr
1010ISA::getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
1011{
1012 auto vec = tc->readMiscRegNoEffect(idx);
1013 Addr addr = mbits(vec, 63, 2);
1014 if (intr && bits(vec, 1, 0) == 1)
1015 addr += 4 * cause;
1016 return addr;
1017}
1018
1019} // namespace RiscvISA
1020} // namespace gem5
1021
1022std::ostream &
1023operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)
1024{
1025 switch (pm) {
1027 return os << "PRV_U";
1029 return os << "PRV_S";
1031 return os << "PRV_M";
1032 }
1033 return os << "PRV_<invalid>";
1034}
#define DPRINTF(x,...)
Definition trace.hh:209
BaseInterrupts * getInterruptController(ThreadID tid)
Definition base.hh:253
virtual Counter totalInsts() const =0
virtual void wakeup(ThreadID tid)=0
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
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
virtual std::string name() const
Definition named.hh:47
Target & as()
Definition pcstate.hh:73
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Addr getAddr() const
Definition packet.hh:807
void setMiscReg(RegIndex idx, RegVal val) override
Definition isa.cc:651
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:924
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:423
void globalClearExclusive() override
Definition isa.cc:996
const int WARN_FAILURE
Definition isa.hh:83
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.cc:908
void resetThread() override
Definition isa.cc:1004
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:641
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:413
bool hpmCounterEnabled(int counter) const
Definition isa.cc:384
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:293
RiscvType rvType() const
Definition isa.hh:170
bool handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask) override
Definition isa.cc:948
void clear() override
Definition isa.cc:318
bool getEnableRvv() const
Definition isa.hh:172
std::vector< RegVal > miscRegFile
Definition isa.hh:77
bool inUserMode() const override
Definition isa.cc:287
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:917
const Addr INVALID_RESERVATION_ADDR
Definition isa.hh:84
virtual Addr getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
Definition isa.cc:1010
unsigned getVecLenInBytes()
Definition isa.hh:183
std::unordered_map< int, Addr > load_reservation_addrs
Definition isa.hh:85
RiscvType _rvType
Definition isa.hh:76
PrivilegeModeSet getPrivilegeModeSet()
Definition isa.hh:188
RiscvISAParams Params
Definition isa.hh:120
ISA(const Params &p)
Definition isa.cc:261
void handleLockedRead(const RequestPtr &req) override
Definition isa.cc:938
void vtype(VTYPE v)
Definition pcstate.hh:103
void vl(uint32_t v)
Definition pcstate.hh:106
void invoke(ThreadContext *tc, const StaticInstPtr &inst=nullStaticInstPtr) override
Definition faults.cc:171
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal getReg(const RegId &reg) const
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
virtual BaseCPU * getCpuPtr()=0
virtual void setReg(const RegId &reg, RegVal val)
virtual void setStCondFailures(unsigned sc_failures)=0
virtual unsigned readStCondFailures() const =0
virtual const PCStateBase & pcState() const =0
virtual int threadId() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
virtual BaseMMU * getMMUPtr()=0
virtual ContextID contextId() const =0
Vector Register Abstraction This generic class is the model in a particularization of MVC,...
Definition vec_reg.hh:126
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:188
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition logging.hh:236
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition logging.hh:214
#define UNSERIALIZE_CONTAINER(member)
Definition serialize.hh:634
#define SERIALIZE_CONTAINER(member)
Definition serialize.hh:626
#define warn(...)
Definition logging.hh:256
#define inform(...)
Definition logging.hh:257
constexpr RegClass matRegClass
Definition mat.hh:92
constexpr RegClass vecElemClass
Definition vec.hh:105
Bitfield< 5, 0 > status
constexpr RegClass intRegClass
Definition int.hh:173
constexpr RegClass vecPredRegClass
Definition vec.hh:109
constexpr RegClass ccRegClass
Definition cc.hh:87
constexpr RegClass miscRegClass
Definition misc.hh:2975
Bitfield< 25 > vec
Definition misc.hh:113
const RegVal UI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1506
const RegVal SI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1497
Bitfield< 0 > p
constexpr enums::RiscvType RV32
Definition pcstate.hh:56
const RegVal FRM_MASK
Definition misc.hh:1514
Bitfield< 2 > i
const RegVal SSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1418
const RegVal STATUS_SXL_MASK
Definition misc.hh:1324
const RegVal FFLAGS_MASK
Definition misc.hh:1513
const RegVal STATUS_UXL_MASK
Definition misc.hh:1325
const RegVal USTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1449
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:233
@ MISCREG_USTATUS
Definition misc.hh:258
@ 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:230
@ 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:250
@ MISCREG_HPMCOUNTER22H
Definition misc.hh:239
@ 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:221
@ MISCREG_HPMEVENT21
Definition misc.hh:129
@ MISCREG_HPMCOUNTER12H
Definition misc.hh:229
@ 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:219
@ 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:220
@ MISCREG_HPMCOUNTER15H
Definition misc.hh:232
@ MISCREG_MEDELEG
Definition misc.hh:148
@ MISCREG_USCRATCH
Definition misc.hh:189
@ MISCREG_HPMEVENT25
Definition misc.hh:133
@ MISCREG_HPMCOUNTER31H
Definition misc.hh:248
@ MISCREG_HPMCOUNTER11
Definition misc.hh:90
@ MISCREG_HPMCOUNTER17H
Definition misc.hh:234
@ MISCREG_HPMEVENT03
Definition misc.hh:111
@ MISCREG_PMPCFG1
Definition misc.hh:157
@ MISCREG_SSTATUS
Definition misc.hh:261
@ MISCREG_HPMEVENT13
Definition misc.hh:121
@ MISCREG_PMPADDR13
Definition misc.hh:173
@ MISCREG_FFLAGS_EXE
Definition misc.hh:256
@ MISCREG_HPMCOUNTER12
Definition misc.hh:91
@ MISCREG_HPMCOUNTER29H
Definition misc.hh:246
@ 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:238
@ MISCREG_PMPADDR03
Definition misc.hh:163
@ MISCREG_SCOUNTEREN
Definition misc.hh:180
@ MISCREG_HPMCOUNTER18H
Definition misc.hh:235
@ MISCREG_HPMCOUNTER06
Definition misc.hh:85
@ MISCREG_HPMCOUNTER20H
Definition misc.hh:237
@ 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:215
@ 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_HPMCOUNTER05H
Definition misc.hh:222
@ MISCREG_HPMCOUNTER20
Definition misc.hh:99
@ MISCREG_HPMEVENT09
Definition misc.hh:117
@ MISCREG_HPMCOUNTER04
Definition misc.hh:83
@ MISCREG_HPMCOUNTER25H
Definition misc.hh:242
@ MISCREG_HPMCOUNTER27H
Definition misc.hh:244
@ MISCREG_HPMCOUNTER06H
Definition misc.hh:223
@ MISCREG_PMPADDR07
Definition misc.hh:167
@ MISCREG_HPMCOUNTER08H
Definition misc.hh:225
@ MISCREG_HPMEVENT16
Definition misc.hh:124
@ MISCREG_HPMCOUNTER18
Definition misc.hh:97
@ MISCREG_SSCRATCH
Definition misc.hh:181
@ MISCREG_HPMCOUNTER19H
Definition misc.hh:236
@ MISCREG_HPMEVENT14
Definition misc.hh:122
@ MISCREG_HPMCOUNTER10H
Definition misc.hh:227
@ MISCREG_HPMCOUNTER05
Definition misc.hh:84
@ MISCREG_HPMCOUNTER30H
Definition misc.hh:247
@ MISCREG_HPMCOUNTER17
Definition misc.hh:96
@ MISCREG_HPMCOUNTER09H
Definition misc.hh:226
@ MISCREG_HPMCOUNTER27
Definition misc.hh:106
@ MISCREG_HPMCOUNTER24
Definition misc.hh:103
@ MISCREG_HPMCOUNTER28H
Definition misc.hh:245
@ MISCREG_HPMCOUNTER14H
Definition misc.hh:231
@ MISCREG_HPMCOUNTER23
Definition misc.hh:102
@ MISCREG_CYCLE
Definition misc.hh:79
@ MISCREG_HPMCOUNTER07H
Definition misc.hh:224
@ 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:241
@ MISCREG_HPMEVENT11
Definition misc.hh:119
@ MISCREG_HPMCOUNTER31
Definition misc.hh:110
@ MISCREG_HPMCOUNTER23H
Definition misc.hh:240
@ MISCREG_HPMCOUNTER11H
Definition misc.hh:228
@ 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:243
@ MISCREG_PMPCFG2
Definition misc.hh:158
const off_t FRM_OFFSET
Definition misc.hh:1298
const RegVal MI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1486
const RegVal MSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1344
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 3 > addr
Definition types.hh:84
constexpr RegClass floatRegClass
Definition float.hh:143
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
constexpr char CCRegClassName[]
Definition reg_class.hh:81
uint16_t RegIndex
Definition types.hh:176
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
uint64_t RegVal
Definition types.hh:173
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 ...

Generated on Mon Jan 13 2025 04:28:22 for gem5 by doxygen 1.9.8