gem5 v24.0.0.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 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met: redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer;
12 * redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution;
15 * neither the name of the copyright holders nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#include "arch/riscv/isa.hh"
33
34#include <ctime>
35#include <set>
36#include <sstream>
37
38#include "arch/riscv/faults.hh"
41#include "arch/riscv/mmu.hh"
43#include "arch/riscv/pmp.hh"
44#include "arch/riscv/pcstate.hh"
49#include "base/bitfield.hh"
50#include "base/compiler.hh"
51#include "base/logging.hh"
52#include "base/trace.hh"
53#include "cpu/base.hh"
54#include "debug/Checkpoint.hh"
55#include "debug/LLSC.hh"
56#include "debug/MatRegs.hh"
57#include "debug/RiscvMisc.hh"
58#include "debug/VecRegs.hh"
59#include "mem/packet.hh"
60#include "mem/request.hh"
61#include "params/RiscvISA.hh"
62#include "sim/pseudo_inst.hh"
63
64namespace gem5
65{
66
67namespace RiscvISA
68{
69
70[[maybe_unused]] const std::array<const char *, NUM_MISCREGS> MiscRegNames = {{
71 [MISCREG_PRV] = "PRV",
72 [MISCREG_ISA] = "ISA",
73 [MISCREG_VENDORID] = "VENDORID",
74 [MISCREG_ARCHID] = "ARCHID",
75 [MISCREG_IMPID] = "IMPID",
76 [MISCREG_HARTID] = "HARTID",
77 [MISCREG_STATUS] = "STATUS",
78 [MISCREG_IP] = "IP",
79 [MISCREG_IE] = "IE",
80 [MISCREG_CYCLE] = "CYCLE",
81 [MISCREG_TIME] = "TIME",
82 [MISCREG_INSTRET] = "INSTRET",
83 [MISCREG_HPMCOUNTER03] = "HPMCOUNTER03",
84 [MISCREG_HPMCOUNTER04] = "HPMCOUNTER04",
85 [MISCREG_HPMCOUNTER05] = "HPMCOUNTER05",
86 [MISCREG_HPMCOUNTER06] = "HPMCOUNTER06",
87 [MISCREG_HPMCOUNTER07] = "HPMCOUNTER07",
88 [MISCREG_HPMCOUNTER08] = "HPMCOUNTER08",
89 [MISCREG_HPMCOUNTER09] = "HPMCOUNTER09",
90 [MISCREG_HPMCOUNTER10] = "HPMCOUNTER10",
91 [MISCREG_HPMCOUNTER11] = "HPMCOUNTER11",
92 [MISCREG_HPMCOUNTER12] = "HPMCOUNTER12",
93 [MISCREG_HPMCOUNTER13] = "HPMCOUNTER13",
94 [MISCREG_HPMCOUNTER14] = "HPMCOUNTER14",
95 [MISCREG_HPMCOUNTER15] = "HPMCOUNTER15",
96 [MISCREG_HPMCOUNTER16] = "HPMCOUNTER16",
97 [MISCREG_HPMCOUNTER17] = "HPMCOUNTER17",
98 [MISCREG_HPMCOUNTER18] = "HPMCOUNTER18",
99 [MISCREG_HPMCOUNTER19] = "HPMCOUNTER19",
100 [MISCREG_HPMCOUNTER20] = "HPMCOUNTER20",
101 [MISCREG_HPMCOUNTER21] = "HPMCOUNTER21",
102 [MISCREG_HPMCOUNTER22] = "HPMCOUNTER22",
103 [MISCREG_HPMCOUNTER23] = "HPMCOUNTER23",
104 [MISCREG_HPMCOUNTER24] = "HPMCOUNTER24",
105 [MISCREG_HPMCOUNTER25] = "HPMCOUNTER25",
106 [MISCREG_HPMCOUNTER26] = "HPMCOUNTER26",
107 [MISCREG_HPMCOUNTER27] = "HPMCOUNTER27",
108 [MISCREG_HPMCOUNTER28] = "HPMCOUNTER28",
109 [MISCREG_HPMCOUNTER29] = "HPMCOUNTER29",
110 [MISCREG_HPMCOUNTER30] = "HPMCOUNTER30",
111 [MISCREG_HPMCOUNTER31] = "HPMCOUNTER31",
112 [MISCREG_HPMEVENT03] = "HPMEVENT03",
113 [MISCREG_HPMEVENT04] = "HPMEVENT04",
114 [MISCREG_HPMEVENT05] = "HPMEVENT05",
115 [MISCREG_HPMEVENT06] = "HPMEVENT06",
116 [MISCREG_HPMEVENT07] = "HPMEVENT07",
117 [MISCREG_HPMEVENT08] = "HPMEVENT08",
118 [MISCREG_HPMEVENT09] = "HPMEVENT09",
119 [MISCREG_HPMEVENT10] = "HPMEVENT10",
120 [MISCREG_HPMEVENT11] = "HPMEVENT11",
121 [MISCREG_HPMEVENT12] = "HPMEVENT12",
122 [MISCREG_HPMEVENT13] = "HPMEVENT13",
123 [MISCREG_HPMEVENT14] = "HPMEVENT14",
124 [MISCREG_HPMEVENT15] = "HPMEVENT15",
125 [MISCREG_HPMEVENT16] = "HPMEVENT16",
126 [MISCREG_HPMEVENT17] = "HPMEVENT17",
127 [MISCREG_HPMEVENT18] = "HPMEVENT18",
128 [MISCREG_HPMEVENT19] = "HPMEVENT19",
129 [MISCREG_HPMEVENT20] = "HPMEVENT20",
130 [MISCREG_HPMEVENT21] = "HPMEVENT21",
131 [MISCREG_HPMEVENT22] = "HPMEVENT22",
132 [MISCREG_HPMEVENT23] = "HPMEVENT23",
133 [MISCREG_HPMEVENT24] = "HPMEVENT24",
134 [MISCREG_HPMEVENT25] = "HPMEVENT25",
135 [MISCREG_HPMEVENT26] = "HPMEVENT26",
136 [MISCREG_HPMEVENT27] = "HPMEVENT27",
137 [MISCREG_HPMEVENT28] = "HPMEVENT28",
138 [MISCREG_HPMEVENT29] = "HPMEVENT29",
139 [MISCREG_HPMEVENT30] = "HPMEVENT30",
140 [MISCREG_HPMEVENT31] = "HPMEVENT31",
141 [MISCREG_TSELECT] = "TSELECT",
142 [MISCREG_TDATA1] = "TDATA1",
143 [MISCREG_TDATA2] = "TDATA2",
144 [MISCREG_TDATA3] = "TDATA3",
145 [MISCREG_DCSR] = "DCSR",
146 [MISCREG_DPC] = "DPC",
147 [MISCREG_DSCRATCH] = "DSCRATCH",
148
149 [MISCREG_MEDELEG] = "MEDELEG",
150 [MISCREG_MIDELEG] = "MIDELEG",
151 [MISCREG_MTVEC] = "MTVEC",
152 [MISCREG_MCOUNTEREN] = "MCOUNTEREN",
153 [MISCREG_MSCRATCH] = "MSCRATCH",
154 [MISCREG_MEPC] = "MEPC",
155 [MISCREG_MCAUSE] = "MCAUSE",
156 [MISCREG_MTVAL] = "MTVAL",
157 [MISCREG_PMPCFG0] = "PMPCFG0",
158 [MISCREG_PMPCFG1] = "PMPCFG1", // pmpcfg1 is rv32 only
159 [MISCREG_PMPCFG2] = "PMPCFG2",
160 [MISCREG_PMPCFG3] = "PMPCFG3", // pmpcfg3 is rv32 only
161 [MISCREG_PMPADDR00] = "PMPADDR00",
162 [MISCREG_PMPADDR01] = "PMPADDR01",
163 [MISCREG_PMPADDR02] = "PMPADDR02",
164 [MISCREG_PMPADDR03] = "PMPADDR03",
165 [MISCREG_PMPADDR04] = "PMPADDR04",
166 [MISCREG_PMPADDR05] = "PMPADDR05",
167 [MISCREG_PMPADDR06] = "PMPADDR06",
168 [MISCREG_PMPADDR07] = "PMPADDR07",
169 [MISCREG_PMPADDR08] = "PMPADDR08",
170 [MISCREG_PMPADDR09] = "PMPADDR09",
171 [MISCREG_PMPADDR10] = "PMPADDR10",
172 [MISCREG_PMPADDR11] = "PMPADDR11",
173 [MISCREG_PMPADDR12] = "PMPADDR12",
174 [MISCREG_PMPADDR13] = "PMPADDR13",
175 [MISCREG_PMPADDR14] = "PMPADDR14",
176 [MISCREG_PMPADDR15] = "PMPADDR15",
177
178 [MISCREG_SEDELEG] = "SEDELEG",
179 [MISCREG_SIDELEG] = "SIDELEG",
180 [MISCREG_STVEC] = "STVEC",
181 [MISCREG_SCOUNTEREN] = "SCOUNTEREN",
182 [MISCREG_SSCRATCH] = "SSCRATCH",
183 [MISCREG_SEPC] = "SEPC",
184 [MISCREG_SCAUSE] = "SCAUSE",
185 [MISCREG_STVAL] = "STVAL",
186 [MISCREG_SATP] = "SATP",
187
188 [MISCREG_UTVEC] = "UTVEC",
189 [MISCREG_USCRATCH] = "USCRATCH",
190 [MISCREG_UEPC] = "UEPC",
191 [MISCREG_UCAUSE] = "UCAUSE",
192 [MISCREG_UTVAL] = "UTVAL",
193 [MISCREG_FFLAGS] = "FFLAGS",
194 [MISCREG_FRM] = "FRM",
195
196 [MISCREG_VSTART] = "VSTART",
197 [MISCREG_VXSAT] = "VXSAT",
198 [MISCREG_VXRM] = "VXRM",
199 [MISCREG_VCSR] = "VCSR",
200 [MISCREG_VL] = "VL",
201 [MISCREG_VTYPE] = "VTYPE",
202 [MISCREG_VLENB] = "VLENB",
203
204 [MISCREG_NMIVEC] = "NMIVEC",
205 [MISCREG_NMIE] = "NMIE",
206 [MISCREG_NMIP] = "NMIP",
207
208 // following are rv32 only registers
209 [MISCREG_MSTATUSH] = "MSTATUSH",
210
211 [MISCREG_CYCLEH] = "CYCLEH",
212 [MISCREG_TIMEH] = "TIMEH",
213 [MISCREG_INSTRETH] = "INSTRETH",
214 [MISCREG_HPMCOUNTER03H] = "HPMCOUNTER03H",
215 [MISCREG_HPMCOUNTER04H] = "HPMCOUNTER04H",
216 [MISCREG_HPMCOUNTER05H] = "HPMCOUNTER05H",
217 [MISCREG_HPMCOUNTER06H] = "HPMCOUNTER06H",
218 [MISCREG_HPMCOUNTER07H] = "HPMCOUNTER07H",
219 [MISCREG_HPMCOUNTER08H] = "HPMCOUNTER08H",
220 [MISCREG_HPMCOUNTER09H] = "HPMCOUNTER09H",
221 [MISCREG_HPMCOUNTER10H] = "HPMCOUNTER10H",
222 [MISCREG_HPMCOUNTER11H] = "HPMCOUNTER11H",
223 [MISCREG_HPMCOUNTER12H] = "HPMCOUNTER12H",
224 [MISCREG_HPMCOUNTER13H] = "HPMCOUNTER13H",
225 [MISCREG_HPMCOUNTER14H] = "HPMCOUNTER14H",
226 [MISCREG_HPMCOUNTER15H] = "HPMCOUNTER15H",
227 [MISCREG_HPMCOUNTER16H] = "HPMCOUNTER16H",
228 [MISCREG_HPMCOUNTER17H] = "HPMCOUNTER17H",
229 [MISCREG_HPMCOUNTER18H] = "HPMCOUNTER18H",
230 [MISCREG_HPMCOUNTER19H] = "HPMCOUNTER19H",
231 [MISCREG_HPMCOUNTER20H] = "HPMCOUNTER20H",
232 [MISCREG_HPMCOUNTER21H] = "HPMCOUNTER21H",
233 [MISCREG_HPMCOUNTER22H] = "HPMCOUNTER22H",
234 [MISCREG_HPMCOUNTER23H] = "HPMCOUNTER23H",
235 [MISCREG_HPMCOUNTER24H] = "HPMCOUNTER24H",
236 [MISCREG_HPMCOUNTER25H] = "HPMCOUNTER25H",
237 [MISCREG_HPMCOUNTER26H] = "HPMCOUNTER26H",
238 [MISCREG_HPMCOUNTER27H] = "HPMCOUNTER27H",
239 [MISCREG_HPMCOUNTER28H] = "HPMCOUNTER28H",
240 [MISCREG_HPMCOUNTER29H] = "HPMCOUNTER29H",
241 [MISCREG_HPMCOUNTER30H] = "HPMCOUNTER30H",
242 [MISCREG_HPMCOUNTER31H] = "HPMCOUNTER31H",
243
244 [MISCREG_FFLAGS_EXE] = "FFLAGS_EXE",
245}};
246
247namespace
248{
249
250/* Not applicable to RISCV */
253 debug::IntRegs);
255RegClass ccRegClass(CCRegClass, CCRegClassName, 0, debug::IntRegs);
256
257} // anonymous namespace
258
259ISA::ISA(const Params &p) : BaseISA(p, "riscv"),
260 _rvType(p.riscv_type), enableRvv(p.enable_rvv), vlen(p.vlen), elen(p.elen),
261 _privilegeModeSet(p.privilege_mode_set)
262{
263 _regClasses.push_back(&intRegClass);
264 _regClasses.push_back(&floatRegClass);
265 _regClasses.push_back(&vecRegClass);
266 _regClasses.push_back(&vecElemClass);
267 _regClasses.push_back(&vecPredRegClass);
268 _regClasses.push_back(&matRegClass);
269 _regClasses.push_back(&ccRegClass);
270 _regClasses.push_back(&miscRegClass);
271
272 fatal_if( p.vlen < p.elen,
273 "VLEN should be greater or equal",
274 "than ELEN. Ch. 2RISC-V vector spec.");
275
276 inform("RVV enabled, VLEN = %d bits, ELEN = %d bits",
277 p.vlen, p.elen);
278
279
281 clear();
282}
283
284bool ISA::inUserMode() const
285{
286 return miscRegFile[MISCREG_PRV] == PRV_U;
287}
288
289void
291{
292 // First loop through the integer registers.
293 for (auto &id: intRegClass)
294 tc->setReg(id, src->getReg(id));
295
296 // Second loop through the float registers.
297 for (auto &id: floatRegClass)
298 tc->setReg(id, src->getReg(id));
299
300 // Third loop through the vector registers.
302 for (auto &id: vecRegClass) {
303 src->getReg(id, &vc);
304 tc->setReg(id, &vc);
305 }
306
307 // Copying Misc Regs
308 for (int i = 0; i < NUM_PHYS_MISCREGS; i++)
310
311 // Lastly copy PC/NPC
312 tc->pcState(src->pcState());
313}
314
316{
317 std::fill(miscRegFile.begin(), miscRegFile.end(), 0);
318
323
324 MISA misa = 0;
325 STATUS status = 0;
326
327 // default config arch isa string is rv64(32)imafdc
328 misa.rvi = misa.rvm = misa.rva = misa.rvf = misa.rvd = misa.rvc = 1;
329
330 switch (getPrivilegeModeSet()) {
331 case enums::M:
332 break;
333 case enums::MU:
334 misa.rvu = 1;
335 break;
336 case enums::MNU:
337 misa.rvu = misa.rvn = 1;
338 break;
339 case enums::MSU:
340 misa.rvs = misa.rvu = 1;
341 break;
342 case enums::MNSU:
343 misa.rvs = misa.rvu = misa.rvn = 1;
344 break;
345 default:
346 panic("Privilege mode set config should not reach here");
347 }
348
349 // mark FS is initial
350 status.fs = INITIAL;
351
352 // _rvType dependent init.
353 switch (_rvType) {
354 case RV32:
355 misa.rv32_mxl = 1;
356 break;
357 case RV64:
358 misa.rv64_mxl = 2;
359 status.uxl = status.sxl = 2;
360 if (getEnableRvv()) {
362 misa.rvv = 1;
363 }
364 break;
365 default:
366 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
367 }
368
369 miscRegFile[MISCREG_ISA] = misa;
373 // don't set it to zero; software may try to determine the supported
374 // triggers, starting at zero. simply set a different value here.
376 // NMI is always enabled.
378}
379
380bool
381ISA::hpmCounterEnabled(int misc_reg) const
382{
383 int hpmcounter = 0;
384 if (misc_reg >= MISCREG_CYCLEH) {
385 hpmcounter = misc_reg - MISCREG_CYCLEH;
386 } else {
387 hpmcounter = misc_reg - MISCREG_CYCLE;
388 }
389
390 if (hpmcounter < 0 || hpmcounter > 31)
391 panic("Illegal HPM counter %d\n", hpmcounter);
392 int counteren;
394 case PRV_M:
395 return true;
396 case PRV_S:
397 counteren = MISCREG_MCOUNTEREN;
398 break;
399 case PRV_U:
400 counteren = MISCREG_SCOUNTEREN;
401 break;
402 default:
403 panic("Unknown privilege level %d\n", miscRegFile[MISCREG_PRV]);
404 return false;
405 }
406 return (miscRegFile[counteren] & (1ULL << (hpmcounter))) > 0;
407}
408
409RegVal
411{
412 // Illegal CSR
413 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
414 DPRINTF(RiscvMisc, "Reading MiscReg %s (%d): %#x.\n",
415 MiscRegNames[idx], idx, miscRegFile[idx]);
416 return miscRegFile[idx];
417}
418
419RegVal
421{
422 switch (idx) {
423 case MISCREG_HARTID:
424 return tc->contextId();
425 case MISCREG_CYCLE:
427 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
428 tc->getCpuPtr()->curCycle());
429 return static_cast<RegVal>(tc->getCpuPtr()->curCycle());
430 } else {
431 warn("Cycle counter disabled.\n");
432 return 0;
433 }
434 case MISCREG_CYCLEH:
436 DPRINTF(RiscvMisc, "Cycle counter at: %llu.\n",
437 tc->getCpuPtr()->curCycle());
438 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
439 } else {
440 warn("Cycle counter disabled.\n");
441 return 0;
442 }
443 case MISCREG_TIME:
445 DPRINTF(RiscvMisc, "Wall-clock counter at: %llu.\n",
446 std::time(nullptr));
448 } else {
449 warn("Wall clock disabled.\n");
450 return 0;
451 }
452 case MISCREG_TIMEH:
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_INSTRET:
463 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
464 tc->getCpuPtr()->totalInsts());
465 return static_cast<RegVal>(tc->getCpuPtr()->totalInsts());
466 } else {
467 warn("Instruction counter disabled.\n");
468 return 0;
469 }
470 case MISCREG_INSTRETH:
472 DPRINTF(RiscvMisc, "Instruction counter at: %llu.\n",
473 tc->getCpuPtr()->totalInsts());
474 return bits<RegVal>(tc->getCpuPtr()->totalInsts(), 63, 32);
475 } else {
476 warn("Instruction counter disabled.\n");
477 return 0;
478 }
479 case MISCREG_IP:
480 {
481 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
483 return ic->readIP();
484 }
485 case MISCREG_UIP:
486 {
488 }
489 case MISCREG_SIP:
490 {
492 }
493 case MISCREG_IE:
494 {
495 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
497 return ic->readIE();
498 }
499 case MISCREG_UIE:
500 {
502 }
503 case MISCREG_SIE:
504 {
506 }
507 case MISCREG_SEPC:
508 case MISCREG_MEPC:
509 {
510 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
511 auto val = readMiscRegNoEffect(idx);
512 // if compressed instructions are disabled, epc[1] is set to 0
513 if (misa.rvc == 0)
514 return mbits(val, 63, 2);
515 // epc[0] is always 0
516 else
517 return mbits(val, 63, 1);
518 }
519 case MISCREG_STATUS:
520 {
521 // Updating the SD bit.
522 // . Per RISC-V ISA Manual, vol II, section 3.1.6.6, page 26,
523 // the SD bit is a read-only bit indicating whether any of
524 // FS, VS, and XS fields being in the respective dirty state.
525 // . Per section 3.1.6, page 20, the SD bit is the most
526 // significant bit of the MSTATUS CSR for both RV32 and RV64.
527 // . Per section 3.1.6.6, page 29, the explicit formula for
528 // updating the SD is,
529 // SD = ((FS==DIRTY) | (XS==DIRTY) | (VS==DIRTY))
530 // . Ideally, we want to update the SD after every relevant
531 // instruction, however, lazily updating the Status register
532 // upon its read produces the same effect as well.
533 STATUS status = readMiscRegNoEffect(idx);
534 uint64_t sd_bit = \
535 (status.xs == 3) || (status.fs == 3) || (status.vs == 3);
536 // For RV32, the SD bit is at index 31
537 // For RV64, the SD bit is at index 63.
538 switch (_rvType) {
539 case RV32:
540 status.rv32_sd = sd_bit;
541 break;
542 case RV64:
543 status.rv64_sd = sd_bit;
544 break;
545 default:
546 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
547 }
548 // Check status.mpp
549 MISA misa = readMiscRegNoEffect(MISCREG_ISA);
550 switch(status.mpp) {
551 case PRV_U:
552 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
553 break;
554 case PRV_S:
555 if (misa.rvs)
556 status.mpp = PRV_S;
557 else
558 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
559 break;
560 case PRV_M:
561 break;
562 default:
563 status.mpp = (misa.rvu) ? PRV_U : PRV_M;
564 }
565
567
568 return readMiscRegNoEffect(idx);
569 }
570 case MISCREG_USTATUS:
571 {
574 }
575 case MISCREG_SSTATUS:
576 {
579 }
580 case MISCREG_VLENB:
581 {
582 auto rpc = tc->pcState().as<PCState>();
583 return rpc.vlenb();
584 }
585 case MISCREG_VTYPE:
586 {
587 auto rpc = tc->pcState().as<PCState>();
588 return rpc.vtype();
589 }
590 case MISCREG_VL:
591 {
592 auto rpc = tc->pcState().as<PCState>();
593 return (RegVal)rpc.vl();
594 }
595 case MISCREG_VCSR:
596 {
599 }
600 break;
602 {
604 }
605 case MISCREG_FCSR:
606 {
609 }
610 default:
611 // Try reading HPM counters
612 // As a placeholder, all HPM counters are just cycle counters
613 if (idx >= MISCREG_HPMCOUNTER03 &&
614 idx <= MISCREG_HPMCOUNTER31) {
615 if (hpmCounterEnabled(idx)) {
616 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
617 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
618 return tc->getCpuPtr()->curCycle();
619 } else {
620 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
621 return 0;
622 }
623 } else if (idx >= MISCREG_HPMCOUNTER03H &&
624 idx <= MISCREG_HPMCOUNTER31H) {
625 if (hpmCounterEnabled(idx)) {
626 DPRINTF(RiscvMisc, "HPM counter %d: %llu.\n",
627 idx - MISCREG_CYCLE, tc->getCpuPtr()->curCycle());
628 return bits<RegVal>(tc->getCpuPtr()->curCycle(), 63, 32);
629 } else {
630 warn("HPM counter %d disabled.\n", idx - MISCREG_CYCLE);
631 return 0;
632 }
633 }
634 return readMiscRegNoEffect(idx);
635 }
636}
637
638void
640{
641 // Illegal CSR
642 panic_if(idx > NUM_PHYS_MISCREGS, "Illegal CSR index %#x\n", idx);
643 DPRINTF(RiscvMisc, "Setting MiscReg %s (%d) to %#x.\n",
644 MiscRegNames[idx], idx, val);
645 miscRegFile[idx] = val;
646}
647
648void
650{
651 if (idx >= MISCREG_CYCLE && idx <= MISCREG_HPMCOUNTER31) {
652 // Ignore writes to HPM counters for now
653 warn("Ignoring write to miscreg %s.\n", MiscRegNames[idx]);
654 } else {
655 switch (idx) {
656
657 // From section 3.7.1 of RISCV priv. specs
658 // V1.12, the odd-numbered configuration
659 // registers are illegal for RV64 and
660 // each 64 bit CFG register hold configurations
661 // for 8 PMP entries.
662
663 case MISCREG_PMPCFG0:
664 case MISCREG_PMPCFG1:
665 case MISCREG_PMPCFG2:
666 case MISCREG_PMPCFG3:
667 {
668 // PMP registers should only be modified in M mode
670
671 int regSize = 0;
672 switch (_rvType) {
673 case RV32:
674 regSize = 4;
675 break;
676 case RV64:
677 regSize = 8;
678 break;
679 default:
680 panic("%s: Unknown _rvType: %d", name(), (int)_rvType);
681 }
682
683 // Specs do not seem to mention what should be
684 // configured first, cfg or address regs!
685 // qemu seems to update the tables when
686 // pmp addr regs are written (with the assumption
687 // that cfg regs are already written)
688 RegVal res = 0;
689 RegVal old_val = readMiscRegNoEffect(idx);
690
691 for (int i=0; i < regSize; i++) {
692
693 uint8_t cfg_val = (val >> (8*i)) & 0xff;
694 auto mmu = dynamic_cast<RiscvISA::MMU *>
695 (tc->getMMUPtr());
696
697 // Form pmp_index using the index i and
698 // PMPCFG register number
699 uint32_t pmp_index = i+(4*(idx-MISCREG_PMPCFG0));
700 bool result = mmu->getPMP()->pmpUpdateCfg(pmp_index,cfg_val);
701 if (result) {
702 res |= ((RegVal)cfg_val << (8*i));
703 } else {
704 res |= (old_val & (0xFF << (8*i)));
705 }
706 }
707
708 setMiscRegNoEffect(idx, res);
709 }
710 break;
712 {
713 // PMP registers should only be modified in M mode
715
716 auto mmu = dynamic_cast<RiscvISA::MMU *>
717 (tc->getMMUPtr());
718 uint32_t pmp_index = idx-MISCREG_PMPADDR00;
719 if (mmu->getPMP()->pmpUpdateAddr(pmp_index, val)) {
721 }
722 }
723 break;
724
725 case MISCREG_IP:
726 {
728 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
730 ic->setIP(val);
731 }
732 break;
733 case MISCREG_UIP:
734 {
736 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
738 }
739 break;
740 case MISCREG_SIP:
741 {
743 val = (val & mask) | (readMiscReg(MISCREG_IP) & ~mask);
745 }
746 break;
747 case MISCREG_IE:
748 {
750 auto ic = dynamic_cast<RiscvISA::Interrupts *>(
752 ic->setIE(val);
753 }
754 break;
755 case MISCREG_UIE:
756 {
758 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
760 }
761 break;
762 case MISCREG_SIE:
763 {
765 val = (val & mask) | (readMiscReg(MISCREG_IE) & ~mask);
767 }
768 break;
769 case MISCREG_SATP:
770 {
771 // we only support bare and Sv39 mode; setting a different mode
772 // shall have no effect (see 4.1.12 in priv ISA manual)
773 SATP cur_val = readMiscRegNoEffect(idx);
774 SATP new_val = val;
775 if (new_val.mode != AddrXlateMode::BARE &&
776 new_val.mode != AddrXlateMode::SV39)
777 new_val.mode = cur_val.mode;
778 setMiscRegNoEffect(idx, new_val);
779 }
780 break;
781 case MISCREG_TSELECT:
782 {
783 // we don't support debugging, so always set a different value
784 // than written
785 setMiscRegNoEffect(idx, val + 1);
786 }
787 break;
788 case MISCREG_ISA:
789 {
790 MISA cur_misa = (MISA)readMiscRegNoEffect(MISCREG_ISA);
791 MISA new_misa = (MISA)val;
792 // only allow to disable compressed instructions
793 // if the following instruction is 4-byte aligned
794 if (new_misa.rvc == 0 &&
795 bits(tc->pcState().as<RiscvISA::PCState>().npc(),
796 2, 0) != 0) {
797 new_misa.rvc = new_misa.rvc | cur_misa.rvc;
798 }
799 if (!getEnableRvv()) {
800 new_misa.rvv = 0;
801 }
802 new_misa.rvn = cur_misa.rvn;
803 new_misa.rvs = cur_misa.rvs;
804 new_misa.rvu = cur_misa.rvu;
805 setMiscRegNoEffect(idx, new_misa);
806 }
807 break;
808 case MISCREG_STATUS:
809 {
811 if (_rvType != RV32) {
812 // SXL and UXL are hard-wired to 64 bit
813 auto cur = readMiscRegNoEffect(idx);
816 }
817 if (!getEnableRvv()) {
818 // Always OFF is rvv is disabled.
819 val &= ~STATUS_VS_MASK;
820 }
822 }
823 break;
824 case MISCREG_USTATUS:
825 {
827 val = (val & mask) |
830 }
831 break;
832 case MISCREG_SSTATUS:
833 {
835 val = (val & mask) |
838 }
839 break;
840 case MISCREG_VXSAT:
841 {
842 setMiscRegNoEffect(idx, val & 0x1);
843 }
844 break;
845 case MISCREG_VXRM:
846 {
847 setMiscRegNoEffect(idx, val & 0x3);
848 }
849 break;
850 case MISCREG_VCSR:
851 {
853 setMiscRegNoEffect(MISCREG_VXRM, (val & 0x6) >> 1);
854 }
855 break;
857 {
859 new_val |= (val & FFLAGS_MASK);
861 }
862 break;
863 case MISCREG_FFLAGS:
864 {
866 }
867 break;
868 case MISCREG_FRM:
869 {
871 }
872 break;
873 case MISCREG_FCSR:
874 {
877 }
878 break;
879 default:
881 }
882 }
883}
884
885void
887{
889
890 DPRINTF(Checkpoint, "Serializing Riscv Misc Registers\n");
892}
893
894void
896{
897 DPRINTF(Checkpoint, "Unserializing Riscv Misc Registers\n");
899}
900
901void
903{
904 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
905
906 if (load_reservation_addr == INVALID_RESERVATION_ADDR)
907 return;
908 Addr snoop_addr = pkt->getAddr() & cacheBlockMask;
909 DPRINTF(LLSC, "Locked snoop on address %x.\n", snoop_addr);
910 if ((load_reservation_addr & cacheBlockMask) == snoop_addr)
911 load_reservation_addr = INVALID_RESERVATION_ADDR;
912}
913
914
915void
917{
918 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
919
920 load_reservation_addr = req->getPaddr();
921 DPRINTF(LLSC, "[cid:%d]: Reserved address %x.\n",
922 req->contextId(), req->getPaddr());
923}
924
925bool
926ISA::handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask)
927{
928 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
929 bool lr_addr_empty = (load_reservation_addr == INVALID_RESERVATION_ADDR);
930
931 // Normally RISC-V uses zero to indicate success and nonzero to indicate
932 // failure (right now only 1 is reserved), but in gem5 zero indicates
933 // failure and one indicates success, so here we conform to that (it should
934 // be switched in the instruction's implementation)
935
936 DPRINTF(LLSC, "[cid:%d]: load_reservation_addrs empty? %s.\n",
937 req->contextId(),
938 lr_addr_empty ? "yes" : "no");
939 if (!lr_addr_empty) {
940 DPRINTF(LLSC, "[cid:%d]: addr = %x.\n", req->contextId(),
941 req->getPaddr() & cacheBlockMask);
942 DPRINTF(LLSC, "[cid:%d]: last locked addr = %x.\n", req->contextId(),
943 load_reservation_addr & cacheBlockMask);
944 }
945 if (lr_addr_empty ||
946 (load_reservation_addr & cacheBlockMask)
947 != ((req->getPaddr() & cacheBlockMask))) {
948 req->setExtraData(0);
949 int stCondFailures = tc->readStCondFailures();
950 tc->setStCondFailures(++stCondFailures);
951 if (stCondFailures % WARN_FAILURE == 0) {
952 warn("%i: context %d: %d consecutive SC failures.\n",
953 curTick(), tc->contextId(), stCondFailures);
954 }
955
956 // Must clear any reservations
957 load_reservation_addr = INVALID_RESERVATION_ADDR;
958
959 return false;
960 }
961 if (req->isUncacheable()) {
962 req->setExtraData(2);
963 }
964
965 // Must clear any reservations
966 load_reservation_addr = INVALID_RESERVATION_ADDR;
967
968 DPRINTF(LLSC, "[cid:%d]: SC success! Current locked addr = %x.\n",
969 req->contextId(), load_reservation_addr & cacheBlockMask);
970 return true;
971}
972
973void
975{
976 tc->getCpuPtr()->wakeup(tc->threadId());
977 Addr& load_reservation_addr = load_reservation_addrs[tc->contextId()];
978 load_reservation_addr = INVALID_RESERVATION_ADDR;
979}
980
981void
983{
984 Reset().invoke(tc);
985}
986
987Addr
988ISA::getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
989{
990 auto vec = tc->readMiscRegNoEffect(idx);
991 Addr addr = mbits(vec, 63, 2);
992 if (intr && bits(vec, 1, 0) == 1)
993 addr += 4 * cause;
994 return addr;
995}
996
997} // namespace RiscvISA
998} // namespace gem5
999
1000std::ostream &
1001operator<<(std::ostream &os, gem5::RiscvISA::PrivilegeMode pm)
1002{
1003 switch (pm) {
1005 return os << "PRV_U";
1007 return os << "PRV_S";
1009 return os << "PRV_M";
1010 }
1011 return os << "PRV_<invalid>";
1012}
#define DPRINTF(x,...)
Definition trace.hh:210
BaseInterrupts * getInterruptController(ThreadID tid)
Definition base.hh:228
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:649
void handleLockedSnoop(PacketPtr pkt, Addr cacheBlockMask) override
Definition isa.cc:902
RegVal readMiscReg(RegIndex idx) override
Definition isa.cc:420
void globalClearExclusive() override
Definition isa.cc:974
const int WARN_FAILURE
Definition isa.hh:82
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition isa.cc:886
void resetThread() override
Definition isa.cc:982
void setMiscRegNoEffect(RegIndex idx, RegVal val) override
Definition isa.cc:639
RegVal readMiscRegNoEffect(RegIndex idx) const override
Definition isa.cc:410
bool hpmCounterEnabled(int counter) const
Definition isa.cc:381
void copyRegsFrom(ThreadContext *src) override
Definition isa.cc:290
RiscvType rvType() const
Definition isa.hh:153
bool handleLockedWrite(const RequestPtr &req, Addr cacheBlockMask) override
Definition isa.cc:926
void clear() override
Definition isa.cc:315
bool getEnableRvv() const
Definition isa.hh:155
std::vector< RegVal > miscRegFile
Definition isa.hh:76
bool inUserMode() const override
Definition isa.cc:284
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition isa.cc:895
const Addr INVALID_RESERVATION_ADDR
Definition isa.hh:83
virtual Addr getFaultHandlerAddr(RegIndex idx, uint64_t cause, bool intr) const
Definition isa.cc:988
std::unordered_map< int, Addr > load_reservation_addrs
Definition isa.hh:84
RiscvType _rvType
Definition isa.hh:75
PrivilegeModeSet getPrivilegeModeSet()
Definition isa.hh:171
RiscvISAParams Params
Definition isa.hh:102
ISA(const Params &p)
Definition isa.cc:259
void handleLockedRead(const RequestPtr &req) override
Definition isa.cc:916
void vlenb(uint64_t v)
Definition pcstate.hh:107
void vtype(VTYPE v)
Definition pcstate.hh:110
void vl(uint32_t v)
Definition pcstate.hh:113
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:2937
Bitfield< 25 > vec
Definition misc.hh:113
const RegVal UI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1487
const RegVal SI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1478
Bitfield< 0 > p
constexpr enums::RiscvType RV32
Definition pcstate.hh:56
const RegVal FRM_MASK
Definition misc.hh:1495
Bitfield< 2 > i
const RegVal SSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1399
const RegVal STATUS_SXL_MASK
Definition misc.hh:1305
const RegVal FFLAGS_MASK
Definition misc.hh:1494
const RegVal STATUS_UXL_MASK
Definition misc.hh:1306
const RegVal USTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1430
const std::array< const char *, NUM_MISCREGS > MiscRegNames
Definition isa.cc:70
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:232
@ MISCREG_USTATUS
Definition misc.hh:257
@ 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:229
@ 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:249
@ MISCREG_HPMCOUNTER22H
Definition misc.hh:238
@ 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:220
@ MISCREG_HPMEVENT21
Definition misc.hh:129
@ MISCREG_HPMCOUNTER12H
Definition misc.hh:228
@ 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:218
@ 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:219
@ MISCREG_HPMCOUNTER15H
Definition misc.hh:231
@ MISCREG_MEDELEG
Definition misc.hh:148
@ MISCREG_USCRATCH
Definition misc.hh:188
@ MISCREG_HPMEVENT25
Definition misc.hh:133
@ MISCREG_HPMCOUNTER31H
Definition misc.hh:247
@ MISCREG_HPMCOUNTER11
Definition misc.hh:90
@ MISCREG_HPMCOUNTER17H
Definition misc.hh:233
@ MISCREG_HPMEVENT03
Definition misc.hh:111
@ MISCREG_PMPCFG1
Definition misc.hh:157
@ MISCREG_SSTATUS
Definition misc.hh:260
@ MISCREG_HPMEVENT13
Definition misc.hh:121
@ MISCREG_PMPADDR13
Definition misc.hh:173
@ MISCREG_FFLAGS_EXE
Definition misc.hh:255
@ MISCREG_HPMCOUNTER12
Definition misc.hh:91
@ MISCREG_HPMCOUNTER29H
Definition misc.hh:245
@ 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:237
@ MISCREG_PMPADDR03
Definition misc.hh:163
@ MISCREG_SCOUNTEREN
Definition misc.hh:180
@ MISCREG_HPMCOUNTER18H
Definition misc.hh:234
@ MISCREG_HPMCOUNTER06
Definition misc.hh:85
@ MISCREG_HPMCOUNTER20H
Definition misc.hh:236
@ 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:214
@ 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:221
@ MISCREG_HPMCOUNTER20
Definition misc.hh:99
@ MISCREG_HPMEVENT09
Definition misc.hh:117
@ MISCREG_HPMCOUNTER04
Definition misc.hh:83
@ MISCREG_HPMCOUNTER25H
Definition misc.hh:241
@ MISCREG_HPMCOUNTER27H
Definition misc.hh:243
@ MISCREG_HPMCOUNTER06H
Definition misc.hh:222
@ MISCREG_PMPADDR07
Definition misc.hh:167
@ MISCREG_HPMCOUNTER08H
Definition misc.hh:224
@ MISCREG_HPMEVENT16
Definition misc.hh:124
@ MISCREG_HPMCOUNTER18
Definition misc.hh:97
@ MISCREG_SSCRATCH
Definition misc.hh:181
@ MISCREG_HPMCOUNTER19H
Definition misc.hh:235
@ MISCREG_HPMEVENT14
Definition misc.hh:122
@ MISCREG_HPMCOUNTER10H
Definition misc.hh:226
@ MISCREG_HPMCOUNTER05
Definition misc.hh:84
@ MISCREG_HPMCOUNTER30H
Definition misc.hh:246
@ MISCREG_HPMCOUNTER17
Definition misc.hh:96
@ MISCREG_HPMCOUNTER09H
Definition misc.hh:225
@ MISCREG_HPMCOUNTER27
Definition misc.hh:106
@ MISCREG_HPMCOUNTER24
Definition misc.hh:103
@ MISCREG_HPMCOUNTER28H
Definition misc.hh:244
@ MISCREG_HPMCOUNTER14H
Definition misc.hh:230
@ MISCREG_HPMCOUNTER23
Definition misc.hh:102
@ MISCREG_CYCLE
Definition misc.hh:79
@ MISCREG_HPMCOUNTER07H
Definition misc.hh:223
@ 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:240
@ MISCREG_HPMEVENT11
Definition misc.hh:119
@ MISCREG_HPMCOUNTER31
Definition misc.hh:110
@ MISCREG_HPMCOUNTER23H
Definition misc.hh:239
@ MISCREG_HPMCOUNTER11H
Definition misc.hh:227
@ 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:242
@ MISCREG_PMPCFG2
Definition misc.hh:158
const off_t FRM_OFFSET
Definition misc.hh:1279
const RegVal MI_MASK[enums::Num_PrivilegeModeSet]
Definition misc.hh:1467
const RegVal MSTATUS_MASKS[enums::Num_RiscvType][enums::Num_PrivilegeModeSet]
Definition misc.hh:1325
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 3 > addr
Definition types.hh:84
constexpr RegClass floatRegClass
Definition float.hh:143
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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
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:1001

Generated on Tue Jun 18 2024 16:23:57 for gem5 by doxygen 1.11.0