gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
types.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 ARM Limited
3  * Copyright (c) 2014 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) 2017 The University of Virginia
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __ARCH_RISCV_TYPES_HH__
43 #define __ARCH_RISCV_TYPES_HH__
44 
45 #include "arch/riscv/pcstate.hh"
46 #include "base/bitunion.hh"
47 
48 namespace gem5
49 {
50 
51 namespace RiscvISA
52 {
53 
54 typedef uint32_t MachInst;
55 
56 // This should be further extend someday when we start to support 64b+ inst.
57 // For now, we should be safe using the msbs to store extra information.
59  // Decoder state
60  Bitfield<63, 62> rv_type;
61  Bitfield<61> compressed;
62  // More bits for vector extension
63  Bitfield<57, 41> vl; // [0, 2**16]
64  Bitfield<40> vill;
65  SubBitUnion(vtype8, 39, 32) // exclude vill
66  Bitfield<39> vma;
67  Bitfield<38> vta;
68  Bitfield<37, 35> vsew;
69  Bitfield<34, 32> vlmul;
70  EndSubBitUnion(vtype8)
71  // Common
72  uint32_t instBits;
73  Bitfield< 1, 0> quadRant;
74  Bitfield< 6, 2> opcode5;
75  Bitfield< 6, 0> opcode;
76  // R-Type
77  Bitfield<31, 0> all;
78  Bitfield<11, 7> rd;
79  Bitfield<14, 12> funct3;
80  Bitfield<19, 15> rs1;
81  Bitfield<24, 20> rs2;
82  Bitfield<31, 25> funct7;
83  // Bit shifts
84  Bitfield<30> srType;
85  Bitfield<24, 20> shamt5;
86  Bitfield<25, 20> shamt6;
87  // I-Type
88  Bitfield<31, 20> imm12;
89  // Sync
90  Bitfield<23, 20> succ;
91  Bitfield<27, 24> pred;
92  // S-Type
93  Bitfield<11, 7> imm5;
94  Bitfield<31, 25> imm7;
95  // U-Type
96  Bitfield<31, 12> imm20;
97  // SB-Type
98  Bitfield<7> bimm12bit11;
99  Bitfield<11, 8> bimm12bits4to1;
100  Bitfield<30, 25> bimm12bits10to5;
101  Bitfield<31> immsign;
102  // UJ-Type
103  Bitfield<30, 21> ujimmbits10to1;
104  Bitfield<20> ujimmbit11;
105  Bitfield<19, 12> ujimmbits19to12;
106  // System
107  Bitfield<31, 20> funct12;
108  Bitfield<19, 15> csrimm;
109  // Floating point
110  Bitfield<11, 7> fd;
111  Bitfield<19, 15> fs1;
112  Bitfield<24, 20> fs2;
113  Bitfield<31, 27> fs3;
114  Bitfield<14, 12> round_mode;
115  Bitfield<24, 20> conv_sgn;
116  Bitfield<26, 25> funct2;
117  // AMO
118  Bitfield<31, 27> amofunct;
119  Bitfield<26> aq;
120  Bitfield<25> rl;
121  // Compressed
122  Bitfield<15, 13> copcode;
123  Bitfield<12> cfunct1;
124  Bitfield<11, 10> cfunct2high;
125  Bitfield< 6, 5> cfunct2low;
126  Bitfield<11, 7> rc1;
127  Bitfield< 6, 2> rc2;
128  Bitfield< 9, 7> rp1;
129  Bitfield< 4, 2> rp2;
130  Bitfield<11, 7> fc1;
131  Bitfield< 6, 2> fc2;
132  Bitfield< 4, 2> fp2;
133  Bitfield<12, 2> cjumpimm;
134  Bitfield< 5, 3> cjumpimm3to1;
135  Bitfield<11, 11> cjumpimm4to4;
136  Bitfield< 2, 2> cjumpimm5to5;
137  Bitfield< 7, 7> cjumpimm6to6;
138  Bitfield< 6, 6> cjumpimm7to7;
139  Bitfield<10, 9> cjumpimm9to8;
140  Bitfield< 8, 8> cjumpimm10to10;
141  Bitfield<12> cjumpimmsign;
142  Bitfield<12, 5> cimm8;
143  Bitfield<12, 7> cimm6;
144  Bitfield< 6, 2> cimm5;
145  Bitfield<12, 10> cimm3;
146  Bitfield< 6, 5> cimm2;
147  Bitfield<12> cimm1;
148  // Pseudo instructions
149  Bitfield<31, 25> m5func;
150  // vector
151  Bitfield<31, 26> vfunct6;
152  Bitfield<31, 27> vfunct5;
153  Bitfield<27, 25> vfunct3;
154  Bitfield<26, 25> vfunct2;
155  Bitfield<31, 29> nf;
156  Bitfield<28> mew;
157  Bitfield<27, 26> mop;
158  Bitfield<25> vm;
159  Bitfield<24, 20> lumop;
160  Bitfield<24, 20> sumop;
161  Bitfield<14, 12> width;
162  Bitfield<24, 20> vs2;
163  Bitfield<19, 15> vs1;
164  Bitfield<11, 7> vd;
165  Bitfield<11, 7> vs3;
166  Bitfield<19, 15> vecimm;
167  Bitfield<17, 15> simm3;
168  // vsetvli
169  Bitfield<31> bit31;
170  Bitfield<30> bit30;
171  Bitfield<30, 20> zimm_vsetvli;
172  // vsetivli
173  Bitfield<31, 30> bit31_30;
174  Bitfield<29, 20> zimm_vsetivli;
175  Bitfield<19, 15> uimm_vsetivli;
176  // vsetvl
177  Bitfield<31, 25> bit31_25;
178 
180 
181 } // namespace RiscvISA
182 } // namespace gem5
183 
184 #endif // __ARCH_RISCV_TYPES_HH__
gem5::RiscvISA::bit31_25
Bitfield< 31, 25 > bit31_25
Definition: types.hh:177
gem5::RiscvISA::vecimm
Bitfield< 19, 15 > vecimm
Definition: types.hh:166
gem5::RiscvISA::cjumpimm5to5
Bitfield< 2, 2 > cjumpimm5to5
Definition: types.hh:136
gem5::RiscvISA::vta
Bitfield< 38 > vta
Definition: types.hh:67
gem5::RiscvISA::cfunct1
Bitfield< 12 > cfunct1
Definition: types.hh:123
gem5::RiscvISA::cimm6
Bitfield< 12, 7 > cimm6
Definition: types.hh:143
gem5::RiscvISA::bit31_30
Bitfield< 31, 30 > bit31_30
Definition: types.hh:173
gem5::RiscvISA::rp2
Bitfield< 4, 2 > rp2
Definition: types.hh:129
gem5::RiscvISA::immsign
Bitfield< 31 > immsign
Definition: types.hh:101
gem5::RiscvISA::fs2
Bitfield< 24, 20 > fs2
Definition: types.hh:112
gem5::RiscvISA::MachInst
uint32_t MachInst
Definition: types.hh:54
gem5::RiscvISA::cjumpimm7to7
Bitfield< 6, 6 > cjumpimm7to7
Definition: types.hh:138
gem5::RiscvISA::zimm_vsetivli
Bitfield< 29, 20 > zimm_vsetivli
Definition: types.hh:174
gem5::RiscvISA::imm5
Bitfield< 11, 7 > imm5
Definition: types.hh:93
gem5::RiscvISA::mew
Bitfield< 28 > mew
Definition: types.hh:156
gem5::RiscvISA::csrimm
Bitfield< 19, 15 > csrimm
Definition: types.hh:108
gem5::RiscvISA::all
Bitfield< 31, 0 > all
Definition: types.hh:77
gem5::RiscvISA::vd
Bitfield< 11, 7 > vd
Definition: types.hh:164
gem5::RiscvISA::compressed
Bitfield< 61 > compressed
Definition: types.hh:61
gem5::RiscvISA::funct2
Bitfield< 26, 25 > funct2
Definition: types.hh:116
gem5::RiscvISA::round_mode
Bitfield< 14, 12 > round_mode
Definition: types.hh:114
gem5::RiscvISA::vl
Bitfield< 57, 41 > vl
Definition: types.hh:63
gem5::RiscvISA::conv_sgn
Bitfield< 24, 20 > conv_sgn
Definition: types.hh:115
gem5::RiscvISA::cjumpimm4to4
Bitfield< 11, 11 > cjumpimm4to4
Definition: types.hh:135
gem5::RiscvISA::zimm_vsetvli
Bitfield< 30, 20 > zimm_vsetvli
Definition: types.hh:171
gem5::RiscvISA::cjumpimm3to1
Bitfield< 5, 3 > cjumpimm3to1
Definition: types.hh:134
gem5::RiscvISA::vfunct2
Bitfield< 26, 25 > vfunct2
Definition: types.hh:154
gem5::RiscvISA::cjumpimm6to6
Bitfield< 7, 7 > cjumpimm6to6
Definition: types.hh:137
gem5::RiscvISA::vm
Bitfield< 25 > vm
Definition: types.hh:158
gem5::RiscvISA::rp1
Bitfield< 9, 7 > rp1
Definition: types.hh:128
gem5::RiscvISA::sumop
Bitfield< 24, 20 > sumop
Definition: types.hh:160
gem5::RiscvISA::aq
Bitfield< 26 > aq
Definition: types.hh:119
gem5::RiscvISA::simm3
Bitfield< 17, 15 > simm3
Definition: types.hh:167
gem5::RiscvISA::ujimmbit11
Bitfield< 20 > ujimmbit11
Definition: types.hh:104
gem5::RiscvISA::quadRant
Bitfield< 1, 0 > quadRant
Definition: types.hh:73
gem5::RiscvISA::rc2
Bitfield< 6, 2 > rc2
Definition: types.hh:127
gem5::RiscvISA::imm12
Bitfield< 31, 20 > imm12
Definition: types.hh:88
gem5::RiscvISA::srType
Bitfield< 30 > srType
Definition: types.hh:84
pcstate.hh
gem5::RiscvISA::funct7
Bitfield< 31, 25 > funct7
Definition: types.hh:82
gem5::RiscvISA::rl
Bitfield< 25 > rl
Definition: types.hh:120
gem5::RiscvISA::imm20
Bitfield< 31, 12 > imm20
Definition: types.hh:96
gem5::RiscvISA::rc1
Bitfield< 11, 7 > rc1
Definition: types.hh:126
gem5::RiscvISA::bit30
Bitfield< 30 > bit30
Definition: types.hh:170
gem5::RiscvISA::cjumpimm
Bitfield< 12, 2 > cjumpimm
Definition: types.hh:133
gem5::RiscvISA::fd
Bitfield< 11, 7 > fd
Definition: types.hh:110
gem5::RiscvISA::imm7
Bitfield< 31, 25 > imm7
Definition: types.hh:94
gem5::RiscvISA::vs2
Bitfield< 24, 20 > vs2
Definition: types.hh:162
gem5::RiscvISA::ujimmbits19to12
Bitfield< 19, 12 > ujimmbits19to12
Definition: types.hh:105
gem5::RiscvISA::fc2
Bitfield< 6, 2 > fc2
Definition: types.hh:131
bitunion.hh
gem5::RiscvISA::shamt6
Bitfield< 25, 20 > shamt6
Definition: types.hh:86
gem5::RiscvISA::vfunct5
Bitfield< 31, 27 > vfunct5
Definition: types.hh:152
gem5::RiscvISA::nf
Bitfield< 31, 29 > nf
Definition: types.hh:155
gem5::RiscvISA::m5func
Bitfield< 31, 25 > m5func
Definition: types.hh:149
gem5::RiscvISA::EndSubBitUnion
EndSubBitUnion(cu) Bitfield< 27 > rp
gem5::RiscvISA::opcode5
Bitfield< 6, 2 > opcode5
Definition: types.hh:74
gem5::RiscvISA::rs2
Bitfield< 24, 20 > rs2
Definition: types.hh:81
gem5::RiscvISA::cjumpimm9to8
Bitfield< 10, 9 > cjumpimm9to8
Definition: types.hh:139
gem5::ArmISA::instBits
uint32_t instBits
Definition: types.hh:87
gem5::RiscvISA::amofunct
Bitfield< 31, 27 > amofunct
Definition: types.hh:118
gem5::RiscvISA::rd
Bitfield< 11, 7 > rd
Definition: types.hh:78
gem5::RiscvISA::ujimmbits10to1
Bitfield< 30, 21 > ujimmbits10to1
Definition: types.hh:103
gem5::RiscvISA::shamt5
Bitfield< 24, 20 > shamt5
Definition: types.hh:85
gem5::RiscvISA::cimm3
Bitfield< 12, 10 > cimm3
Definition: types.hh:145
gem5::RiscvISA::bit31
Bitfield< 31 > bit31
Definition: types.hh:169
gem5::RiscvISA::succ
Bitfield< 23, 20 > succ
Definition: types.hh:90
gem5::RiscvISA::vs1
Bitfield< 19, 15 > vs1
Definition: types.hh:163
gem5::RiscvISA::funct12
Bitfield< 31, 20 > funct12
Definition: types.hh:107
gem5::RiscvISA::lumop
Bitfield< 24, 20 > lumop
Definition: types.hh:159
gem5::RiscvISA::copcode
Bitfield< 15, 13 > copcode
Definition: types.hh:122
gem5::RiscvISA::width
Bitfield< 14, 12 > width
Definition: types.hh:161
gem5::RiscvISA::funct3
Bitfield< 14, 12 > funct3
Definition: types.hh:79
gem5::RiscvISA::vs3
Bitfield< 11, 7 > vs3
Definition: types.hh:165
gem5::X86ISA::ExtMachInst
Definition: types.hh:212
gem5::RiscvISA::fs1
Bitfield< 19, 15 > fs1
Definition: types.hh:111
gem5::RiscvISA::cimm5
Bitfield< 6, 2 > cimm5
Definition: types.hh:144
gem5::RiscvISA::uimm_vsetivli
Bitfield< 19, 15 > uimm_vsetivli
Definition: types.hh:175
gem5::RiscvISA::cfunct2low
Bitfield< 6, 5 > cfunct2low
Definition: types.hh:125
gem5::RiscvISA::cimm1
Bitfield< 12 > cimm1
Definition: types.hh:147
gem5::RiscvISA::vfunct3
Bitfield< 27, 25 > vfunct3
Definition: types.hh:153
gem5::RiscvISA::vill
Bitfield< 40 > vill
Definition: types.hh:64
gem5::RiscvISA::rv_type
rv_type
Definition: types.hh:60
gem5::RiscvISA::SubBitUnion
SubBitUnion(im, 15, 8) Bitfield< 15 > im7
gem5::RiscvISA::pred
Bitfield< 27, 24 > pred
Definition: types.hh:91
gem5::RiscvISA::cjumpimm10to10
Bitfield< 8, 8 > cjumpimm10to10
Definition: types.hh:140
gem5::RiscvISA::cjumpimmsign
Bitfield< 12 > cjumpimmsign
Definition: types.hh:141
gem5::RiscvISA::cimm2
Bitfield< 6, 5 > cimm2
Definition: types.hh:146
gem5::RiscvISA::rs1
Bitfield< 19, 15 > rs1
Definition: types.hh:80
gem5::RiscvISA::EndBitUnion
EndBitUnion(SATP) enum AddrXlateMode
Definition: pagetable.hh:49
gem5::RiscvISA::vlmul
Bitfield< 34, 32 > vlmul
Definition: types.hh:69
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::RiscvISA::cimm8
Bitfield< 12, 5 > cimm8
Definition: types.hh:142
gem5::RiscvISA::opcode
Bitfield< 6, 0 > opcode
Definition: types.hh:75
gem5::RiscvISA::bimm12bit11
Bitfield< 7 > bimm12bit11
Definition: types.hh:98
gem5::RiscvISA::BitUnion64
BitUnion64(SATP) Bitfield< 63
gem5::RiscvISA::cfunct2high
Bitfield< 11, 10 > cfunct2high
Definition: types.hh:124
gem5::RiscvISA::fs3
Bitfield< 31, 27 > fs3
Definition: types.hh:113
gem5::RiscvISA::vfunct6
Bitfield< 31, 26 > vfunct6
Definition: types.hh:151
gem5::RiscvISA::bimm12bits10to5
Bitfield< 30, 25 > bimm12bits10to5
Definition: types.hh:100
gem5::RiscvISA::fp2
Bitfield< 4, 2 > fp2
Definition: types.hh:132
gem5::RiscvISA::mop
Bitfield< 27, 26 > mop
Definition: types.hh:157
gem5::RiscvISA::fc1
Bitfield< 11, 7 > fc1
Definition: types.hh:130
gem5::RiscvISA::bimm12bits4to1
Bitfield< 11, 8 > bimm12bits4to1
Definition: types.hh:99
gem5::RiscvISA::vsew
Bitfield< 37, 35 > vsew
Definition: types.hh:68

Generated on Sun Jul 30 2023 01:56:50 for gem5 by doxygen 1.8.17