ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RV64IMACFD_RV32ICInstr.cpp
Go to the documentation of this file.
1
8#include "RV64IMACFDArch.h"
9#include "RV64IMACFDFuncs.h"
10
11using namespace etiss;
12using namespace etiss::instr;
13
14
15// CADDI4SPN -------------------------------------------------------------------
18 "caddi4spn",
19 (uint16_t) 0x00,
20 (uint16_t) 0xe003,
22 {
23
24// -----------------------------------------------------------------------------
25
26// -----------------------------------------------------------------------------
27
28// -----------------------------------------------------------------------------
29etiss_uint8 rd = 0;
30static BitArrayRange R_rd_0(4, 2);
31rd += R_rd_0.read(ba) << 0;
32etiss_uint16 imm = 0;
33static BitArrayRange R_imm_3(5, 5);
34imm += R_imm_3.read(ba) << 3;
35static BitArrayRange R_imm_2(6, 6);
36imm += R_imm_2.read(ba) << 2;
37static BitArrayRange R_imm_6(10, 7);
38imm += R_imm_6.read(ba) << 6;
39static BitArrayRange R_imm_4(12, 11);
40imm += R_imm_4.read(ba) << 4;
41
42// -----------------------------------------------------------------------------
43
44 {
46
47 cp.code() = std::string("//CADDI4SPN\n");
48
49// -----------------------------------------------------------------------------
50cp.code() += "etiss_coverage_count(1, 42);\n";
51{ // block
52cp.code() += "etiss_coverage_count(1, 1169);\n";
53cp.code() += "{ // block\n";
54cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
55cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
56cp.code() += "} // block\n";
57} // block
58cp.code() += "etiss_coverage_count(1, 2327);\n";
59if (imm) { // conditional
60cp.code() += "etiss_coverage_count(1, 2328);\n";
61cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(imm) + "ULL;\n";
62cp.code() += "etiss_coverage_count(9, 2339, 2333, 2332, 2330, 2331, 2338, 2336, 2335, 2337);\n";
63} // conditional
64else { // conditional
65{ // procedure
66cp.code() += "{ // procedure\n";
67cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
68cp.code() += "etiss_coverage_count(2, 2342, 2340);\n";
69cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
70cp.code() += "} // procedure\n";
71} // procedure
72} // conditional
73cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
74cp.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// -----------------------------------------------------------------------------
84cp.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// -----------------------------------------------------------------------------
94etiss_uint8 rd = 0;
95static BitArrayRange R_rd_0(4, 2);
96rd += R_rd_0.read(ba) << 0;
97etiss_uint16 imm = 0;
98static BitArrayRange R_imm_3(5, 5);
99imm += R_imm_3.read(ba) << 3;
100static BitArrayRange R_imm_2(6, 6);
101imm += R_imm_2.read(ba) << 2;
102static BitArrayRange R_imm_6(10, 7);
103imm += R_imm_6.read(ba) << 6;
104static BitArrayRange R_imm_4(12, 11);
105imm += R_imm_4.read(ba) << 4;
106
107// -----------------------------------------------------------------------------
108
109 std::stringstream ss;
110// -----------------------------------------------------------------------------
111ss << "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// -----------------------------------------------------------------------------
131etiss_uint8 rd = 0;
132static BitArrayRange R_rd_0(4, 2);
133rd += R_rd_0.read(ba) << 0;
134etiss_uint8 uimm = 0;
135static BitArrayRange R_uimm_6(5, 5);
136uimm += R_uimm_6.read(ba) << 6;
137static BitArrayRange R_uimm_2(6, 6);
138uimm += R_uimm_2.read(ba) << 2;
139etiss_uint8 rs1 = 0;
140static BitArrayRange R_rs1_0(9, 7);
141rs1 += R_rs1_0.read(ba) << 0;
142static BitArrayRange R_uimm_3(12, 10);
143uimm += R_uimm_3.read(ba) << 3;
144
145// -----------------------------------------------------------------------------
146
147 {
149
150 cp.code() = std::string("//CLW\n");
151
152// -----------------------------------------------------------------------------
153cp.code() += "etiss_coverage_count(1, 43);\n";
154{ // block
155cp.code() += "etiss_coverage_count(1, 1169);\n";
156cp.code() += "{ // block\n";
157cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
158cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
159cp.code() += "} // block\n";
160} // block
161{ // block
162cp.code() += "etiss_coverage_count(1, 2363);\n";
163cp.code() += "{ // block\n";
164cp.code() += "etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] + " + std::to_string(uimm) + "ULL;\n";
165cp.code() += "etiss_coverage_count(7, 2351, 2350, 2348, 2347, 2345, 2346, 2349);\n";
166cp.code() += "etiss_uint32 mem_val_0;\n";
167cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";
168cp.code() += "if (cpu->exception) { // conditional\n";
169{ // procedure
170cp.code() += "{ // procedure\n";
171cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
172cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
173cp.code() += "} // procedure\n";
174} // procedure
175cp.code() += "} // conditional\n";
176cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd + 8ULL) + "ULL] = (etiss_int32)(mem_val_0);\n";
177cp.code() += "etiss_coverage_count(8, 2362, 2356, 2355, 2353, 2354, 2361, 2359, 2358);\n";
178cp.code() += "} // block\n";
179} // block
180cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
181cp.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// -----------------------------------------------------------------------------
191cp.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// -----------------------------------------------------------------------------
201etiss_uint8 rd = 0;
202static BitArrayRange R_rd_0(4, 2);
203rd += R_rd_0.read(ba) << 0;
204etiss_uint8 uimm = 0;
205static BitArrayRange R_uimm_6(5, 5);
206uimm += R_uimm_6.read(ba) << 6;
207static BitArrayRange R_uimm_2(6, 6);
208uimm += R_uimm_2.read(ba) << 2;
209etiss_uint8 rs1 = 0;
210static BitArrayRange R_rs1_0(9, 7);
211rs1 += R_rs1_0.read(ba) << 0;
212static BitArrayRange R_uimm_3(12, 10);
213uimm += R_uimm_3.read(ba) << 3;
214
215// -----------------------------------------------------------------------------
216
217 std::stringstream ss;
218// -----------------------------------------------------------------------------
219ss << "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// -----------------------------------------------------------------------------
239etiss_uint8 rs2 = 0;
240static BitArrayRange R_rs2_0(4, 2);
241rs2 += R_rs2_0.read(ba) << 0;
242etiss_uint8 uimm = 0;
243static BitArrayRange R_uimm_6(5, 5);
244uimm += R_uimm_6.read(ba) << 6;
245static BitArrayRange R_uimm_2(6, 6);
246uimm += R_uimm_2.read(ba) << 2;
247etiss_uint8 rs1 = 0;
248static BitArrayRange R_rs1_0(9, 7);
249rs1 += R_rs1_0.read(ba) << 0;
250static BitArrayRange R_uimm_3(12, 10);
251uimm += R_uimm_3.read(ba) << 3;
252
253// -----------------------------------------------------------------------------
254
255 {
257
258 cp.code() = std::string("//CSW\n");
259
260// -----------------------------------------------------------------------------
261cp.code() += "etiss_coverage_count(1, 44);\n";
262{ // block
263cp.code() += "etiss_coverage_count(1, 1169);\n";
264cp.code() += "{ // block\n";
265cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
266cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
267cp.code() += "} // block\n";
268} // block
269{ // block
270cp.code() += "etiss_coverage_count(1, 2384);\n";
271cp.code() += "{ // block\n";
272cp.code() += "etiss_uint64 load_address = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] + " + std::to_string(uimm) + "ULL;\n";
273cp.code() += "etiss_coverage_count(7, 2372, 2371, 2369, 2368, 2366, 2367, 2370);\n";
274cp.code() += "etiss_uint32 mem_val_0;\n";
275cp.code() += "mem_val_0 = (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 + 8ULL) + "ULL]);\n";
276cp.code() += "etiss_coverage_count(8, 2383, 2375, 2374, 2382, 2380, 2379, 2377, 2378);\n";
277cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, load_address, (etiss_uint8*)&mem_val_0, 4);\n";
278cp.code() += "if (cpu->exception) { // conditional\n";
279{ // procedure
280cp.code() += "{ // procedure\n";
281cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
282cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
283cp.code() += "} // procedure\n";
284} // procedure
285cp.code() += "} // conditional\n";
286cp.code() += "} // block\n";
287} // block
288cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
289cp.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// -----------------------------------------------------------------------------
299cp.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// -----------------------------------------------------------------------------
309etiss_uint8 rs2 = 0;
310static BitArrayRange R_rs2_0(4, 2);
311rs2 += R_rs2_0.read(ba) << 0;
312etiss_uint8 uimm = 0;
313static BitArrayRange R_uimm_6(5, 5);
314uimm += R_uimm_6.read(ba) << 6;
315static BitArrayRange R_uimm_2(6, 6);
316uimm += R_uimm_2.read(ba) << 2;
317etiss_uint8 rs1 = 0;
318static BitArrayRange R_rs1_0(9, 7);
319rs1 += R_rs1_0.read(ba) << 0;
320static BitArrayRange R_uimm_3(12, 10);
321uimm += R_uimm_3.read(ba) << 3;
322
323// -----------------------------------------------------------------------------
324
325 std::stringstream ss;
326// -----------------------------------------------------------------------------
327ss << "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// -----------------------------------------------------------------------------
347etiss_uint8 imm = 0;
348static BitArrayRange R_imm_0(6, 2);
349imm += R_imm_0.read(ba) << 0;
350etiss_uint8 rs1 = 0;
351static BitArrayRange R_rs1_0(11, 7);
352rs1 += R_rs1_0.read(ba) << 0;
353static BitArrayRange R_imm_5(12, 12);
354imm += R_imm_5.read(ba) << 5;
355
356// -----------------------------------------------------------------------------
357
358 {
360
361 cp.code() = std::string("//CADDI\n");
362
363// -----------------------------------------------------------------------------
364cp.code() += "etiss_coverage_count(1, 45);\n";
365{ // block
366cp.code() += "etiss_coverage_count(1, 1169);\n";
367cp.code() += "{ // block\n";
368cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
369cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
370cp.code() += "} // block\n";
371} // block
372cp.code() += "etiss_coverage_count(1, 2385);\n";
373if ((rs1 % 32ULL) != 0LL) { // conditional
374cp.code() += "etiss_coverage_count(5, 2391, 2388, 2386, 2389, 2390);\n";
375cp.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";
376cp.code() += "etiss_coverage_count(10, 2406, 2396, 2395, 2393, 2405, 2401, 2400, 2398, 2404, 2402);\n";
377} // conditional
378cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
379cp.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// -----------------------------------------------------------------------------
390etiss_uint8 imm = 0;
391static BitArrayRange R_imm_0(6, 2);
392imm += R_imm_0.read(ba) << 0;
393etiss_uint8 rs1 = 0;
394static BitArrayRange R_rs1_0(11, 7);
395rs1 += R_rs1_0.read(ba) << 0;
396static BitArrayRange R_imm_5(12, 12);
397imm += R_imm_5.read(ba) << 5;
398
399// -----------------------------------------------------------------------------
400
401 std::stringstream ss;
402// -----------------------------------------------------------------------------
403ss << "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// -----------------------------------------------------------------------------
423etiss_uint8 nzimm = 0;
424static BitArrayRange R_nzimm_0(6, 2);
425nzimm += R_nzimm_0.read(ba) << 0;
426static BitArrayRange R_nzimm_5(12, 12);
427nzimm += R_nzimm_5.read(ba) << 5;
428
429// -----------------------------------------------------------------------------
430
431 {
433
434 cp.code() = std::string("//CNOP\n");
435
436// -----------------------------------------------------------------------------
437cp.code() += "etiss_coverage_count(1, 46);\n";
438{ // block
439cp.code() += "etiss_coverage_count(1, 1169);\n";
440cp.code() += "{ // block\n";
441cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
442cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
443cp.code() += "} // block\n";
444} // block
445{ // block
446cp.code() += "etiss_coverage_count(1, 2407);\n";
447cp.code() += "{ // block\n";
448cp.code() += "} // block\n";
449} // block
450cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
451cp.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// -----------------------------------------------------------------------------
462etiss_uint8 nzimm = 0;
463static BitArrayRange R_nzimm_0(6, 2);
464nzimm += R_nzimm_0.read(ba) << 0;
465static BitArrayRange R_nzimm_5(12, 12);
466nzimm += R_nzimm_5.read(ba) << 5;
467
468// -----------------------------------------------------------------------------
469
470 std::stringstream ss;
471// -----------------------------------------------------------------------------
472ss << "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// -----------------------------------------------------------------------------
492etiss_uint8 imm = 0;
493static BitArrayRange R_imm_0(6, 2);
494imm += R_imm_0.read(ba) << 0;
495etiss_uint8 rd = 0;
496static BitArrayRange R_rd_0(11, 7);
497rd += R_rd_0.read(ba) << 0;
498static BitArrayRange R_imm_5(12, 12);
499imm += R_imm_5.read(ba) << 5;
500
501// -----------------------------------------------------------------------------
502
503 {
505
506 cp.code() = std::string("//CLI\n");
507
508// -----------------------------------------------------------------------------
509cp.code() += "etiss_coverage_count(1, 48);\n";
510{ // block
511cp.code() += "etiss_coverage_count(1, 1169);\n";
512cp.code() += "{ // block\n";
513cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
514cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
515cp.code() += "} // block\n";
516} // block
517{ // block
518cp.code() += "etiss_coverage_count(1, 2439);\n";
519cp.code() += "{ // block\n";
520cp.code() += "etiss_coverage_count(1, 2423);\n";
521if ((rd % 32ULL) != 0LL) { // conditional
522cp.code() += "etiss_coverage_count(5, 2429, 2426, 2424, 2427, 2428);\n";
523cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(((etiss_int8)(((etiss_int8)imm) << (2)) >> (2))) + "LL;\n";
524cp.code() += "etiss_coverage_count(6, 2438, 2434, 2433, 2431, 2437, 2435);\n";
525} // conditional
526cp.code() += "} // block\n";
527} // block
528cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
529cp.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// -----------------------------------------------------------------------------
540etiss_uint8 imm = 0;
541static BitArrayRange R_imm_0(6, 2);
542imm += R_imm_0.read(ba) << 0;
543etiss_uint8 rd = 0;
544static BitArrayRange R_rd_0(11, 7);
545rd += R_rd_0.read(ba) << 0;
546static BitArrayRange R_imm_5(12, 12);
547imm += R_imm_5.read(ba) << 5;
548
549// -----------------------------------------------------------------------------
550
551 std::stringstream ss;
552// -----------------------------------------------------------------------------
553ss << "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// -----------------------------------------------------------------------------
573etiss_uint32 imm = 0;
574static BitArrayRange R_imm_12(6, 2);
575imm += R_imm_12.read(ba) << 12;
576etiss_uint8 rd = 0;
577static BitArrayRange R_rd_0(11, 7);
578rd += R_rd_0.read(ba) << 0;
579static BitArrayRange R_imm_17(12, 12);
580imm += R_imm_17.read(ba) << 17;
581
582// -----------------------------------------------------------------------------
583
584 {
586
587 cp.code() = std::string("//CLUI\n");
588
589// -----------------------------------------------------------------------------
590cp.code() += "etiss_coverage_count(1, 49);\n";
591{ // block
592cp.code() += "etiss_coverage_count(1, 1169);\n";
593cp.code() += "{ // block\n";
594cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
595cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
596cp.code() += "} // block\n";
597} // block
598{ // block
599cp.code() += "etiss_coverage_count(1, 2463);\n";
600cp.code() += "{ // block\n";
601cp.code() += "etiss_coverage_count(1, 2440);\n";
602if (imm == 0LL) { // conditional
603cp.code() += "etiss_coverage_count(3, 2443, 2441, 2442);\n";
604{ // procedure
605cp.code() += "{ // procedure\n";
606cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
607cp.code() += "etiss_coverage_count(2, 2446, 2444);\n";
608cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
609cp.code() += "} // procedure\n";
610} // procedure
611} // conditional
612cp.code() += "etiss_coverage_count(1, 2447);\n";
613if ((rd % 32ULL) != 0LL) { // conditional
614cp.code() += "etiss_coverage_count(5, 2453, 2450, 2448, 2451, 2452);\n";
615cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = " + std::to_string(((etiss_int32)(((etiss_int32)imm) << (14)) >> (14))) + "LL;\n";
616cp.code() += "etiss_coverage_count(6, 2462, 2458, 2457, 2455, 2461, 2459);\n";
617} // conditional
618cp.code() += "} // block\n";
619} // block
620cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
621cp.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// -----------------------------------------------------------------------------
631cp.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// -----------------------------------------------------------------------------
641etiss_uint32 imm = 0;
642static BitArrayRange R_imm_12(6, 2);
643imm += R_imm_12.read(ba) << 12;
644etiss_uint8 rd = 0;
645static BitArrayRange R_rd_0(11, 7);
646rd += R_rd_0.read(ba) << 0;
647static BitArrayRange R_imm_17(12, 12);
648imm += R_imm_17.read(ba) << 17;
649
650// -----------------------------------------------------------------------------
651
652 std::stringstream ss;
653// -----------------------------------------------------------------------------
654ss << "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// -----------------------------------------------------------------------------
674etiss_uint16 nzimm = 0;
675static BitArrayRange R_nzimm_5(2, 2);
676nzimm += R_nzimm_5.read(ba) << 5;
677static BitArrayRange R_nzimm_7(4, 3);
678nzimm += R_nzimm_7.read(ba) << 7;
679static BitArrayRange R_nzimm_6(5, 5);
680nzimm += R_nzimm_6.read(ba) << 6;
681static BitArrayRange R_nzimm_4(6, 6);
682nzimm += R_nzimm_4.read(ba) << 4;
683static BitArrayRange R_nzimm_9(12, 12);
684nzimm += R_nzimm_9.read(ba) << 9;
685
686// -----------------------------------------------------------------------------
687
688 {
690
691 cp.code() = std::string("//CADDI16SP\n");
692
693// -----------------------------------------------------------------------------
694cp.code() += "etiss_coverage_count(1, 50);\n";
695{ // block
696cp.code() += "etiss_coverage_count(1, 1169);\n";
697cp.code() += "{ // block\n";
698cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
699cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
700cp.code() += "} // block\n";
701} // block
702cp.code() += "etiss_coverage_count(1, 2464);\n";
703if (nzimm) { // conditional
704cp.code() += "etiss_coverage_count(1, 2465);\n";
705cp.code() += "*((RV64IMACFD*)cpu)->X[2ULL] = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)nzimm) << (6)) >> (6))) + "LL;\n";
706cp.code() += "etiss_coverage_count(8, 2476, 2468, 2467, 2475, 2471, 2470, 2474, 2472);\n";
707} // conditional
708else { // conditional
709{ // procedure
710cp.code() += "{ // procedure\n";
711cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
712cp.code() += "etiss_coverage_count(2, 2479, 2477);\n";
713cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
714cp.code() += "} // procedure\n";
715} // procedure
716} // conditional
717cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
718cp.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// -----------------------------------------------------------------------------
728cp.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// -----------------------------------------------------------------------------
738etiss_uint16 nzimm = 0;
739static BitArrayRange R_nzimm_5(2, 2);
740nzimm += R_nzimm_5.read(ba) << 5;
741static BitArrayRange R_nzimm_7(4, 3);
742nzimm += R_nzimm_7.read(ba) << 7;
743static BitArrayRange R_nzimm_6(5, 5);
744nzimm += R_nzimm_6.read(ba) << 6;
745static BitArrayRange R_nzimm_4(6, 6);
746nzimm += R_nzimm_4.read(ba) << 4;
747static BitArrayRange R_nzimm_9(12, 12);
748nzimm += R_nzimm_9.read(ba) << 9;
749
750// -----------------------------------------------------------------------------
751
752 std::stringstream ss;
753// -----------------------------------------------------------------------------
754ss << "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// -----------------------------------------------------------------------------
774etiss_uint8 rd = 0;
775static BitArrayRange R_rd_0(11, 7);
776rd += R_rd_0.read(ba) << 0;
777
778// -----------------------------------------------------------------------------
779
780 {
782
783 cp.code() = std::string("//__reserved_clui\n");
784
785// -----------------------------------------------------------------------------
786cp.code() += "etiss_coverage_count(1, 51);\n";
787{ // block
788cp.code() += "etiss_coverage_count(1, 1169);\n";
789cp.code() += "{ // block\n";
790cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
791cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
792cp.code() += "} // block\n";
793} // block
794{ // procedure
795cp.code() += "{ // procedure\n";
796cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
797cp.code() += "etiss_coverage_count(2, 2482, 2480);\n";
798cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
799cp.code() += "} // procedure\n";
800} // procedure
801cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
802cp.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// -----------------------------------------------------------------------------
812cp.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// -----------------------------------------------------------------------------
822etiss_uint8 rd = 0;
823static BitArrayRange R_rd_0(11, 7);
824rd += R_rd_0.read(ba) << 0;
825
826// -----------------------------------------------------------------------------
827
828 std::stringstream ss;
829// -----------------------------------------------------------------------------
830ss << "__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// -----------------------------------------------------------------------------
850etiss_uint8 shamt = 0;
851static BitArrayRange R_shamt_0(6, 2);
852shamt += R_shamt_0.read(ba) << 0;
853etiss_uint8 rs1 = 0;
854static BitArrayRange R_rs1_0(9, 7);
855rs1 += R_rs1_0.read(ba) << 0;
856
857// -----------------------------------------------------------------------------
858
859 {
861
862 cp.code() = std::string("//CSRLI\n");
863
864// -----------------------------------------------------------------------------
865cp.code() += "etiss_coverage_count(1, 52);\n";
866{ // block
867cp.code() += "etiss_coverage_count(1, 1169);\n";
868cp.code() += "{ // block\n";
869cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
870cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
871cp.code() += "} // block\n";
872} // block
873{ // block
874cp.code() += "etiss_coverage_count(1, 2496);\n";
875cp.code() += "{ // block\n";
876cp.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";
877cp.code() += "etiss_coverage_count(11, 2495, 2487, 2486, 2484, 2485, 2494, 2492, 2491, 2489, 2490, 2493);\n";
878cp.code() += "} // block\n";
879} // block
880cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
881cp.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// -----------------------------------------------------------------------------
892etiss_uint8 shamt = 0;
893static BitArrayRange R_shamt_0(6, 2);
894shamt += R_shamt_0.read(ba) << 0;
895etiss_uint8 rs1 = 0;
896static BitArrayRange R_rs1_0(9, 7);
897rs1 += R_rs1_0.read(ba) << 0;
898
899// -----------------------------------------------------------------------------
900
901 std::stringstream ss;
902// -----------------------------------------------------------------------------
903ss << "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// -----------------------------------------------------------------------------
923etiss_uint8 shamt = 0;
924static BitArrayRange R_shamt_0(6, 2);
925shamt += R_shamt_0.read(ba) << 0;
926etiss_uint8 rs1 = 0;
927static BitArrayRange R_rs1_0(9, 7);
928rs1 += R_rs1_0.read(ba) << 0;
929
930// -----------------------------------------------------------------------------
931
932 {
934
935 cp.code() = std::string("//CSRAI\n");
936
937// -----------------------------------------------------------------------------
938cp.code() += "etiss_coverage_count(1, 53);\n";
939{ // block
940cp.code() += "etiss_coverage_count(1, 1169);\n";
941cp.code() += "{ // block\n";
942cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
943cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
944cp.code() += "} // block\n";
945} // block
946{ // block
947cp.code() += "etiss_coverage_count(1, 2536);\n";
948cp.code() += "{ // block\n";
949cp.code() += "etiss_coverage_count(1, 2497);\n";
950if (shamt) { // conditional
951cp.code() += "etiss_coverage_count(1, 2498);\n";
952{ // block
953cp.code() += "etiss_coverage_count(1, 2518);\n";
954cp.code() += "{ // block\n";
955cp.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";
956cp.code() += "etiss_coverage_count(13, 2517, 2506, 2505, 2503, 2504, 2516, 2513, 2511, 2510, 2508, 2509, 2514, 2515);\n";
957cp.code() += "} // block\n";
958} // block
959} // conditional
960cp.code() += "} // block\n";
961} // block
962cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
963cp.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// -----------------------------------------------------------------------------
974etiss_uint8 shamt = 0;
975static BitArrayRange R_shamt_0(6, 2);
976shamt += R_shamt_0.read(ba) << 0;
977etiss_uint8 rs1 = 0;
978static BitArrayRange R_rs1_0(9, 7);
979rs1 += R_rs1_0.read(ba) << 0;
980
981// -----------------------------------------------------------------------------
982
983 std::stringstream ss;
984// -----------------------------------------------------------------------------
985ss << "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// -----------------------------------------------------------------------------
1005etiss_uint8 imm = 0;
1006static BitArrayRange R_imm_0(6, 2);
1007imm += R_imm_0.read(ba) << 0;
1008etiss_uint8 rs1 = 0;
1009static BitArrayRange R_rs1_0(9, 7);
1010rs1 += R_rs1_0.read(ba) << 0;
1011static BitArrayRange R_imm_5(12, 12);
1012imm += R_imm_5.read(ba) << 5;
1013
1014// -----------------------------------------------------------------------------
1015
1016 {
1018
1019 cp.code() = std::string("//CANDI\n");
1020
1021// -----------------------------------------------------------------------------
1022cp.code() += "etiss_coverage_count(1, 54);\n";
1023{ // block
1024cp.code() += "etiss_coverage_count(1, 1169);\n";
1025cp.code() += "{ // block\n";
1026cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1027cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1028cp.code() += "} // block\n";
1029} // block
1030{ // block
1031cp.code() += "etiss_coverage_count(1, 2552);\n";
1032cp.code() += "{ // block\n";
1033cp.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";
1034cp.code() += "etiss_coverage_count(12, 2551, 2541, 2540, 2538, 2539, 2550, 2546, 2545, 2543, 2544, 2549, 2547);\n";
1035cp.code() += "} // block\n";
1036} // block
1037cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1038cp.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// -----------------------------------------------------------------------------
1049etiss_uint8 imm = 0;
1050static BitArrayRange R_imm_0(6, 2);
1051imm += R_imm_0.read(ba) << 0;
1052etiss_uint8 rs1 = 0;
1053static BitArrayRange R_rs1_0(9, 7);
1054rs1 += R_rs1_0.read(ba) << 0;
1055static BitArrayRange R_imm_5(12, 12);
1056imm += R_imm_5.read(ba) << 5;
1057
1058// -----------------------------------------------------------------------------
1059
1060 std::stringstream ss;
1061// -----------------------------------------------------------------------------
1062ss << "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// -----------------------------------------------------------------------------
1082etiss_uint8 rs2 = 0;
1083static BitArrayRange R_rs2_0(4, 2);
1084rs2 += R_rs2_0.read(ba) << 0;
1085etiss_uint8 rd = 0;
1086static BitArrayRange R_rd_0(9, 7);
1087rd += R_rd_0.read(ba) << 0;
1088
1089// -----------------------------------------------------------------------------
1090
1091 {
1093
1094 cp.code() = std::string("//CSUB\n");
1095
1096// -----------------------------------------------------------------------------
1097cp.code() += "etiss_coverage_count(1, 55);\n";
1098{ // block
1099cp.code() += "etiss_coverage_count(1, 1169);\n";
1100cp.code() += "{ // block\n";
1101cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1102cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1103cp.code() += "} // block\n";
1104} // block
1105{ // block
1106cp.code() += "etiss_coverage_count(1, 2570);\n";
1107cp.code() += "{ // block\n";
1108cp.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";
1109cp.code() += "etiss_coverage_count(14, 2569, 2557, 2556, 2554, 2555, 2568, 2562, 2561, 2559, 2560, 2567, 2566, 2564, 2565);\n";
1110cp.code() += "} // block\n";
1111} // block
1112cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1113cp.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// -----------------------------------------------------------------------------
1124etiss_uint8 rs2 = 0;
1125static BitArrayRange R_rs2_0(4, 2);
1126rs2 += R_rs2_0.read(ba) << 0;
1127etiss_uint8 rd = 0;
1128static BitArrayRange R_rd_0(9, 7);
1129rd += R_rd_0.read(ba) << 0;
1130
1131// -----------------------------------------------------------------------------
1132
1133 std::stringstream ss;
1134// -----------------------------------------------------------------------------
1135ss << "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// -----------------------------------------------------------------------------
1155etiss_uint8 rs2 = 0;
1156static BitArrayRange R_rs2_0(4, 2);
1157rs2 += R_rs2_0.read(ba) << 0;
1158etiss_uint8 rd = 0;
1159static BitArrayRange R_rd_0(9, 7);
1160rd += R_rd_0.read(ba) << 0;
1161
1162// -----------------------------------------------------------------------------
1163
1164 {
1166
1167 cp.code() = std::string("//CXOR\n");
1168
1169// -----------------------------------------------------------------------------
1170cp.code() += "etiss_coverage_count(1, 56);\n";
1171{ // block
1172cp.code() += "etiss_coverage_count(1, 1169);\n";
1173cp.code() += "{ // block\n";
1174cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1175cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1176cp.code() += "} // block\n";
1177} // block
1178{ // block
1179cp.code() += "etiss_coverage_count(1, 2588);\n";
1180cp.code() += "{ // block\n";
1181cp.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";
1182cp.code() += "etiss_coverage_count(14, 2587, 2575, 2574, 2572, 2573, 2586, 2580, 2579, 2577, 2578, 2585, 2584, 2582, 2583);\n";
1183cp.code() += "} // block\n";
1184} // block
1185cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1186cp.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// -----------------------------------------------------------------------------
1197etiss_uint8 rs2 = 0;
1198static BitArrayRange R_rs2_0(4, 2);
1199rs2 += R_rs2_0.read(ba) << 0;
1200etiss_uint8 rd = 0;
1201static BitArrayRange R_rd_0(9, 7);
1202rd += R_rd_0.read(ba) << 0;
1203
1204// -----------------------------------------------------------------------------
1205
1206 std::stringstream ss;
1207// -----------------------------------------------------------------------------
1208ss << "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// -----------------------------------------------------------------------------
1228etiss_uint8 rs2 = 0;
1229static BitArrayRange R_rs2_0(4, 2);
1230rs2 += R_rs2_0.read(ba) << 0;
1231etiss_uint8 rd = 0;
1232static BitArrayRange R_rd_0(9, 7);
1233rd += R_rd_0.read(ba) << 0;
1234
1235// -----------------------------------------------------------------------------
1236
1237 {
1239
1240 cp.code() = std::string("//COR\n");
1241
1242// -----------------------------------------------------------------------------
1243cp.code() += "etiss_coverage_count(1, 57);\n";
1244{ // block
1245cp.code() += "etiss_coverage_count(1, 1169);\n";
1246cp.code() += "{ // block\n";
1247cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1248cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1249cp.code() += "} // block\n";
1250} // block
1251{ // block
1252cp.code() += "etiss_coverage_count(1, 2606);\n";
1253cp.code() += "{ // block\n";
1254cp.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";
1255cp.code() += "etiss_coverage_count(14, 2605, 2593, 2592, 2590, 2591, 2604, 2598, 2597, 2595, 2596, 2603, 2602, 2600, 2601);\n";
1256cp.code() += "} // block\n";
1257} // block
1258cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1259cp.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// -----------------------------------------------------------------------------
1270etiss_uint8 rs2 = 0;
1271static BitArrayRange R_rs2_0(4, 2);
1272rs2 += R_rs2_0.read(ba) << 0;
1273etiss_uint8 rd = 0;
1274static BitArrayRange R_rd_0(9, 7);
1275rd += R_rd_0.read(ba) << 0;
1276
1277// -----------------------------------------------------------------------------
1278
1279 std::stringstream ss;
1280// -----------------------------------------------------------------------------
1281ss << "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// -----------------------------------------------------------------------------
1301etiss_uint8 rs2 = 0;
1302static BitArrayRange R_rs2_0(4, 2);
1303rs2 += R_rs2_0.read(ba) << 0;
1304etiss_uint8 rd = 0;
1305static BitArrayRange R_rd_0(9, 7);
1306rd += R_rd_0.read(ba) << 0;
1307
1308// -----------------------------------------------------------------------------
1309
1310 {
1312
1313 cp.code() = std::string("//CAND\n");
1314
1315// -----------------------------------------------------------------------------
1316cp.code() += "etiss_coverage_count(1, 58);\n";
1317{ // block
1318cp.code() += "etiss_coverage_count(1, 1169);\n";
1319cp.code() += "{ // block\n";
1320cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1321cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1322cp.code() += "} // block\n";
1323} // block
1324{ // block
1325cp.code() += "etiss_coverage_count(1, 2624);\n";
1326cp.code() += "{ // block\n";
1327cp.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";
1328cp.code() += "etiss_coverage_count(14, 2623, 2611, 2610, 2608, 2609, 2622, 2616, 2615, 2613, 2614, 2621, 2620, 2618, 2619);\n";
1329cp.code() += "} // block\n";
1330} // block
1331cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1332cp.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// -----------------------------------------------------------------------------
1343etiss_uint8 rs2 = 0;
1344static BitArrayRange R_rs2_0(4, 2);
1345rs2 += R_rs2_0.read(ba) << 0;
1346etiss_uint8 rd = 0;
1347static BitArrayRange R_rd_0(9, 7);
1348rd += R_rd_0.read(ba) << 0;
1349
1350// -----------------------------------------------------------------------------
1351
1352 std::stringstream ss;
1353// -----------------------------------------------------------------------------
1354ss << "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// -----------------------------------------------------------------------------
1374etiss_uint16 imm = 0;
1375static BitArrayRange R_imm_5(2, 2);
1376imm += R_imm_5.read(ba) << 5;
1377static BitArrayRange R_imm_1(5, 3);
1378imm += R_imm_1.read(ba) << 1;
1379static BitArrayRange R_imm_7(6, 6);
1380imm += R_imm_7.read(ba) << 7;
1381static BitArrayRange R_imm_6(7, 7);
1382imm += R_imm_6.read(ba) << 6;
1383static BitArrayRange R_imm_10(8, 8);
1384imm += R_imm_10.read(ba) << 10;
1385static BitArrayRange R_imm_8(10, 9);
1386imm += R_imm_8.read(ba) << 8;
1387static BitArrayRange R_imm_4(11, 11);
1388imm += R_imm_4.read(ba) << 4;
1389static BitArrayRange R_imm_11(12, 12);
1390imm += R_imm_11.read(ba) << 11;
1391
1392// -----------------------------------------------------------------------------
1393
1394 {
1396
1397 cp.code() = std::string("//CJ\n");
1398
1399// -----------------------------------------------------------------------------
1400cp.code() += "etiss_coverage_count(1, 59);\n";
1401{ // block
1402cp.code() += "etiss_coverage_count(1, 1169);\n";
1403cp.code() += "{ // block\n";
1404cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1405cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1406cp.code() += "} // block\n";
1407} // block
1408cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
1409cp.code() += "etiss_coverage_count(6, 2631, 2625, 2630, 2626, 2629, 2627);\n";
1410cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1411cp.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// -----------------------------------------------------------------------------
1421cp.code() += "return cpu->exception;\n";
1422// -----------------------------------------------------------------------------
1423 }
1424
1425 return true;
1426 },
1427 0,
1428 [] (BitArray & ba, Instruction & instr)
1429 {
1430// -----------------------------------------------------------------------------
1431etiss_uint16 imm = 0;
1432static BitArrayRange R_imm_5(2, 2);
1433imm += R_imm_5.read(ba) << 5;
1434static BitArrayRange R_imm_1(5, 3);
1435imm += R_imm_1.read(ba) << 1;
1436static BitArrayRange R_imm_7(6, 6);
1437imm += R_imm_7.read(ba) << 7;
1438static BitArrayRange R_imm_6(7, 7);
1439imm += R_imm_6.read(ba) << 6;
1440static BitArrayRange R_imm_10(8, 8);
1441imm += R_imm_10.read(ba) << 10;
1442static BitArrayRange R_imm_8(10, 9);
1443imm += R_imm_8.read(ba) << 8;
1444static BitArrayRange R_imm_4(11, 11);
1445imm += R_imm_4.read(ba) << 4;
1446static BitArrayRange R_imm_11(12, 12);
1447imm += R_imm_11.read(ba) << 11;
1448
1449// -----------------------------------------------------------------------------
1450
1451 std::stringstream ss;
1452// -----------------------------------------------------------------------------
1453ss << "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// -----------------------------------------------------------------------------
1473etiss_uint16 imm = 0;
1474static BitArrayRange R_imm_5(2, 2);
1475imm += R_imm_5.read(ba) << 5;
1476static BitArrayRange R_imm_1(4, 3);
1477imm += R_imm_1.read(ba) << 1;
1478static BitArrayRange R_imm_6(6, 5);
1479imm += R_imm_6.read(ba) << 6;
1480etiss_uint8 rs1 = 0;
1481static BitArrayRange R_rs1_0(9, 7);
1482rs1 += R_rs1_0.read(ba) << 0;
1483static BitArrayRange R_imm_3(11, 10);
1484imm += R_imm_3.read(ba) << 3;
1485static BitArrayRange R_imm_8(12, 12);
1486imm += R_imm_8.read(ba) << 8;
1487
1488// -----------------------------------------------------------------------------
1489
1490 {
1492
1493 cp.code() = std::string("//CBEQZ\n");
1494
1495// -----------------------------------------------------------------------------
1496cp.code() += "etiss_coverage_count(1, 60);\n";
1497{ // block
1498cp.code() += "etiss_coverage_count(1, 1169);\n";
1499cp.code() += "{ // block\n";
1500cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1501cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1502cp.code() += "} // block\n";
1503} // block
1504cp.code() += "etiss_coverage_count(1, 2632);\n";
1505cp.code() += "if (*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] == 0LL) { // conditional\n";
1506cp.code() += "etiss_coverage_count(6, 2639, 2637, 2636, 2634, 2635, 2638);\n";
1507cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (7)) >> (7))) + "LL;\n";
1508cp.code() += "etiss_coverage_count(6, 2646, 2640, 2645, 2641, 2644, 2642);\n";
1509cp.code() += "} // conditional\n";
1510cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1511cp.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// -----------------------------------------------------------------------------
1521cp.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// -----------------------------------------------------------------------------
1531etiss_uint16 imm = 0;
1532static BitArrayRange R_imm_5(2, 2);
1533imm += R_imm_5.read(ba) << 5;
1534static BitArrayRange R_imm_1(4, 3);
1535imm += R_imm_1.read(ba) << 1;
1536static BitArrayRange R_imm_6(6, 5);
1537imm += R_imm_6.read(ba) << 6;
1538etiss_uint8 rs1 = 0;
1539static BitArrayRange R_rs1_0(9, 7);
1540rs1 += R_rs1_0.read(ba) << 0;
1541static BitArrayRange R_imm_3(11, 10);
1542imm += R_imm_3.read(ba) << 3;
1543static BitArrayRange R_imm_8(12, 12);
1544imm += R_imm_8.read(ba) << 8;
1545
1546// -----------------------------------------------------------------------------
1547
1548 std::stringstream ss;
1549// -----------------------------------------------------------------------------
1550ss << "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// -----------------------------------------------------------------------------
1570etiss_uint16 imm = 0;
1571static BitArrayRange R_imm_5(2, 2);
1572imm += R_imm_5.read(ba) << 5;
1573static BitArrayRange R_imm_1(4, 3);
1574imm += R_imm_1.read(ba) << 1;
1575static BitArrayRange R_imm_6(6, 5);
1576imm += R_imm_6.read(ba) << 6;
1577etiss_uint8 rs1 = 0;
1578static BitArrayRange R_rs1_0(9, 7);
1579rs1 += R_rs1_0.read(ba) << 0;
1580static BitArrayRange R_imm_3(11, 10);
1581imm += R_imm_3.read(ba) << 3;
1582static BitArrayRange R_imm_8(12, 12);
1583imm += R_imm_8.read(ba) << 8;
1584
1585// -----------------------------------------------------------------------------
1586
1587 {
1589
1590 cp.code() = std::string("//CBNEZ\n");
1591
1592// -----------------------------------------------------------------------------
1593cp.code() += "etiss_coverage_count(1, 61);\n";
1594{ // block
1595cp.code() += "etiss_coverage_count(1, 1169);\n";
1596cp.code() += "{ // block\n";
1597cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1598cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1599cp.code() += "} // block\n";
1600} // block
1601cp.code() += "etiss_coverage_count(1, 2647);\n";
1602cp.code() += "if (*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 + 8ULL) + "ULL] != 0LL) { // conditional\n";
1603cp.code() += "etiss_coverage_count(6, 2654, 2652, 2651, 2649, 2650, 2653);\n";
1604cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + ((etiss_int16)(((etiss_int16)imm) << (7)) >> (7))) + "LL;\n";
1605cp.code() += "etiss_coverage_count(6, 2661, 2655, 2660, 2656, 2659, 2657);\n";
1606cp.code() += "} // conditional\n";
1607cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1608cp.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// -----------------------------------------------------------------------------
1618cp.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// -----------------------------------------------------------------------------
1628etiss_uint16 imm = 0;
1629static BitArrayRange R_imm_5(2, 2);
1630imm += R_imm_5.read(ba) << 5;
1631static BitArrayRange R_imm_1(4, 3);
1632imm += R_imm_1.read(ba) << 1;
1633static BitArrayRange R_imm_6(6, 5);
1634imm += R_imm_6.read(ba) << 6;
1635etiss_uint8 rs1 = 0;
1636static BitArrayRange R_rs1_0(9, 7);
1637rs1 += R_rs1_0.read(ba) << 0;
1638static BitArrayRange R_imm_3(11, 10);
1639imm += R_imm_3.read(ba) << 3;
1640static BitArrayRange R_imm_8(12, 12);
1641imm += R_imm_8.read(ba) << 8;
1642
1643// -----------------------------------------------------------------------------
1644
1645 std::stringstream ss;
1646// -----------------------------------------------------------------------------
1647ss << "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// -----------------------------------------------------------------------------
1667etiss_uint8 nzuimm = 0;
1668static BitArrayRange R_nzuimm_0(6, 2);
1669nzuimm += R_nzuimm_0.read(ba) << 0;
1670etiss_uint8 rs1 = 0;
1671static BitArrayRange R_rs1_0(11, 7);
1672rs1 += R_rs1_0.read(ba) << 0;
1673
1674// -----------------------------------------------------------------------------
1675
1676 {
1678
1679 cp.code() = std::string("//CSLLI\n");
1680
1681// -----------------------------------------------------------------------------
1682cp.code() += "etiss_coverage_count(1, 62);\n";
1683{ // block
1684cp.code() += "etiss_coverage_count(1, 1169);\n";
1685cp.code() += "{ // block\n";
1686cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1687cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1688cp.code() += "} // block\n";
1689} // block
1690cp.code() += "etiss_coverage_count(1, 2662);\n";
1691if (nzuimm) { // conditional
1692cp.code() += "etiss_coverage_count(1, 2663);\n";
1693cp.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";
1694cp.code() += "etiss_coverage_count(9, 2676, 2668, 2667, 2665, 2675, 2673, 2672, 2670, 2674);\n";
1695} // conditional
1696cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1697cp.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// -----------------------------------------------------------------------------
1708etiss_uint8 nzuimm = 0;
1709static BitArrayRange R_nzuimm_0(6, 2);
1710nzuimm += R_nzuimm_0.read(ba) << 0;
1711etiss_uint8 rs1 = 0;
1712static BitArrayRange R_rs1_0(11, 7);
1713rs1 += R_rs1_0.read(ba) << 0;
1714
1715// -----------------------------------------------------------------------------
1716
1717 std::stringstream ss;
1718// -----------------------------------------------------------------------------
1719ss << "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// -----------------------------------------------------------------------------
1739etiss_uint8 uimm = 0;
1740static BitArrayRange R_uimm_6(3, 2);
1741uimm += R_uimm_6.read(ba) << 6;
1742static BitArrayRange R_uimm_2(6, 4);
1743uimm += R_uimm_2.read(ba) << 2;
1744etiss_uint8 rd = 0;
1745static BitArrayRange R_rd_0(11, 7);
1746rd += R_rd_0.read(ba) << 0;
1747static BitArrayRange R_uimm_5(12, 12);
1748uimm += R_uimm_5.read(ba) << 5;
1749
1750// -----------------------------------------------------------------------------
1751
1752 {
1754
1755 cp.code() = std::string("//CLWSP\n");
1756
1757// -----------------------------------------------------------------------------
1758cp.code() += "etiss_coverage_count(1, 63);\n";
1759{ // block
1760cp.code() += "etiss_coverage_count(1, 1169);\n";
1761cp.code() += "{ // block\n";
1762cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1763cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1764cp.code() += "} // block\n";
1765} // block
1766{ // block
1767cp.code() += "etiss_coverage_count(1, 2703);\n";
1768cp.code() += "{ // block\n";
1769cp.code() += "etiss_coverage_count(1, 2677);\n";
1770if (rd % 32ULL) { // conditional
1771cp.code() += "etiss_coverage_count(2, 2680, 2678);\n";
1772{ // block
1773cp.code() += "etiss_coverage_count(1, 2699);\n";
1774cp.code() += "{ // block\n";
1775cp.code() += "etiss_uint32 mem_val_0;\n";
1776cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(uimm) + "ULL, (etiss_uint8*)&mem_val_0, 4);\n";
1777cp.code() += "if (cpu->exception) { // conditional\n";
1778{ // procedure
1779cp.code() += "{ // procedure\n";
1780cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
1781cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1782cp.code() += "} // procedure\n";
1783} // procedure
1784cp.code() += "} // conditional\n";
1785cp.code() += "etiss_int32 res = mem_val_0;\n";
1786cp.code() += "etiss_coverage_count(6, 2689, 2688, 2687, 2685, 2684, 2686);\n";
1787cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(res);\n";
1788cp.code() += "etiss_coverage_count(6, 2698, 2694, 2693, 2691, 2697, 2695);\n";
1789cp.code() += "} // block\n";
1790} // block
1791} // conditional
1792else { // conditional
1793{ // procedure
1794cp.code() += "{ // procedure\n";
1795cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
1796cp.code() += "etiss_coverage_count(3, 2702, 2700, 2701);\n";
1797cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1798cp.code() += "} // procedure\n";
1799} // procedure
1800} // conditional
1801cp.code() += "} // block\n";
1802} // block
1803cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1804cp.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// -----------------------------------------------------------------------------
1814cp.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// -----------------------------------------------------------------------------
1824etiss_uint8 uimm = 0;
1825static BitArrayRange R_uimm_6(3, 2);
1826uimm += R_uimm_6.read(ba) << 6;
1827static BitArrayRange R_uimm_2(6, 4);
1828uimm += R_uimm_2.read(ba) << 2;
1829etiss_uint8 rd = 0;
1830static BitArrayRange R_rd_0(11, 7);
1831rd += R_rd_0.read(ba) << 0;
1832static BitArrayRange R_uimm_5(12, 12);
1833uimm += R_uimm_5.read(ba) << 5;
1834
1835// -----------------------------------------------------------------------------
1836
1837 std::stringstream ss;
1838// -----------------------------------------------------------------------------
1839ss << "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// -----------------------------------------------------------------------------
1859etiss_uint8 rs2 = 0;
1860static BitArrayRange R_rs2_0(6, 2);
1861rs2 += R_rs2_0.read(ba) << 0;
1862etiss_uint8 rd = 0;
1863static BitArrayRange R_rd_0(11, 7);
1864rd += R_rd_0.read(ba) << 0;
1865
1866// -----------------------------------------------------------------------------
1867
1868 {
1870
1871 cp.code() = std::string("//CMV\n");
1872
1873// -----------------------------------------------------------------------------
1874cp.code() += "etiss_coverage_count(1, 64);\n";
1875{ // block
1876cp.code() += "etiss_coverage_count(1, 1169);\n";
1877cp.code() += "{ // block\n";
1878cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1879cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1880cp.code() += "} // block\n";
1881} // block
1882cp.code() += "etiss_coverage_count(1, 2704);\n";
1883if ((rd % 32ULL) != 0LL) { // conditional
1884cp.code() += "etiss_coverage_count(5, 2710, 2707, 2705, 2708, 2709);\n";
1885cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL];\n";
1886cp.code() += "etiss_coverage_count(7, 2721, 2715, 2714, 2712, 2720, 2719, 2717);\n";
1887} // conditional
1888cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1889cp.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// -----------------------------------------------------------------------------
1900etiss_uint8 rs2 = 0;
1901static BitArrayRange R_rs2_0(6, 2);
1902rs2 += R_rs2_0.read(ba) << 0;
1903etiss_uint8 rd = 0;
1904static BitArrayRange R_rd_0(11, 7);
1905rd += R_rd_0.read(ba) << 0;
1906
1907// -----------------------------------------------------------------------------
1908
1909 std::stringstream ss;
1910// -----------------------------------------------------------------------------
1911ss << "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// -----------------------------------------------------------------------------
1931etiss_uint8 rs1 = 0;
1932static BitArrayRange R_rs1_0(11, 7);
1933rs1 += R_rs1_0.read(ba) << 0;
1934
1935// -----------------------------------------------------------------------------
1936
1937 {
1939
1940 cp.code() = std::string("//CJR\n");
1941
1942// -----------------------------------------------------------------------------
1943cp.code() += "etiss_coverage_count(1, 65);\n";
1944{ // block
1945cp.code() += "etiss_coverage_count(1, 1169);\n";
1946cp.code() += "{ // block\n";
1947cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
1948cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1949cp.code() += "} // block\n";
1950} // block
1951cp.code() += "etiss_coverage_count(1, 2722);\n";
1952if (rs1) { // conditional
1953cp.code() += "etiss_coverage_count(1, 2723);\n";
1954cp.code() += "cpu->nextPc = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] & -2LL;\n";
1955cp.code() += "etiss_coverage_count(6, 2733, 2724, 2732, 2729, 2728, 2726);\n";
1956} // conditional
1957else { // conditional
1958{ // procedure
1959cp.code() += "{ // procedure\n";
1960cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
1961cp.code() += "etiss_coverage_count(3, 2736, 2734, 2735);\n";
1962cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
1963cp.code() += "} // procedure\n";
1964} // procedure
1965} // conditional
1966cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1967cp.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// -----------------------------------------------------------------------------
1977cp.code() += "return cpu->exception;\n";
1978// -----------------------------------------------------------------------------
1979 }
1980
1981 return true;
1982 },
1983 0,
1984 [] (BitArray & ba, Instruction & instr)
1985 {
1986// -----------------------------------------------------------------------------
1987etiss_uint8 rs1 = 0;
1988static BitArrayRange R_rs1_0(11, 7);
1989rs1 += R_rs1_0.read(ba) << 0;
1990
1991// -----------------------------------------------------------------------------
1992
1993 std::stringstream ss;
1994// -----------------------------------------------------------------------------
1995ss << "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// -----------------------------------------------------------------------------
2024cp.code() += "etiss_coverage_count(1, 66);\n";
2025{ // block
2026cp.code() += "etiss_coverage_count(1, 1169);\n";
2027cp.code() += "{ // block\n";
2028cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2029cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2030cp.code() += "} // block\n";
2031} // block
2032{ // procedure
2033cp.code() += "{ // procedure\n";
2034cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2ULL);\n";
2035cp.code() += "etiss_coverage_count(3, 2739, 2737, 2738);\n";
2036cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2037cp.code() += "} // procedure\n";
2038} // procedure
2039cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2040cp.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// -----------------------------------------------------------------------------
2050cp.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// -----------------------------------------------------------------------------
2065ss << "__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// -----------------------------------------------------------------------------
2085etiss_uint8 rs2 = 0;
2086static BitArrayRange R_rs2_0(6, 2);
2087rs2 += R_rs2_0.read(ba) << 0;
2088etiss_uint8 rd = 0;
2089static BitArrayRange R_rd_0(11, 7);
2090rd += R_rd_0.read(ba) << 0;
2091
2092// -----------------------------------------------------------------------------
2093
2094 {
2096
2097 cp.code() = std::string("//CADD\n");
2098
2099// -----------------------------------------------------------------------------
2100cp.code() += "etiss_coverage_count(1, 67);\n";
2101{ // block
2102cp.code() += "etiss_coverage_count(1, 1169);\n";
2103cp.code() += "{ // block\n";
2104cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2105cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2106cp.code() += "} // block\n";
2107} // block
2108cp.code() += "etiss_coverage_count(1, 2740);\n";
2109if ((rd % 32ULL) != 0LL) { // conditional
2110cp.code() += "etiss_coverage_count(5, 2746, 2743, 2741, 2744, 2745);\n";
2111cp.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";
2112cp.code() += "etiss_coverage_count(11, 2763, 2751, 2750, 2748, 2762, 2756, 2755, 2753, 2761, 2760, 2758);\n";
2113} // conditional
2114cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2115cp.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// -----------------------------------------------------------------------------
2126etiss_uint8 rs2 = 0;
2127static BitArrayRange R_rs2_0(6, 2);
2128rs2 += R_rs2_0.read(ba) << 0;
2129etiss_uint8 rd = 0;
2130static BitArrayRange R_rd_0(11, 7);
2131rd += R_rd_0.read(ba) << 0;
2132
2133// -----------------------------------------------------------------------------
2134
2135 std::stringstream ss;
2136// -----------------------------------------------------------------------------
2137ss << "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// -----------------------------------------------------------------------------
2157etiss_uint8 rs1 = 0;
2158static BitArrayRange R_rs1_0(11, 7);
2159rs1 += R_rs1_0.read(ba) << 0;
2160
2161// -----------------------------------------------------------------------------
2162
2163 {
2165
2166 cp.code() = std::string("//CJALR\n");
2167
2168// -----------------------------------------------------------------------------
2169cp.code() += "etiss_coverage_count(1, 68);\n";
2170{ // block
2171cp.code() += "etiss_coverage_count(1, 1169);\n";
2172cp.code() += "{ // block\n";
2173cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2174cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2175cp.code() += "} // block\n";
2176} // block
2177{ // block
2178cp.code() += "etiss_coverage_count(1, 2784);\n";
2179cp.code() += "{ // block\n";
2180cp.code() += "etiss_uint64 new_pc = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL];\n";
2181cp.code() += "etiss_coverage_count(4, 2770, 2769, 2768, 2766);\n";
2182cp.code() += "*((RV64IMACFD*)cpu)->X[1ULL] = " + std::to_string(ic.current_address_ + 2ULL) + "ULL;\n";
2183cp.code() += "etiss_coverage_count(6, 2777, 2773, 2772, 2776, 2774, 2775);\n";
2184cp.code() += "cpu->nextPc = new_pc & -2LL;\n";
2185cp.code() += "etiss_coverage_count(4, 2783, 2778, 2782, 2779);\n";
2186cp.code() += "} // block\n";
2187} // block
2188cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2189cp.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// -----------------------------------------------------------------------------
2199cp.code() += "return cpu->exception;\n";
2200// -----------------------------------------------------------------------------
2201 }
2202
2203 return true;
2204 },
2205 0,
2206 [] (BitArray & ba, Instruction & instr)
2207 {
2208// -----------------------------------------------------------------------------
2209etiss_uint8 rs1 = 0;
2210static BitArrayRange R_rs1_0(11, 7);
2211rs1 += R_rs1_0.read(ba) << 0;
2212
2213// -----------------------------------------------------------------------------
2214
2215 std::stringstream ss;
2216// -----------------------------------------------------------------------------
2217ss << "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// -----------------------------------------------------------------------------
2246cp.code() += "etiss_coverage_count(1, 69);\n";
2247{ // block
2248cp.code() += "etiss_coverage_count(1, 1169);\n";
2249cp.code() += "{ // block\n";
2250cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2251cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2252cp.code() += "} // block\n";
2253} // block
2254{ // procedure
2255cp.code() += "{ // procedure\n";
2256cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 3LL);\n";
2257cp.code() += "etiss_coverage_count(2, 2787, 2785);\n";
2258cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2259cp.code() += "} // procedure\n";
2260} // procedure
2261cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2262cp.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// -----------------------------------------------------------------------------
2272cp.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// -----------------------------------------------------------------------------
2287ss << "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// -----------------------------------------------------------------------------
2307etiss_uint8 rs2 = 0;
2308static BitArrayRange R_rs2_0(6, 2);
2309rs2 += R_rs2_0.read(ba) << 0;
2310etiss_uint8 uimm = 0;
2311static BitArrayRange R_uimm_6(8, 7);
2312uimm += R_uimm_6.read(ba) << 6;
2313static BitArrayRange R_uimm_2(12, 9);
2314uimm += R_uimm_2.read(ba) << 2;
2315
2316// -----------------------------------------------------------------------------
2317
2318 {
2320
2321 cp.code() = std::string("//CSWSP\n");
2322
2323// -----------------------------------------------------------------------------
2324cp.code() += "etiss_coverage_count(1, 70);\n";
2325{ // block
2326cp.code() += "etiss_coverage_count(1, 1169);\n";
2327cp.code() += "{ // block\n";
2328cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2329cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2330cp.code() += "} // block\n";
2331} // block
2332{ // block
2333cp.code() += "etiss_coverage_count(1, 2806);\n";
2334cp.code() += "{ // block\n";
2335cp.code() += "etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[2ULL] + " + std::to_string(uimm) + "ULL;\n";
2336cp.code() += "etiss_coverage_count(5, 2794, 2793, 2791, 2790, 2792);\n";
2337cp.code() += "etiss_uint32 mem_val_0;\n";
2338cp.code() += "mem_val_0 = (etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n";
2339cp.code() += "etiss_coverage_count(7, 2805, 2797, 2796, 2804, 2802, 2801, 2799);\n";
2340cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n";
2341cp.code() += "if (cpu->exception) { // conditional\n";
2342{ // procedure
2343cp.code() += "{ // procedure\n";
2344cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
2345cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2346cp.code() += "} // procedure\n";
2347} // procedure
2348cp.code() += "} // conditional\n";
2349cp.code() += "} // block\n";
2350} // block
2351cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2352cp.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// -----------------------------------------------------------------------------
2362cp.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// -----------------------------------------------------------------------------
2372etiss_uint8 rs2 = 0;
2373static BitArrayRange R_rs2_0(6, 2);
2374rs2 += R_rs2_0.read(ba) << 0;
2375etiss_uint8 uimm = 0;
2376static BitArrayRange R_uimm_6(8, 7);
2377uimm += R_uimm_6.read(ba) << 6;
2378static BitArrayRange R_uimm_2(12, 9);
2379uimm += R_uimm_2.read(ba) << 2;
2380
2381// -----------------------------------------------------------------------------
2382
2383 std::stringstream ss;
2384// -----------------------------------------------------------------------------
2385ss << "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// -----------------------------------------------------------------------------
2414cp.code() += "etiss_coverage_count(1, 71);\n";
2415{ // block
2416cp.code() += "etiss_coverage_count(1, 1169);\n";
2417cp.code() += "{ // block\n";
2418cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 2) + "ULL;\n";
2419cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
2420cp.code() += "} // block\n";
2421} // block
2422{ // procedure
2423cp.code() += "{ // procedure\n";
2424cp.code() += "RV64IMACFD_raise(cpu, system, plugin_pointers, 0LL, 2LL);\n";
2425cp.code() += "etiss_coverage_count(2, 2809, 2807);\n";
2426cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
2427cp.code() += "} // procedure\n";
2428} // procedure
2429cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
2430cp.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// -----------------------------------------------------------------------------
2440cp.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// -----------------------------------------------------------------------------
2455ss << "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 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 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 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 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 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 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 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 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 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 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 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 __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 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 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();})
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.
I read(const BitArray &ba)
reads bits from the range to the return value starting at the lsb.
stores a bit vector
this class contains parameters that persist in between instruction lookpus/translation within a trans...
uint64_t current_address_
start address of current instruction
holds information and translation callbacks for an instruction.
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition Benchmark.h:53