gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
registers.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  * All rights reserved
6  *
7  * The license below extends only to copyright in the software and shall
8  * not be construed as granting a license to any other intellectual
9  * property including but not limited to intellectual property relating
10  * to a hardware implementation of the functionality of the software
11  * licensed hereunder. You may use the software subject to the license
12  * terms below provided that you ensure that this notice is replicated
13  * unmodified and in its entirety in all distributions of the software,
14  * modified or unmodified, in source code or in binary form.
15  *
16  * Copyright (c) 2016 RISC-V Foundation
17  * Copyright (c) 2016 The University of Virginia
18  * All rights reserved.
19  *
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions are
22  * met: redistributions of source code must retain the above copyright
23  * notice, this list of conditions and the following disclaimer;
24  * redistributions in binary form must reproduce the above copyright
25  * notice, this list of conditions and the following disclaimer in the
26  * documentation and/or other materials provided with the distribution;
27  * neither the name of the copyright holders nor the names of its
28  * contributors may be used to endorse or promote products derived from
29  * this software without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  * Authors: Andreas Hansson
44  * Sven Karlsson
45  * Alec Roelke
46  * Yifei Liu
47  * Lin Cheng
48  * Xihao Chen
49  * Cheng Tan
50  */
51 
52 #ifndef __ARCH_RISCV_REGISTERS_HH__
53 #define __ARCH_RISCV_REGISTERS_HH__
54 
55 #include <map>
56 #include <string>
57 #include <vector>
58 
59 #include "arch/generic/types.hh"
61 #include "arch/generic/vec_reg.hh"
62 #include "arch/isa_traits.hh"
63 #include "arch/riscv/generated/max_inst_regs.hh"
64 #include "base/types.hh"
65 
66 namespace RiscvISA {
67 
69 using RiscvISAInst::MaxInstDestRegs;
70 const int MaxMiscDestRegs = 2;
71 
72 // Not applicable to RISC-V
79 
80 // Not applicable to RISC-V
86 
87 const int NumIntArchRegs = 32;
88 const int NumMicroIntRegs = 1;
89 const int NumIntRegs = NumIntArchRegs + NumMicroIntRegs;
90 const int NumFloatRegs = 32;
91 
92 const unsigned NumVecRegs = 1; // Not applicable to RISC-V
93  // (1 to prevent warnings)
94 const int NumVecPredRegs = 1; // Not applicable to RISC-V
95  // (1 to prevent warnings)
96 
97 const int NumCCRegs = 0;
98 
99 // Semantically meaningful register indices
100 const int ZeroReg = 0;
101 const int ReturnAddrReg = 1;
102 const int StackPointerReg = 2;
103 const int GlobalPointerReg = 3;
104 const int ThreadPointerReg = 4;
105 const int FramePointerReg = 8;
106 const int ReturnValueReg = 10;
108 const std::vector<int> ArgumentRegs = {10, 11, 12, 13, 14, 15, 16, 17};
109 const int AMOTempReg = 32;
110 
111 const int SyscallPseudoReturnReg = 10;
112 const std::vector<int> SyscallArgumentRegs = {10, 11, 12, 13, 14, 15, 16};
113 const int SyscallNumReg = 17;
114 
116  "zero", "ra", "sp", "gp",
117  "tp", "t0", "t1", "t2",
118  "s0", "s1", "a0", "a1",
119  "a2", "a3", "a4", "a5",
120  "a6", "a7", "s2", "s3",
121  "s4", "s5", "s6", "s7",
122  "s8", "s9", "s10", "s11",
123  "t3", "t4", "t5", "t6"
124 };
126  "ft0", "ft1", "ft2", "ft3",
127  "ft4", "ft5", "ft6", "ft7",
128  "fs0", "fs1", "fa0", "fa1",
129  "fa2", "fa3", "fa4", "fa5",
130  "fa6", "fa7", "fs2", "fs3",
131  "fs4", "fs5", "fs6", "fs7",
132  "fs8", "fs9", "fs10", "fs11",
133  "ft8", "ft9", "ft10", "ft11"
134 };
135 
214 
224  // pmpcfg1 rv32 only
226  // pmpcfg3 rv32 only
243 
253 
261 
263 };
265 
266 enum CSRIndex {
267  CSR_USTATUS = 0x000,
268  CSR_UIE = 0x004,
269  CSR_UTVEC = 0x005,
270  CSR_USCRATCH = 0x040,
271  CSR_UEPC = 0x041,
272  CSR_UCAUSE = 0x042,
273  CSR_UTVAL = 0x043,
274  CSR_UIP = 0x044,
275  CSR_FFLAGS = 0x001,
276  CSR_FRM = 0x002,
277  CSR_FCSR = 0x003,
278  CSR_CYCLE = 0xC00,
279  CSR_TIME = 0xC01,
280  CSR_INSTRET = 0xC02,
310  // HPMCOUNTERH rv32 only
311 
312  CSR_SSTATUS = 0x100,
313  CSR_SEDELEG = 0x102,
314  CSR_SIDELEG = 0x103,
315  CSR_SIE = 0x104,
316  CSR_STVEC = 0x105,
317  CSR_SCOUNTEREN = 0x106,
318  CSR_SSCRATCH = 0x140,
319  CSR_SEPC = 0x141,
320  CSR_SCAUSE = 0x142,
321  CSR_STVAL = 0x143,
322  CSR_SIP = 0x144,
323  CSR_SATP = 0x180,
324 
325  CSR_MVENDORID = 0xF11,
326  CSR_MARCHID = 0xF12,
327  CSR_MIMPID = 0xF13,
328  CSR_MHARTID = 0xF14,
329  CSR_MSTATUS = 0x300,
330  CSR_MISA = 0x301,
331  CSR_MEDELEG = 0x302,
332  CSR_MIDELEG = 0x303,
333  CSR_MIE = 0x304,
334  CSR_MTVEC = 0x305,
335  CSR_MCOUNTEREN = 0x306,
336  CSR_MSCRATCH = 0x340,
337  CSR_MEPC = 0x341,
338  CSR_MCAUSE = 0x342,
339  CSR_MTVAL = 0x343,
340  CSR_MIP = 0x344,
341  CSR_PMPCFG0 = 0x3A0,
342  // pmpcfg1 rv32 only
343  CSR_PMPCFG2 = 0x3A2,
344  // pmpcfg3 rv32 only
345  CSR_PMPADDR00 = 0x3B0,
346  CSR_PMPADDR01 = 0x3B1,
347  CSR_PMPADDR02 = 0x3B2,
348  CSR_PMPADDR03 = 0x3B3,
349  CSR_PMPADDR04 = 0x3B4,
350  CSR_PMPADDR05 = 0x3B5,
351  CSR_PMPADDR06 = 0x3B6,
352  CSR_PMPADDR07 = 0x3B7,
353  CSR_PMPADDR08 = 0x3B8,
354  CSR_PMPADDR09 = 0x3B9,
355  CSR_PMPADDR10 = 0x3BA,
356  CSR_PMPADDR11 = 0x3BB,
357  CSR_PMPADDR12 = 0x3BC,
358  CSR_PMPADDR13 = 0x3BD,
359  CSR_PMPADDR14 = 0x3BE,
360  CSR_PMPADDR15 = 0x3BF,
361  CSR_MCYCLE = 0xB00,
362  CSR_MINSTRET = 0xB02,
392  // MHPMCOUNTERH rv32 only
422 
423  CSR_TSELECT = 0x7A0,
424  CSR_TDATA1 = 0x7A1,
425  CSR_TDATA2 = 0x7A2,
426  CSR_TDATA3 = 0x7A3,
427  CSR_DCSR = 0x7B0,
428  CSR_DPC = 0x7B1,
429  CSR_DSCRATCH = 0x7B2
430 };
431 
433 {
434  const std::string name;
435  const int physIndex;
436 };
437 
438 const std::map<int, CSRMetadata> CSRData = {
439  {CSR_USTATUS, {"ustatus", MISCREG_STATUS}},
440  {CSR_UIE, {"uie", MISCREG_IE}},
441  {CSR_UTVEC, {"utvec", MISCREG_UTVEC}},
442  {CSR_USCRATCH, {"uscratch", MISCREG_USCRATCH}},
443  {CSR_UEPC, {"uepc", MISCREG_UEPC}},
444  {CSR_UCAUSE, {"ucause", MISCREG_UCAUSE}},
445  {CSR_UTVAL, {"utval", MISCREG_UTVAL}},
446  {CSR_UIP, {"uip", MISCREG_IP}},
447  {CSR_FFLAGS, {"fflags", MISCREG_FFLAGS}},
448  {CSR_FRM, {"frm", MISCREG_FRM}},
449  {CSR_FCSR, {"fcsr", MISCREG_FFLAGS}}, // Actually FRM << 5 | FFLAGS
450  {CSR_CYCLE, {"cycle", MISCREG_CYCLE}},
451  {CSR_TIME, {"time", MISCREG_TIME}},
452  {CSR_INSTRET, {"instret", MISCREG_INSTRET}},
453  {CSR_HPMCOUNTER03, {"hpmcounter03", MISCREG_HPMCOUNTER03}},
454  {CSR_HPMCOUNTER04, {"hpmcounter04", MISCREG_HPMCOUNTER04}},
455  {CSR_HPMCOUNTER05, {"hpmcounter05", MISCREG_HPMCOUNTER05}},
456  {CSR_HPMCOUNTER06, {"hpmcounter06", MISCREG_HPMCOUNTER06}},
457  {CSR_HPMCOUNTER07, {"hpmcounter07", MISCREG_HPMCOUNTER07}},
458  {CSR_HPMCOUNTER08, {"hpmcounter08", MISCREG_HPMCOUNTER08}},
459  {CSR_HPMCOUNTER09, {"hpmcounter09", MISCREG_HPMCOUNTER09}},
460  {CSR_HPMCOUNTER10, {"hpmcounter10", MISCREG_HPMCOUNTER10}},
461  {CSR_HPMCOUNTER11, {"hpmcounter11", MISCREG_HPMCOUNTER11}},
462  {CSR_HPMCOUNTER12, {"hpmcounter12", MISCREG_HPMCOUNTER12}},
463  {CSR_HPMCOUNTER13, {"hpmcounter13", MISCREG_HPMCOUNTER13}},
464  {CSR_HPMCOUNTER14, {"hpmcounter14", MISCREG_HPMCOUNTER14}},
465  {CSR_HPMCOUNTER15, {"hpmcounter15", MISCREG_HPMCOUNTER15}},
466  {CSR_HPMCOUNTER16, {"hpmcounter16", MISCREG_HPMCOUNTER16}},
467  {CSR_HPMCOUNTER17, {"hpmcounter17", MISCREG_HPMCOUNTER17}},
468  {CSR_HPMCOUNTER18, {"hpmcounter18", MISCREG_HPMCOUNTER18}},
469  {CSR_HPMCOUNTER19, {"hpmcounter19", MISCREG_HPMCOUNTER19}},
470  {CSR_HPMCOUNTER20, {"hpmcounter20", MISCREG_HPMCOUNTER20}},
471  {CSR_HPMCOUNTER21, {"hpmcounter21", MISCREG_HPMCOUNTER21}},
472  {CSR_HPMCOUNTER22, {"hpmcounter22", MISCREG_HPMCOUNTER22}},
473  {CSR_HPMCOUNTER23, {"hpmcounter23", MISCREG_HPMCOUNTER23}},
474  {CSR_HPMCOUNTER24, {"hpmcounter24", MISCREG_HPMCOUNTER24}},
475  {CSR_HPMCOUNTER25, {"hpmcounter25", MISCREG_HPMCOUNTER25}},
476  {CSR_HPMCOUNTER26, {"hpmcounter26", MISCREG_HPMCOUNTER26}},
477  {CSR_HPMCOUNTER27, {"hpmcounter27", MISCREG_HPMCOUNTER27}},
478  {CSR_HPMCOUNTER28, {"hpmcounter28", MISCREG_HPMCOUNTER28}},
479  {CSR_HPMCOUNTER29, {"hpmcounter29", MISCREG_HPMCOUNTER29}},
480  {CSR_HPMCOUNTER30, {"hpmcounter30", MISCREG_HPMCOUNTER30}},
481  {CSR_HPMCOUNTER31, {"hpmcounter31", MISCREG_HPMCOUNTER31}},
482 
483  {CSR_SSTATUS, {"sstatus", MISCREG_STATUS}},
484  {CSR_SEDELEG, {"sedeleg", MISCREG_SEDELEG}},
485  {CSR_SIDELEG, {"sideleg", MISCREG_SIDELEG}},
486  {CSR_SIE, {"sie", MISCREG_IE}},
487  {CSR_STVEC, {"stvec", MISCREG_STVEC}},
488  {CSR_SCOUNTEREN, {"scounteren", MISCREG_SCOUNTEREN}},
489  {CSR_SSCRATCH, {"sscratch", MISCREG_SSCRATCH}},
490  {CSR_SEPC, {"sepc", MISCREG_SEPC}},
491  {CSR_SCAUSE, {"scause", MISCREG_SCAUSE}},
492  {CSR_STVAL, {"stval", MISCREG_STVAL}},
493  {CSR_SIP, {"sip", MISCREG_IP}},
494  {CSR_SATP, {"satp", MISCREG_SATP}},
495 
496  {CSR_MVENDORID, {"mvendorid", MISCREG_VENDORID}},
497  {CSR_MARCHID, {"marchid", MISCREG_ARCHID}},
498  {CSR_MIMPID, {"mimpid", MISCREG_IMPID}},
499  {CSR_MHARTID, {"mhartid", MISCREG_HARTID}},
500  {CSR_MSTATUS, {"mstatus", MISCREG_STATUS}},
501  {CSR_MISA, {"misa", MISCREG_ISA}},
502  {CSR_MEDELEG, {"medeleg", MISCREG_MEDELEG}},
503  {CSR_MIDELEG, {"mideleg", MISCREG_MIDELEG}},
504  {CSR_MIE, {"mie", MISCREG_IE}},
505  {CSR_MTVEC, {"mtvec", MISCREG_MTVEC}},
506  {CSR_MCOUNTEREN, {"mcounteren", MISCREG_MCOUNTEREN}},
507  {CSR_MSCRATCH, {"mscratch", MISCREG_MSCRATCH}},
508  {CSR_MEPC, {"mepc", MISCREG_MEPC}},
509  {CSR_MCAUSE, {"mcause", MISCREG_MCAUSE}},
510  {CSR_MTVAL, {"mtval", MISCREG_MTVAL}},
511  {CSR_MIP, {"mip", MISCREG_IP}},
512  {CSR_PMPCFG0, {"pmpcfg0", MISCREG_PMPCFG0}},
513  // pmpcfg1 rv32 only
514  {CSR_PMPCFG2, {"pmpcfg2", MISCREG_PMPCFG2}},
515  // pmpcfg3 rv32 only
516  {CSR_PMPADDR00, {"pmpaddr0", MISCREG_PMPADDR00}},
517  {CSR_PMPADDR01, {"pmpaddr1", MISCREG_PMPADDR01}},
518  {CSR_PMPADDR02, {"pmpaddr2", MISCREG_PMPADDR02}},
519  {CSR_PMPADDR03, {"pmpaddr3", MISCREG_PMPADDR03}},
520  {CSR_PMPADDR04, {"pmpaddr4", MISCREG_PMPADDR04}},
521  {CSR_PMPADDR05, {"pmpaddr5", MISCREG_PMPADDR05}},
522  {CSR_PMPADDR06, {"pmpaddr6", MISCREG_PMPADDR06}},
523  {CSR_PMPADDR07, {"pmpaddr7", MISCREG_PMPADDR07}},
524  {CSR_PMPADDR08, {"pmpaddr8", MISCREG_PMPADDR08}},
525  {CSR_PMPADDR09, {"pmpaddr9", MISCREG_PMPADDR09}},
526  {CSR_PMPADDR10, {"pmpaddr10", MISCREG_PMPADDR10}},
527  {CSR_PMPADDR11, {"pmpaddr11", MISCREG_PMPADDR11}},
528  {CSR_PMPADDR12, {"pmpaddr12", MISCREG_PMPADDR12}},
529  {CSR_PMPADDR13, {"pmpaddr13", MISCREG_PMPADDR13}},
530  {CSR_PMPADDR14, {"pmpaddr14", MISCREG_PMPADDR14}},
531  {CSR_PMPADDR15, {"pmpaddr15", MISCREG_PMPADDR15}},
532  {CSR_MCYCLE, {"mcycle", MISCREG_CYCLE}},
533  {CSR_MINSTRET, {"minstret", MISCREG_INSTRET}},
534  {CSR_MHPMCOUNTER03, {"mhpmcounter03", MISCREG_HPMCOUNTER03}},
535  {CSR_MHPMCOUNTER04, {"mhpmcounter04", MISCREG_HPMCOUNTER04}},
536  {CSR_MHPMCOUNTER05, {"mhpmcounter05", MISCREG_HPMCOUNTER05}},
537  {CSR_MHPMCOUNTER06, {"mhpmcounter06", MISCREG_HPMCOUNTER06}},
538  {CSR_MHPMCOUNTER07, {"mhpmcounter07", MISCREG_HPMCOUNTER07}},
539  {CSR_MHPMCOUNTER08, {"mhpmcounter08", MISCREG_HPMCOUNTER08}},
540  {CSR_MHPMCOUNTER09, {"mhpmcounter09", MISCREG_HPMCOUNTER09}},
541  {CSR_MHPMCOUNTER10, {"mhpmcounter10", MISCREG_HPMCOUNTER10}},
542  {CSR_MHPMCOUNTER11, {"mhpmcounter11", MISCREG_HPMCOUNTER11}},
543  {CSR_MHPMCOUNTER12, {"mhpmcounter12", MISCREG_HPMCOUNTER12}},
544  {CSR_MHPMCOUNTER13, {"mhpmcounter13", MISCREG_HPMCOUNTER13}},
545  {CSR_MHPMCOUNTER14, {"mhpmcounter14", MISCREG_HPMCOUNTER14}},
546  {CSR_MHPMCOUNTER15, {"mhpmcounter15", MISCREG_HPMCOUNTER15}},
547  {CSR_MHPMCOUNTER16, {"mhpmcounter16", MISCREG_HPMCOUNTER16}},
548  {CSR_MHPMCOUNTER17, {"mhpmcounter17", MISCREG_HPMCOUNTER17}},
549  {CSR_MHPMCOUNTER18, {"mhpmcounter18", MISCREG_HPMCOUNTER18}},
550  {CSR_MHPMCOUNTER19, {"mhpmcounter19", MISCREG_HPMCOUNTER19}},
551  {CSR_MHPMCOUNTER20, {"mhpmcounter20", MISCREG_HPMCOUNTER20}},
552  {CSR_MHPMCOUNTER21, {"mhpmcounter21", MISCREG_HPMCOUNTER21}},
553  {CSR_MHPMCOUNTER22, {"mhpmcounter22", MISCREG_HPMCOUNTER22}},
554  {CSR_MHPMCOUNTER23, {"mhpmcounter23", MISCREG_HPMCOUNTER23}},
555  {CSR_MHPMCOUNTER24, {"mhpmcounter24", MISCREG_HPMCOUNTER24}},
556  {CSR_MHPMCOUNTER25, {"mhpmcounter25", MISCREG_HPMCOUNTER25}},
557  {CSR_MHPMCOUNTER26, {"mhpmcounter26", MISCREG_HPMCOUNTER26}},
558  {CSR_MHPMCOUNTER27, {"mhpmcounter27", MISCREG_HPMCOUNTER27}},
559  {CSR_MHPMCOUNTER28, {"mhpmcounter28", MISCREG_HPMCOUNTER28}},
560  {CSR_MHPMCOUNTER29, {"mhpmcounter29", MISCREG_HPMCOUNTER29}},
561  {CSR_MHPMCOUNTER30, {"mhpmcounter30", MISCREG_HPMCOUNTER30}},
562  {CSR_MHPMCOUNTER31, {"mhpmcounter31", MISCREG_HPMCOUNTER31}},
563  {CSR_MHPMEVENT03, {"mhpmevent03", MISCREG_HPMEVENT03}},
564  {CSR_MHPMEVENT04, {"mhpmevent04", MISCREG_HPMEVENT04}},
565  {CSR_MHPMEVENT05, {"mhpmevent05", MISCREG_HPMEVENT05}},
566  {CSR_MHPMEVENT06, {"mhpmevent06", MISCREG_HPMEVENT06}},
567  {CSR_MHPMEVENT07, {"mhpmevent07", MISCREG_HPMEVENT07}},
568  {CSR_MHPMEVENT08, {"mhpmevent08", MISCREG_HPMEVENT08}},
569  {CSR_MHPMEVENT09, {"mhpmevent09", MISCREG_HPMEVENT09}},
570  {CSR_MHPMEVENT10, {"mhpmevent10", MISCREG_HPMEVENT10}},
571  {CSR_MHPMEVENT11, {"mhpmevent11", MISCREG_HPMEVENT11}},
572  {CSR_MHPMEVENT12, {"mhpmevent12", MISCREG_HPMEVENT12}},
573  {CSR_MHPMEVENT13, {"mhpmevent13", MISCREG_HPMEVENT13}},
574  {CSR_MHPMEVENT14, {"mhpmevent14", MISCREG_HPMEVENT14}},
575  {CSR_MHPMEVENT15, {"mhpmevent15", MISCREG_HPMEVENT15}},
576  {CSR_MHPMEVENT16, {"mhpmevent16", MISCREG_HPMEVENT16}},
577  {CSR_MHPMEVENT17, {"mhpmevent17", MISCREG_HPMEVENT17}},
578  {CSR_MHPMEVENT18, {"mhpmevent18", MISCREG_HPMEVENT18}},
579  {CSR_MHPMEVENT19, {"mhpmevent19", MISCREG_HPMEVENT19}},
580  {CSR_MHPMEVENT20, {"mhpmevent20", MISCREG_HPMEVENT20}},
581  {CSR_MHPMEVENT21, {"mhpmevent21", MISCREG_HPMEVENT21}},
582  {CSR_MHPMEVENT22, {"mhpmevent22", MISCREG_HPMEVENT22}},
583  {CSR_MHPMEVENT23, {"mhpmevent23", MISCREG_HPMEVENT23}},
584  {CSR_MHPMEVENT24, {"mhpmevent24", MISCREG_HPMEVENT24}},
585  {CSR_MHPMEVENT25, {"mhpmevent25", MISCREG_HPMEVENT25}},
586  {CSR_MHPMEVENT26, {"mhpmevent26", MISCREG_HPMEVENT26}},
587  {CSR_MHPMEVENT27, {"mhpmevent27", MISCREG_HPMEVENT27}},
588  {CSR_MHPMEVENT28, {"mhpmevent28", MISCREG_HPMEVENT28}},
589  {CSR_MHPMEVENT29, {"mhpmevent29", MISCREG_HPMEVENT29}},
590  {CSR_MHPMEVENT30, {"mhpmevent30", MISCREG_HPMEVENT30}},
591  {CSR_MHPMEVENT31, {"mhpmevent31", MISCREG_HPMEVENT31}},
592 
593  {CSR_TSELECT, {"tselect", MISCREG_TSELECT}},
594  {CSR_TDATA1, {"tdata1", MISCREG_TDATA1}},
595  {CSR_TDATA2, {"tdata2", MISCREG_TDATA2}},
596  {CSR_TDATA3, {"tdata3", MISCREG_TDATA3}},
597  {CSR_DCSR, {"dcsr", MISCREG_DCSR}},
598  {CSR_DPC, {"dpc", MISCREG_DPC}},
599  {CSR_DSCRATCH, {"dscratch", MISCREG_DSCRATCH}}
600 };
601 
609 BitUnion64(STATUS)
610  Bitfield<63> sd;
611  Bitfield<35, 34> sxl;
612  Bitfield<33, 32> uxl;
613  Bitfield<22> tsr;
614  Bitfield<21> tw;
615  Bitfield<20> tvm;
616  Bitfield<19> mxr;
617  Bitfield<18> sum;
618  Bitfield<17> mprv;
619  Bitfield<16, 15> xs;
620  Bitfield<14, 13> fs;
621  Bitfield<12, 11> mpp;
622  Bitfield<8> spp;
623  Bitfield<7> mpie;
624  Bitfield<5> spie;
625  Bitfield<4> upie;
626  Bitfield<3> mie;
627  Bitfield<1> sie;
628  Bitfield<0> uie;
629 EndBitUnion(STATUS)
630 
631 
637 BitUnion64(INTERRUPT)
638  Bitfield<11> mei;
639  Bitfield<9> sei;
640  Bitfield<8> uei;
641  Bitfield<7> mti;
642  Bitfield<5> sti;
643  Bitfield<4> uti;
644  Bitfield<3> msi;
645  Bitfield<1> ssi;
646  Bitfield<0> usi;
647 EndBitUnion(INTERRUPT)
648 
649 const off_t MXL_OFFSET = (sizeof(uint64_t) * 8 - 2);
650 const off_t SXL_OFFSET = 34;
651 const off_t UXL_OFFSET = 32;
652 const off_t FS_OFFSET = 13;
653 const off_t FRM_OFFSET = 5;
654 
655 const RegVal ISA_MXL_MASK = 3ULL << MXL_OFFSET;
657 const RegVal MISA_MASK = ISA_MXL_MASK | ISA_EXT_MASK;
658 
659 const RegVal STATUS_SD_MASK = 1ULL << ((sizeof(uint64_t) * 8) - 1);
662 const RegVal STATUS_TSR_MASK = 1ULL << 22;
663 const RegVal STATUS_TW_MASK = 1ULL << 21;
664 const RegVal STATUS_TVM_MASK = 1ULL << 20;
665 const RegVal STATUS_MXR_MASK = 1ULL << 19;
666 const RegVal STATUS_SUM_MASK = 1ULL << 18;
667 const RegVal STATUS_MPRV_MASK = 1ULL << 17;
668 const RegVal STATUS_XS_MASK = 3ULL << 15;
670 const RegVal STATUS_MPP_MASK = 3ULL << 11;
671 const RegVal STATUS_SPP_MASK = 1ULL << 8;
675 const RegVal STATUS_MIE_MASK = 1ULL << 3;
676 const RegVal STATUS_SIE_MASK = 1ULL << 1;
677 const RegVal STATUS_UIE_MASK = 1ULL << 0;
698 
699 const RegVal MEI_MASK = 1ULL << 11;
700 const RegVal SEI_MASK = 1ULL << 9;
701 const RegVal UEI_MASK = 1ULL << 8;
702 const RegVal MTI_MASK = 1ULL << 7;
703 const RegVal STI_MASK = 1ULL << 5;
704 const RegVal UTI_MASK = 1ULL << 4;
705 const RegVal MSI_MASK = 1ULL << 3;
706 const RegVal SSI_MASK = 1ULL << 1;
707 const RegVal USI_MASK = 1ULL << 0;
712  STI_MASK | UTI_MASK |
713  SSI_MASK | USI_MASK;
715 const RegVal FFLAGS_MASK = (1 << FRM_OFFSET) - 1;
716 const RegVal FRM_MASK = 0x7;
717 
718 const std::map<int, RegVal> CSRMasks = {
720  {CSR_UIE, UI_MASK},
721  {CSR_UIP, UI_MASK},
723  {CSR_FRM, FRM_MASK},
724  {CSR_FCSR, FFLAGS_MASK | (FRM_MASK << FRM_OFFSET)},
726  {CSR_SIE, SI_MASK},
727  {CSR_SIP, SI_MASK},
729  {CSR_MISA, MISA_MASK},
730  {CSR_MIE, MI_MASK},
731  {CSR_MIP, MI_MASK}
732 };
733 
734 }
735 
736 #endif // __ARCH_RISCV_REGISTERS_HH__
const std::vector< std::string > IntRegNames
Definition: registers.hh:115
const RegVal USTATUS_MASK
Definition: registers.hh:694
const RegVal STATUS_SUM_MASK
Definition: registers.hh:666
Bitfield< 4 > uti
Definition: registers.hh:643
const RegVal STATUS_TW_MASK
Definition: registers.hh:663
Bitfield< 9 > sei
Definition: registers.hh:639
const std::vector< int > ArgumentRegs
Definition: registers.hh:108
const int NumFloatRegs
Definition: registers.hh:90
const std::vector< int > ReturnValueRegs
Definition: registers.hh:107
const RegVal STATUS_UXL_MASK
Definition: registers.hh:661
Bitfield< 5 > sti
Definition: registers.hh:642
Bitfield< 5 > spie
Definition: registers.hh:624
const int NumIntArchRegs
Definition: registers.hh:87
const RegVal STATUS_TVM_MASK
Definition: registers.hh:664
const RegVal SI_MASK
Definition: registers.hh:711
const off_t FS_OFFSET
Definition: registers.hh:652
const int NumCCRegs
Definition: registers.hh:97
constexpr unsigned DummyNumVecElemPerVecReg
Definition: vec_reg.hh:664
Vector Register Abstraction This generic class is the model in a particularization of MVC...
Definition: vec_reg.hh:160
const RegVal STATUS_MPRV_MASK
Definition: registers.hh:667
const int StackPointerReg
Definition: registers.hh:102
const std::map< int, RegVal > CSRMasks
Definition: registers.hh:718
constexpr bool DummyVecPredRegHasPackedRepr
Dummy type aliases and constants for architectures that do not implement vector predicate registers...
const std::vector< int > SyscallArgumentRegs
Definition: registers.hh:112
BitUnion64(STATUS) Bitfield< 63 > sd
These fields are specified in the RISC-V Instruction Set Manual, Volume II, v1.10, accessible at www.riscv.org.
const RegVal UEI_MASK
Definition: registers.hh:701
const RegVal SSI_MASK
Definition: registers.hh:706
const RegVal MSI_MASK
Definition: registers.hh:705
const RegVal UI_MASK
Definition: registers.hh:714
uint64_t RegVal
Definition: types.hh:168
VecRegT< DummyVecElem, DummyNumVecElemPerVecReg, true > DummyConstVecReg
Definition: vec_reg.hh:666
const int ThreadPointerReg
Definition: registers.hh:104
Bitfield< 17 > mprv
Definition: registers.hh:618
const int SyscallPseudoReturnReg
Definition: registers.hh:111
uint32_t DummyVecElem
Dummy type aliases and constants for architectures that do not implement vector registers.
Definition: vec_reg.hh:663
const RegVal STATUS_SPP_MASK
Definition: registers.hh:671
const RegVal STATUS_MPIE_MASK
Definition: registers.hh:672
const int MaxInstSrcRegs
Definition: registers.hh:59
const RegVal SSTATUS_MASK
Definition: registers.hh:688
Bitfield< 7 > mti
Definition: registers.hh:641
DummyVecPredReg::Container DummyVecPredRegContainer
constexpr size_t DummyVecPredRegSizeBits
const RegVal STATUS_XS_MASK
Definition: registers.hh:668
Bitfield< 8 > spp
Definition: registers.hh:622
const RegVal STATUS_SPIE_MASK
Definition: registers.hh:673
Bitfield< 21 > tw
Definition: registers.hh:614
const int MaxMiscDestRegs
Definition: registers.hh:70
const RegVal STATUS_MXR_MASK
Definition: registers.hh:665
const off_t FRM_OFFSET
Definition: registers.hh:653
const RegVal STATUS_MIE_MASK
Definition: registers.hh:675
const int NumMiscRegs
Definition: registers.hh:264
const RegVal STATUS_UPIE_MASK
Definition: registers.hh:674
const std::vector< std::string > FloatRegNames
Definition: registers.hh:125
const RegVal FFLAGS_MASK
Definition: registers.hh:715
Predicate register view.
Definition: vec_pred_reg.hh:70
constexpr bool VecPredRegHasPackedRepr
Definition: registers.hh:85
const RegVal USI_MASK
Definition: registers.hh:707
const RegVal ISA_EXT_MASK
Definition: registers.hh:656
constexpr size_t VecRegSizeBytes
Definition: registers.hh:78
::DummyVecElem VecElem
Definition: registers.hh:73
Bitfield< 1 > ssi
Definition: registers.hh:645
const int NumIntRegs
Definition: registers.hh:89
const int NumMicroIntRegs
Definition: registers.hh:88
Bitfield< 8 > uei
Definition: registers.hh:640
Bitfield< 18 > sum
Definition: registers.hh:617
Bitfield< 3 > msi
Definition: registers.hh:644
Bitfield< 14, 13 > fs
Definition: registers.hh:620
const RegVal STATUS_SIE_MASK
Definition: registers.hh:676
const RegVal MISA_MASK
Definition: registers.hh:657
const RegVal STATUS_TSR_MASK
Definition: registers.hh:662
const RegVal UTI_MASK
Definition: registers.hh:704
const std::map< int, CSRMetadata > CSRData
Definition: registers.hh:438
const RegVal STATUS_SD_MASK
Definition: registers.hh:659
Bitfield< 1 > sie
Definition: registers.hh:627
const int SyscallNumReg
Definition: registers.hh:113
VecRegT< DummyVecElem, DummyNumVecElemPerVecReg, false > DummyVecReg
Definition: vec_reg.hh:665
const off_t UXL_OFFSET
Definition: registers.hh:651
DummyVecReg::Container DummyVecRegContainer
Definition: vec_reg.hh:667
constexpr unsigned NumVecElemPerVecReg
Definition: registers.hh:77
const int ReturnValueReg
Definition: registers.hh:106
const int ReturnAddrReg
Definition: registers.hh:101
const std::string name
Definition: registers.hh:434
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
#define ULL(N)
uint64_t constant
Definition: types.hh:50
const RegVal FRM_MASK
Definition: registers.hh:716
const off_t SXL_OFFSET
Definition: registers.hh:650
Bitfield< 33, 32 > uxl
Definition: registers.hh:612
Bitfield< 4 > upie
Definition: registers.hh:625
const int ZeroReg
Definition: registers.hh:100
Bitfield< 12, 11 > mpp
Definition: registers.hh:621
const RegVal STATUS_FS_MASK
Definition: registers.hh:669
const RegVal MEI_MASK
Definition: registers.hh:699
const RegVal MSTATUS_MASK
Definition: registers.hh:678
const int NumVecPredRegs
Definition: registers.hh:94
Bitfield< 0 > uie
Definition: registers.hh:628
const RegVal MI_MASK
Definition: registers.hh:708
const int FramePointerReg
Definition: registers.hh:105
VecPredRegT< DummyVecElem, DummyNumVecElemPerVecReg, DummyVecPredRegHasPackedRepr, true > DummyConstVecPredReg
const RegVal STATUS_MPP_MASK
Definition: registers.hh:670
Vector Registers layout specification.
Generic predicate register container.
Definition: vec_pred_reg.hh:51
Bitfield< 22 > tsr
Definition: registers.hh:613
const RegVal STI_MASK
Definition: registers.hh:703
VecPredRegT< DummyVecElem, DummyNumVecElemPerVecReg, DummyVecPredRegHasPackedRepr, false > DummyVecPredReg
const int GlobalPointerReg
Definition: registers.hh:103
constexpr size_t VecPredRegSizeBits
Definition: registers.hh:84
EndBitUnion(IndexReg) BitUnion32(RandomReg) Bitfield< 30
const int AMOTempReg
Definition: registers.hh:109
Bitfield< 16, 15 > xs
Definition: registers.hh:619
Bitfield< 20 > tvm
Definition: registers.hh:615
const RegVal MTI_MASK
Definition: registers.hh:702
Bitfield< 35, 34 > sxl
Definition: registers.hh:611
Vector Register Abstraction This generic class is a view in a particularization of MVC...
Definition: vec_reg.hh:174
Bitfield< 0 > usi
Definition: registers.hh:646
const unsigned NumVecRegs
Definition: registers.hh:92
Bitfield< 19 > mxr
Definition: registers.hh:616
const RegVal STATUS_SXL_MASK
Definition: registers.hh:660
Bitfield< 3 > mie
Definition: registers.hh:626
constexpr size_t DummyVecRegSizeBytes
Definition: vec_reg.hh:668
Bitfield< 7 > mpie
Definition: registers.hh:623
const RegVal SEI_MASK
Definition: registers.hh:700
const RegVal ISA_MXL_MASK
Definition: registers.hh:655
const RegVal STATUS_UIE_MASK
Definition: registers.hh:677

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13