gem5  v22.1.0.0
int.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 The Hewlett-Packard Development Company
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __ARCH_X86_REGS_INT_HH__
39 #define __ARCH_X86_REGS_INT_HH__
40 
41 #include "arch/x86/x86_traits.hh"
42 #include "base/bitunion.hh"
43 #include "base/logging.hh"
44 #include "cpu/reg_class.hh"
45 #include "debug/IntRegs.hh"
46 
47 namespace gem5
48 {
49 
50 namespace X86ISA
51 {
52 
53 BitUnion64(X86IntReg)
54  Bitfield<63,0> R;
55  SignedBitfield<63,0> SR;
56  Bitfield<31,0> E;
57  SignedBitfield<31,0> SE;
58  Bitfield<15,0> X;
59  SignedBitfield<15,0> SX;
60  Bitfield<15,8> H;
61  SignedBitfield<15,8> SH;
62  Bitfield<7, 0> L;
63  SignedBitfield<7, 0> SL;
64 EndBitUnion(X86IntReg)
65 
66 namespace int_reg
67 {
68 
69 enum : RegIndex
70 {
71  _RaxIdx,
72  _RcxIdx,
73  _RdxIdx,
74  _RbxIdx,
75  _RspIdx,
76  _RbpIdx,
77  _RsiIdx,
78  _RdiIdx,
79  _R8Idx,
80  _R9Idx,
81  _R10Idx,
82  _R11Idx,
83  _R12Idx,
84  _R13Idx,
85  _R14Idx,
86  _R15Idx,
87 
89  MicroBegin = NumArchRegs,
90  _T0Idx = MicroBegin,
91  MicroEnd = MicroBegin + NumMicroIntRegs,
92 
93  _ProdlowIdx,
94  _ProdhiIdx,
95  _QuotientIdx,
96  _RemainderIdx,
97  _DivisorIdx,
98  _DoublebitsIdx,
99 
100  NumRegs
101 };
102 
103 } // namespace int_reg
104 
106 {
107  std::string regName(const RegId &id) const override;
108 };
109 
111 
112 inline constexpr RegClass flatIntRegClass =
114  ops(flatIntRegClassOps);
115 
117 {
118  RegId flatten(const BaseISA &isa, const RegId &id) const override;
119 };
120 
122 
123 inline constexpr RegClass intRegClass =
125  ops(intRegClassOps).
126  needsFlattening();
127 
128 namespace int_reg
129 {
130 
131 inline constexpr RegId
132  Rax = intRegClass[_RaxIdx],
133  Rcx = intRegClass[_RcxIdx],
134  Rdx = intRegClass[_RdxIdx],
135  Rbx = intRegClass[_RbxIdx],
136  Rsp = intRegClass[_RspIdx],
137  Rbp = intRegClass[_RbpIdx],
138  Rsi = intRegClass[_RsiIdx],
139  Rdi = intRegClass[_RdiIdx],
149  Prodlow = intRegClass[_ProdlowIdx],
150  Prodhi = intRegClass[_ProdhiIdx],
151  Quotient = intRegClass[_QuotientIdx],
152  Remainder = intRegClass[_RemainderIdx],
153  Divisor = intRegClass[_DivisorIdx],
154  Doublebits = intRegClass[_DoublebitsIdx];
155 
156 // Aliases for other register sizes.
157 inline constexpr auto
158  &Eax = Rax, &Ax = Rax, &Al = Rax,
159  &Ecx = Rcx, &Cx = Rcx, &Cl = Rcx,
160  &Edx = Rdx, &Dx = Rdx, &Dl = Rdx,
161  &Ebx = Rbx, &Bx = Rbx, &Bl = Rbx,
162  &Esp = Rsp, &Sp = Rsp, &Spl = Rsp, &Ah = Rsp,
163  &Ebp = Rbp, &Bp = Rbp, &Bpl = Rbp, &Ch = Rbp,
164  &Esi = Rsi, &Si = Rsi, &Sil = Rsi, &Dh = Rsi,
165  &Edi = Rdi, &Di = Rdi, &Dil = Rdi, &Bh = Rdi,
166  &R8d = R8, &R8w = R8, &R8b = R8,
167  &R9d = R9, &R9w = R9, &R9b = R9,
168  &R10d = R10, &R10w = R10, &R10b = R10,
169  &R11d = R11, &R11w = R11, &R11b = R11,
170  &R12d = R12, &R12w = R12, &R12b = R12,
171  &R13d = R13, &R13w = R13, &R13b = R13,
172  &R14d = R14, &R14w = R14, &R14b = R14,
173  &R15d = R15, &R15w = R15, &R15b = R15;
174 
175 } // namespace int_reg
176 
177 // This needs to be large enough to miss all the other bits of an index.
178 inline constexpr RegIndex IntFoldBit = 1 << 6;
179 
180 inline static constexpr RegId
182 {
183  return intRegClass[int_reg::MicroBegin + index];
184 }
185 
186 inline static constexpr RegId
188 {
189  if ((index & 0x1C) == 4 && foldBit)
190  index = (index - 4) | foldBit;
191  return intRegClass[index];
192 }
193 
194 } // namespace X86ISA
195 } // namespace gem5
196 
197 #endif // __ARCH_X86_REGS_INT_HH__
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:91
std::string regName(const RegId &id) const override
Print the name of the register specified in id.
Definition: int.cc:49
RegId flatten(const BaseISA &isa, const RegId &id) const override
Flatten register id id using information in the ISA object isa.
Definition: int.cc:135
const int NumRegs
Definition: int.hh:67
constexpr auto & Bl
Definition: int.hh:161
constexpr auto & R13d
Definition: int.hh:171
constexpr auto & R11d
Definition: int.hh:169
constexpr auto & Cx
Definition: int.hh:159
constexpr auto & R15w
Definition: int.hh:173
constexpr auto & R11b
Definition: int.hh:169
constexpr RegId R12
Definition: int.hh:144
constexpr auto & Ax
Definition: int.hh:158
constexpr RegId R9
Definition: int.hh:141
constexpr RegId R8
Definition: int.hh:140
constexpr RegId Prodhi
Definition: int.hh:150
constexpr auto & R11w
Definition: int.hh:169
constexpr auto & Al
Definition: int.hh:158
constexpr auto & Ebp
Definition: int.hh:163
constexpr RegId R14
Definition: int.hh:146
constexpr RegId Doublebits
Definition: int.hh:154
constexpr auto & R12b
Definition: int.hh:170
constexpr auto & Dl
Definition: int.hh:160
constexpr RegId Rbx
Definition: int.hh:135
constexpr auto & Ecx
Definition: int.hh:159
constexpr auto & Bp
Definition: int.hh:163
constexpr RegId Rsi
Definition: int.hh:138
constexpr auto & R10d
Definition: int.hh:168
constexpr auto & Si
Definition: int.hh:164
constexpr auto & R14b
Definition: int.hh:172
constexpr auto & Spl
Definition: int.hh:162
constexpr auto & Bpl
Definition: int.hh:163
constexpr auto & R14d
Definition: int.hh:172
constexpr auto & Dil
Definition: int.hh:165
constexpr auto & Dh
Definition: int.hh:164
constexpr RegId R15
Definition: int.hh:147
constexpr RegId Rax
Definition: int.hh:132
constexpr auto & Esp
Definition: int.hh:162
constexpr auto & Bh
Definition: int.hh:165
constexpr RegId Quotient
Definition: int.hh:151
constexpr auto & Di
Definition: int.hh:165
constexpr RegId Divisor
Definition: int.hh:153
constexpr auto & Ah
Definition: int.hh:162
constexpr auto & Sp
Definition: int.hh:162
constexpr RegId Rdx
Definition: int.hh:134
constexpr auto & R13b
Definition: int.hh:171
constexpr auto & Eax
Definition: int.hh:158
constexpr RegId Rsp
Definition: int.hh:136
constexpr RegId Rdi
Definition: int.hh:139
constexpr auto & Edx
Definition: int.hh:160
constexpr auto & Edi
Definition: int.hh:165
constexpr auto & R15d
Definition: int.hh:173
constexpr RegId R13
Definition: int.hh:145
constexpr auto & R13w
Definition: int.hh:171
constexpr auto & R9w
Definition: int.hh:167
constexpr auto & R9d
Definition: int.hh:167
constexpr auto & R12w
Definition: int.hh:170
constexpr RegId Prodlow
Definition: int.hh:149
constexpr auto & Ch
Definition: int.hh:163
constexpr auto & R10b
Definition: int.hh:168
constexpr auto & R8w
Definition: int.hh:166
constexpr auto & R8b
Definition: int.hh:166
constexpr auto & R15b
Definition: int.hh:173
constexpr auto & R10w
Definition: int.hh:168
constexpr auto & R14w
Definition: int.hh:172
constexpr auto & Esi
Definition: int.hh:164
constexpr auto & R9b
Definition: int.hh:167
constexpr auto & Cl
Definition: int.hh:159
constexpr RegId Remainder
Definition: int.hh:152
constexpr auto & R8d
Definition: int.hh:166
constexpr auto & R12d
Definition: int.hh:170
constexpr RegId Rbp
Definition: int.hh:137
constexpr auto & Dx
Definition: int.hh:160
constexpr auto & Sil
Definition: int.hh:164
constexpr auto & Bx
Definition: int.hh:161
constexpr RegId R11
Definition: int.hh:143
constexpr RegId R10
Definition: int.hh:142
constexpr RegId T0
Definition: int.hh:148
constexpr RegId Rcx
Definition: int.hh:133
constexpr auto & Ebx
Definition: int.hh:161
static constexpr RegId intRegMicro(int index)
Definition: int.hh:181
Bitfield< 15, 0 > X
Definition: int.hh:58
Bitfield< 15, 8 > H
Definition: int.hh:60
Bitfield< 31, 0 > E
Definition: int.hh:56
SignedBitfield< 31, 0 > SE
Definition: int.hh:57
SignedBitfield< 63, 0 > SR
Definition: int.hh:55
SignedBitfield< 15, 8 > SH
Definition: int.hh:61
constexpr RegClass intRegClass
Definition: int.hh:123
constexpr FlatIntRegClassOps flatIntRegClassOps
Definition: int.hh:110
BitUnion64(VAddr) Bitfield< 20
const int NumMicroIntRegs
Definition: x86_traits.hh:50
Bitfield< 7, 0 > L
Definition: int.hh:62
constexpr RegClass flatIntRegClass
Definition: int.hh:112
Bitfield< 5, 3 > index
Definition: types.hh:98
static constexpr RegId intRegFolded(RegIndex index, RegIndex foldBit)
Definition: int.hh:187
SignedBitfield< 7, 0 > SL
Definition: int.hh:63
EndBitUnion(TriggerIntMessage) GEM5_DEPRECATED_NAMESPACE(DeliveryMode
constexpr RegIndex IntFoldBit
Definition: int.hh:178
constexpr IntRegClassOps intRegClassOps
Definition: int.hh:121
SignedBitfield< 15, 0 > SX
Definition: int.hh:59
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint16_t RegIndex
Definition: types.hh:176
constexpr char IntRegClassName[]
Definition: reg_class.hh:73
@ IntRegClass
Integer register.
Definition: reg_class.hh:60

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