gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2016 RISC-V Foundation
16  * Copyright (c) 2016 The University of Virginia
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met: redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer;
23  * redistributions in binary form must reproduce the above copyright
24  * notice, this list of conditions and the following disclaimer in the
25  * documentation and/or other materials provided with the distribution;
26  * neither the name of the copyright holders nor the names of its
27  * contributors may be used to endorse or promote products derived from
28  * this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  *
42  * Authors: Andreas Hansson
43  * Sven Karlsson
44  * Alec Roelke
45  */
46 
47 #ifndef __ARCH_RISCV_REGISTERS_HH__
48 #define __ARCH_RISCV_REGISTERS_HH__
49 
50 #include <map>
51 #include <string>
52 
53 #include "arch/isa_traits.hh"
54 #include "arch/riscv/generated/max_inst_regs.hh"
55 #include "base/types.hh"
56 
57 namespace RiscvISA {
58 
60 using RiscvISAInst::MaxInstDestRegs;
61 const int MaxMiscDestRegs = 1;
62 
63 typedef uint_fast16_t RegIndex;
64 typedef uint64_t IntReg;
65 typedef uint64_t FloatRegBits;
66 typedef double FloatReg;
67 typedef uint8_t CCReg; // Not applicable to Riscv
68 typedef uint64_t MiscReg;
69 
70 const int NumIntArchRegs = 32;
71 const int NumMicroIntRegs = 1;
73 const int NumFloatRegs = 32;
74 const int NumCCRegs = 0;
75 const int NumMiscRegs = 4096;
76 
77 // These help enumerate all the registers for dependence tracking.
78 const int FP_Reg_Base = NumIntRegs;
82 
83 // Semantically meaningful register indices
84 const int ZeroReg = 0;
85 const int ReturnAddrReg = 1;
86 const int StackPointerReg = 2;
87 const int GlobalPointerReg = 3;
88 const int ThreadPointerReg = 4;
89 const int FramePointerReg = 8;
90 const int ReturnValueRegs[] = {10, 11};
92 const int ArgumentRegs[] = {10, 11, 12, 13, 14, 15, 16, 17};
93 const int AMOTempReg = 32;
94 
95 const char* const RegisterNames[] = {"zero", "ra", "sp", "gp",
96  "tp", "t0", "t1", "t2",
97  "s0", "s1", "a0", "a1",
98  "a2", "a3", "a4", "a5",
99  "a6", "a7", "s2", "s3",
100  "s4", "s5", "s6", "s7",
101  "s8", "s9", "s10", "s11",
102  "t3", "t4", "t5", "t6"};
103 
106  ArgumentRegs[2], ArgumentRegs[3]};
108 
109 const int NumHpmcounter = 29;
110 const int NumHpmcounterh = 29;
111 const int NumMhpmcounter = 29;
112 const int NumMhpmevent = 29;
115  MISCREG_UIE = 0x004,
116  MISCREG_UTVEC = 0x005,
118  MISCREG_UEPC = 0x041,
119  MISCREG_UCAUSE = 0x042,
121  MISCREG_UIP = 0x044,
122  MISCREG_FFLAGS = 0x001,
123  MISCREG_FRM = 0x002,
124  MISCREG_FCSR = 0x003,
125  MISCREG_CYCLE = 0xC00,
126  MISCREG_TIME = 0xC01,
129  MISCREG_CYCLEH = 0xC80,
130  MISCREG_TIMEH = 0xC81,
133 
137  MISCREG_SIE = 0x104,
138  MISCREG_STVEC = 0x105,
140  MISCREG_SEPC = 0x141,
141  MISCREG_SCAUSE = 0x142,
143  MISCREG_SIP = 0x144,
144  MISCREG_SPTBR = 0x180,
145 
149  MISCREG_HIE = 0x204,
150  MISCREG_HTVEC = 0x205,
152  MISCREG_HEPC = 0x241,
153  MISCREG_HCAUSE = 0x242,
155  MISCREG_HIP = 0x244,
156 
159  MISCREG_MIMPID = 0xF13,
162  MISCREG_MISA = 0x301,
165  MISCREG_MIE = 0x304,
166  MISCREG_MTVEC = 0x305,
168  MISCREG_MEPC = 0x341,
169  MISCREG_MCAUSE = 0x342,
171  MISCREG_MIP = 0x344,
172  MISCREG_MBASE = 0x380,
173  MISCREG_MBOUND = 0x381,
174  MISCREG_MIBASE = 0x382,
176  MISCREG_MDBASE = 0x384,
178  MISCREG_MCYCLE = 0xB00,
185 
187  MISCREG_TDATA1 = 0x7A1,
188  MISCREG_TDATA2 = 0x7A2,
189  MISCREG_TDATA3 = 0x7A3,
190  MISCREG_DCSR = 0x7B0,
191  MISCREG_DPC = 0x7B1,
193 };
194 
195 }
196 
197 #endif // __ARCH_RISCV_REGISTERS_HH__
const int NumFloatRegs
Definition: registers.hh:73
const int FP_Reg_Base
Definition: registers.hh:78
const int NumIntArchRegs
Definition: registers.hh:70
const int NumMhpmcounter
Definition: registers.hh:111
const int NumCCRegs
Definition: registers.hh:74
uint64_t MiscReg
Definition: registers.hh:68
const int StackPointerReg
Definition: registers.hh:86
const int ArgumentRegs[]
Definition: registers.hh:92
const int ThreadPointerReg
Definition: registers.hh:88
const int SyscallPseudoReturnReg
Definition: registers.hh:107
const int MaxInstSrcRegs
Definition: registers.hh:56
const int MaxMiscDestRegs
Definition: registers.hh:61
const int NumMiscRegs
Definition: registers.hh:75
const int CC_Reg_Base
Definition: registers.hh:79
const int NumHpmcounterh
Definition: registers.hh:110
const int NumIntRegs
Definition: registers.hh:72
const int NumMicroIntRegs
Definition: registers.hh:71
const char *const RegisterNames[]
Definition: registers.hh:95
const int ReturnValueRegs[]
Definition: registers.hh:90
const int SyscallNumReg
Definition: registers.hh:104
const int ReturnValueReg
Definition: registers.hh:91
const int ReturnAddrReg
Definition: registers.hh:85
const int SyscallArgumentRegs[]
Definition: registers.hh:105
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
const int ZeroReg
Definition: registers.hh:84
const int Max_Reg_Index
Definition: registers.hh:81
uint8_t CCReg
Definition: registers.hh:67
uint64_t FloatRegBits
Definition: registers.hh:65
const int FramePointerReg
Definition: registers.hh:89
double FloatReg
Definition: registers.hh:66
const int GlobalPointerReg
Definition: registers.hh:87
uint64_t IntReg
Definition: registers.hh:64
const int AMOTempReg
Definition: registers.hh:93
const int NumMhpmevent
Definition: registers.hh:112
const int Misc_Reg_Base
Definition: registers.hh:80
const int NumHpmcounter
Definition: registers.hh:109
uint_fast16_t RegIndex
Definition: registers.hh:63

Generated on Fri Jun 9 2017 13:03:36 for gem5 by doxygen 1.8.6