1// -*- mode:c++ -*-
2
3// Copyright (c) 2015 RISC-V Foundation
4// Copyright (c) 2016 The University of Virginia
5// All rights reserved.
6//
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are
9// met: redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer;
11// redistributions in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution;
14// neither the name of the copyright holders nor the names of its
15// contributors may be used to endorse or promote products derived from
16// this software without specific prior written permission.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29//
30// Authors: Maxwell Walter
31//          Alec Roelke
32
33////////////////////////////////////////////////////////////////////
34//
35// Bitfield definitions.
36//
37
38def bitfield QUADRANT <1:0>;
39def bitfield OPCODE <6:2>;
40
41// R-Type
42def bitfield ALL	<31:0>;
43def bitfield RD     <11:7>;
44def bitfield FUNCT3 <14:12>;
45def bitfield RS1    <19:15>;
46def bitfield RS2    <24:20>;
47def bitfield FUNCT7 <31:25>;
48
49// Bit shifts
50def bitfield SRTYPE <30>;
51def bitfield SHAMT5 <24:20>;
52def bitfield SHAMT6 <25:20>;
53
54// I-Type
55def bitfield IMM12  <31:20>;
56
57// S-Type
58def bitfield IMM5   <11:7>;
59def bitfield IMM7   <31:25>;
60
61// U-Type
62def bitfield IMM20  <31:12>;
63
64// SB-Type
65def bitfield BIMM12BIT11 <7>;
66def bitfield BIMM12BITS4TO1<11:8>;
67def bitfield BIMM12BITS10TO5 <30:25>;
68def bitfield IMMSIGN <31>;
69
70// UJ-Type
71def bitfield UJIMMBITS10TO1 <30:21>;
72def bitfield UJIMMBIT11 <20>;
73def bitfield UJIMMBITS19TO12 <19:12>;
74
75// System
76def bitfield FUNCT12 <31:20>;
77def bitfield CSRIMM <19:15>;
78
79// Floating point
80def bitfield FD <11:7>;
81def bitfield FS1 <19:15>;
82def bitfield FS2 <24:20>;
83def bitfield FS3 <31:27>;
84
85def bitfield ROUND_MODE <14:12>;
86def bitfield CONV_SGN <24:20>;
87def bitfield FUNCT2 <26:25>;
88
89// AMO
90def bitfield AMOFUNCT <31:27>;
91def bitfield AQ <26>;
92def bitfield RL <25>;
93
94// Compressed
95def bitfield COPCODE <15:13>;
96def bitfield CFUNCT1 <12>;
97def bitfield CFUNCT2HIGH <11:10>;
98def bitfield CFUNCT2LOW <6:5>;
99def bitfield RC1 <11:7>;
100def bitfield RC2 <6:2>;
101def bitfield RP1 <9:7>;
102def bitfield RP2 <4:2>;
103def bitfield FC1 <11:7>;
104def bitfield FC2 <6:2>;
105def bitfield FP2 <4:2>;
106def bitfield CJUMPIMM <12:2>;
107def bitfield CJUMPIMM3TO1 <5:3>;
108def bitfield CJUMPIMM4TO4 <11:11>;
109def bitfield CJUMPIMM5TO5 <2:2>;
110def bitfield CJUMPIMM6TO6 <7:7>;
111def bitfield CJUMPIMM7TO7 <6:6>;
112def bitfield CJUMPIMM9TO8 <10:9>;
113def bitfield CJUMPIMM10TO10 <8:8>;
114def bitfield CJUMPIMMSIGN <12:12>;
115def bitfield CIMM8 <12:5>;
116def bitfield CIMM6 <12:7>;
117def bitfield CIMM5 <6:2>;
118def bitfield CIMM3 <12:10>;
119def bitfield CIMM2 <6:5>;
120def bitfield CIMM1 <12>;
121