ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
RV64IMACFD_RV32ICInstr.cpp
Go to the documentation of this file.
1 
8 #include "RV64IMACFDArch.h"
9 #include "RV64IMACFDFuncs.h"
10 
11 using namespace etiss;
12 using namespace etiss::instr;
13 
14 
15 // CADDI4SPN -------------------------------------------------------------------
18  "caddi4spn",
19  (uint16_t) 0x00,
20  (uint16_t) 0xe003,
21  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
22  {
23 
24 // -----------------------------------------------------------------------------
25 
26 // -----------------------------------------------------------------------------
27 
28 // -----------------------------------------------------------------------------
29 etiss_uint8 rd = 0;
30 static BitArrayRange R_rd_0(4, 2);
31 rd += R_rd_0.read(ba) << 0;
32 etiss_uint16 imm = 0;
33 static BitArrayRange R_imm_3(5, 5);
34 imm += R_imm_3.read(ba) << 3;
35 static BitArrayRange R_imm_2(6, 6);
36 imm += R_imm_2.read(ba) << 2;
37 static BitArrayRange R_imm_6(10, 7);
38 imm += R_imm_6.read(ba) << 6;
39 static BitArrayRange R_imm_4(12, 11);
40 imm += R_imm_4.read(ba) << 4;
41 
42 // -----------------------------------------------------------------------------
43 
44  {
46 
47  cp.code() = std::string("//CADDI4SPN\n");
48 
49 // -----------------------------------------------------------------------------
50 cp.code() += "etiss_coverage_count(1, 42);\n";
51 { // block
52 cp.code() += "etiss_coverage_count(1, 1169);\n";
53 cp.code() += "{ // block\n";
54 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
55 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
56 cp.code() += "} // block\n";
57 } // block
58 cp.code() += "etiss_coverage_count(1, 2327);\n";
59 if (imm) { // conditional
60 cp.code() += "etiss_coverage_count(1, 2328);\n";
61 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(imm) + "ULL;\n";
62 cp.code() += "etiss_coverage_count(9, 2339, 2333, 2332, 2330, 2331, 2338, 2336, 2335, 2337);\n";
63 } // conditional
64 else { // conditional
65 { // procedure
66 cp.code() += "{ // procedure\n";
67 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
68 cp.code() += "etiss_coverage_count(2, 2342, 2340);\n";
69 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
70 cp.code() += "} // procedure\n";
71 } // procedure
72 } // conditional
73 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
74 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
75 // -----------------------------------------------------------------------------
76  cp.getAffectedRegisters().add("instructionPointer", 32);
77  }
78  {
80 
81  cp.code() = std::string("//CADDI4SPN\n");
82 
83 // -----------------------------------------------------------------------------
84 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
85 // -----------------------------------------------------------------------------
86  }
87 
88  return true;
89  },
90  0,
91  [] (BitArray & ba, Instruction & instr)
92  {
93 // -----------------------------------------------------------------------------
94 etiss_uint8 rd = 0;
95 static BitArrayRange R_rd_0(4, 2);
96 rd += R_rd_0.read(ba) << 0;
97 etiss_uint16 imm = 0;
98 static BitArrayRange R_imm_3(5, 5);
99 imm += R_imm_3.read(ba) << 3;
100 static BitArrayRange R_imm_2(6, 6);
101 imm += R_imm_2.read(ba) << 2;
102 static BitArrayRange R_imm_6(10, 7);
103 imm += R_imm_6.read(ba) << 6;
104 static BitArrayRange R_imm_4(12, 11);
105 imm += R_imm_4.read(ba) << 4;
106 
107 // -----------------------------------------------------------------------------
108 
109  std::stringstream ss;
110 // -----------------------------------------------------------------------------
111 ss << "caddi4spn" << " # " << ba << (" [rd=" + std::to_string(rd) + " | imm=" + std::to_string(imm) + "]");
112 // -----------------------------------------------------------------------------
113  return ss.str();
114  }
115 );
116 
117 // CLW -------------------------------------------------------------------------
120  "clw",
121  (uint16_t) 0x4000,
122  (uint16_t) 0xe003,
123  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
124  {
125 
126 // -----------------------------------------------------------------------------
127 
128 // -----------------------------------------------------------------------------
129 
130 // -----------------------------------------------------------------------------
131 etiss_uint8 rd = 0;
132 static BitArrayRange R_rd_0(4, 2);
133 rd += R_rd_0.read(ba) << 0;
134 etiss_uint8 uimm = 0;
135 static BitArrayRange R_uimm_6(5, 5);
136 uimm += R_uimm_6.read(ba) << 6;
137 static BitArrayRange R_uimm_2(6, 6);
138 uimm += R_uimm_2.read(ba) << 2;
139 etiss_uint8 rs1 = 0;
140 static BitArrayRange R_rs1_0(9, 7);
141 rs1 += R_rs1_0.read(ba) << 0;
142 static BitArrayRange R_uimm_3(12, 10);
143 uimm += R_uimm_3.read(ba) << 3;
144 
145 // -----------------------------------------------------------------------------
146 
147  {
149 
150  cp.code() = std::string("//CLW\n");
151 
152 // -----------------------------------------------------------------------------
153 cp.code() += "etiss_coverage_count(1, 43);\n";
154 { // block
155 cp.code() += "etiss_coverage_count(1, 1169);\n";
156 cp.code() += "{ // block\n";
157 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
158 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
159 cp.code() += "} // block\n";
160 } // block
161 { // block
162 cp.code() += "etiss_coverage_count(1, 2363);\n";
163 cp.code() += "{ // block\n";
164 cp.code() += "etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] + " + std::to_string(uimm) + "ULL;\n";
165 cp.code() += "etiss_coverage_count(7, 2351, 2350, 2348, 2347, 2345, 2346, 2349);\n";
166 cp.code() += "etiss_uint32 mem_val_0;\n";
167 cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";
168 cp.code() += "if (cpu->exception) { // conditional\n";
169 { // procedure
170 cp.code() += "{ // procedure\n";
171 cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
172 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
173 cp.code() += "} // procedure\n";
174 } // procedure
175 cp.code() += "} // conditional\n";
176 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = (etiss_int32)(mem_val_0);\n";
177 cp.code() += "etiss_coverage_count(8, 2362, 2356, 2355, 2353, 2354, 2361, 2359, 2358);\n";
178 cp.code() += "} // block\n";
179 } // block
180 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
181 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
182 // -----------------------------------------------------------------------------
183  cp.getAffectedRegisters().add("instructionPointer", 32);
184  }
185  {
187 
188  cp.code() = std::string("//CLW\n");
189 
190 // -----------------------------------------------------------------------------
191 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
192 // -----------------------------------------------------------------------------
193  }
194 
195  return true;
196  },
197  0,
198  [] (BitArray & ba, Instruction & instr)
199  {
200 // -----------------------------------------------------------------------------
201 etiss_uint8 rd = 0;
202 static BitArrayRange R_rd_0(4, 2);
203 rd += R_rd_0.read(ba) << 0;
204 etiss_uint8 uimm = 0;
205 static BitArrayRange R_uimm_6(5, 5);
206 uimm += R_uimm_6.read(ba) << 6;
207 static BitArrayRange R_uimm_2(6, 6);
208 uimm += R_uimm_2.read(ba) << 2;
209 etiss_uint8 rs1 = 0;
210 static BitArrayRange R_rs1_0(9, 7);
211 rs1 += R_rs1_0.read(ba) << 0;
212 static BitArrayRange R_uimm_3(12, 10);
213 uimm += R_uimm_3.read(ba) << 3;
214 
215 // -----------------------------------------------------------------------------
216 
217  std::stringstream ss;
218 // -----------------------------------------------------------------------------
219 ss << "clw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | uimm=" + std::to_string(uimm) + " | rs1=" + std::to_string(rs1) + "]");
220 // -----------------------------------------------------------------------------
221  return ss.str();
222  }
223 );
224 
225 // CSW -------------------------------------------------------------------------
228  "csw",
229  (uint16_t) 0xc000,
230  (uint16_t) 0xe003,
231  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
232  {
233 
234 // -----------------------------------------------------------------------------
235 
236 // -----------------------------------------------------------------------------
237 
238 // -----------------------------------------------------------------------------
239 etiss_uint8 rs2 = 0;
240 static BitArrayRange R_rs2_0(4, 2);
241 rs2 += R_rs2_0.read(ba) << 0;
242 etiss_uint8 uimm = 0;
243 static BitArrayRange R_uimm_6(5, 5);
244 uimm += R_uimm_6.read(ba) << 6;
245 static BitArrayRange R_uimm_2(6, 6);
246 uimm += R_uimm_2.read(ba) << 2;
247 etiss_uint8 rs1 = 0;
248 static BitArrayRange R_rs1_0(9, 7);
249 rs1 += R_rs1_0.read(ba) << 0;
250 static BitArrayRange R_uimm_3(12, 10);
251 uimm += R_uimm_3.read(ba) << 3;
252 
253 // -----------------------------------------------------------------------------
254 
255  {
257 
258  cp.code() = std::string("//CSW\n");
259 
260 // -----------------------------------------------------------------------------
261 cp.code() += "etiss_coverage_count(1, 44);\n";
262 { // block
263 cp.code() += "etiss_coverage_count(1, 1169);\n";
264 cp.code() += "{ // block\n";
265 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
266 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
267 cp.code() += "} // block\n";
268 } // block
269 { // block
270 cp.code() += "etiss_coverage_count(1, 2384);\n";
271 cp.code() += "{ // block\n";
272 cp.code() += "etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] + " + std::to_string(uimm) + "ULL;\n";
273 cp.code() += "etiss_coverage_count(7, 2372, 2371, 2369, 2368, 2366, 2367, 2370);\n";
274 cp.code() += "etiss_uint32 mem_val_0;\n";
275 cp.code() += "mem_val_0 = (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL]);\n";
276 cp.code() += "etiss_coverage_count(8, 2383, 2375, 2374, 2382, 2380, 2379, 2377, 2378);\n";
277 cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";
278 cp.code() += "if (cpu->exception) { // conditional\n";
279 { // procedure
280 cp.code() += "{ // procedure\n";
281 cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
282 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
283 cp.code() += "} // procedure\n";
284 } // procedure
285 cp.code() += "} // conditional\n";
286 cp.code() += "} // block\n";
287 } // block
288 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
289 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
290 // -----------------------------------------------------------------------------
291  cp.getAffectedRegisters().add("instructionPointer", 32);
292  }
293  {
295 
296  cp.code() = std::string("//CSW\n");
297 
298 // -----------------------------------------------------------------------------
299 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
300 // -----------------------------------------------------------------------------
301  }
302 
303  return true;
304  },
305  0,
306  [] (BitArray & ba, Instruction & instr)
307  {
308 // -----------------------------------------------------------------------------
309 etiss_uint8 rs2 = 0;
310 static BitArrayRange R_rs2_0(4, 2);
311 rs2 += R_rs2_0.read(ba) << 0;
312 etiss_uint8 uimm = 0;
313 static BitArrayRange R_uimm_6(5, 5);
314 uimm += R_uimm_6.read(ba) << 6;
315 static BitArrayRange R_uimm_2(6, 6);
316 uimm += R_uimm_2.read(ba) << 2;
317 etiss_uint8 rs1 = 0;
318 static BitArrayRange R_rs1_0(9, 7);
319 rs1 += R_rs1_0.read(ba) << 0;
320 static BitArrayRange R_uimm_3(12, 10);
321 uimm += R_uimm_3.read(ba) << 3;
322 
323 // -----------------------------------------------------------------------------
324 
325  std::stringstream ss;
326 // -----------------------------------------------------------------------------
327 ss << "csw" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | uimm=" + std::to_string(uimm) + " | rs1=" + std::to_string(rs1) + "]");
328 // -----------------------------------------------------------------------------
329  return ss.str();
330  }
331 );
332 
333 // CADDI -----------------------------------------------------------------------
336  "caddi",
337  (uint16_t) 0x01,
338  (uint16_t) 0xe003,
339  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
340  {
341 
342 // -----------------------------------------------------------------------------
343 
344 // -----------------------------------------------------------------------------
345 
346 // -----------------------------------------------------------------------------
347 etiss_uint8 imm = 0;
348 static BitArrayRange R_imm_0(6, 2);
349 imm += R_imm_0.read(ba) << 0;
350 etiss_uint8 rs1 = 0;
351 static BitArrayRange R_rs1_0(11, 7);
352 rs1 += R_rs1_0.read(ba) << 0;
353 static BitArrayRange R_imm_5(12, 12);
354 imm += R_imm_5.read(ba) << 5;
355 
356 // -----------------------------------------------------------------------------
357 
358  {
360 
361  cp.code() = std::string("//CADDI\n");
362 
363 // -----------------------------------------------------------------------------
364 cp.code() += "etiss_coverage_count(1, 45);\n";
365 { // block
366 cp.code() += "etiss_coverage_count(1, 1169);\n";
367 cp.code() += "{ // block\n";
368 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
369 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
370 cp.code() += "} // block\n";
371 } // block
372 cp.code() += "etiss_coverage_count(1, 2385);\n";
373 if ((rs1 % 32ULL) != 0LL) { // conditional
374 cp.code() += "etiss_coverage_count(5, 2391, 2388, 2386, 2389, 2390);\n";
375 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int8)(((etiss_int8)imm) << (2)) >> (2))) + "LL;\n";
376 cp.code() += "etiss_coverage_count(10, 2406, 2396, 2395, 2393, 2405, 2401, 2400, 2398, 2404, 2402);\n";
377 } // conditional
378 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
379 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
380 // -----------------------------------------------------------------------------
381  cp.getAffectedRegisters().add("instructionPointer", 32);
382  }
383 
384  return true;
385  },
386  0,
387  [] (BitArray & ba, Instruction & instr)
388  {
389 // -----------------------------------------------------------------------------
390 etiss_uint8 imm = 0;
391 static BitArrayRange R_imm_0(6, 2);
392 imm += R_imm_0.read(ba) << 0;
393 etiss_uint8 rs1 = 0;
394 static BitArrayRange R_rs1_0(11, 7);
395 rs1 += R_rs1_0.read(ba) << 0;
396 static BitArrayRange R_imm_5(12, 12);
397 imm += R_imm_5.read(ba) << 5;
398 
399 // -----------------------------------------------------------------------------
400 
401  std::stringstream ss;
402 // -----------------------------------------------------------------------------
403 ss << "caddi" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + "]");
404 // -----------------------------------------------------------------------------
405  return ss.str();
406  }
407 );
408 
409 // CNOP ------------------------------------------------------------------------
412  "cnop",
413  (uint16_t) 0x01,
414  (uint16_t) 0xef83,
415  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
416  {
417 
418 // -----------------------------------------------------------------------------
419 
420 // -----------------------------------------------------------------------------
421 
422 // -----------------------------------------------------------------------------
423 etiss_uint8 nzimm = 0;
424 static BitArrayRange R_nzimm_0(6, 2);
425 nzimm += R_nzimm_0.read(ba) << 0;
426 static BitArrayRange R_nzimm_5(12, 12);
427 nzimm += R_nzimm_5.read(ba) << 5;
428 
429 // -----------------------------------------------------------------------------
430 
431  {
433 
434  cp.code() = std::string("//CNOP\n");
435 
436 // -----------------------------------------------------------------------------
437 cp.code() += "etiss_coverage_count(1, 46);\n";
438 { // block
439 cp.code() += "etiss_coverage_count(1, 1169);\n";
440 cp.code() += "{ // block\n";
441 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
442 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
443 cp.code() += "} // block\n";
444 } // block
445 { // block
446 cp.code() += "etiss_coverage_count(1, 2407);\n";
447 cp.code() += "{ // block\n";
448 cp.code() += "} // block\n";
449 } // block
450 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
451 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
452 // -----------------------------------------------------------------------------
453  cp.getAffectedRegisters().add("instructionPointer", 32);
454  }
455 
456  return true;
457  },
458  0,
459  [] (BitArray & ba, Instruction & instr)
460  {
461 // -----------------------------------------------------------------------------
462 etiss_uint8 nzimm = 0;
463 static BitArrayRange R_nzimm_0(6, 2);
464 nzimm += R_nzimm_0.read(ba) << 0;
465 static BitArrayRange R_nzimm_5(12, 12);
466 nzimm += R_nzimm_5.read(ba) << 5;
467 
468 // -----------------------------------------------------------------------------
469 
470  std::stringstream ss;
471 // -----------------------------------------------------------------------------
472 ss << "cnop" << " # " << ba << (" [nzimm=" + std::to_string(nzimm) + "]");
473 // -----------------------------------------------------------------------------
474  return ss.str();
475  }
476 );
477 
478 // CLI -------------------------------------------------------------------------
481  "cli",
482  (uint16_t) 0x4001,
483  (uint16_t) 0xe003,
484  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
485  {
486 
487 // -----------------------------------------------------------------------------
488 
489 // -----------------------------------------------------------------------------
490 
491 // -----------------------------------------------------------------------------
492 etiss_uint8 imm = 0;
493 static BitArrayRange R_imm_0(6, 2);
494 imm += R_imm_0.read(ba) << 0;
495 etiss_uint8 rd = 0;
496 static BitArrayRange R_rd_0(11, 7);
497 rd += R_rd_0.read(ba) << 0;
498 static BitArrayRange R_imm_5(12, 12);
499 imm += R_imm_5.read(ba) << 5;
500 
501 // -----------------------------------------------------------------------------
502 
503  {
505 
506  cp.code() = std::string("//CLI\n");
507 
508 // -----------------------------------------------------------------------------
509 cp.code() += "etiss_coverage_count(1, 48);\n";
510 { // block
511 cp.code() += "etiss_coverage_count(1, 1169);\n";
512 cp.code() += "{ // block\n";
513 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
514 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
515 cp.code() += "} // block\n";
516 } // block
517 { // block
518 cp.code() += "etiss_coverage_count(1, 2439);\n";
519 cp.code() += "{ // block\n";
520 cp.code() += "etiss_coverage_count(1, 2423);\n";
521 if ((rd % 32ULL) != 0LL) { // conditional
522 cp.code() += "etiss_coverage_count(5, 2429, 2426, 2424, 2427, 2428);\n";
523 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(((etiss_int8)(((etiss_int8)imm) << (2)) >> (2))) + "LL;\n";
524 cp.code() += "etiss_coverage_count(6, 2438, 2434, 2433, 2431, 2437, 2435);\n";
525 } // conditional
526 cp.code() += "} // block\n";
527 } // block
528 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
529 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
530 // -----------------------------------------------------------------------------
531  cp.getAffectedRegisters().add("instructionPointer", 32);
532  }
533 
534  return true;
535  },
536  0,
537  [] (BitArray & ba, Instruction & instr)
538  {
539 // -----------------------------------------------------------------------------
540 etiss_uint8 imm = 0;
541 static BitArrayRange R_imm_0(6, 2);
542 imm += R_imm_0.read(ba) << 0;
543 etiss_uint8 rd = 0;
544 static BitArrayRange R_rd_0(11, 7);
545 rd += R_rd_0.read(ba) << 0;
546 static BitArrayRange R_imm_5(12, 12);
547 imm += R_imm_5.read(ba) << 5;
548 
549 // -----------------------------------------------------------------------------
550 
551  std::stringstream ss;
552 // -----------------------------------------------------------------------------
553 ss << "cli" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rd=" + std::to_string(rd) + "]");
554 // -----------------------------------------------------------------------------
555  return ss.str();
556  }
557 );
558 
559 // CLUI ------------------------------------------------------------------------
562  "clui",
563  (uint16_t) 0x6001,
564  (uint16_t) 0xe003,
565  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
566  {
567 
568 // -----------------------------------------------------------------------------
569 
570 // -----------------------------------------------------------------------------
571 
572 // -----------------------------------------------------------------------------
573 etiss_uint32 imm = 0;
574 static BitArrayRange R_imm_12(6, 2);
575 imm += R_imm_12.read(ba) << 12;
576 etiss_uint8 rd = 0;
577 static BitArrayRange R_rd_0(11, 7);
578 rd += R_rd_0.read(ba) << 0;
579 static BitArrayRange R_imm_17(12, 12);
580 imm += R_imm_17.read(ba) << 17;
581 
582 // -----------------------------------------------------------------------------
583 
584  {
586 
587  cp.code() = std::string("//CLUI\n");
588 
589 // -----------------------------------------------------------------------------
590 cp.code() += "etiss_coverage_count(1, 49);\n";
591 { // block
592 cp.code() += "etiss_coverage_count(1, 1169);\n";
593 cp.code() += "{ // block\n";
594 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
595 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
596 cp.code() += "} // block\n";
597 } // block
598 { // block
599 cp.code() += "etiss_coverage_count(1, 2463);\n";
600 cp.code() += "{ // block\n";
601 cp.code() += "etiss_coverage_count(1, 2440);\n";
602 if (imm == 0LL) { // conditional
603 cp.code() += "etiss_coverage_count(3, 2443, 2441, 2442);\n";
604 { // procedure
605 cp.code() += "{ // procedure\n";
606 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
607 cp.code() += "etiss_coverage_count(2, 2446, 2444);\n";
608 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
609 cp.code() += "} // procedure\n";
610 } // procedure
611 } // conditional
612 cp.code() += "etiss_coverage_count(1, 2447);\n";
613 if ((rd % 32ULL) != 0LL) { // conditional
614 cp.code() += "etiss_coverage_count(5, 2453, 2450, 2448, 2451, 2452);\n";
615 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(((etiss_int32)(((etiss_int32)imm) << (14)) >> (14))) + "LL;\n";
616 cp.code() += "etiss_coverage_count(6, 2462, 2458, 2457, 2455, 2461, 2459);\n";
617 } // conditional
618 cp.code() += "} // block\n";
619 } // block
620 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
621 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
622 // -----------------------------------------------------------------------------
623  cp.getAffectedRegisters().add("instructionPointer", 32);
624  }
625  {
627 
628  cp.code() = std::string("//CLUI\n");
629 
630 // -----------------------------------------------------------------------------
631 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
632 // -----------------------------------------------------------------------------
633  }
634 
635  return true;
636  },
637  0,
638  [] (BitArray & ba, Instruction & instr)
639  {
640 // -----------------------------------------------------------------------------
641 etiss_uint32 imm = 0;
642 static BitArrayRange R_imm_12(6, 2);
643 imm += R_imm_12.read(ba) << 12;
644 etiss_uint8 rd = 0;
645 static BitArrayRange R_rd_0(11, 7);
646 rd += R_rd_0.read(ba) << 0;
647 static BitArrayRange R_imm_17(12, 12);
648 imm += R_imm_17.read(ba) << 17;
649 
650 // -----------------------------------------------------------------------------
651 
652  std::stringstream ss;
653 // -----------------------------------------------------------------------------
654 ss << "clui" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rd=" + std::to_string(rd) + "]");
655 // -----------------------------------------------------------------------------
656  return ss.str();
657  }
658 );
659 
660 // CADDI16SP -------------------------------------------------------------------
663  "caddi16sp",
664  (uint16_t) 0x6101,
665  (uint16_t) 0xef83,
666  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
667  {
668 
669 // -----------------------------------------------------------------------------
670 
671 // -----------------------------------------------------------------------------
672 
673 // -----------------------------------------------------------------------------
674 etiss_uint16 nzimm = 0;
675 static BitArrayRange R_nzimm_5(2, 2);
676 nzimm += R_nzimm_5.read(ba) << 5;
677 static BitArrayRange R_nzimm_7(4, 3);
678 nzimm += R_nzimm_7.read(ba) << 7;
679 static BitArrayRange R_nzimm_6(5, 5);
680 nzimm += R_nzimm_6.read(ba) << 6;
681 static BitArrayRange R_nzimm_4(6, 6);
682 nzimm += R_nzimm_4.read(ba) << 4;
683 static BitArrayRange R_nzimm_9(12, 12);
684 nzimm += R_nzimm_9.read(ba) << 9;
685 
686 // -----------------------------------------------------------------------------
687 
688  {
690 
691  cp.code() = std::string("//CADDI16SP\n");
692 
693 // -----------------------------------------------------------------------------
694 cp.code() += "etiss_coverage_count(1, 50);\n";
695 { // block
696 cp.code() += "etiss_coverage_count(1, 1169);\n";
697 cp.code() += "{ // block\n";
698 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
699 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
700 cp.code() += "} // block\n";
701 } // block
702 cp.code() += "etiss_coverage_count(1, 2464);\n";
703 if (nzimm) { // conditional
704 cp.code() += "etiss_coverage_count(1, 2465);\n";
705 cp.code() += "*((RV64IMACFD*)cpu)->X[2ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)nzimm) << (6)) >> (6))) + "LL;\n";
706 cp.code() += "etiss_coverage_count(8, 2476, 2468, 2467, 2475, 2471, 2470, 2474, 2472);\n";
707 } // conditional
708 else { // conditional
709 { // procedure
710 cp.code() += "{ // procedure\n";
711 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
712 cp.code() += "etiss_coverage_count(2, 2479, 2477);\n";
713 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
714 cp.code() += "} // procedure\n";
715 } // procedure
716 } // conditional
717 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
718 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
719 // -----------------------------------------------------------------------------
720  cp.getAffectedRegisters().add("instructionPointer", 32);
721  }
722  {
724 
725  cp.code() = std::string("//CADDI16SP\n");
726 
727 // -----------------------------------------------------------------------------
728 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
729 // -----------------------------------------------------------------------------
730  }
731 
732  return true;
733  },
734  0,
735  [] (BitArray & ba, Instruction & instr)
736  {
737 // -----------------------------------------------------------------------------
738 etiss_uint16 nzimm = 0;
739 static BitArrayRange R_nzimm_5(2, 2);
740 nzimm += R_nzimm_5.read(ba) << 5;
741 static BitArrayRange R_nzimm_7(4, 3);
742 nzimm += R_nzimm_7.read(ba) << 7;
743 static BitArrayRange R_nzimm_6(5, 5);
744 nzimm += R_nzimm_6.read(ba) << 6;
745 static BitArrayRange R_nzimm_4(6, 6);
746 nzimm += R_nzimm_4.read(ba) << 4;
747 static BitArrayRange R_nzimm_9(12, 12);
748 nzimm += R_nzimm_9.read(ba) << 9;
749 
750 // -----------------------------------------------------------------------------
751 
752  std::stringstream ss;
753 // -----------------------------------------------------------------------------
754 ss << "caddi16sp" << " # " << ba << (" [nzimm=" + std::to_string(nzimm) + "]");
755 // -----------------------------------------------------------------------------
756  return ss.str();
757  }
758 );
759 
760 // __reserved_clui -------------------------------------------------------------
763  "__reserved_clui",
764  (uint16_t) 0x6001,
765  (uint16_t) 0xf07f,
766  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
767  {
768 
769 // -----------------------------------------------------------------------------
770 
771 // -----------------------------------------------------------------------------
772 
773 // -----------------------------------------------------------------------------
774 etiss_uint8 rd = 0;
775 static BitArrayRange R_rd_0(11, 7);
776 rd += R_rd_0.read(ba) << 0;
777 
778 // -----------------------------------------------------------------------------
779 
780  {
782 
783  cp.code() = std::string("//__reserved_clui\n");
784 
785 // -----------------------------------------------------------------------------
786 cp.code() += "etiss_coverage_count(1, 51);\n";
787 { // block
788 cp.code() += "etiss_coverage_count(1, 1169);\n";
789 cp.code() += "{ // block\n";
790 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
791 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
792 cp.code() += "} // block\n";
793 } // block
794 { // procedure
795 cp.code() += "{ // procedure\n";
796 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
797 cp.code() += "etiss_coverage_count(2, 2482, 2480);\n";
798 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
799 cp.code() += "} // procedure\n";
800 } // procedure
801 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
802 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
803 // -----------------------------------------------------------------------------
804  cp.getAffectedRegisters().add("instructionPointer", 32);
805  }
806  {
808 
809  cp.code() = std::string("//__reserved_clui\n");
810 
811 // -----------------------------------------------------------------------------
812 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
813 // -----------------------------------------------------------------------------
814  }
815 
816  return true;
817  },
818  0,
819  [] (BitArray & ba, Instruction & instr)
820  {
821 // -----------------------------------------------------------------------------
822 etiss_uint8 rd = 0;
823 static BitArrayRange R_rd_0(11, 7);
824 rd += R_rd_0.read(ba) << 0;
825 
826 // -----------------------------------------------------------------------------
827 
828  std::stringstream ss;
829 // -----------------------------------------------------------------------------
830 ss << "__reserved_clui" << " # " << ba << (" [rd=" + std::to_string(rd) + "]");
831 // -----------------------------------------------------------------------------
832  return ss.str();
833  }
834 );
835 
836 // CSRLI -----------------------------------------------------------------------
839  "csrli",
840  (uint16_t) 0x8001,
841  (uint16_t) 0xfc03,
842  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
843  {
844 
845 // -----------------------------------------------------------------------------
846 
847 // -----------------------------------------------------------------------------
848 
849 // -----------------------------------------------------------------------------
850 etiss_uint8 shamt = 0;
851 static BitArrayRange R_shamt_0(6, 2);
852 shamt += R_shamt_0.read(ba) << 0;
853 etiss_uint8 rs1 = 0;
854 static BitArrayRange R_rs1_0(9, 7);
855 rs1 += R_rs1_0.read(ba) << 0;
856 
857 // -----------------------------------------------------------------------------
858 
859  {
861 
862  cp.code() = std::string("//CSRLI\n");
863 
864 // -----------------------------------------------------------------------------
865 cp.code() += "etiss_coverage_count(1, 52);\n";
866 { // block
867 cp.code() += "etiss_coverage_count(1, 1169);\n";
868 cp.code() += "{ // block\n";
869 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
870 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
871 cp.code() += "} // block\n";
872 } // block
873 { // block
874 cp.code() += "etiss_coverage_count(1, 2496);\n";
875 cp.code() += "{ // block\n";
876 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] >> " + std::to_string(shamt) + "ULL;\n";
877 cp.code() += "etiss_coverage_count(11, 2495, 2487, 2486, 2484, 2485, 2494, 2492, 2491, 2489, 2490, 2493);\n";
878 cp.code() += "} // block\n";
879 } // block
880 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
881 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
882 // -----------------------------------------------------------------------------
883  cp.getAffectedRegisters().add("instructionPointer", 32);
884  }
885 
886  return true;
887  },
888  0,
889  [] (BitArray & ba, Instruction & instr)
890  {
891 // -----------------------------------------------------------------------------
892 etiss_uint8 shamt = 0;
893 static BitArrayRange R_shamt_0(6, 2);
894 shamt += R_shamt_0.read(ba) << 0;
895 etiss_uint8 rs1 = 0;
896 static BitArrayRange R_rs1_0(9, 7);
897 rs1 += R_rs1_0.read(ba) << 0;
898 
899 // -----------------------------------------------------------------------------
900 
901  std::stringstream ss;
902 // -----------------------------------------------------------------------------
903 ss << "csrli" << " # " << ba << (" [shamt=" + std::to_string(shamt) + " | rs1=" + std::to_string(rs1) + "]");
904 // -----------------------------------------------------------------------------
905  return ss.str();
906  }
907 );
908 
909 // CSRAI -----------------------------------------------------------------------
912  "csrai",
913  (uint16_t) 0x8401,
914  (uint16_t) 0xfc03,
915  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
916  {
917 
918 // -----------------------------------------------------------------------------
919 
920 // -----------------------------------------------------------------------------
921 
922 // -----------------------------------------------------------------------------
923 etiss_uint8 shamt = 0;
924 static BitArrayRange R_shamt_0(6, 2);
925 shamt += R_shamt_0.read(ba) << 0;
926 etiss_uint8 rs1 = 0;
927 static BitArrayRange R_rs1_0(9, 7);
928 rs1 += R_rs1_0.read(ba) << 0;
929 
930 // -----------------------------------------------------------------------------
931 
932  {
934 
935  cp.code() = std::string("//CSRAI\n");
936 
937 // -----------------------------------------------------------------------------
938 cp.code() += "etiss_coverage_count(1, 53);\n";
939 { // block
940 cp.code() += "etiss_coverage_count(1, 1169);\n";
941 cp.code() += "{ // block\n";
942 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
943 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
944 cp.code() += "} // block\n";
945 } // block
946 { // block
947 cp.code() += "etiss_coverage_count(1, 2536);\n";
948 cp.code() += "{ // block\n";
949 cp.code() += "etiss_coverage_count(1, 2497);\n";
950 if (shamt) { // conditional
951 cp.code() += "etiss_coverage_count(1, 2498);\n";
952 { // block
953 cp.code() += "etiss_coverage_count(1, 2518);\n";
954 cp.code() += "{ // block\n";
955 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] = ((etiss_int64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL])) >> " + std::to_string(shamt) + "ULL;\n";
956 cp.code() += "etiss_coverage_count(13, 2517, 2506, 2505, 2503, 2504, 2516, 2513, 2511, 2510, 2508, 2509, 2514, 2515);\n";
957 cp.code() += "} // block\n";
958 } // block
959 } // conditional
960 cp.code() += "} // block\n";
961 } // block
962 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
963 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
964 // -----------------------------------------------------------------------------
965  cp.getAffectedRegisters().add("instructionPointer", 32);
966  }
967 
968  return true;
969  },
970  0,
971  [] (BitArray & ba, Instruction & instr)
972  {
973 // -----------------------------------------------------------------------------
974 etiss_uint8 shamt = 0;
975 static BitArrayRange R_shamt_0(6, 2);
976 shamt += R_shamt_0.read(ba) << 0;
977 etiss_uint8 rs1 = 0;
978 static BitArrayRange R_rs1_0(9, 7);
979 rs1 += R_rs1_0.read(ba) << 0;
980 
981 // -----------------------------------------------------------------------------
982 
983  std::stringstream ss;
984 // -----------------------------------------------------------------------------
985 ss << "csrai" << " # " << ba << (" [shamt=" + std::to_string(shamt) + " | rs1=" + std::to_string(rs1) + "]");
986 // -----------------------------------------------------------------------------
987  return ss.str();
988  }
989 );
990 
991 // CANDI -----------------------------------------------------------------------
994  "candi",
995  (uint16_t) 0x8801,
996  (uint16_t) 0xec03,
997  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
998  {
999 
1000 // -----------------------------------------------------------------------------
1001 
1002 // -----------------------------------------------------------------------------
1003 
1004 // -----------------------------------------------------------------------------
1005 etiss_uint8 imm = 0;
1006 static BitArrayRange R_imm_0(6, 2);
1007 imm += R_imm_0.read(ba) << 0;
1008 etiss_uint8 rs1 = 0;
1009 static BitArrayRange R_rs1_0(9, 7);
1010 rs1 += R_rs1_0.read(ba) << 0;
1011 static BitArrayRange R_imm_5(12, 12);
1012 imm += R_imm_5.read(ba) << 5;
1013 
1014 // -----------------------------------------------------------------------------
1015 
1016  {
1018 
1019  cp.code() = std::string("//CANDI\n");
1020 
1021 // -----------------------------------------------------------------------------
1022 cp.code() += "etiss_coverage_count(1, 54);\n";
1023 { // block
1024 cp.code() += "etiss_coverage_count(1, 1169);\n";
1025 cp.code() += "{ // block\n";
1026 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1027 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1028 cp.code() += "} // block\n";
1029 } // block
1030 { // block
1031 cp.code() += "etiss_coverage_count(1, 2552);\n";
1032 cp.code() += "{ // block\n";
1033 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] & " + std::to_string(((etiss_int8)(((etiss_int8)imm) << (2)) >> (2))) + "LL;\n";
1034 cp.code() += "etiss_coverage_count(12, 2551, 2541, 2540, 2538, 2539, 2550, 2546, 2545, 2543, 2544, 2549, 2547);\n";
1035 cp.code() += "} // block\n";
1036 } // block
1037 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1038 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1039 // -----------------------------------------------------------------------------
1040  cp.getAffectedRegisters().add("instructionPointer", 32);
1041  }
1042 
1043  return true;
1044  },
1045  0,
1046  [] (BitArray & ba, Instruction & instr)
1047  {
1048 // -----------------------------------------------------------------------------
1049 etiss_uint8 imm = 0;
1050 static BitArrayRange R_imm_0(6, 2);
1051 imm += R_imm_0.read(ba) << 0;
1052 etiss_uint8 rs1 = 0;
1053 static BitArrayRange R_rs1_0(9, 7);
1054 rs1 += R_rs1_0.read(ba) << 0;
1055 static BitArrayRange R_imm_5(12, 12);
1056 imm += R_imm_5.read(ba) << 5;
1057 
1058 // -----------------------------------------------------------------------------
1059 
1060  std::stringstream ss;
1061 // -----------------------------------------------------------------------------
1062 ss << "candi" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + "]");
1063 // -----------------------------------------------------------------------------
1064  return ss.str();
1065  }
1066 );
1067 
1068 // CSUB ------------------------------------------------------------------------
1071  "csub",
1072  (uint16_t) 0x8c01,
1073  (uint16_t) 0xfc63,
1074  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1075  {
1076 
1077 // -----------------------------------------------------------------------------
1078 
1079 // -----------------------------------------------------------------------------
1080 
1081 // -----------------------------------------------------------------------------
1082 etiss_uint8 rs2 = 0;
1083 static BitArrayRange R_rs2_0(4, 2);
1084 rs2 += R_rs2_0.read(ba) << 0;
1085 etiss_uint8 rd = 0;
1086 static BitArrayRange R_rd_0(9, 7);
1087 rd += R_rd_0.read(ba) << 0;
1088 
1089 // -----------------------------------------------------------------------------
1090 
1091  {
1093 
1094  cp.code() = std::string("//CSUB\n");
1095 
1096 // -----------------------------------------------------------------------------
1097 cp.code() += "etiss_coverage_count(1, 55);\n";
1098 { // block
1099 cp.code() += "etiss_coverage_count(1, 1169);\n";
1100 cp.code() += "{ // block\n";
1101 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1102 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1103 cp.code() += "} // block\n";
1104 } // block
1105 { // block
1106 cp.code() += "etiss_coverage_count(1, 2570);\n";
1107 cp.code() += "{ // block\n";
1108 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] - *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL];\n";
1109 cp.code() += "etiss_coverage_count(14, 2569, 2557, 2556, 2554, 2555, 2568, 2562, 2561, 2559, 2560, 2567, 2566, 2564, 2565);\n";
1110 cp.code() += "} // block\n";
1111 } // block
1112 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1113 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1114 // -----------------------------------------------------------------------------
1115  cp.getAffectedRegisters().add("instructionPointer", 32);
1116  }
1117 
1118  return true;
1119  },
1120  0,
1121  [] (BitArray & ba, Instruction & instr)
1122  {
1123 // -----------------------------------------------------------------------------
1124 etiss_uint8 rs2 = 0;
1125 static BitArrayRange R_rs2_0(4, 2);
1126 rs2 += R_rs2_0.read(ba) << 0;
1127 etiss_uint8 rd = 0;
1128 static BitArrayRange R_rd_0(9, 7);
1129 rd += R_rd_0.read(ba) << 0;
1130 
1131 // -----------------------------------------------------------------------------
1132 
1133  std::stringstream ss;
1134 // -----------------------------------------------------------------------------
1135 ss << "csub" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
1136 // -----------------------------------------------------------------------------
1137  return ss.str();
1138  }
1139 );
1140 
1141 // CXOR ------------------------------------------------------------------------
1144  "cxor",
1145  (uint16_t) 0x8c21,
1146  (uint16_t) 0xfc63,
1147  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1148  {
1149 
1150 // -----------------------------------------------------------------------------
1151 
1152 // -----------------------------------------------------------------------------
1153 
1154 // -----------------------------------------------------------------------------
1155 etiss_uint8 rs2 = 0;
1156 static BitArrayRange R_rs2_0(4, 2);
1157 rs2 += R_rs2_0.read(ba) << 0;
1158 etiss_uint8 rd = 0;
1159 static BitArrayRange R_rd_0(9, 7);
1160 rd += R_rd_0.read(ba) << 0;
1161 
1162 // -----------------------------------------------------------------------------
1163 
1164  {
1166 
1167  cp.code() = std::string("//CXOR\n");
1168 
1169 // -----------------------------------------------------------------------------
1170 cp.code() += "etiss_coverage_count(1, 56);\n";
1171 { // block
1172 cp.code() += "etiss_coverage_count(1, 1169);\n";
1173 cp.code() += "{ // block\n";
1174 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1175 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1176 cp.code() += "} // block\n";
1177 } // block
1178 { // block
1179 cp.code() += "etiss_coverage_count(1, 2588);\n";
1180 cp.code() += "{ // block\n";
1181 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] ^ *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL];\n";
1182 cp.code() += "etiss_coverage_count(14, 2587, 2575, 2574, 2572, 2573, 2586, 2580, 2579, 2577, 2578, 2585, 2584, 2582, 2583);\n";
1183 cp.code() += "} // block\n";
1184 } // block
1185 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1186 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1187 // -----------------------------------------------------------------------------
1188  cp.getAffectedRegisters().add("instructionPointer", 32);
1189  }
1190 
1191  return true;
1192  },
1193  0,
1194  [] (BitArray & ba, Instruction & instr)
1195  {
1196 // -----------------------------------------------------------------------------
1197 etiss_uint8 rs2 = 0;
1198 static BitArrayRange R_rs2_0(4, 2);
1199 rs2 += R_rs2_0.read(ba) << 0;
1200 etiss_uint8 rd = 0;
1201 static BitArrayRange R_rd_0(9, 7);
1202 rd += R_rd_0.read(ba) << 0;
1203 
1204 // -----------------------------------------------------------------------------
1205 
1206  std::stringstream ss;
1207 // -----------------------------------------------------------------------------
1208 ss << "cxor" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
1209 // -----------------------------------------------------------------------------
1210  return ss.str();
1211  }
1212 );
1213 
1214 // COR -------------------------------------------------------------------------
1217  "cor",
1218  (uint16_t) 0x8c41,
1219  (uint16_t) 0xfc63,
1220  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1221  {
1222 
1223 // -----------------------------------------------------------------------------
1224 
1225 // -----------------------------------------------------------------------------
1226 
1227 // -----------------------------------------------------------------------------
1228 etiss_uint8 rs2 = 0;
1229 static BitArrayRange R_rs2_0(4, 2);
1230 rs2 += R_rs2_0.read(ba) << 0;
1231 etiss_uint8 rd = 0;
1232 static BitArrayRange R_rd_0(9, 7);
1233 rd += R_rd_0.read(ba) << 0;
1234 
1235 // -----------------------------------------------------------------------------
1236 
1237  {
1239 
1240  cp.code() = std::string("//COR\n");
1241 
1242 // -----------------------------------------------------------------------------
1243 cp.code() += "etiss_coverage_count(1, 57);\n";
1244 { // block
1245 cp.code() += "etiss_coverage_count(1, 1169);\n";
1246 cp.code() += "{ // block\n";
1247 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1248 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1249 cp.code() += "} // block\n";
1250 } // block
1251 { // block
1252 cp.code() += "etiss_coverage_count(1, 2606);\n";
1253 cp.code() += "{ // block\n";
1254 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] | *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL];\n";
1255 cp.code() += "etiss_coverage_count(14, 2605, 2593, 2592, 2590, 2591, 2604, 2598, 2597, 2595, 2596, 2603, 2602, 2600, 2601);\n";
1256 cp.code() += "} // block\n";
1257 } // block
1258 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1259 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1260 // -----------------------------------------------------------------------------
1261  cp.getAffectedRegisters().add("instructionPointer", 32);
1262  }
1263 
1264  return true;
1265  },
1266  0,
1267  [] (BitArray & ba, Instruction & instr)
1268  {
1269 // -----------------------------------------------------------------------------
1270 etiss_uint8 rs2 = 0;
1271 static BitArrayRange R_rs2_0(4, 2);
1272 rs2 += R_rs2_0.read(ba) << 0;
1273 etiss_uint8 rd = 0;
1274 static BitArrayRange R_rd_0(9, 7);
1275 rd += R_rd_0.read(ba) << 0;
1276 
1277 // -----------------------------------------------------------------------------
1278 
1279  std::stringstream ss;
1280 // -----------------------------------------------------------------------------
1281 ss << "cor" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
1282 // -----------------------------------------------------------------------------
1283  return ss.str();
1284  }
1285 );
1286 
1287 // CAND ------------------------------------------------------------------------
1290  "cand",
1291  (uint16_t) 0x8c61,
1292  (uint16_t) 0xfc63,
1293  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1294  {
1295 
1296 // -----------------------------------------------------------------------------
1297 
1298 // -----------------------------------------------------------------------------
1299 
1300 // -----------------------------------------------------------------------------
1301 etiss_uint8 rs2 = 0;
1302 static BitArrayRange R_rs2_0(4, 2);
1303 rs2 += R_rs2_0.read(ba) << 0;
1304 etiss_uint8 rd = 0;
1305 static BitArrayRange R_rd_0(9, 7);
1306 rd += R_rd_0.read(ba) << 0;
1307 
1308 // -----------------------------------------------------------------------------
1309 
1310  {
1312 
1313  cp.code() = std::string("//CAND\n");
1314 
1315 // -----------------------------------------------------------------------------
1316 cp.code() += "etiss_coverage_count(1, 58);\n";
1317 { // block
1318 cp.code() += "etiss_coverage_count(1, 1169);\n";
1319 cp.code() += "{ // block\n";
1320 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1321 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1322 cp.code() += "} // block\n";
1323 } // block
1324 { // block
1325 cp.code() += "etiss_coverage_count(1, 2624);\n";
1326 cp.code() += "{ // block\n";
1327 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] & *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL];\n";
1328 cp.code() += "etiss_coverage_count(14, 2623, 2611, 2610, 2608, 2609, 2622, 2616, 2615, 2613, 2614, 2621, 2620, 2618, 2619);\n";
1329 cp.code() += "} // block\n";
1330 } // block
1331 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1332 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1333 // -----------------------------------------------------------------------------
1334  cp.getAffectedRegisters().add("instructionPointer", 32);
1335  }
1336 
1337  return true;
1338  },
1339  0,
1340  [] (BitArray & ba, Instruction & instr)
1341  {
1342 // -----------------------------------------------------------------------------
1343 etiss_uint8 rs2 = 0;
1344 static BitArrayRange R_rs2_0(4, 2);
1345 rs2 += R_rs2_0.read(ba) << 0;
1346 etiss_uint8 rd = 0;
1347 static BitArrayRange R_rd_0(9, 7);
1348 rd += R_rd_0.read(ba) << 0;
1349 
1350 // -----------------------------------------------------------------------------
1351 
1352  std::stringstream ss;
1353 // -----------------------------------------------------------------------------
1354 ss << "cand" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
1355 // -----------------------------------------------------------------------------
1356  return ss.str();
1357  }
1358 );
1359 
1360 // CJ --------------------------------------------------------------------------
1363  "cj",
1364  (uint16_t) 0xa001,
1365  (uint16_t) 0xe003,
1366  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1367  {
1368 
1369 // -----------------------------------------------------------------------------
1370 
1371 // -----------------------------------------------------------------------------
1372 
1373 // -----------------------------------------------------------------------------
1374 etiss_uint16 imm = 0;
1375 static BitArrayRange R_imm_5(2, 2);
1376 imm += R_imm_5.read(ba) << 5;
1377 static BitArrayRange R_imm_1(5, 3);
1378 imm += R_imm_1.read(ba) << 1;
1379 static BitArrayRange R_imm_7(6, 6);
1380 imm += R_imm_7.read(ba) << 7;
1381 static BitArrayRange R_imm_6(7, 7);
1382 imm += R_imm_6.read(ba) << 6;
1383 static BitArrayRange R_imm_10(8, 8);
1384 imm += R_imm_10.read(ba) << 10;
1385 static BitArrayRange R_imm_8(10, 9);
1386 imm += R_imm_8.read(ba) << 8;
1387 static BitArrayRange R_imm_4(11, 11);
1388 imm += R_imm_4.read(ba) << 4;
1389 static BitArrayRange R_imm_11(12, 12);
1390 imm += R_imm_11.read(ba) << 11;
1391 
1392 // -----------------------------------------------------------------------------
1393 
1394  {
1396 
1397  cp.code() = std::string("//CJ\n");
1398 
1399 // -----------------------------------------------------------------------------
1400 cp.code() += "etiss_coverage_count(1, 59);\n";
1401 { // block
1402 cp.code() += "etiss_coverage_count(1, 1169);\n";
1403 cp.code() += "{ // block\n";
1404 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1405 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1406 cp.code() += "} // block\n";
1407 } // block
1408 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
1409 cp.code() += "etiss_coverage_count(6, 2631, 2625, 2630, 2626, 2629, 2627);\n";
1410 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1411 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1412 // -----------------------------------------------------------------------------
1413  cp.getAffectedRegisters().add("instructionPointer", 32);
1414  }
1415  {
1417 
1418  cp.code() = std::string("//CJ\n");
1419 
1420 // -----------------------------------------------------------------------------
1421 cp.code() += "return cpu->exception;\n";
1422 // -----------------------------------------------------------------------------
1423  }
1424 
1425  return true;
1426  },
1427  0,
1428  [] (BitArray & ba, Instruction & instr)
1429  {
1430 // -----------------------------------------------------------------------------
1431 etiss_uint16 imm = 0;
1432 static BitArrayRange R_imm_5(2, 2);
1433 imm += R_imm_5.read(ba) << 5;
1434 static BitArrayRange R_imm_1(5, 3);
1435 imm += R_imm_1.read(ba) << 1;
1436 static BitArrayRange R_imm_7(6, 6);
1437 imm += R_imm_7.read(ba) << 7;
1438 static BitArrayRange R_imm_6(7, 7);
1439 imm += R_imm_6.read(ba) << 6;
1440 static BitArrayRange R_imm_10(8, 8);
1441 imm += R_imm_10.read(ba) << 10;
1442 static BitArrayRange R_imm_8(10, 9);
1443 imm += R_imm_8.read(ba) << 8;
1444 static BitArrayRange R_imm_4(11, 11);
1445 imm += R_imm_4.read(ba) << 4;
1446 static BitArrayRange R_imm_11(12, 12);
1447 imm += R_imm_11.read(ba) << 11;
1448 
1449 // -----------------------------------------------------------------------------
1450 
1451  std::stringstream ss;
1452 // -----------------------------------------------------------------------------
1453 ss << "cj" << " # " << ba << (" [imm=" + std::to_string(imm) + "]");
1454 // -----------------------------------------------------------------------------
1455  return ss.str();
1456  }
1457 );
1458 
1459 // CBEQZ -----------------------------------------------------------------------
1462  "cbeqz",
1463  (uint16_t) 0xc001,
1464  (uint16_t) 0xe003,
1465  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1466  {
1467 
1468 // -----------------------------------------------------------------------------
1469 
1470 // -----------------------------------------------------------------------------
1471 
1472 // -----------------------------------------------------------------------------
1473 etiss_uint16 imm = 0;
1474 static BitArrayRange R_imm_5(2, 2);
1475 imm += R_imm_5.read(ba) << 5;
1476 static BitArrayRange R_imm_1(4, 3);
1477 imm += R_imm_1.read(ba) << 1;
1478 static BitArrayRange R_imm_6(6, 5);
1479 imm += R_imm_6.read(ba) << 6;
1480 etiss_uint8 rs1 = 0;
1481 static BitArrayRange R_rs1_0(9, 7);
1482 rs1 += R_rs1_0.read(ba) << 0;
1483 static BitArrayRange R_imm_3(11, 10);
1484 imm += R_imm_3.read(ba) << 3;
1485 static BitArrayRange R_imm_8(12, 12);
1486 imm += R_imm_8.read(ba) << 8;
1487 
1488 // -----------------------------------------------------------------------------
1489 
1490  {
1492 
1493  cp.code() = std::string("//CBEQZ\n");
1494 
1495 // -----------------------------------------------------------------------------
1496 cp.code() += "etiss_coverage_count(1, 60);\n";
1497 { // block
1498 cp.code() += "etiss_coverage_count(1, 1169);\n";
1499 cp.code() += "{ // block\n";
1500 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1501 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1502 cp.code() += "} // block\n";
1503 } // block
1504 cp.code() += "etiss_coverage_count(1, 2632);\n";
1505 cp.code() += "if (*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] == 0LL) { // conditional\n";
1506 cp.code() += "etiss_coverage_count(6, 2639, 2637, 2636, 2634, 2635, 2638);\n";
1507 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (7)) >> (7))) + "LL;\n";
1508 cp.code() += "etiss_coverage_count(6, 2646, 2640, 2645, 2641, 2644, 2642);\n";
1509 cp.code() += "} // conditional\n";
1510 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1511 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1512 // -----------------------------------------------------------------------------
1513  cp.getAffectedRegisters().add("instructionPointer", 32);
1514  }
1515  {
1517 
1518  cp.code() = std::string("//CBEQZ\n");
1519 
1520 // -----------------------------------------------------------------------------
1521 cp.code() += "if (cpu->nextPc != " + std::to_string(ic.current_address_ + 2) + "ULL) return cpu->exception;\n";
1522 // -----------------------------------------------------------------------------
1523  }
1524 
1525  return true;
1526  },
1527  0,
1528  [] (BitArray & ba, Instruction & instr)
1529  {
1530 // -----------------------------------------------------------------------------
1531 etiss_uint16 imm = 0;
1532 static BitArrayRange R_imm_5(2, 2);
1533 imm += R_imm_5.read(ba) << 5;
1534 static BitArrayRange R_imm_1(4, 3);
1535 imm += R_imm_1.read(ba) << 1;
1536 static BitArrayRange R_imm_6(6, 5);
1537 imm += R_imm_6.read(ba) << 6;
1538 etiss_uint8 rs1 = 0;
1539 static BitArrayRange R_rs1_0(9, 7);
1540 rs1 += R_rs1_0.read(ba) << 0;
1541 static BitArrayRange R_imm_3(11, 10);
1542 imm += R_imm_3.read(ba) << 3;
1543 static BitArrayRange R_imm_8(12, 12);
1544 imm += R_imm_8.read(ba) << 8;
1545 
1546 // -----------------------------------------------------------------------------
1547 
1548  std::stringstream ss;
1549 // -----------------------------------------------------------------------------
1550 ss << "cbeqz" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + "]");
1551 // -----------------------------------------------------------------------------
1552  return ss.str();
1553  }
1554 );
1555 
1556 // CBNEZ -----------------------------------------------------------------------
1559  "cbnez",
1560  (uint16_t) 0xe001,
1561  (uint16_t) 0xe003,
1562  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1563  {
1564 
1565 // -----------------------------------------------------------------------------
1566 
1567 // -----------------------------------------------------------------------------
1568 
1569 // -----------------------------------------------------------------------------
1570 etiss_uint16 imm = 0;
1571 static BitArrayRange R_imm_5(2, 2);
1572 imm += R_imm_5.read(ba) << 5;
1573 static BitArrayRange R_imm_1(4, 3);
1574 imm += R_imm_1.read(ba) << 1;
1575 static BitArrayRange R_imm_6(6, 5);
1576 imm += R_imm_6.read(ba) << 6;
1577 etiss_uint8 rs1 = 0;
1578 static BitArrayRange R_rs1_0(9, 7);
1579 rs1 += R_rs1_0.read(ba) << 0;
1580 static BitArrayRange R_imm_3(11, 10);
1581 imm += R_imm_3.read(ba) << 3;
1582 static BitArrayRange R_imm_8(12, 12);
1583 imm += R_imm_8.read(ba) << 8;
1584 
1585 // -----------------------------------------------------------------------------
1586 
1587  {
1589 
1590  cp.code() = std::string("//CBNEZ\n");
1591 
1592 // -----------------------------------------------------------------------------
1593 cp.code() += "etiss_coverage_count(1, 61);\n";
1594 { // block
1595 cp.code() += "etiss_coverage_count(1, 1169);\n";
1596 cp.code() += "{ // block\n";
1597 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1598 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1599 cp.code() += "} // block\n";
1600 } // block
1601 cp.code() += "etiss_coverage_count(1, 2647);\n";
1602 cp.code() += "if (*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] != 0LL) { // conditional\n";
1603 cp.code() += "etiss_coverage_count(6, 2654, 2652, 2651, 2649, 2650, 2653);\n";
1604 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (7)) >> (7))) + "LL;\n";
1605 cp.code() += "etiss_coverage_count(6, 2661, 2655, 2660, 2656, 2659, 2657);\n";
1606 cp.code() += "} // conditional\n";
1607 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1608 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1609 // -----------------------------------------------------------------------------
1610  cp.getAffectedRegisters().add("instructionPointer", 32);
1611  }
1612  {
1614 
1615  cp.code() = std::string("//CBNEZ\n");
1616 
1617 // -----------------------------------------------------------------------------
1618 cp.code() += "if (cpu->nextPc != " + std::to_string(ic.current_address_ + 2) + "ULL) return cpu->exception;\n";
1619 // -----------------------------------------------------------------------------
1620  }
1621 
1622  return true;
1623  },
1624  0,
1625  [] (BitArray & ba, Instruction & instr)
1626  {
1627 // -----------------------------------------------------------------------------
1628 etiss_uint16 imm = 0;
1629 static BitArrayRange R_imm_5(2, 2);
1630 imm += R_imm_5.read(ba) << 5;
1631 static BitArrayRange R_imm_1(4, 3);
1632 imm += R_imm_1.read(ba) << 1;
1633 static BitArrayRange R_imm_6(6, 5);
1634 imm += R_imm_6.read(ba) << 6;
1635 etiss_uint8 rs1 = 0;
1636 static BitArrayRange R_rs1_0(9, 7);
1637 rs1 += R_rs1_0.read(ba) << 0;
1638 static BitArrayRange R_imm_3(11, 10);
1639 imm += R_imm_3.read(ba) << 3;
1640 static BitArrayRange R_imm_8(12, 12);
1641 imm += R_imm_8.read(ba) << 8;
1642 
1643 // -----------------------------------------------------------------------------
1644 
1645  std::stringstream ss;
1646 // -----------------------------------------------------------------------------
1647 ss << "cbnez" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + "]");
1648 // -----------------------------------------------------------------------------
1649  return ss.str();
1650  }
1651 );
1652 
1653 // CSLLI -----------------------------------------------------------------------
1656  "cslli",
1657  (uint16_t) 0x02,
1658  (uint16_t) 0xf003,
1659  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1660  {
1661 
1662 // -----------------------------------------------------------------------------
1663 
1664 // -----------------------------------------------------------------------------
1665 
1666 // -----------------------------------------------------------------------------
1667 etiss_uint8 nzuimm = 0;
1668 static BitArrayRange R_nzuimm_0(6, 2);
1669 nzuimm += R_nzuimm_0.read(ba) << 0;
1670 etiss_uint8 rs1 = 0;
1671 static BitArrayRange R_rs1_0(11, 7);
1672 rs1 += R_rs1_0.read(ba) << 0;
1673 
1674 // -----------------------------------------------------------------------------
1675 
1676  {
1678 
1679  cp.code() = std::string("//CSLLI\n");
1680 
1681 // -----------------------------------------------------------------------------
1682 cp.code() += "etiss_coverage_count(1, 62);\n";
1683 { // block
1684 cp.code() += "etiss_coverage_count(1, 1169);\n";
1685 cp.code() += "{ // block\n";
1686 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1687 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1688 cp.code() += "} // block\n";
1689 } // block
1690 cp.code() += "etiss_coverage_count(1, 2662);\n";
1691 if (nzuimm) { // conditional
1692 cp.code() += "etiss_coverage_count(1, 2663);\n";
1693 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] << " + std::to_string(nzuimm) + "ULL;\n";
1694 cp.code() += "etiss_coverage_count(9, 2676, 2668, 2667, 2665, 2675, 2673, 2672, 2670, 2674);\n";
1695 } // conditional
1696 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1697 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1698 // -----------------------------------------------------------------------------
1699  cp.getAffectedRegisters().add("instructionPointer", 32);
1700  }
1701 
1702  return true;
1703  },
1704  0,
1705  [] (BitArray & ba, Instruction & instr)
1706  {
1707 // -----------------------------------------------------------------------------
1708 etiss_uint8 nzuimm = 0;
1709 static BitArrayRange R_nzuimm_0(6, 2);
1710 nzuimm += R_nzuimm_0.read(ba) << 0;
1711 etiss_uint8 rs1 = 0;
1712 static BitArrayRange R_rs1_0(11, 7);
1713 rs1 += R_rs1_0.read(ba) << 0;
1714 
1715 // -----------------------------------------------------------------------------
1716 
1717  std::stringstream ss;
1718 // -----------------------------------------------------------------------------
1719 ss << "cslli" << " # " << ba << (" [nzuimm=" + std::to_string(nzuimm) + " | rs1=" + std::to_string(rs1) + "]");
1720 // -----------------------------------------------------------------------------
1721  return ss.str();
1722  }
1723 );
1724 
1725 // CLWSP -----------------------------------------------------------------------
1728  "clwsp",
1729  (uint16_t) 0x4002,
1730  (uint16_t) 0xe003,
1731  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1732  {
1733 
1734 // -----------------------------------------------------------------------------
1735 
1736 // -----------------------------------------------------------------------------
1737 
1738 // -----------------------------------------------------------------------------
1739 etiss_uint8 uimm = 0;
1740 static BitArrayRange R_uimm_6(3, 2);
1741 uimm += R_uimm_6.read(ba) << 6;
1742 static BitArrayRange R_uimm_2(6, 4);
1743 uimm += R_uimm_2.read(ba) << 2;
1744 etiss_uint8 rd = 0;
1745 static BitArrayRange R_rd_0(11, 7);
1746 rd += R_rd_0.read(ba) << 0;
1747 static BitArrayRange R_uimm_5(12, 12);
1748 uimm += R_uimm_5.read(ba) << 5;
1749 
1750 // -----------------------------------------------------------------------------
1751 
1752  {
1754 
1755  cp.code() = std::string("//CLWSP\n");
1756 
1757 // -----------------------------------------------------------------------------
1758 cp.code() += "etiss_coverage_count(1, 63);\n";
1759 { // block
1760 cp.code() += "etiss_coverage_count(1, 1169);\n";
1761 cp.code() += "{ // block\n";
1762 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1763 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1764 cp.code() += "} // block\n";
1765 } // block
1766 { // block
1767 cp.code() += "etiss_coverage_count(1, 2703);\n";
1768 cp.code() += "{ // block\n";
1769 cp.code() += "etiss_coverage_count(1, 2677);\n";
1770 if (rd % 32ULL) { // conditional
1771 cp.code() += "etiss_coverage_count(2, 2680, 2678);\n";
1772 { // block
1773 cp.code() += "etiss_coverage_count(1, 2699);\n";
1774 cp.code() += "{ // block\n";
1775 cp.code() += "etiss_uint32 mem_val_0;\n";
1776 cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(uimm) + "ULL, (etiss_uint8*)&mem_val_0, 4);\n";
1777 cp.code() += "if (cpu->exception) { // conditional\n";
1778 { // procedure
1779 cp.code() += "{ // procedure\n";
1780 cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
1781 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1782 cp.code() += "} // procedure\n";
1783 } // procedure
1784 cp.code() += "} // conditional\n";
1785 cp.code() += "etiss_int32 res = mem_val_0;\n";
1786 cp.code() += "etiss_coverage_count(6, 2689, 2688, 2687, 2685, 2684, 2686);\n";
1787 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(res);\n";
1788 cp.code() += "etiss_coverage_count(6, 2698, 2694, 2693, 2691, 2697, 2695);\n";
1789 cp.code() += "} // block\n";
1790 } // block
1791 } // conditional
1792 else { // conditional
1793 { // procedure
1794 cp.code() += "{ // procedure\n";
1795 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
1796 cp.code() += "etiss_coverage_count(3, 2702, 2700, 2701);\n";
1797 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1798 cp.code() += "} // procedure\n";
1799 } // procedure
1800 } // conditional
1801 cp.code() += "} // block\n";
1802 } // block
1803 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1804 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1805 // -----------------------------------------------------------------------------
1806  cp.getAffectedRegisters().add("instructionPointer", 32);
1807  }
1808  {
1810 
1811  cp.code() = std::string("//CLWSP\n");
1812 
1813 // -----------------------------------------------------------------------------
1814 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
1815 // -----------------------------------------------------------------------------
1816  }
1817 
1818  return true;
1819  },
1820  0,
1821  [] (BitArray & ba, Instruction & instr)
1822  {
1823 // -----------------------------------------------------------------------------
1824 etiss_uint8 uimm = 0;
1825 static BitArrayRange R_uimm_6(3, 2);
1826 uimm += R_uimm_6.read(ba) << 6;
1827 static BitArrayRange R_uimm_2(6, 4);
1828 uimm += R_uimm_2.read(ba) << 2;
1829 etiss_uint8 rd = 0;
1830 static BitArrayRange R_rd_0(11, 7);
1831 rd += R_rd_0.read(ba) << 0;
1832 static BitArrayRange R_uimm_5(12, 12);
1833 uimm += R_uimm_5.read(ba) << 5;
1834 
1835 // -----------------------------------------------------------------------------
1836 
1837  std::stringstream ss;
1838 // -----------------------------------------------------------------------------
1839 ss << "clwsp" << " # " << ba << (" [uimm=" + std::to_string(uimm) + " | rd=" + std::to_string(rd) + "]");
1840 // -----------------------------------------------------------------------------
1841  return ss.str();
1842  }
1843 );
1844 
1845 // CMV -------------------------------------------------------------------------
1848  "cmv",
1849  (uint16_t) 0x8002,
1850  (uint16_t) 0xf003,
1851  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1852  {
1853 
1854 // -----------------------------------------------------------------------------
1855 
1856 // -----------------------------------------------------------------------------
1857 
1858 // -----------------------------------------------------------------------------
1859 etiss_uint8 rs2 = 0;
1860 static BitArrayRange R_rs2_0(6, 2);
1861 rs2 += R_rs2_0.read(ba) << 0;
1862 etiss_uint8 rd = 0;
1863 static BitArrayRange R_rd_0(11, 7);
1864 rd += R_rd_0.read(ba) << 0;
1865 
1866 // -----------------------------------------------------------------------------
1867 
1868  {
1870 
1871  cp.code() = std::string("//CMV\n");
1872 
1873 // -----------------------------------------------------------------------------
1874 cp.code() += "etiss_coverage_count(1, 64);\n";
1875 { // block
1876 cp.code() += "etiss_coverage_count(1, 1169);\n";
1877 cp.code() += "{ // block\n";
1878 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1879 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1880 cp.code() += "} // block\n";
1881 } // block
1882 cp.code() += "etiss_coverage_count(1, 2704);\n";
1883 if ((rd % 32ULL) != 0LL) { // conditional
1884 cp.code() += "etiss_coverage_count(5, 2710, 2707, 2705, 2708, 2709);\n";
1885 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n";
1886 cp.code() += "etiss_coverage_count(7, 2721, 2715, 2714, 2712, 2720, 2719, 2717);\n";
1887 } // conditional
1888 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1889 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1890 // -----------------------------------------------------------------------------
1891  cp.getAffectedRegisters().add("instructionPointer", 32);
1892  }
1893 
1894  return true;
1895  },
1896  0,
1897  [] (BitArray & ba, Instruction & instr)
1898  {
1899 // -----------------------------------------------------------------------------
1900 etiss_uint8 rs2 = 0;
1901 static BitArrayRange R_rs2_0(6, 2);
1902 rs2 += R_rs2_0.read(ba) << 0;
1903 etiss_uint8 rd = 0;
1904 static BitArrayRange R_rd_0(11, 7);
1905 rd += R_rd_0.read(ba) << 0;
1906 
1907 // -----------------------------------------------------------------------------
1908 
1909  std::stringstream ss;
1910 // -----------------------------------------------------------------------------
1911 ss << "cmv" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
1912 // -----------------------------------------------------------------------------
1913  return ss.str();
1914  }
1915 );
1916 
1917 // CJR -------------------------------------------------------------------------
1920  "cjr",
1921  (uint16_t) 0x8002,
1922  (uint16_t) 0xf07f,
1923  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1924  {
1925 
1926 // -----------------------------------------------------------------------------
1927 
1928 // -----------------------------------------------------------------------------
1929 
1930 // -----------------------------------------------------------------------------
1931 etiss_uint8 rs1 = 0;
1932 static BitArrayRange R_rs1_0(11, 7);
1933 rs1 += R_rs1_0.read(ba) << 0;
1934 
1935 // -----------------------------------------------------------------------------
1936 
1937  {
1939 
1940  cp.code() = std::string("//CJR\n");
1941 
1942 // -----------------------------------------------------------------------------
1943 cp.code() += "etiss_coverage_count(1, 65);\n";
1944 { // block
1945 cp.code() += "etiss_coverage_count(1, 1169);\n";
1946 cp.code() += "{ // block\n";
1947 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1948 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1949 cp.code() += "} // block\n";
1950 } // block
1951 cp.code() += "etiss_coverage_count(1, 2722);\n";
1952 if (rs1) { // conditional
1953 cp.code() += "etiss_coverage_count(1, 2723);\n";
1954 cp.code() += "cpu->nextPc = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] & -2LL;\n";
1955 cp.code() += "etiss_coverage_count(6, 2733, 2724, 2732, 2729, 2728, 2726);\n";
1956 } // conditional
1957 else { // conditional
1958 { // procedure
1959 cp.code() += "{ // procedure\n";
1960 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
1961 cp.code() += "etiss_coverage_count(3, 2736, 2734, 2735);\n";
1962 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1963 cp.code() += "} // procedure\n";
1964 } // procedure
1965 } // conditional
1966 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1967 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1968 // -----------------------------------------------------------------------------
1969  cp.getAffectedRegisters().add("instructionPointer", 32);
1970  }
1971  {
1973 
1974  cp.code() = std::string("//CJR\n");
1975 
1976 // -----------------------------------------------------------------------------
1977 cp.code() += "return cpu->exception;\n";
1978 // -----------------------------------------------------------------------------
1979  }
1980 
1981  return true;
1982  },
1983  0,
1984  [] (BitArray & ba, Instruction & instr)
1985  {
1986 // -----------------------------------------------------------------------------
1987 etiss_uint8 rs1 = 0;
1988 static BitArrayRange R_rs1_0(11, 7);
1989 rs1 += R_rs1_0.read(ba) << 0;
1990 
1991 // -----------------------------------------------------------------------------
1992 
1993  std::stringstream ss;
1994 // -----------------------------------------------------------------------------
1995 ss << "cjr" << " # " << ba << (" [rs1=" + std::to_string(rs1) + "]");
1996 // -----------------------------------------------------------------------------
1997  return ss.str();
1998  }
1999 );
2000 
2001 // __reserved_cmv --------------------------------------------------------------
2004  "__reserved_cmv",
2005  (uint16_t) 0x8002,
2006  (uint16_t) 0xffff,
2007  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2008  {
2009 
2010 // -----------------------------------------------------------------------------
2011 
2012 // -----------------------------------------------------------------------------
2013 
2014 // -----------------------------------------------------------------------------
2015 
2016 // -----------------------------------------------------------------------------
2017 
2018  {
2020 
2021  cp.code() = std::string("//__reserved_cmv\n");
2022 
2023 // -----------------------------------------------------------------------------
2024 cp.code() += "etiss_coverage_count(1, 66);\n";
2025 { // block
2026 cp.code() += "etiss_coverage_count(1, 1169);\n";
2027 cp.code() += "{ // block\n";
2028 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2029 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2030 cp.code() += "} // block\n";
2031 } // block
2032 { // procedure
2033 cp.code() += "{ // procedure\n";
2034 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
2035 cp.code() += "etiss_coverage_count(3, 2739, 2737, 2738);\n";
2036 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2037 cp.code() += "} // procedure\n";
2038 } // procedure
2039 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2040 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2041 // -----------------------------------------------------------------------------
2042  cp.getAffectedRegisters().add("instructionPointer", 32);
2043  }
2044  {
2046 
2047  cp.code() = std::string("//__reserved_cmv\n");
2048 
2049 // -----------------------------------------------------------------------------
2050 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
2051 // -----------------------------------------------------------------------------
2052  }
2053 
2054  return true;
2055  },
2056  0,
2057  [] (BitArray & ba, Instruction & instr)
2058  {
2059 // -----------------------------------------------------------------------------
2060 
2061 // -----------------------------------------------------------------------------
2062 
2063  std::stringstream ss;
2064 // -----------------------------------------------------------------------------
2065 ss << "__reserved_cmv" << " # " << ba << (" []");
2066 // -----------------------------------------------------------------------------
2067  return ss.str();
2068  }
2069 );
2070 
2071 // CADD ------------------------------------------------------------------------
2074  "cadd",
2075  (uint16_t) 0x9002,
2076  (uint16_t) 0xf003,
2077  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2078  {
2079 
2080 // -----------------------------------------------------------------------------
2081 
2082 // -----------------------------------------------------------------------------
2083 
2084 // -----------------------------------------------------------------------------
2085 etiss_uint8 rs2 = 0;
2086 static BitArrayRange R_rs2_0(6, 2);
2087 rs2 += R_rs2_0.read(ba) << 0;
2088 etiss_uint8 rd = 0;
2089 static BitArrayRange R_rd_0(11, 7);
2090 rd += R_rd_0.read(ba) << 0;
2091 
2092 // -----------------------------------------------------------------------------
2093 
2094  {
2096 
2097  cp.code() = std::string("//CADD\n");
2098 
2099 // -----------------------------------------------------------------------------
2100 cp.code() += "etiss_coverage_count(1, 67);\n";
2101 { // block
2102 cp.code() += "etiss_coverage_count(1, 1169);\n";
2103 cp.code() += "{ // block\n";
2104 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2105 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2106 cp.code() += "} // block\n";
2107 } // block
2108 cp.code() += "etiss_coverage_count(1, 2740);\n";
2109 if ((rd % 32ULL) != 0LL) { // conditional
2110 cp.code() += "etiss_coverage_count(5, 2746, 2743, 2741, 2744, 2745);\n";
2111 cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] + *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n";
2112 cp.code() += "etiss_coverage_count(11, 2763, 2751, 2750, 2748, 2762, 2756, 2755, 2753, 2761, 2760, 2758);\n";
2113 } // conditional
2114 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2115 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2116 // -----------------------------------------------------------------------------
2117  cp.getAffectedRegisters().add("instructionPointer", 32);
2118  }
2119 
2120  return true;
2121  },
2122  0,
2123  [] (BitArray & ba, Instruction & instr)
2124  {
2125 // -----------------------------------------------------------------------------
2126 etiss_uint8 rs2 = 0;
2127 static BitArrayRange R_rs2_0(6, 2);
2128 rs2 += R_rs2_0.read(ba) << 0;
2129 etiss_uint8 rd = 0;
2130 static BitArrayRange R_rd_0(11, 7);
2131 rd += R_rd_0.read(ba) << 0;
2132 
2133 // -----------------------------------------------------------------------------
2134 
2135  std::stringstream ss;
2136 // -----------------------------------------------------------------------------
2137 ss << "cadd" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | rd=" + std::to_string(rd) + "]");
2138 // -----------------------------------------------------------------------------
2139  return ss.str();
2140  }
2141 );
2142 
2143 // CJALR -----------------------------------------------------------------------
2146  "cjalr",
2147  (uint16_t) 0x9002,
2148  (uint16_t) 0xf07f,
2149  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2150  {
2151 
2152 // -----------------------------------------------------------------------------
2153 
2154 // -----------------------------------------------------------------------------
2155 
2156 // -----------------------------------------------------------------------------
2157 etiss_uint8 rs1 = 0;
2158 static BitArrayRange R_rs1_0(11, 7);
2159 rs1 += R_rs1_0.read(ba) << 0;
2160 
2161 // -----------------------------------------------------------------------------
2162 
2163  {
2165 
2166  cp.code() = std::string("//CJALR\n");
2167 
2168 // -----------------------------------------------------------------------------
2169 cp.code() += "etiss_coverage_count(1, 68);\n";
2170 { // block
2171 cp.code() += "etiss_coverage_count(1, 1169);\n";
2172 cp.code() += "{ // block\n";
2173 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2174 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2175 cp.code() += "} // block\n";
2176 } // block
2177 { // block
2178 cp.code() += "etiss_coverage_count(1, 2784);\n";
2179 cp.code() += "{ // block\n";
2180 cp.code() += "etiss_uint64 new_pc = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n";
2181 cp.code() += "etiss_coverage_count(4, 2770, 2769, 2768, 2766);\n";
2182 cp.code() += "*((RV64IMACFD*)cpu)->X[1ULL] = " + std::to_string(ic.current_address_ + 2ULL) + "ULL;\n";
2183 cp.code() += "etiss_coverage_count(6, 2777, 2773, 2772, 2776, 2774, 2775);\n";
2184 cp.code() += "cpu->nextPc = new_pc & -2LL;\n";
2185 cp.code() += "etiss_coverage_count(4, 2783, 2778, 2782, 2779);\n";
2186 cp.code() += "} // block\n";
2187 } // block
2188 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2189 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2190 // -----------------------------------------------------------------------------
2191  cp.getAffectedRegisters().add("instructionPointer", 32);
2192  }
2193  {
2195 
2196  cp.code() = std::string("//CJALR\n");
2197 
2198 // -----------------------------------------------------------------------------
2199 cp.code() += "return cpu->exception;\n";
2200 // -----------------------------------------------------------------------------
2201  }
2202 
2203  return true;
2204  },
2205  0,
2206  [] (BitArray & ba, Instruction & instr)
2207  {
2208 // -----------------------------------------------------------------------------
2209 etiss_uint8 rs1 = 0;
2210 static BitArrayRange R_rs1_0(11, 7);
2211 rs1 += R_rs1_0.read(ba) << 0;
2212 
2213 // -----------------------------------------------------------------------------
2214 
2215  std::stringstream ss;
2216 // -----------------------------------------------------------------------------
2217 ss << "cjalr" << " # " << ba << (" [rs1=" + std::to_string(rs1) + "]");
2218 // -----------------------------------------------------------------------------
2219  return ss.str();
2220  }
2221 );
2222 
2223 // CEBREAK ---------------------------------------------------------------------
2226  "cebreak",
2227  (uint16_t) 0x9002,
2228  (uint16_t) 0xffff,
2229  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2230  {
2231 
2232 // -----------------------------------------------------------------------------
2233 
2234 // -----------------------------------------------------------------------------
2235 
2236 // -----------------------------------------------------------------------------
2237 
2238 // -----------------------------------------------------------------------------
2239 
2240  {
2242 
2243  cp.code() = std::string("//CEBREAK\n");
2244 
2245 // -----------------------------------------------------------------------------
2246 cp.code() += "etiss_coverage_count(1, 69);\n";
2247 { // block
2248 cp.code() += "etiss_coverage_count(1, 1169);\n";
2249 cp.code() += "{ // block\n";
2250 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2251 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2252 cp.code() += "} // block\n";
2253 } // block
2254 { // procedure
2255 cp.code() += "{ // procedure\n";
2256 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 3LL);\n";
2257 cp.code() += "etiss_coverage_count(2, 2787, 2785);\n";
2258 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2259 cp.code() += "} // procedure\n";
2260 } // procedure
2261 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2262 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2263 // -----------------------------------------------------------------------------
2264  cp.getAffectedRegisters().add("instructionPointer", 32);
2265  }
2266  {
2268 
2269  cp.code() = std::string("//CEBREAK\n");
2270 
2271 // -----------------------------------------------------------------------------
2272 cp.code() += "return cpu->exception;\n";
2273 // -----------------------------------------------------------------------------
2274  }
2275 
2276  return true;
2277  },
2278  0,
2279  [] (BitArray & ba, Instruction & instr)
2280  {
2281 // -----------------------------------------------------------------------------
2282 
2283 // -----------------------------------------------------------------------------
2284 
2285  std::stringstream ss;
2286 // -----------------------------------------------------------------------------
2287 ss << "cebreak" << " # " << ba << (" []");
2288 // -----------------------------------------------------------------------------
2289  return ss.str();
2290  }
2291 );
2292 
2293 // CSWSP -----------------------------------------------------------------------
2296  "cswsp",
2297  (uint16_t) 0xc002,
2298  (uint16_t) 0xe003,
2299  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2300  {
2301 
2302 // -----------------------------------------------------------------------------
2303 
2304 // -----------------------------------------------------------------------------
2305 
2306 // -----------------------------------------------------------------------------
2307 etiss_uint8 rs2 = 0;
2308 static BitArrayRange R_rs2_0(6, 2);
2309 rs2 += R_rs2_0.read(ba) << 0;
2310 etiss_uint8 uimm = 0;
2311 static BitArrayRange R_uimm_6(8, 7);
2312 uimm += R_uimm_6.read(ba) << 6;
2313 static BitArrayRange R_uimm_2(12, 9);
2314 uimm += R_uimm_2.read(ba) << 2;
2315 
2316 // -----------------------------------------------------------------------------
2317 
2318  {
2320 
2321  cp.code() = std::string("//CSWSP\n");
2322 
2323 // -----------------------------------------------------------------------------
2324 cp.code() += "etiss_coverage_count(1, 70);\n";
2325 { // block
2326 cp.code() += "etiss_coverage_count(1, 1169);\n";
2327 cp.code() += "{ // block\n";
2328 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2329 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2330 cp.code() += "} // block\n";
2331 } // block
2332 { // block
2333 cp.code() += "etiss_coverage_count(1, 2806);\n";
2334 cp.code() += "{ // block\n";
2335 cp.code() += "etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(uimm) + "ULL;\n";
2336 cp.code() += "etiss_coverage_count(5, 2794, 2793, 2791, 2790, 2792);\n";
2337 cp.code() += "etiss_uint32 mem_val_0;\n";
2338 cp.code() += "mem_val_0 = (etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n";
2339 cp.code() += "etiss_coverage_count(7, 2805, 2797, 2796, 2804, 2802, 2801, 2799);\n";
2340 cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n";
2341 cp.code() += "if (cpu->exception) { // conditional\n";
2342 { // procedure
2343 cp.code() += "{ // procedure\n";
2344 cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
2345 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2346 cp.code() += "} // procedure\n";
2347 } // procedure
2348 cp.code() += "} // conditional\n";
2349 cp.code() += "} // block\n";
2350 } // block
2351 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2352 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2353 // -----------------------------------------------------------------------------
2354  cp.getAffectedRegisters().add("instructionPointer", 32);
2355  }
2356  {
2358 
2359  cp.code() = std::string("//CSWSP\n");
2360 
2361 // -----------------------------------------------------------------------------
2362 cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
2363 // -----------------------------------------------------------------------------
2364  }
2365 
2366  return true;
2367  },
2368  0,
2369  [] (BitArray & ba, Instruction & instr)
2370  {
2371 // -----------------------------------------------------------------------------
2372 etiss_uint8 rs2 = 0;
2373 static BitArrayRange R_rs2_0(6, 2);
2374 rs2 += R_rs2_0.read(ba) << 0;
2375 etiss_uint8 uimm = 0;
2376 static BitArrayRange R_uimm_6(8, 7);
2377 uimm += R_uimm_6.read(ba) << 6;
2378 static BitArrayRange R_uimm_2(12, 9);
2379 uimm += R_uimm_2.read(ba) << 2;
2380 
2381 // -----------------------------------------------------------------------------
2382 
2383  std::stringstream ss;
2384 // -----------------------------------------------------------------------------
2385 ss << "cswsp" << " # " << ba << (" [rs2=" + std::to_string(rs2) + " | uimm=" + std::to_string(uimm) + "]");
2386 // -----------------------------------------------------------------------------
2387  return ss.str();
2388  }
2389 );
2390 
2391 // DII -------------------------------------------------------------------------
2394  "dii",
2395  (uint16_t) 0x00,
2396  (uint16_t) 0xffff,
2397  [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
2398  {
2399 
2400 // -----------------------------------------------------------------------------
2401 
2402 // -----------------------------------------------------------------------------
2403 
2404 // -----------------------------------------------------------------------------
2405 
2406 // -----------------------------------------------------------------------------
2407 
2408  {
2410 
2411  cp.code() = std::string("//DII\n");
2412 
2413 // -----------------------------------------------------------------------------
2414 cp.code() += "etiss_coverage_count(1, 71);\n";
2415 { // block
2416 cp.code() += "etiss_coverage_count(1, 1169);\n";
2417 cp.code() += "{ // block\n";
2418 cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2419 cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2420 cp.code() += "} // block\n";
2421 } // block
2422 { // procedure
2423 cp.code() += "{ // procedure\n";
2424 cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
2425 cp.code() += "etiss_coverage_count(2, 2809, 2807);\n";
2426 cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2427 cp.code() += "} // procedure\n";
2428 } // procedure
2429 cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2430 cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
2431 // -----------------------------------------------------------------------------
2432  cp.getAffectedRegisters().add("instructionPointer", 32);
2433  }
2434  {
2436 
2437  cp.code() = std::string("//DII\n");
2438 
2439 // -----------------------------------------------------------------------------
2440 cp.code() += "return cpu->exception;\n";
2441 // -----------------------------------------------------------------------------
2442  }
2443 
2444  return true;
2445  },
2446  0,
2447  [] (BitArray & ba, Instruction & instr)
2448  {
2449 // -----------------------------------------------------------------------------
2450 
2451 // -----------------------------------------------------------------------------
2452 
2453  std::stringstream ss;
2454 // -----------------------------------------------------------------------------
2455 ss << "dii" << " # " << ba << (" []");
2456 // -----------------------------------------------------------------------------
2457  return ss.str();
2458  }
2459 );
etiss::instr::InstructionGroup ISA16_RV64IMACFD("ISA16_RV64IMACFD", 16)
static InstructionDefinition cnop_nzimm(ISA16_RV64IMACFD, "cnop",(uint16_t) 0x01,(uint16_t) 0xef83, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 nzimm=0;static BitArrayRange R_nzimm_0(6, 2);nzimm+=R_nzimm_0.read(ba)<< 0;static BitArrayRange R_nzimm_5(12, 12);nzimm+=R_nzimm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CNOP\n");cp.code()+="etiss_coverage_count(1, 46);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2407);\n";cp.code()+="{ // block\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 nzimm=0;static BitArrayRange R_nzimm_0(6, 2);nzimm+=R_nzimm_0.read(ba)<< 0;static BitArrayRange R_nzimm_5(12, 12);nzimm+=R_nzimm_5.read(ba)<< 5;std::stringstream ss;ss<< "cnop"<< " # "<< ba<<(" [nzimm="+std::to_string(nzimm)+"]");return ss.str();})
static InstructionDefinition cjr_rs1(ISA16_RV64IMACFD, "cjr",(uint16_t) 0x8002,(uint16_t) 0xf07f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CJR\n");cp.code()+="etiss_coverage_count(1, 65);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2722);\n";if(rs1) { cp.code()+="etiss_coverage_count(1, 2723);\n";cp.code()+="cpu->nextPc = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] & -2LL;\n";cp.code()+="etiss_coverage_count(6, 2733, 2724, 2732, 2729, 2728, 2726);\n";} else { { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";cp.code()+="etiss_coverage_count(3, 2736, 2734, 2735);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} } cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CJR\n");cp.code()+="return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "cjr"<< " # "<< ba<<(" [rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition clwsp_uimm_rd(ISA16_RV64IMACFD, "clwsp",(uint16_t) 0x4002,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(3, 2);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 4);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_uimm_5(12, 12);uimm+=R_uimm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CLWSP\n");cp.code()+="etiss_coverage_count(1, 63);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2703);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 2677);\n";if(rd % 32ULL) { cp.code()+="etiss_coverage_count(2, 2680, 2678);\n";{ cp.code()+="etiss_coverage_count(1, 2699);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 mem_val_0;\n";cp.code()+="cpu->exception |= (*(system->dread))(system->handle, cpu, *((RV64IMACFD*)cpu)->X[2ULL] + "+std::to_string(uimm)+"ULL, (etiss_uint8*)&mem_val_0, 4);\n";cp.code()+="if (cpu->exception) { // conditional\n";{ cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="} // conditional\n";cp.code()+="etiss_int32 res = mem_val_0;\n";cp.code()+="etiss_coverage_count(6, 2689, 2688, 2687, 2685, 2684, 2686);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_int64)(res);\n";cp.code()+="etiss_coverage_count(6, 2698, 2694, 2693, 2691, 2697, 2695);\n";cp.code()+="} // block\n";} } else { { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";cp.code()+="etiss_coverage_count(3, 2702, 2700, 2701);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} } cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CLWSP\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(3, 2);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 4);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_uimm_5(12, 12);uimm+=R_uimm_5.read(ba)<< 5;std::stringstream ss;ss<< "clwsp"<< " # "<< ba<<(" [uimm="+std::to_string(uimm)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition cli_imm_rd(ISA16_RV64IMACFD, "cli",(uint16_t) 0x4001,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CLI\n");cp.code()+="etiss_coverage_count(1, 48);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2439);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 2423);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 2429, 2426, 2424, 2427, 2428);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = "+std::to_string(((etiss_int8)(((etiss_int8) imm)<<(2)) >>(2)))+"LL;\n";cp.code()+="etiss_coverage_count(6, 2438, 2434, 2433, 2431, 2437, 2435);\n";} cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;std::stringstream ss;ss<< "cli"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition clui_imm_rd(ISA16_RV64IMACFD, "clui",(uint16_t) 0x6001,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint32 imm=0;static BitArrayRange R_imm_12(6, 2);imm+=R_imm_12.read(ba)<< 12;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_imm_17(12, 12);imm+=R_imm_17.read(ba)<< 17;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CLUI\n");cp.code()+="etiss_coverage_count(1, 49);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2463);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 2440);\n";if(imm==0LL) { cp.code()+="etiss_coverage_count(3, 2443, 2441, 2442);\n";{ cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";cp.code()+="etiss_coverage_count(2, 2446, 2444);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} } cp.code()+="etiss_coverage_count(1, 2447);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 2453, 2450, 2448, 2451, 2452);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = "+std::to_string(((etiss_int32)(((etiss_int32) imm)<<(14)) >>(14)))+"LL;\n";cp.code()+="etiss_coverage_count(6, 2462, 2458, 2457, 2455, 2461, 2459);\n";} cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CLUI\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint32 imm=0;static BitArrayRange R_imm_12(6, 2);imm+=R_imm_12.read(ba)<< 12;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;static BitArrayRange R_imm_17(12, 12);imm+=R_imm_17.read(ba)<< 17;std::stringstream ss;ss<< "clui"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition caddi16sp_nzimm(ISA16_RV64IMACFD, "caddi16sp",(uint16_t) 0x6101,(uint16_t) 0xef83, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint16 nzimm=0;static BitArrayRange R_nzimm_5(2, 2);nzimm+=R_nzimm_5.read(ba)<< 5;static BitArrayRange R_nzimm_7(4, 3);nzimm+=R_nzimm_7.read(ba)<< 7;static BitArrayRange R_nzimm_6(5, 5);nzimm+=R_nzimm_6.read(ba)<< 6;static BitArrayRange R_nzimm_4(6, 6);nzimm+=R_nzimm_4.read(ba)<< 4;static BitArrayRange R_nzimm_9(12, 12);nzimm+=R_nzimm_9.read(ba)<< 9;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CADDI16SP\n");cp.code()+="etiss_coverage_count(1, 50);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2464);\n";if(nzimm) { cp.code()+="etiss_coverage_count(1, 2465);\n";cp.code()+="*((RV64IMACFD*)cpu)->X[2ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + "+std::to_string(((etiss_int16)(((etiss_int16) nzimm)<<(6)) >>(6)))+"LL;\n";cp.code()+="etiss_coverage_count(8, 2476, 2468, 2467, 2475, 2471, 2470, 2474, 2472);\n";} else { { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";cp.code()+="etiss_coverage_count(2, 2479, 2477);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} } cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CADDI16SP\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint16 nzimm=0;static BitArrayRange R_nzimm_5(2, 2);nzimm+=R_nzimm_5.read(ba)<< 5;static BitArrayRange R_nzimm_7(4, 3);nzimm+=R_nzimm_7.read(ba)<< 7;static BitArrayRange R_nzimm_6(5, 5);nzimm+=R_nzimm_6.read(ba)<< 6;static BitArrayRange R_nzimm_4(6, 6);nzimm+=R_nzimm_4.read(ba)<< 4;static BitArrayRange R_nzimm_9(12, 12);nzimm+=R_nzimm_9.read(ba)<< 9;std::stringstream ss;ss<< "caddi16sp"<< " # "<< ba<<(" [nzimm="+std::to_string(nzimm)+"]");return ss.str();})
static InstructionDefinition cjalr_rs1(ISA16_RV64IMACFD, "cjalr",(uint16_t) 0x9002,(uint16_t) 0xf07f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CJALR\n");cp.code()+="etiss_coverage_count(1, 68);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2784);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 new_pc = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(4, 2770, 2769, 2768, 2766);\n";cp.code()+="*((RV64IMACFD*)cpu)->X[1ULL] = "+std::to_string(ic.current_address_+2ULL)+"ULL;\n";cp.code()+="etiss_coverage_count(6, 2777, 2773, 2772, 2776, 2774, 2775);\n";cp.code()+="cpu->nextPc = new_pc & -2LL;\n";cp.code()+="etiss_coverage_count(4, 2783, 2778, 2782, 2779);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CJALR\n");cp.code()+="return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "cjalr"<< " # "<< ba<<(" [rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition csrai_shamt_rs1(ISA16_RV64IMACFD, "csrai",(uint16_t) 0x8401,(uint16_t) 0xfc03, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(6, 2);shamt+=R_shamt_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSRAI\n");cp.code()+="etiss_coverage_count(1, 53);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2536);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 2497);\n";if(shamt) { cp.code()+="etiss_coverage_count(1, 2498);\n";{ cp.code()+="etiss_coverage_count(1, 2518);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] = ((etiss_int64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL])) >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(13, 2517, 2506, 2505, 2503, 2504, 2516, 2513, 2511, 2510, 2508, 2509, 2514, 2515);\n";cp.code()+="} // block\n";} } cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(6, 2);shamt+=R_shamt_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "csrai"<< " # "<< ba<<(" [shamt="+std::to_string(shamt)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition caddi_imm_rs1(ISA16_RV64IMACFD, "caddi",(uint16_t) 0x01,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CADDI\n");cp.code()+="etiss_coverage_count(1, 45);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2385);\n";if((rs1 % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 2391, 2388, 2386, 2389, 2390);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] + "+std::to_string(((etiss_int8)(((etiss_int8) imm)<<(2)) >>(2)))+"LL;\n";cp.code()+="etiss_coverage_count(10, 2406, 2396, 2395, 2393, 2405, 2401, 2400, 2398, 2404, 2402);\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;std::stringstream ss;ss<< "caddi"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition cand_rs2_rd(ISA16_RV64IMACFD, "cand",(uint16_t) 0x8c61,(uint16_t) 0xfc63, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CAND\n");cp.code()+="etiss_coverage_count(1, 58);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2624);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] & *((RV64IMACFD*)cpu)->X["+std::to_string(rs2+8ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(14, 2623, 2611, 2610, 2608, 2609, 2622, 2616, 2615, 2613, 2614, 2621, 2620, 2618, 2619);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "cand"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition caddi4spn_rd_imm(ISA16_RV64IMACFD, "caddi4spn",(uint16_t) 0x00,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(4, 2);rd+=R_rd_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_3(5, 5);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_2(6, 6);imm+=R_imm_2.read(ba)<< 2;static BitArrayRange R_imm_6(10, 7);imm+=R_imm_6.read(ba)<< 6;static BitArrayRange R_imm_4(12, 11);imm+=R_imm_4.read(ba)<< 4;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CADDI4SPN\n");cp.code()+="etiss_coverage_count(1, 42);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2327);\n";if(imm) { cp.code()+="etiss_coverage_count(1, 2328);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + "+std::to_string(imm)+"ULL;\n";cp.code()+="etiss_coverage_count(9, 2339, 2333, 2332, 2330, 2331, 2338, 2336, 2335, 2337);\n";} else { { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";cp.code()+="etiss_coverage_count(2, 2342, 2340);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} } cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CADDI4SPN\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(4, 2);rd+=R_rd_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_3(5, 5);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_2(6, 6);imm+=R_imm_2.read(ba)<< 2;static BitArrayRange R_imm_6(10, 7);imm+=R_imm_6.read(ba)<< 6;static BitArrayRange R_imm_4(12, 11);imm+=R_imm_4.read(ba)<< 4;std::stringstream ss;ss<< "caddi4spn"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | imm="+std::to_string(imm)+"]");return ss.str();})
static InstructionDefinition cebreak_(ISA16_RV64IMACFD, "cebreak",(uint16_t) 0x9002,(uint16_t) 0xffff, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { { CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CEBREAK\n");cp.code()+="etiss_coverage_count(1, 69);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 3LL);\n";cp.code()+="etiss_coverage_count(2, 2787, 2785);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CEBREAK\n");cp.code()+="return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { std::stringstream ss;ss<< "cebreak"<< " # "<< ba<<(" []");return ss.str();})
static InstructionDefinition cj_imm(ISA16_RV64IMACFD, "cj",(uint16_t) 0xa001,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(5, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_7(6, 6);imm+=R_imm_7.read(ba)<< 7;static BitArrayRange R_imm_6(7, 7);imm+=R_imm_6.read(ba)<< 6;static BitArrayRange R_imm_10(8, 8);imm+=R_imm_10.read(ba)<< 10;static BitArrayRange R_imm_8(10, 9);imm+=R_imm_8.read(ba)<< 8;static BitArrayRange R_imm_4(11, 11);imm+=R_imm_4.read(ba)<< 4;static BitArrayRange R_imm_11(12, 12);imm+=R_imm_11.read(ba)<< 11;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CJ\n");cp.code()+="etiss_coverage_count(1, 59);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+((etiss_int16)(((etiss_int16) imm)<<(4)) >>(4)))+"LL;\n";cp.code()+="etiss_coverage_count(6, 2631, 2625, 2630, 2626, 2629, 2627);\n";cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CJ\n");cp.code()+="return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(5, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_7(6, 6);imm+=R_imm_7.read(ba)<< 7;static BitArrayRange R_imm_6(7, 7);imm+=R_imm_6.read(ba)<< 6;static BitArrayRange R_imm_10(8, 8);imm+=R_imm_10.read(ba)<< 10;static BitArrayRange R_imm_8(10, 9);imm+=R_imm_8.read(ba)<< 8;static BitArrayRange R_imm_4(11, 11);imm+=R_imm_4.read(ba)<< 4;static BitArrayRange R_imm_11(12, 12);imm+=R_imm_11.read(ba)<< 11;std::stringstream ss;ss<< "cj"<< " # "<< ba<<(" [imm="+std::to_string(imm)+"]");return ss.str();})
static InstructionDefinition csw_rs2_uimm_rs1(ISA16_RV64IMACFD, "csw",(uint16_t) 0xc000,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(5, 5);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 6);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_uimm_3(12, 10);uimm+=R_uimm_3.read(ba)<< 3;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSW\n");cp.code()+="etiss_coverage_count(1, 44);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2384);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] + "+std::to_string(uimm)+"ULL;\n";cp.code()+="etiss_coverage_count(7, 2372, 2371, 2369, 2368, 2366, 2367, 2370);\n";cp.code()+="etiss_uint32 mem_val_0;\n";cp.code()+="mem_val_0 = (etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2+8ULL)+"ULL]);\n";cp.code()+="etiss_coverage_count(8, 2383, 2375, 2374, 2382, 2380, 2379, 2377, 2378);\n";cp.code()+="cpu->exception |= (*(system->dwrite))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";cp.code()+="if (cpu->exception) { // conditional\n";{ cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="} // conditional\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CSW\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(5, 5);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 6);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_uimm_3(12, 10);uimm+=R_uimm_3.read(ba)<< 3;std::stringstream ss;ss<< "csw"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | uimm="+std::to_string(uimm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition cxor_rs2_rd(ISA16_RV64IMACFD, "cxor",(uint16_t) 0x8c21,(uint16_t) 0xfc63, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CXOR\n");cp.code()+="etiss_coverage_count(1, 56);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2588);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] ^ *((RV64IMACFD*)cpu)->X["+std::to_string(rs2+8ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(14, 2587, 2575, 2574, 2572, 2573, 2586, 2580, 2579, 2577, 2578, 2585, 2584, 2582, 2583);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "cxor"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition cor_rs2_rd(ISA16_RV64IMACFD, "cor",(uint16_t) 0x8c41,(uint16_t) 0xfc63, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//COR\n");cp.code()+="etiss_coverage_count(1, 57);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2606);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] | *((RV64IMACFD*)cpu)->X["+std::to_string(rs2+8ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(14, 2605, 2593, 2592, 2590, 2591, 2604, 2598, 2597, 2595, 2596, 2603, 2602, 2600, 2601);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "cor"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition cbnez_imm_rs1(ISA16_RV64IMACFD, "cbnez",(uint16_t) 0xe001,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(4, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_6(6, 5);imm+=R_imm_6.read(ba)<< 6;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_3(11, 10);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_8(12, 12);imm+=R_imm_8.read(ba)<< 8;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CBNEZ\n");cp.code()+="etiss_coverage_count(1, 61);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2647);\n";cp.code()+="if (*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] != 0LL) { // conditional\n";cp.code()+="etiss_coverage_count(6, 2654, 2652, 2651, 2649, 2650, 2653);\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+((etiss_int16)(((etiss_int16) imm)<<(7)) >>(7)))+"LL;\n";cp.code()+="etiss_coverage_count(6, 2661, 2655, 2660, 2656, 2659, 2657);\n";cp.code()+="} // conditional\n";cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CBNEZ\n");cp.code()+="if (cpu->nextPc != "+std::to_string(ic.current_address_+2)+"ULL) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(4, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_6(6, 5);imm+=R_imm_6.read(ba)<< 6;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_3(11, 10);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_8(12, 12);imm+=R_imm_8.read(ba)<< 8;std::stringstream ss;ss<< "cbnez"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition cslli_nzuimm_rs1(ISA16_RV64IMACFD, "cslli",(uint16_t) 0x02,(uint16_t) 0xf003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 nzuimm=0;static BitArrayRange R_nzuimm_0(6, 2);nzuimm+=R_nzuimm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSLLI\n");cp.code()+="etiss_coverage_count(1, 62);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2662);\n";if(nzuimm) { cp.code()+="etiss_coverage_count(1, 2663);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] << "+std::to_string(nzuimm)+"ULL;\n";cp.code()+="etiss_coverage_count(9, 2676, 2668, 2667, 2665, 2675, 2673, 2672, 2670, 2674);\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 nzuimm=0;static BitArrayRange R_nzuimm_0(6, 2);nzuimm+=R_nzuimm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(11, 7);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "cslli"<< " # "<< ba<<(" [nzuimm="+std::to_string(nzuimm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition dii_(ISA16_RV64IMACFD, "dii",(uint16_t) 0x00,(uint16_t) 0xffff, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { { CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//DII\n");cp.code()+="etiss_coverage_count(1, 71);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";cp.code()+="etiss_coverage_count(2, 2809, 2807);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//DII\n");cp.code()+="return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { std::stringstream ss;ss<< "dii"<< " # "<< ba<<(" []");return ss.str();})
static InstructionDefinition cmv_rs2_rd(ISA16_RV64IMACFD, "cmv",(uint16_t) 0x8002,(uint16_t) 0xf003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CMV\n");cp.code()+="etiss_coverage_count(1, 64);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2704);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 2710, 2707, 2705, 2708, 2709);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(7, 2721, 2715, 2714, 2712, 2720, 2719, 2717);\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "cmv"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition csrli_shamt_rs1(ISA16_RV64IMACFD, "csrli",(uint16_t) 0x8001,(uint16_t) 0xfc03, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(6, 2);shamt+=R_shamt_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSRLI\n");cp.code()+="etiss_coverage_count(1, 52);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2496);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(11, 2495, 2487, 2486, 2484, 2485, 2494, 2492, 2491, 2489, 2490, 2493);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(6, 2);shamt+=R_shamt_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;std::stringstream ss;ss<< "csrli"<< " # "<< ba<<(" [shamt="+std::to_string(shamt)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition __reserved_cmv_(ISA16_RV64IMACFD, "__reserved_cmv",(uint16_t) 0x8002,(uint16_t) 0xffff, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { { CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//__reserved_cmv\n");cp.code()+="etiss_coverage_count(1, 66);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";cp.code()+="etiss_coverage_count(3, 2739, 2737, 2738);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//__reserved_cmv\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { std::stringstream ss;ss<< "__reserved_cmv"<< " # "<< ba<<(" []");return ss.str();})
static InstructionDefinition cadd_rs2_rd(ISA16_RV64IMACFD, "cadd",(uint16_t) 0x9002,(uint16_t) 0xf003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CADD\n");cp.code()+="etiss_coverage_count(1, 67);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2740);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 2746, 2743, 2741, 2744, 2745);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] + *((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(11, 2763, 2751, 2750, 2748, 2762, 2756, 2755, 2753, 2761, 2760, 2758);\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "cadd"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition __reserved_clui_rd(ISA16_RV64IMACFD, "__reserved_clui",(uint16_t) 0x6001,(uint16_t) 0xf07f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//__reserved_clui\n");cp.code()+="etiss_coverage_count(1, 51);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";cp.code()+="etiss_coverage_count(2, 2482, 2480);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//__reserved_clui\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "__reserved_clui"<< " # "<< ba<<(" [rd="+std::to_string(rd)+"]");return ss.str();})
static InstructionDefinition clw_rd_uimm_rs1(ISA16_RV64IMACFD, "clw",(uint16_t) 0x4000,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(4, 2);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(5, 5);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 6);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_uimm_3(12, 10);uimm+=R_uimm_3.read(ba)<< 3;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CLW\n");cp.code()+="etiss_coverage_count(1, 43);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2363);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] + "+std::to_string(uimm)+"ULL;\n";cp.code()+="etiss_coverage_count(7, 2351, 2350, 2348, 2347, 2345, 2346, 2349);\n";cp.code()+="etiss_uint32 mem_val_0;\n";cp.code()+="cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";cp.code()+="if (cpu->exception) { // conditional\n";{ cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="} // conditional\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = (etiss_int32)(mem_val_0);\n";cp.code()+="etiss_coverage_count(8, 2362, 2356, 2355, 2353, 2354, 2361, 2359, 2358);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CLW\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rd=0;static BitArrayRange R_rd_0(4, 2);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(5, 5);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(6, 6);uimm+=R_uimm_2.read(ba)<< 2;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_uimm_3(12, 10);uimm+=R_uimm_3.read(ba)<< 3;std::stringstream ss;ss<< "clw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | uimm="+std::to_string(uimm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition candi_imm_rs1(ISA16_RV64IMACFD, "candi",(uint16_t) 0x8801,(uint16_t) 0xec03, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CANDI\n");cp.code()+="etiss_coverage_count(1, 54);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2552);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] & "+std::to_string(((etiss_int8)(((etiss_int8) imm)<<(2)) >>(2)))+"LL;\n";cp.code()+="etiss_coverage_count(12, 2551, 2541, 2540, 2538, 2539, 2550, 2546, 2545, 2543, 2544, 2549, 2547);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 imm=0;static BitArrayRange R_imm_0(6, 2);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_5(12, 12);imm+=R_imm_5.read(ba)<< 5;std::stringstream ss;ss<< "candi"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition cswsp_rs2_uimm(ISA16_RV64IMACFD, "cswsp",(uint16_t) 0xc002,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(8, 7);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(12, 9);uimm+=R_uimm_2.read(ba)<< 2;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSWSP\n");cp.code()+="etiss_coverage_count(1, 70);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2806);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[2ULL] + "+std::to_string(uimm)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 2794, 2793, 2791, 2790, 2792);\n";cp.code()+="etiss_uint32 mem_val_0;\n";cp.code()+="mem_val_0 = (etiss_uint32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]);\n";cp.code()+="etiss_coverage_count(7, 2805, 2797, 2796, 2804, 2802, 2801, 2799);\n";cp.code()+="cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n";cp.code()+="if (cpu->exception) { // conditional\n";{ cp.code()+="{ // procedure\n";cp.code()+="RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";cp.code()+="goto instr_exit_"+std::to_string(ic.current_address_)+";\n";cp.code()+="} // procedure\n";} cp.code()+="} // conditional\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CSWSP\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(6, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 uimm=0;static BitArrayRange R_uimm_6(8, 7);uimm+=R_uimm_6.read(ba)<< 6;static BitArrayRange R_uimm_2(12, 9);uimm+=R_uimm_2.read(ba)<< 2;std::stringstream ss;ss<< "cswsp"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | uimm="+std::to_string(uimm)+"]");return ss.str();})
static InstructionDefinition cbeqz_imm_rs1(ISA16_RV64IMACFD, "cbeqz",(uint16_t) 0xc001,(uint16_t) 0xe003, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(4, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_6(6, 5);imm+=R_imm_6.read(ba)<< 6;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_3(11, 10);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_8(12, 12);imm+=R_imm_8.read(ba)<< 8;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CBEQZ\n");cp.code()+="etiss_coverage_count(1, 60);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 2632);\n";cp.code()+="if (*((RV64IMACFD*)cpu)->X["+std::to_string(rs1+8ULL)+"ULL] == 0LL) { // conditional\n";cp.code()+="etiss_coverage_count(6, 2639, 2637, 2636, 2634, 2635, 2638);\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+((etiss_int16)(((etiss_int16) imm)<<(7)) >>(7)))+"LL;\n";cp.code()+="etiss_coverage_count(6, 2646, 2640, 2645, 2641, 2644, 2642);\n";cp.code()+="} // conditional\n";cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} { CodePart &cp=cs.append(CodePart::APPENDEDRETURNINGREQUIRED);cp.code()=std::string("//CBEQZ\n");cp.code()+="if (cpu->nextPc != "+std::to_string(ic.current_address_+2)+"ULL) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint16 imm=0;static BitArrayRange R_imm_5(2, 2);imm+=R_imm_5.read(ba)<< 5;static BitArrayRange R_imm_1(4, 3);imm+=R_imm_1.read(ba)<< 1;static BitArrayRange R_imm_6(6, 5);imm+=R_imm_6.read(ba)<< 6;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(9, 7);rs1+=R_rs1_0.read(ba)<< 0;static BitArrayRange R_imm_3(11, 10);imm+=R_imm_3.read(ba)<< 3;static BitArrayRange R_imm_8(12, 12);imm+=R_imm_8.read(ba)<< 8;std::stringstream ss;ss<< "cbeqz"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rs1="+std::to_string(rs1)+"]");return ss.str();})
static InstructionDefinition csub_rs2_rd(ISA16_RV64IMACFD, "csub",(uint16_t) 0x8c01,(uint16_t) 0xfc63, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//CSUB\n");cp.code()+="etiss_coverage_count(1, 55);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+2)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 2570);\n";cp.code()+="{ // block\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rd+8ULL)+"ULL] - *((RV64IMACFD*)cpu)->X["+std::to_string(rs2+8ULL)+"ULL];\n";cp.code()+="etiss_coverage_count(14, 2569, 2557, 2556, 2554, 2555, 2568, 2562, 2561, 2559, 2560, 2567, 2566, 2564, 2565);\n";cp.code()+="} // block\n";} cp.code()+="instr_exit_"+std::to_string(ic.current_address_)+":\n";cp.code()+="cpu->instructionPointer = cpu->nextPc;\n";cp.getAffectedRegisters().add("instructionPointer", 32);} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(4, 2);rs2+=R_rs2_0.read(ba)<< 0;etiss_uint8 rd=0;static BitArrayRange R_rd_0(9, 7);rd+=R_rd_0.read(ba)<< 0;std::stringstream ss;ss<< "csub"<< " # "<< ba<<(" [rs2="+std::to_string(rs2)+" | rd="+std::to_string(rd)+"]");return ss.str();})
static __inline__ uint16_t
Definition: arm_mve.h:315
int16_t etiss_int16
Definition: types.h:89
uint32_t etiss_uint32
Definition: types.h:93
int8_t etiss_int8
Definition: types.h:86
uint8_t etiss_uint8
Definition: types.h:87
int32_t etiss_int32
Definition: types.h:92
uint16_t etiss_uint16
Definition: types.h:90
Contains a small code snipped.
Definition: CodePart.h:386
@ APPENDEDRETURNINGREQUIRED
Definition: CodePart.h:402
std::string & code()
Definition: CodePart.h:416
RegisterSet & getAffectedRegisters()
Definition: CodePart.h:414
A set of CodeParts.
Definition: CodePart.h:437
void append(const CodePart &part, CodePart::TYPE type)
Definition: CodePart.h:450
void add(const RegisterPart &rp)
add a registerPart to the set or just its relevant bits if a register with the same name is already p...
Definition: CodePart.h:222
Reading through it will only return bits within the range.
Definition: Instruction.h:208
I read(const BitArray &ba)
reads bits from the range to the return value starting at the lsb.
stores a bit vector
Definition: Instruction.h:161
this class contains parameters that persist in between instruction lookpus/translation within a trans...
Definition: Instruction.h:337
uint64_t current_address_
start address of current instruction
Definition: Instruction.h:366
holds information and translation callbacks for an instruction.
Definition: Instruction.h:393
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53