-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefinitions.ice
270 lines (246 loc) · 4.98 KB
/
definitions.ice
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
// 7 bit colour either ALPHA (background or lower layer) or red, green, blue { Arrggbb }
bitfield colour7 {
uint1 alpha,
uint2 red,
uint2 green,
uint2 blue
}
// 6 bit colour red, green, blue { rrggbb }
bitfield colour6 {
uint2 red,
uint2 green,
uint2 blue
}
bitfield colour13 {
uint1 alpha,
uint6 background,
uint6 foreground,
}
// USED FOR TILEMAP COLOUR ENTRY TO INCLUDE THE REFLECTION FLAGS
bitfield colour15 {
uint1 y_reflect,
uint1 x_reflect,
uint1 alpha,
uint6 background,
uint6 foreground,
}
// Vertex in the vector block
bitfield vectorentry {
uint1 active,
uint6 dx, // 1 sign bit + 5 bits for the offset
uint6 dy // 1 sign bit + 5 bits for the offset
}
// Sprite update flag
bitfield spriteupdate {
uint1 y_act, // 1 - kill when off screen, 0 - wrap
uint1 x_act, // 1 - kill when off screen, 0 - wrap
uint1 tile_act, // 1 - increase the tile number
uint1 dysign, // dy - 2's complement update for the y coordinate
uint4 dy,
uint1 dxsign, // dx - 2's complement update for the x coordinate
uint4 dx
}
// BITFIELD FOR FLOATING POINT CSR REGISTER
bitfield floatingpointcsr{
uint24 reserved,
uint3 frm,
uint5 fflags
}
// ROUNDING MODES
$$ RNE = 0
$$ RTZ = 1
$$ RDN = 2
$$ RUP = 3
$$ RMM = 4
// EXCEPTIONS FLAGS
$$ NX = 1
$$ UF = 2
$$ OF = 4
$$ DZ = 8
$$ NV = 16
// RISC-V BASE INSTRUCTION BITFIELDS
bitfield Btype {
uint1 immediate_bits_12,
uint6 immediate_bits_10_5,
uint5 sourceReg2,
uint5 sourceReg1,
uint3 function3,
uint4 immediate_bits_4_1,
uint1 immediate_bits_11,
uint7 opcode
}
bitfield Itype {
uint12 immediate,
uint5 sourceReg1,
uint3 function3,
uint5 destReg,
uint7 opcode
}
bitfield ItypeSHIFT {
uint7 function7,
uint5 shiftCount,
uint5 sourceReg1,
uint3 function3,
uint5 destReg,
uint7 opcode
}
bitfield Jtype {
uint1 immediate_bits_20,
uint10 immediate_bits_10_1,
uint1 immediate_bits_11,
uint8 immediate_bits_19_12,
uint5 destReg,
uint7 opcode
}
bitfield Rtype {
uint7 function7,
uint5 sourceReg2,
uint5 sourceReg1,
uint3 function3,
uint5 destReg,
uint7 opCode
}
bitfield R4type {
uint5 sourceReg3,
uint2 function2,
uint5 sourceReg2,
uint5 sourceReg1,
uint3 function3,
uint5 destReg,
uint7 opCode
}
bitfield Stype {
uint7 immediate_bits_11_5,
uint5 sourceReg2,
uint5 sourceReg1,
uint3 function3,
uint5 immediate_bits_4_0,
uint7 opcode
}
bitfield Utype {
uint20 immediate_bits_31_12,
uint5 destReg,
uint7 opCode
}
// CSR Risc-V Access Instruction
bitfield CSR {
uint12 csr,
uint5 rs1,
uint3 function3,
uint5 rd,
uint7 opcode
}
// COMPRESSED Risc-V Instruction Bitfields
bitfield CBalu {
uint3 function3,
uint1 ib_5,
uint2 function2,
uint3 rd_alt,
uint2 logical2,
uint3 rs2_alt,
uint2 opcode
}
bitfield CBalu50 {
uint3 function3,
uint1 ib_5,
uint2 function2,
uint3 rd_alt,
uint5 ib_4_0,
uint2 opcode
}
bitfield CB {
uint3 function3,
uint1 offset_8,
uint2 offset_4_3,
uint3 rs1_alt,
uint2 offset_7_6,
uint2 offset_2_1,
uint1 offset_5,
uint2 opcode
}
bitfield CI {
uint3 function3,
uint1 ib_5,
uint5 rd,
uint3 ib_4_2,
uint2 ib_7_6,
uint2 opcode
}
bitfield CI50 {
uint3 function3,
uint1 ib_5,
uint5 rd,
uint5 ib_4_0,
uint2 opcode
}
bitfield CI94 {
uint3 function3,
uint1 ib_9,
uint5 rd,
uint1 ib_4,
uint1 ib_6,
uint2 ib_8_7,
uint1 ib_5,
uint2 opcode
}
bitfield CIu94 {
uint3 function3,
uint2 ib_5_4,
uint4 ib_9_6,
uint1 ib_2,
uint1 ib_3,
uint3 rd_alt,
uint2 opcode
}
bitfield CIlui {
uint3 function3,
uint1 ib_17,
uint5 rd,
uint5 ib_16_12,
uint2 opcode
}
bitfield CJ {
uint3 function3,
uint1 ib_11,
uint1 ib_4,
uint2 ib_9_8,
uint1 ib_10,
uint1 ib_6,
uint1 ib_7,
uint3 ib_3_1,
uint1 ib_5,
uint2 opcode
}
bitfield CL {
uint3 function3,
uint3 ib_5_3,
uint3 rs1_alt,
uint1 ib_2,
uint1 ib_6,
uint3 rd_alt,
uint2 opcode
}
bitfield CR {
uint4 function4,
uint5 rs1,
uint5 rs2,
uint2 opcode
}
bitfield CS {
uint3 function3,
uint1 ib_5,
uint2 ib_4_3,
uint3 rs1_alt,
uint1 ib_2,
uint1 ib_6,
uint3 rs2_alt,
uint2 opcode
}
bitfield CSS {
uint3 function3,
uint1 ib_5,
uint3 ib_4_2,
uint2 ib_7_6,
uint5 rs2,
uint2 opcode
}