gem5 v23.0.0.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
48namespace gem5
49{
50
51namespace RiscvISA
52{
53
54typedef 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;
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__
#define BitUnion64(name)
Use this to define conveniently sized values overlayed with bitfields.
Definition bitunion.hh:494
#define EndBitUnion(name)
This closes off the class and union started by the above macro.
Definition bitunion.hh:428
#define SubBitUnion(name, first, last)
Regular bitfields These define macros for read/write regular bitfield based subbitfields.
Definition bitunion.hh:470
#define EndSubBitUnion(name)
This closes off the union created above and gives it a name.
Definition bitunion.hh:455
uint32_t instBits
Definition types.hh:87
Bitfield< 31, 0 > all
Definition types.hh:77
Bitfield< 31, 25 > funct7
Definition types.hh:82
Bitfield< 34, 32 > vlmul
Definition types.hh:69
Bitfield< 7 > bimm12bit11
Definition types.hh:98
Bitfield< 6, 0 > opcode
Definition types.hh:75
Bitfield< 12, 7 > cimm6
Definition types.hh:143
Bitfield< 11, 7 > fc1
Definition types.hh:130
Bitfield< 23, 20 > succ
Definition types.hh:90
Bitfield< 10, 9 > cjumpimm9to8
Definition types.hh:139
Bitfield< 11, 10 > cfunct2high
Definition types.hh:124
Bitfield< 6, 2 > cimm5
Definition types.hh:144
Bitfield< 24, 20 > sumop
Definition types.hh:160
Bitfield< 11, 7 > fd
Definition types.hh:110
Bitfield< 40 > vill
Definition types.hh:64
Bitfield< 38 > vta
Definition types.hh:67
Bitfield< 6, 5 > cfunct2low
Definition types.hh:125
Bitfield< 31, 27 > amofunct
Definition types.hh:118
Bitfield< 6, 5 > cimm2
Definition types.hh:146
Bitfield< 19, 15 > csrimm
Definition types.hh:108
Bitfield< 14, 12 > width
Definition types.hh:161
Bitfield< 4, 2 > fp2
Definition types.hh:132
Bitfield< 24, 20 > shamt5
Definition types.hh:85
Bitfield< 9, 7 > rp1
Definition types.hh:128
Bitfield< 27, 24 > pred
Definition types.hh:91
Bitfield< 15, 13 > copcode
Definition types.hh:122
Bitfield< 14, 12 > funct3
Definition types.hh:79
Bitfield< 61 > compressed
Definition types.hh:61
Bitfield< 11, 8 > bimm12bits4to1
Definition types.hh:99
Bitfield< 31, 30 > bit31_30
Definition types.hh:173
Bitfield< 2, 2 > cjumpimm5to5
Definition types.hh:136
Bitfield< 31 > immsign
Definition types.hh:101
Bitfield< 19, 15 > vs1
Definition types.hh:163
Bitfield< 31, 29 > nf
Definition types.hh:155
Bitfield< 11, 7 > imm5
Definition types.hh:93
Bitfield< 26 > aq
Definition types.hh:119
Bitfield< 29, 20 > zimm_vsetivli
Definition types.hh:174
Bitfield< 19, 12 > ujimmbits19to12
Definition types.hh:105
Bitfield< 12, 2 > cjumpimm
Definition types.hh:133
Bitfield< 24, 20 > rs2
Definition types.hh:81
Bitfield< 31, 27 > fs3
Definition types.hh:113
Bitfield< 11, 7 > vd
Definition types.hh:164
Bitfield< 12, 10 > cimm3
Definition types.hh:145
Bitfield< 31, 20 > funct12
Definition types.hh:107
Bitfield< 6, 2 > opcode5
Definition types.hh:74
Bitfield< 1, 0 > quadRant
Definition types.hh:73
Bitfield< 26, 25 > funct2
Definition types.hh:116
Bitfield< 24, 20 > lumop
Definition types.hh:159
Bitfield< 27, 26 > mop
Definition types.hh:157
Bitfield< 31, 26 > vfunct6
Definition types.hh:151
Bitfield< 25, 20 > shamt6
Definition types.hh:86
Bitfield< 57, 41 > vl
Definition types.hh:63
Bitfield< 20 > ujimmbit11
Definition types.hh:104
Bitfield< 12 > cjumpimmsign
Definition types.hh:141
Bitfield< 24, 20 > conv_sgn
Definition types.hh:115
Bitfield< 4, 2 > rp2
Definition types.hh:129
Bitfield< 24, 20 > fs2
Definition types.hh:112
Bitfield< 31, 25 > imm7
Definition types.hh:94
Bitfield< 6, 2 > fc2
Definition types.hh:131
Bitfield< 30 > srType
Definition types.hh:84
Bitfield< 30 > bit30
Definition types.hh:170
Bitfield< 26, 25 > vfunct2
Definition types.hh:154
Bitfield< 12 > cfunct1
Definition types.hh:123
Bitfield< 19, 15 > uimm_vsetivli
Definition types.hh:175
Bitfield< 31, 12 > imm20
Definition types.hh:96
Bitfield< 30, 20 > zimm_vsetvli
Definition types.hh:171
Bitfield< 14, 12 > round_mode
Definition types.hh:114
Bitfield< 30, 21 > ujimmbits10to1
Definition types.hh:103
Bitfield< 7, 7 > cjumpimm6to6
Definition types.hh:137
Bitfield< 28 > mew
Definition types.hh:156
Bitfield< 19, 15 > rs1
Definition types.hh:80
Bitfield< 11, 7 > rd
Definition types.hh:78
uint32_t MachInst
Definition types.hh:54
Bitfield< 24, 20 > vs2
Definition types.hh:162
Bitfield< 12, 5 > cimm8
Definition types.hh:142
Bitfield< 37, 35 > vsew
Definition types.hh:68
Bitfield< 30, 25 > bimm12bits10to5
Definition types.hh:100
Bitfield< 19, 15 > fs1
Definition types.hh:111
Bitfield< 11, 7 > vs3
Definition types.hh:165
Bitfield< 6, 2 > rc2
Definition types.hh:127
Bitfield< 31, 20 > imm12
Definition types.hh:88
Bitfield< 25 > vm
Definition types.hh:158
Bitfield< 31, 27 > vfunct5
Definition types.hh:152
Bitfield< 11, 7 > rc1
Definition types.hh:126
Bitfield< 12 > cimm1
Definition types.hh:147
Bitfield< 31, 25 > m5func
Definition types.hh:149
Bitfield< 25 > rl
Definition types.hh:120
Bitfield< 6, 6 > cjumpimm7to7
Definition types.hh:138
Bitfield< 5, 3 > cjumpimm3to1
Definition types.hh:134
Bitfield< 31, 25 > bit31_25
Definition types.hh:177
Bitfield< 19, 15 > vecimm
Definition types.hh:166
Bitfield< 8, 8 > cjumpimm10to10
Definition types.hh:140
Bitfield< 17, 15 > simm3
Definition types.hh:167
Bitfield< 11, 11 > cjumpimm4to4
Definition types.hh:135
Bitfield< 27, 25 > vfunct3
Definition types.hh:153
Bitfield< 31 > bit31
Definition types.hh:169
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....

Generated on Mon Jul 10 2023 14:24:28 for gem5 by doxygen 1.9.7