gem5  v22.1.0.0
misc.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 ARM Limited
3  * Copyright (c) 2014-2015 Sven Karlsson
4  * Copyright (c) 2019 Yifei Liu
5  * Copyright (c) 2020 Barkhausen Institut
6  * Copyright (c) 2021 StreamComputing Corp
7  * All rights reserved
8  *
9  * The license below extends only to copyright in the software and shall
10  * not be construed as granting a license to any other intellectual
11  * property including but not limited to intellectual property relating
12  * to a hardware implementation of the functionality of the software
13  * licensed hereunder. You may use the software subject to the license
14  * terms below provided that you ensure that this notice is replicated
15  * unmodified and in its entirety in all distributions of the software,
16  * modified or unmodified, in source code or in binary form.
17  *
18  * Copyright (c) 2016 RISC-V Foundation
19  * Copyright (c) 2016 The University of Virginia
20  * All rights reserved.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions are
24  * met: redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer;
26  * redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution;
29  * neither the name of the copyright holders nor the names of its
30  * contributors may be used to endorse or promote products derived from
31  * this software without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
40  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
41  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44  */
45 
46 #ifndef __ARCH_RISCV_REGS_MISC_HH__
47 #define __ARCH_RISCV_REGS_MISC_HH__
48 
49 #include <string>
50 #include <unordered_map>
51 
53 #include "arch/generic/vec_reg.hh"
54 #include "base/bitunion.hh"
55 #include "base/types.hh"
56 #include "cpu/reg_class.hh"
57 #include "debug/MiscRegs.hh"
58 
59 namespace gem5
60 {
61 
62 namespace RiscvISA
63 {
64 
66 {
144 
154  // pmpcfg1 rv32 only
156  // pmpcfg3 rv32 only
173 
183 
191 
192  // These registers are not in the standard, hence does not exist in the
193  // CSRData map. These are mainly used to provide a minimal implementation
194  // for non-maskable-interrupt in our simple cpu.
195  // non-maskable-interrupt-vector-base-address: NMI version of xTVEC
197  // non-maskable-interrupt-enable: NMI version of xIE
199  // non-maskable-interrupt-pending: NMI version of xIP
201 
203 };
204 
206  NUM_MISCREGS, debug::MiscRegs);
207 
209 {
210  CSR_USTATUS = 0x000,
211  CSR_UIE = 0x004,
212  CSR_UTVEC = 0x005,
213  CSR_USCRATCH = 0x040,
214  CSR_UEPC = 0x041,
215  CSR_UCAUSE = 0x042,
216  CSR_UTVAL = 0x043,
217  CSR_UIP = 0x044,
218  CSR_FFLAGS = 0x001,
219  CSR_FRM = 0x002,
220  CSR_FCSR = 0x003,
221  CSR_CYCLE = 0xC00,
222  CSR_TIME = 0xC01,
223  CSR_INSTRET = 0xC02,
253  // HPMCOUNTERH rv32 only
254 
255  CSR_SSTATUS = 0x100,
256  CSR_SEDELEG = 0x102,
257  CSR_SIDELEG = 0x103,
258  CSR_SIE = 0x104,
259  CSR_STVEC = 0x105,
260  CSR_SCOUNTEREN = 0x106,
261  CSR_SSCRATCH = 0x140,
262  CSR_SEPC = 0x141,
263  CSR_SCAUSE = 0x142,
264  CSR_STVAL = 0x143,
265  CSR_SIP = 0x144,
266  CSR_SATP = 0x180,
267 
268  CSR_MVENDORID = 0xF11,
269  CSR_MARCHID = 0xF12,
270  CSR_MIMPID = 0xF13,
271  CSR_MHARTID = 0xF14,
272  CSR_MSTATUS = 0x300,
273  CSR_MISA = 0x301,
274  CSR_MEDELEG = 0x302,
275  CSR_MIDELEG = 0x303,
276  CSR_MIE = 0x304,
277  CSR_MTVEC = 0x305,
278  CSR_MCOUNTEREN = 0x306,
279  CSR_MSCRATCH = 0x340,
280  CSR_MEPC = 0x341,
281  CSR_MCAUSE = 0x342,
282  CSR_MTVAL = 0x343,
283  CSR_MIP = 0x344,
284  CSR_PMPCFG0 = 0x3A0,
285  // pmpcfg1 rv32 only
286  CSR_PMPCFG2 = 0x3A2,
287  // pmpcfg3 rv32 only
288  CSR_PMPADDR00 = 0x3B0,
289  CSR_PMPADDR01 = 0x3B1,
290  CSR_PMPADDR02 = 0x3B2,
291  CSR_PMPADDR03 = 0x3B3,
292  CSR_PMPADDR04 = 0x3B4,
293  CSR_PMPADDR05 = 0x3B5,
294  CSR_PMPADDR06 = 0x3B6,
295  CSR_PMPADDR07 = 0x3B7,
296  CSR_PMPADDR08 = 0x3B8,
297  CSR_PMPADDR09 = 0x3B9,
298  CSR_PMPADDR10 = 0x3BA,
299  CSR_PMPADDR11 = 0x3BB,
300  CSR_PMPADDR12 = 0x3BC,
301  CSR_PMPADDR13 = 0x3BD,
302  CSR_PMPADDR14 = 0x3BE,
303  CSR_PMPADDR15 = 0x3BF,
304  CSR_MCYCLE = 0xB00,
305  CSR_MINSTRET = 0xB02,
335  // MHPMCOUNTERH rv32 only
365 
366  CSR_TSELECT = 0x7A0,
367  CSR_TDATA1 = 0x7A1,
368  CSR_TDATA2 = 0x7A2,
369  CSR_TDATA3 = 0x7A3,
370  CSR_DCSR = 0x7B0,
371  CSR_DPC = 0x7B1,
372  CSR_DSCRATCH = 0x7B2
373 };
374 
376 {
377  const std::string name;
378  const int physIndex;
379 };
380 
381 const std::unordered_map<int, CSRMetadata> CSRData = {
382  {CSR_USTATUS, {"ustatus", MISCREG_STATUS}},
383  {CSR_UIE, {"uie", MISCREG_IE}},
384  {CSR_UTVEC, {"utvec", MISCREG_UTVEC}},
385  {CSR_USCRATCH, {"uscratch", MISCREG_USCRATCH}},
386  {CSR_UEPC, {"uepc", MISCREG_UEPC}},
387  {CSR_UCAUSE, {"ucause", MISCREG_UCAUSE}},
388  {CSR_UTVAL, {"utval", MISCREG_UTVAL}},
389  {CSR_UIP, {"uip", MISCREG_IP}},
390  {CSR_FFLAGS, {"fflags", MISCREG_FFLAGS}},
391  {CSR_FRM, {"frm", MISCREG_FRM}},
392  {CSR_FCSR, {"fcsr", MISCREG_FFLAGS}}, // Actually FRM << 5 | FFLAGS
393  {CSR_CYCLE, {"cycle", MISCREG_CYCLE}},
394  {CSR_TIME, {"time", MISCREG_TIME}},
395  {CSR_INSTRET, {"instret", MISCREG_INSTRET}},
396  {CSR_HPMCOUNTER03, {"hpmcounter03", MISCREG_HPMCOUNTER03}},
397  {CSR_HPMCOUNTER04, {"hpmcounter04", MISCREG_HPMCOUNTER04}},
398  {CSR_HPMCOUNTER05, {"hpmcounter05", MISCREG_HPMCOUNTER05}},
399  {CSR_HPMCOUNTER06, {"hpmcounter06", MISCREG_HPMCOUNTER06}},
400  {CSR_HPMCOUNTER07, {"hpmcounter07", MISCREG_HPMCOUNTER07}},
401  {CSR_HPMCOUNTER08, {"hpmcounter08", MISCREG_HPMCOUNTER08}},
402  {CSR_HPMCOUNTER09, {"hpmcounter09", MISCREG_HPMCOUNTER09}},
403  {CSR_HPMCOUNTER10, {"hpmcounter10", MISCREG_HPMCOUNTER10}},
404  {CSR_HPMCOUNTER11, {"hpmcounter11", MISCREG_HPMCOUNTER11}},
405  {CSR_HPMCOUNTER12, {"hpmcounter12", MISCREG_HPMCOUNTER12}},
406  {CSR_HPMCOUNTER13, {"hpmcounter13", MISCREG_HPMCOUNTER13}},
407  {CSR_HPMCOUNTER14, {"hpmcounter14", MISCREG_HPMCOUNTER14}},
408  {CSR_HPMCOUNTER15, {"hpmcounter15", MISCREG_HPMCOUNTER15}},
409  {CSR_HPMCOUNTER16, {"hpmcounter16", MISCREG_HPMCOUNTER16}},
410  {CSR_HPMCOUNTER17, {"hpmcounter17", MISCREG_HPMCOUNTER17}},
411  {CSR_HPMCOUNTER18, {"hpmcounter18", MISCREG_HPMCOUNTER18}},
412  {CSR_HPMCOUNTER19, {"hpmcounter19", MISCREG_HPMCOUNTER19}},
413  {CSR_HPMCOUNTER20, {"hpmcounter20", MISCREG_HPMCOUNTER20}},
414  {CSR_HPMCOUNTER21, {"hpmcounter21", MISCREG_HPMCOUNTER21}},
415  {CSR_HPMCOUNTER22, {"hpmcounter22", MISCREG_HPMCOUNTER22}},
416  {CSR_HPMCOUNTER23, {"hpmcounter23", MISCREG_HPMCOUNTER23}},
417  {CSR_HPMCOUNTER24, {"hpmcounter24", MISCREG_HPMCOUNTER24}},
418  {CSR_HPMCOUNTER25, {"hpmcounter25", MISCREG_HPMCOUNTER25}},
419  {CSR_HPMCOUNTER26, {"hpmcounter26", MISCREG_HPMCOUNTER26}},
420  {CSR_HPMCOUNTER27, {"hpmcounter27", MISCREG_HPMCOUNTER27}},
421  {CSR_HPMCOUNTER28, {"hpmcounter28", MISCREG_HPMCOUNTER28}},
422  {CSR_HPMCOUNTER29, {"hpmcounter29", MISCREG_HPMCOUNTER29}},
423  {CSR_HPMCOUNTER30, {"hpmcounter30", MISCREG_HPMCOUNTER30}},
424  {CSR_HPMCOUNTER31, {"hpmcounter31", MISCREG_HPMCOUNTER31}},
425 
426  {CSR_SSTATUS, {"sstatus", MISCREG_STATUS}},
427  {CSR_SEDELEG, {"sedeleg", MISCREG_SEDELEG}},
428  {CSR_SIDELEG, {"sideleg", MISCREG_SIDELEG}},
429  {CSR_SIE, {"sie", MISCREG_IE}},
430  {CSR_STVEC, {"stvec", MISCREG_STVEC}},
431  {CSR_SCOUNTEREN, {"scounteren", MISCREG_SCOUNTEREN}},
432  {CSR_SSCRATCH, {"sscratch", MISCREG_SSCRATCH}},
433  {CSR_SEPC, {"sepc", MISCREG_SEPC}},
434  {CSR_SCAUSE, {"scause", MISCREG_SCAUSE}},
435  {CSR_STVAL, {"stval", MISCREG_STVAL}},
436  {CSR_SIP, {"sip", MISCREG_IP}},
437  {CSR_SATP, {"satp", MISCREG_SATP}},
438 
439  {CSR_MVENDORID, {"mvendorid", MISCREG_VENDORID}},
440  {CSR_MARCHID, {"marchid", MISCREG_ARCHID}},
441  {CSR_MIMPID, {"mimpid", MISCREG_IMPID}},
442  {CSR_MHARTID, {"mhartid", MISCREG_HARTID}},
443  {CSR_MSTATUS, {"mstatus", MISCREG_STATUS}},
444  {CSR_MISA, {"misa", MISCREG_ISA}},
445  {CSR_MEDELEG, {"medeleg", MISCREG_MEDELEG}},
446  {CSR_MIDELEG, {"mideleg", MISCREG_MIDELEG}},
447  {CSR_MIE, {"mie", MISCREG_IE}},
448  {CSR_MTVEC, {"mtvec", MISCREG_MTVEC}},
449  {CSR_MCOUNTEREN, {"mcounteren", MISCREG_MCOUNTEREN}},
450  {CSR_MSCRATCH, {"mscratch", MISCREG_MSCRATCH}},
451  {CSR_MEPC, {"mepc", MISCREG_MEPC}},
452  {CSR_MCAUSE, {"mcause", MISCREG_MCAUSE}},
453  {CSR_MTVAL, {"mtval", MISCREG_MTVAL}},
454  {CSR_MIP, {"mip", MISCREG_IP}},
455  {CSR_PMPCFG0, {"pmpcfg0", MISCREG_PMPCFG0}},
456  // pmpcfg1 rv32 only
457  {CSR_PMPCFG2, {"pmpcfg2", MISCREG_PMPCFG2}},
458  // pmpcfg3 rv32 only
459  {CSR_PMPADDR00, {"pmpaddr0", MISCREG_PMPADDR00}},
460  {CSR_PMPADDR01, {"pmpaddr1", MISCREG_PMPADDR01}},
461  {CSR_PMPADDR02, {"pmpaddr2", MISCREG_PMPADDR02}},
462  {CSR_PMPADDR03, {"pmpaddr3", MISCREG_PMPADDR03}},
463  {CSR_PMPADDR04, {"pmpaddr4", MISCREG_PMPADDR04}},
464  {CSR_PMPADDR05, {"pmpaddr5", MISCREG_PMPADDR05}},
465  {CSR_PMPADDR06, {"pmpaddr6", MISCREG_PMPADDR06}},
466  {CSR_PMPADDR07, {"pmpaddr7", MISCREG_PMPADDR07}},
467  {CSR_PMPADDR08, {"pmpaddr8", MISCREG_PMPADDR08}},
468  {CSR_PMPADDR09, {"pmpaddr9", MISCREG_PMPADDR09}},
469  {CSR_PMPADDR10, {"pmpaddr10", MISCREG_PMPADDR10}},
470  {CSR_PMPADDR11, {"pmpaddr11", MISCREG_PMPADDR11}},
471  {CSR_PMPADDR12, {"pmpaddr12", MISCREG_PMPADDR12}},
472  {CSR_PMPADDR13, {"pmpaddr13", MISCREG_PMPADDR13}},
473  {CSR_PMPADDR14, {"pmpaddr14", MISCREG_PMPADDR14}},
474  {CSR_PMPADDR15, {"pmpaddr15", MISCREG_PMPADDR15}},
475  {CSR_MCYCLE, {"mcycle", MISCREG_CYCLE}},
476  {CSR_MINSTRET, {"minstret", MISCREG_INSTRET}},
477  {CSR_MHPMCOUNTER03, {"mhpmcounter03", MISCREG_HPMCOUNTER03}},
478  {CSR_MHPMCOUNTER04, {"mhpmcounter04", MISCREG_HPMCOUNTER04}},
479  {CSR_MHPMCOUNTER05, {"mhpmcounter05", MISCREG_HPMCOUNTER05}},
480  {CSR_MHPMCOUNTER06, {"mhpmcounter06", MISCREG_HPMCOUNTER06}},
481  {CSR_MHPMCOUNTER07, {"mhpmcounter07", MISCREG_HPMCOUNTER07}},
482  {CSR_MHPMCOUNTER08, {"mhpmcounter08", MISCREG_HPMCOUNTER08}},
483  {CSR_MHPMCOUNTER09, {"mhpmcounter09", MISCREG_HPMCOUNTER09}},
484  {CSR_MHPMCOUNTER10, {"mhpmcounter10", MISCREG_HPMCOUNTER10}},
485  {CSR_MHPMCOUNTER11, {"mhpmcounter11", MISCREG_HPMCOUNTER11}},
486  {CSR_MHPMCOUNTER12, {"mhpmcounter12", MISCREG_HPMCOUNTER12}},
487  {CSR_MHPMCOUNTER13, {"mhpmcounter13", MISCREG_HPMCOUNTER13}},
488  {CSR_MHPMCOUNTER14, {"mhpmcounter14", MISCREG_HPMCOUNTER14}},
489  {CSR_MHPMCOUNTER15, {"mhpmcounter15", MISCREG_HPMCOUNTER15}},
490  {CSR_MHPMCOUNTER16, {"mhpmcounter16", MISCREG_HPMCOUNTER16}},
491  {CSR_MHPMCOUNTER17, {"mhpmcounter17", MISCREG_HPMCOUNTER17}},
492  {CSR_MHPMCOUNTER18, {"mhpmcounter18", MISCREG_HPMCOUNTER18}},
493  {CSR_MHPMCOUNTER19, {"mhpmcounter19", MISCREG_HPMCOUNTER19}},
494  {CSR_MHPMCOUNTER20, {"mhpmcounter20", MISCREG_HPMCOUNTER20}},
495  {CSR_MHPMCOUNTER21, {"mhpmcounter21", MISCREG_HPMCOUNTER21}},
496  {CSR_MHPMCOUNTER22, {"mhpmcounter22", MISCREG_HPMCOUNTER22}},
497  {CSR_MHPMCOUNTER23, {"mhpmcounter23", MISCREG_HPMCOUNTER23}},
498  {CSR_MHPMCOUNTER24, {"mhpmcounter24", MISCREG_HPMCOUNTER24}},
499  {CSR_MHPMCOUNTER25, {"mhpmcounter25", MISCREG_HPMCOUNTER25}},
500  {CSR_MHPMCOUNTER26, {"mhpmcounter26", MISCREG_HPMCOUNTER26}},
501  {CSR_MHPMCOUNTER27, {"mhpmcounter27", MISCREG_HPMCOUNTER27}},
502  {CSR_MHPMCOUNTER28, {"mhpmcounter28", MISCREG_HPMCOUNTER28}},
503  {CSR_MHPMCOUNTER29, {"mhpmcounter29", MISCREG_HPMCOUNTER29}},
504  {CSR_MHPMCOUNTER30, {"mhpmcounter30", MISCREG_HPMCOUNTER30}},
505  {CSR_MHPMCOUNTER31, {"mhpmcounter31", MISCREG_HPMCOUNTER31}},
506  {CSR_MHPMEVENT03, {"mhpmevent03", MISCREG_HPMEVENT03}},
507  {CSR_MHPMEVENT04, {"mhpmevent04", MISCREG_HPMEVENT04}},
508  {CSR_MHPMEVENT05, {"mhpmevent05", MISCREG_HPMEVENT05}},
509  {CSR_MHPMEVENT06, {"mhpmevent06", MISCREG_HPMEVENT06}},
510  {CSR_MHPMEVENT07, {"mhpmevent07", MISCREG_HPMEVENT07}},
511  {CSR_MHPMEVENT08, {"mhpmevent08", MISCREG_HPMEVENT08}},
512  {CSR_MHPMEVENT09, {"mhpmevent09", MISCREG_HPMEVENT09}},
513  {CSR_MHPMEVENT10, {"mhpmevent10", MISCREG_HPMEVENT10}},
514  {CSR_MHPMEVENT11, {"mhpmevent11", MISCREG_HPMEVENT11}},
515  {CSR_MHPMEVENT12, {"mhpmevent12", MISCREG_HPMEVENT12}},
516  {CSR_MHPMEVENT13, {"mhpmevent13", MISCREG_HPMEVENT13}},
517  {CSR_MHPMEVENT14, {"mhpmevent14", MISCREG_HPMEVENT14}},
518  {CSR_MHPMEVENT15, {"mhpmevent15", MISCREG_HPMEVENT15}},
519  {CSR_MHPMEVENT16, {"mhpmevent16", MISCREG_HPMEVENT16}},
520  {CSR_MHPMEVENT17, {"mhpmevent17", MISCREG_HPMEVENT17}},
521  {CSR_MHPMEVENT18, {"mhpmevent18", MISCREG_HPMEVENT18}},
522  {CSR_MHPMEVENT19, {"mhpmevent19", MISCREG_HPMEVENT19}},
523  {CSR_MHPMEVENT20, {"mhpmevent20", MISCREG_HPMEVENT20}},
524  {CSR_MHPMEVENT21, {"mhpmevent21", MISCREG_HPMEVENT21}},
525  {CSR_MHPMEVENT22, {"mhpmevent22", MISCREG_HPMEVENT22}},
526  {CSR_MHPMEVENT23, {"mhpmevent23", MISCREG_HPMEVENT23}},
527  {CSR_MHPMEVENT24, {"mhpmevent24", MISCREG_HPMEVENT24}},
528  {CSR_MHPMEVENT25, {"mhpmevent25", MISCREG_HPMEVENT25}},
529  {CSR_MHPMEVENT26, {"mhpmevent26", MISCREG_HPMEVENT26}},
530  {CSR_MHPMEVENT27, {"mhpmevent27", MISCREG_HPMEVENT27}},
531  {CSR_MHPMEVENT28, {"mhpmevent28", MISCREG_HPMEVENT28}},
532  {CSR_MHPMEVENT29, {"mhpmevent29", MISCREG_HPMEVENT29}},
533  {CSR_MHPMEVENT30, {"mhpmevent30", MISCREG_HPMEVENT30}},
534  {CSR_MHPMEVENT31, {"mhpmevent31", MISCREG_HPMEVENT31}},
535 
536  {CSR_TSELECT, {"tselect", MISCREG_TSELECT}},
537  {CSR_TDATA1, {"tdata1", MISCREG_TDATA1}},
538  {CSR_TDATA2, {"tdata2", MISCREG_TDATA2}},
539  {CSR_TDATA3, {"tdata3", MISCREG_TDATA3}},
540  {CSR_DCSR, {"dcsr", MISCREG_DCSR}},
541  {CSR_DPC, {"dpc", MISCREG_DPC}},
542  {CSR_DSCRATCH, {"dscratch", MISCREG_DSCRATCH}}
543 };
544 
552 BitUnion64(STATUS)
553  Bitfield<63> sd;
554  Bitfield<35, 34> sxl;
555  Bitfield<33, 32> uxl;
556  Bitfield<22> tsr;
557  Bitfield<21> tw;
558  Bitfield<20> tvm;
559  Bitfield<19> mxr;
560  Bitfield<18> sum;
561  Bitfield<17> mprv;
562  Bitfield<16, 15> xs;
563  Bitfield<14, 13> fs;
564  Bitfield<12, 11> mpp;
565  Bitfield<10, 9> vs;
566  Bitfield<8> spp;
567  Bitfield<7> mpie;
568  Bitfield<5> spie;
569  Bitfield<4> upie;
570  Bitfield<3> mie;
571  Bitfield<1> sie;
572  Bitfield<0> uie;
573 EndBitUnion(STATUS)
574 
575 
581 BitUnion64(INTERRUPT)
582  Bitfield<11> mei;
583  Bitfield<9> sei;
584  Bitfield<8> uei;
585  Bitfield<7> mti;
586  Bitfield<5> sti;
587  Bitfield<4> uti;
588  Bitfield<3> msi;
589  Bitfield<1> ssi;
590  Bitfield<0> usi;
591 EndBitUnion(INTERRUPT)
592 
593 const off_t MXL_OFFSET = (sizeof(uint64_t) * 8 - 2);
594 const off_t SXL_OFFSET = 34;
595 const off_t UXL_OFFSET = 32;
596 const off_t FS_OFFSET = 13;
597 const off_t FRM_OFFSET = 5;
598 
599 const RegVal ISA_MXL_MASK = 3ULL << MXL_OFFSET;
601 const RegVal ISA_EXT_C_MASK = 1UL << ('c' - 'a');
603 
604 const RegVal STATUS_SD_MASK = 1ULL << ((sizeof(uint64_t) * 8) - 1);
607 const RegVal STATUS_TSR_MASK = 1ULL << 22;
608 const RegVal STATUS_TW_MASK = 1ULL << 21;
609 const RegVal STATUS_TVM_MASK = 1ULL << 20;
610 const RegVal STATUS_MXR_MASK = 1ULL << 19;
611 const RegVal STATUS_SUM_MASK = 1ULL << 18;
612 const RegVal STATUS_MPRV_MASK = 1ULL << 17;
613 const RegVal STATUS_XS_MASK = 3ULL << 15;
615 const RegVal STATUS_MPP_MASK = 3ULL << 11;
616 const RegVal STATUS_VS_MASK = 3ULL << 9;
617 const RegVal STATUS_SPP_MASK = 1ULL << 8;
618 const RegVal STATUS_MPIE_MASK = 1ULL << 7;
619 const RegVal STATUS_SPIE_MASK = 1ULL << 5;
620 const RegVal STATUS_UPIE_MASK = 1ULL << 4;
621 const RegVal STATUS_MIE_MASK = 1ULL << 3;
622 const RegVal STATUS_SIE_MASK = 1ULL << 1;
623 const RegVal STATUS_UIE_MASK = 1ULL << 0;
644 
645 const RegVal MEI_MASK = 1ULL << 11;
646 const RegVal SEI_MASK = 1ULL << 9;
647 const RegVal UEI_MASK = 1ULL << 8;
648 const RegVal MTI_MASK = 1ULL << 7;
649 const RegVal STI_MASK = 1ULL << 5;
650 const RegVal UTI_MASK = 1ULL << 4;
651 const RegVal MSI_MASK = 1ULL << 3;
652 const RegVal SSI_MASK = 1ULL << 1;
653 const RegVal USI_MASK = 1ULL << 0;
658  STI_MASK | UTI_MASK |
659  SSI_MASK | USI_MASK;
661 const RegVal FFLAGS_MASK = (1 << FRM_OFFSET) - 1;
662 const RegVal FRM_MASK = 0x7;
663 
664 const std::unordered_map<int, RegVal> CSRMasks = {
666  {CSR_UIE, UI_MASK},
667  {CSR_UIP, UI_MASK},
669  {CSR_FRM, FRM_MASK},
672  {CSR_SIE, SI_MASK},
673  {CSR_SIP, SI_MASK},
675  {CSR_MISA, MISA_MASK},
676  {CSR_MIE, MI_MASK},
677  {CSR_MIP, MI_MASK}
678 };
679 
680 } // namespace RiscvISA
681 } // namespace gem5
682 
683 #endif // __ARCH_RISCV_REGS_MISC_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Bitfield< 4 > sd
Definition: misc_types.hh:833
const RegVal STATUS_TSR_MASK
Definition: misc.hh:607
const RegVal UI_MASK
Definition: misc.hh:660
Bitfield< 3 > msi
Definition: misc.hh:588
Bitfield< 0 > uie
Definition: misc.hh:572
Bitfield< 12, 11 > mpp
Definition: misc.hh:564
Bitfield< 21 > tw
Definition: misc.hh:557
@ CSR_MHPMEVENT19
Definition: misc.hh:352
@ CSR_HPMCOUNTER18
Definition: misc.hh:239
@ CSR_HPMCOUNTER11
Definition: misc.hh:232
@ CSR_HPMCOUNTER05
Definition: misc.hh:226
@ CSR_PMPADDR15
Definition: misc.hh:303
@ CSR_MHPMEVENT27
Definition: misc.hh:360
@ CSR_HPMCOUNTER23
Definition: misc.hh:244
@ CSR_MHPMEVENT17
Definition: misc.hh:350
@ CSR_PMPADDR11
Definition: misc.hh:299
@ CSR_HPMCOUNTER17
Definition: misc.hh:238
@ CSR_MHPMEVENT21
Definition: misc.hh:354
@ CSR_MHPMCOUNTER07
Definition: misc.hh:310
@ CSR_HPMCOUNTER16
Definition: misc.hh:237
@ CSR_HPMCOUNTER15
Definition: misc.hh:236
@ CSR_HPMCOUNTER07
Definition: misc.hh:228
@ CSR_HPMCOUNTER27
Definition: misc.hh:248
@ CSR_HPMCOUNTER08
Definition: misc.hh:229
@ CSR_HPMCOUNTER21
Definition: misc.hh:242
@ CSR_HPMCOUNTER24
Definition: misc.hh:245
@ CSR_PMPADDR12
Definition: misc.hh:300
@ CSR_PMPADDR04
Definition: misc.hh:292
@ CSR_MHPMEVENT22
Definition: misc.hh:355
@ CSR_MHPMCOUNTER16
Definition: misc.hh:319
@ CSR_MHPMEVENT06
Definition: misc.hh:339
@ CSR_MHPMCOUNTER23
Definition: misc.hh:326
@ CSR_PMPADDR06
Definition: misc.hh:294
@ CSR_SSCRATCH
Definition: misc.hh:261
@ CSR_MHPMEVENT05
Definition: misc.hh:338
@ CSR_MHPMCOUNTER22
Definition: misc.hh:325
@ CSR_PMPADDR14
Definition: misc.hh:302
@ CSR_MHPMEVENT13
Definition: misc.hh:346
@ CSR_HPMCOUNTER29
Definition: misc.hh:250
@ CSR_MHPMCOUNTER06
Definition: misc.hh:309
@ CSR_HPMCOUNTER04
Definition: misc.hh:225
@ CSR_HPMCOUNTER25
Definition: misc.hh:246
@ CSR_MHPMEVENT20
Definition: misc.hh:353
@ CSR_HPMCOUNTER26
Definition: misc.hh:247
@ CSR_MHPMEVENT31
Definition: misc.hh:364
@ CSR_HPMCOUNTER28
Definition: misc.hh:249
@ CSR_MHPMCOUNTER29
Definition: misc.hh:332
@ CSR_MHPMCOUNTER15
Definition: misc.hh:318
@ CSR_MHPMEVENT14
Definition: misc.hh:347
@ CSR_HPMCOUNTER10
Definition: misc.hh:231
@ CSR_MHPMCOUNTER28
Definition: misc.hh:331
@ CSR_PMPADDR10
Definition: misc.hh:298
@ CSR_MHPMCOUNTER27
Definition: misc.hh:330
@ CSR_MHPMCOUNTER03
Definition: misc.hh:306
@ CSR_MHPMEVENT07
Definition: misc.hh:340
@ CSR_MHPMCOUNTER11
Definition: misc.hh:314
@ CSR_PMPADDR02
Definition: misc.hh:290
@ CSR_MHPMEVENT03
Definition: misc.hh:336
@ CSR_HPMCOUNTER30
Definition: misc.hh:251
@ CSR_PMPADDR07
Definition: misc.hh:295
@ CSR_MHPMEVENT08
Definition: misc.hh:341
@ CSR_MHPMEVENT25
Definition: misc.hh:358
@ CSR_MHPMCOUNTER19
Definition: misc.hh:322
@ CSR_MHPMCOUNTER05
Definition: misc.hh:308
@ CSR_PMPADDR13
Definition: misc.hh:301
@ CSR_MHPMEVENT30
Definition: misc.hh:363
@ CSR_MHPMCOUNTER10
Definition: misc.hh:313
@ CSR_HPMCOUNTER22
Definition: misc.hh:243
@ CSR_MHPMEVENT16
Definition: misc.hh:349
@ CSR_MHPMEVENT12
Definition: misc.hh:345
@ CSR_HPMCOUNTER20
Definition: misc.hh:241
@ CSR_MHPMEVENT09
Definition: misc.hh:342
@ CSR_MHPMEVENT04
Definition: misc.hh:337
@ CSR_PMPADDR08
Definition: misc.hh:296
@ CSR_MHPMEVENT29
Definition: misc.hh:362
@ CSR_MHPMCOUNTER25
Definition: misc.hh:328
@ CSR_MHPMEVENT15
Definition: misc.hh:348
@ CSR_PMPADDR09
Definition: misc.hh:297
@ CSR_MHPMEVENT11
Definition: misc.hh:344
@ CSR_MHPMCOUNTER13
Definition: misc.hh:316
@ CSR_MHPMEVENT10
Definition: misc.hh:343
@ CSR_MHPMEVENT18
Definition: misc.hh:351
@ CSR_HPMCOUNTER06
Definition: misc.hh:227
@ CSR_MHPMEVENT23
Definition: misc.hh:356
@ CSR_MHPMEVENT26
Definition: misc.hh:359
@ CSR_MHPMCOUNTER09
Definition: misc.hh:312
@ CSR_PMPADDR01
Definition: misc.hh:289
@ CSR_DSCRATCH
Definition: misc.hh:372
@ CSR_MHPMCOUNTER24
Definition: misc.hh:327
@ CSR_PMPADDR00
Definition: misc.hh:288
@ CSR_MHPMCOUNTER26
Definition: misc.hh:329
@ CSR_USCRATCH
Definition: misc.hh:213
@ CSR_MHPMCOUNTER17
Definition: misc.hh:320
@ CSR_HPMCOUNTER13
Definition: misc.hh:234
@ CSR_MHPMCOUNTER20
Definition: misc.hh:323
@ CSR_HPMCOUNTER12
Definition: misc.hh:233
@ CSR_MHPMCOUNTER21
Definition: misc.hh:324
@ CSR_MHPMEVENT28
Definition: misc.hh:361
@ CSR_HPMCOUNTER14
Definition: misc.hh:235
@ CSR_MHPMCOUNTER31
Definition: misc.hh:334
@ CSR_HPMCOUNTER31
Definition: misc.hh:252
@ CSR_PMPADDR03
Definition: misc.hh:291
@ CSR_PMPADDR05
Definition: misc.hh:293
@ CSR_MSCRATCH
Definition: misc.hh:279
@ CSR_MINSTRET
Definition: misc.hh:305
@ CSR_MVENDORID
Definition: misc.hh:268
@ CSR_MHPMCOUNTER14
Definition: misc.hh:317
@ CSR_MCOUNTEREN
Definition: misc.hh:278
@ CSR_HPMCOUNTER09
Definition: misc.hh:230
@ CSR_SCOUNTEREN
Definition: misc.hh:260
@ CSR_HPMCOUNTER19
Definition: misc.hh:240
@ CSR_HPMCOUNTER03
Definition: misc.hh:224
@ CSR_MHPMCOUNTER18
Definition: misc.hh:321
@ CSR_MHPMCOUNTER12
Definition: misc.hh:315
@ CSR_MHPMCOUNTER30
Definition: misc.hh:333
@ CSR_MHPMCOUNTER04
Definition: misc.hh:307
@ CSR_MHPMEVENT24
Definition: misc.hh:357
@ CSR_MHPMCOUNTER08
Definition: misc.hh:311
Bitfield< 1 > ssi
Definition: misc.hh:589
Bitfield< 35, 34 > sxl
Definition: misc.hh:554
const RegVal FRM_MASK
Definition: misc.hh:662
const RegVal MI_MASK
Definition: misc.hh:654
const RegVal USTATUS_MASK
Definition: misc.hh:640
Bitfield< 0 > usi
Definition: misc.hh:590
Bitfield< 18 > sum
Definition: misc.hh:560
Bitfield< 8 > spp
Definition: misc.hh:566
const RegVal STATUS_SD_MASK
Definition: misc.hh:604
const RegVal SI_MASK
Definition: misc.hh:657
Bitfield< 4 > uti
Definition: misc.hh:587
const RegVal MEI_MASK
Definition: misc.hh:645
Bitfield< 8 > uei
Definition: misc.hh:584
const RegVal SSTATUS_MASK
Definition: misc.hh:634
Bitfield< 4 > upie
Definition: misc.hh:569
Bitfield< 17 > mprv
Definition: misc.hh:561
const RegVal SEI_MASK
Definition: misc.hh:646
const RegVal SSI_MASK
Definition: misc.hh:652
const off_t UXL_OFFSET
Definition: misc.hh:595
Bitfield< 5 > sti
Definition: misc.hh:586
Bitfield< 1 > sie
Definition: misc.hh:571
const RegVal ISA_MXL_MASK
Definition: misc.hh:599
const RegVal UTI_MASK
Definition: misc.hh:650
const off_t SXL_OFFSET
Definition: misc.hh:594
const RegVal STATUS_MIE_MASK
Definition: misc.hh:621
const RegVal STATUS_SIE_MASK
Definition: misc.hh:622
const off_t FS_OFFSET
Definition: misc.hh:596
const RegVal STATUS_TW_MASK
Definition: misc.hh:608
const RegVal STATUS_MPIE_MASK
Definition: misc.hh:618
Bitfield< 14, 13 > fs
Definition: misc.hh:563
const RegVal STATUS_VS_MASK
Definition: misc.hh:616
const RegVal MTI_MASK
Definition: misc.hh:648
Bitfield< 20 > tvm
Definition: misc.hh:558
const RegVal STATUS_XS_MASK
Definition: misc.hh:613
const RegVal STATUS_SXL_MASK
Definition: misc.hh:605
const RegVal FFLAGS_MASK
Definition: misc.hh:661
Bitfield< 7 > mti
Definition: misc.hh:585
EndBitUnion(SATP) enum AddrXlateMode
Definition: pagetable.hh:49
const RegVal STATUS_MPRV_MASK
Definition: misc.hh:612
Bitfield< 33, 32 > uxl
Definition: misc.hh:555
const RegVal MSI_MASK
Definition: misc.hh:651
Bitfield< 5 > spie
Definition: misc.hh:568
Bitfield< 3 > mie
Definition: misc.hh:570
Bitfield< 7 > mpie
Definition: misc.hh:567
const RegVal STATUS_UXL_MASK
Definition: misc.hh:606
const RegVal USI_MASK
Definition: misc.hh:653
const RegVal STATUS_MXR_MASK
Definition: misc.hh:610
const std::unordered_map< int, CSRMetadata > CSRData
Definition: misc.hh:381
Bitfield< 22 > tsr
Definition: misc.hh:556
const std::unordered_map< int, RegVal > CSRMasks
Definition: misc.hh:664
const RegVal UEI_MASK
Definition: misc.hh:647
const RegVal STATUS_FS_MASK
Definition: misc.hh:614
const RegVal STATUS_SPP_MASK
Definition: misc.hh:617
const RegVal ISA_EXT_MASK
Definition: misc.hh:600
const RegVal STATUS_SPIE_MASK
Definition: misc.hh:619
const RegVal STATUS_MPP_MASK
Definition: misc.hh:615
const RegVal STATUS_UIE_MASK
Definition: misc.hh:623
const RegVal ISA_EXT_C_MASK
Definition: misc.hh:601
const RegVal MISA_MASK
Definition: misc.hh:602
@ MISCREG_PMPADDR11
Definition: misc.hh:168
@ MISCREG_HPMCOUNTER09
Definition: misc.hh:85
@ MISCREG_MTVEC
Definition: misc.hh:147
@ MISCREG_HPMEVENT31
Definition: misc.hh:136
@ MISCREG_IMPID
Definition: misc.hh:71
@ MISCREG_HPMEVENT07
Definition: misc.hh:112
@ MISCREG_UTVEC
Definition: misc.hh:184
@ MISCREG_HPMCOUNTER16
Definition: misc.hh:92
@ MISCREG_HPMCOUNTER19
Definition: misc.hh:95
@ MISCREG_PMPADDR12
Definition: misc.hh:169
@ MISCREG_HPMCOUNTER07
Definition: misc.hh:83
@ MISCREG_HPMEVENT29
Definition: misc.hh:134
@ MISCREG_HPMCOUNTER26
Definition: misc.hh:102
@ MISCREG_PMPADDR05
Definition: misc.hh:162
@ MISCREG_HPMCOUNTER13
Definition: misc.hh:89
@ MISCREG_PMPADDR10
Definition: misc.hh:167
@ MISCREG_SIDELEG
Definition: misc.hh:175
@ MISCREG_NMIE
Definition: misc.hh:198
@ MISCREG_PMPADDR14
Definition: misc.hh:171
@ MISCREG_PMPADDR09
Definition: misc.hh:166
@ MISCREG_HPMEVENT06
Definition: misc.hh:111
@ MISCREG_TSELECT
Definition: misc.hh:137
@ MISCREG_MSCRATCH
Definition: misc.hh:149
@ MISCREG_ISA
Definition: misc.hh:68
@ MISCREG_NMIVEC
Definition: misc.hh:196
@ MISCREG_STVEC
Definition: misc.hh:176
@ MISCREG_HPMEVENT21
Definition: misc.hh:126
@ MISCREG_SCAUSE
Definition: misc.hh:180
@ MISCREG_UEPC
Definition: misc.hh:186
@ MISCREG_STATUS
Definition: misc.hh:73
@ MISCREG_HPMEVENT12
Definition: misc.hh:117
@ MISCREG_HPMCOUNTER25
Definition: misc.hh:101
@ MISCREG_SATP
Definition: misc.hh:182
@ MISCREG_PMPADDR04
Definition: misc.hh:161
@ MISCREG_MCOUNTEREN
Definition: misc.hh:148
@ MISCREG_UTVAL
Definition: misc.hh:188
@ MISCREG_PMPADDR00
Definition: misc.hh:157
@ MISCREG_HPMCOUNTER22
Definition: misc.hh:98
@ MISCREG_HPMEVENT17
Definition: misc.hh:122
@ MISCREG_MCAUSE
Definition: misc.hh:151
@ MISCREG_UCAUSE
Definition: misc.hh:187
@ MISCREG_HPMEVENT20
Definition: misc.hh:125
@ MISCREG_MEDELEG
Definition: misc.hh:145
@ MISCREG_USCRATCH
Definition: misc.hh:185
@ MISCREG_HPMEVENT25
Definition: misc.hh:130
@ MISCREG_HPMCOUNTER11
Definition: misc.hh:87
@ MISCREG_HPMEVENT03
Definition: misc.hh:108
@ MISCREG_PRV
Definition: misc.hh:67
@ MISCREG_IP
Definition: misc.hh:74
@ MISCREG_TDATA3
Definition: misc.hh:140
@ MISCREG_HPMEVENT13
Definition: misc.hh:118
@ MISCREG_PMPADDR13
Definition: misc.hh:170
@ MISCREG_HPMCOUNTER12
Definition: misc.hh:88
@ MISCREG_MTVAL
Definition: misc.hh:152
@ MISCREG_HPMEVENT04
Definition: misc.hh:109
@ MISCREG_HPMEVENT08
Definition: misc.hh:113
@ MISCREG_IE
Definition: misc.hh:75
@ MISCREG_HPMEVENT19
Definition: misc.hh:124
@ MISCREG_DSCRATCH
Definition: misc.hh:143
@ NUM_MISCREGS
Definition: misc.hh:202
@ MISCREG_HPMEVENT30
Definition: misc.hh:135
@ MISCREG_SEDELEG
Definition: misc.hh:174
@ MISCREG_PMPADDR06
Definition: misc.hh:163
@ MISCREG_HPMCOUNTER21
Definition: misc.hh:97
@ MISCREG_PMPADDR03
Definition: misc.hh:160
@ MISCREG_SCOUNTEREN
Definition: misc.hh:177
@ MISCREG_HPMCOUNTER06
Definition: misc.hh:82
@ MISCREG_HPMCOUNTER28
Definition: misc.hh:104
@ MISCREG_PMPADDR02
Definition: misc.hh:159
@ MISCREG_MIDELEG
Definition: misc.hh:146
@ MISCREG_HPMCOUNTER30
Definition: misc.hh:106
@ MISCREG_HPMCOUNTER14
Definition: misc.hh:90
@ MISCREG_HPMEVENT10
Definition: misc.hh:115
@ MISCREG_HPMEVENT26
Definition: misc.hh:131
@ MISCREG_HPMEVENT18
Definition: misc.hh:123
@ MISCREG_MEPC
Definition: misc.hh:150
@ MISCREG_HPMEVENT23
Definition: misc.hh:128
@ MISCREG_INSTRET
Definition: misc.hh:78
@ MISCREG_HARTID
Definition: misc.hh:72
@ MISCREG_FFLAGS
Definition: misc.hh:189
@ MISCREG_HPMCOUNTER20
Definition: misc.hh:96
@ MISCREG_HPMEVENT09
Definition: misc.hh:114
@ MISCREG_HPMCOUNTER04
Definition: misc.hh:80
@ MISCREG_PMPADDR07
Definition: misc.hh:164
@ MISCREG_TDATA1
Definition: misc.hh:138
@ MISCREG_HPMEVENT16
Definition: misc.hh:121
@ MISCREG_HPMCOUNTER18
Definition: misc.hh:94
@ MISCREG_TIME
Definition: misc.hh:77
@ MISCREG_SSCRATCH
Definition: misc.hh:178
@ MISCREG_HPMEVENT14
Definition: misc.hh:119
@ MISCREG_HPMCOUNTER05
Definition: misc.hh:81
@ MISCREG_SEPC
Definition: misc.hh:179
@ MISCREG_HPMCOUNTER17
Definition: misc.hh:93
@ MISCREG_HPMCOUNTER27
Definition: misc.hh:103
@ MISCREG_HPMCOUNTER24
Definition: misc.hh:100
@ MISCREG_HPMCOUNTER23
Definition: misc.hh:99
@ MISCREG_CYCLE
Definition: misc.hh:76
@ MISCREG_HPMCOUNTER15
Definition: misc.hh:91
@ MISCREG_HPMEVENT24
Definition: misc.hh:129
@ MISCREG_HPMCOUNTER10
Definition: misc.hh:86
@ MISCREG_HPMCOUNTER29
Definition: misc.hh:105
@ MISCREG_STVAL
Definition: misc.hh:181
@ MISCREG_VENDORID
Definition: misc.hh:69
@ MISCREG_PMPADDR01
Definition: misc.hh:158
@ MISCREG_HPMEVENT27
Definition: misc.hh:132
@ MISCREG_HPMEVENT15
Definition: misc.hh:120
@ MISCREG_HPMEVENT05
Definition: misc.hh:110
@ MISCREG_ARCHID
Definition: misc.hh:70
@ MISCREG_DCSR
Definition: misc.hh:141
@ MISCREG_HPMEVENT11
Definition: misc.hh:116
@ MISCREG_HPMCOUNTER31
Definition: misc.hh:107
@ MISCREG_TDATA2
Definition: misc.hh:139
@ MISCREG_PMPADDR08
Definition: misc.hh:165
@ MISCREG_HPMCOUNTER03
Definition: misc.hh:79
@ MISCREG_PMPADDR15
Definition: misc.hh:172
@ MISCREG_HPMEVENT28
Definition: misc.hh:133
@ MISCREG_HPMEVENT22
Definition: misc.hh:127
@ MISCREG_PMPCFG0
Definition: misc.hh:153
@ MISCREG_HPMCOUNTER08
Definition: misc.hh:84
@ MISCREG_NMIP
Definition: misc.hh:200
@ MISCREG_PMPCFG2
Definition: misc.hh:155
const off_t FRM_OFFSET
Definition: misc.hh:597
Bitfield< 9, 5 > vs
Bitfield< 16, 15 > xs
Definition: misc.hh:562
const RegVal STI_MASK
Definition: misc.hh:649
const RegVal STATUS_SUM_MASK
Definition: misc.hh:611
BitUnion64(SATP) Bitfield< 63
Bitfield< 19 > mxr
Definition: misc.hh:559
const RegVal STATUS_UPIE_MASK
Definition: misc.hh:620
Bitfield< 9 > sei
Definition: misc.hh:583
const RegVal STATUS_TVM_MASK
Definition: misc.hh:609
const RegVal MSTATUS_MASK
Definition: misc.hh:624
constexpr RegClass miscRegClass(MiscRegClass, MiscRegClassName, NUM_MISCREGS, debug::MiscRegs)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
constexpr char MiscRegClassName[]
Definition: reg_class.hh:79
uint64_t RegVal
Definition: types.hh:173
@ MiscRegClass
Control (misc) register.
Definition: reg_class.hh:68
const std::string name
Definition: misc.hh:377
Vector Registers layout specification.

Generated on Wed Dec 21 2022 10:22:25 for gem5 by doxygen 1.9.1