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_RV64IInstr.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// LWU -------------------------------------------------------------------------
18 "lwu",
19 (uint32_t) 0x006003,
20 (uint32_t) 0x00707f,
22 {
23
24// -----------------------------------------------------------------------------
25
26// -----------------------------------------------------------------------------
27
28// -----------------------------------------------------------------------------
29etiss_uint8 rd = 0;
30static BitArrayRange R_rd_0(11, 7);
31rd += R_rd_0.read(ba) << 0;
32etiss_uint8 rs1 = 0;
33static BitArrayRange R_rs1_0(19, 15);
34rs1 += R_rs1_0.read(ba) << 0;
35etiss_uint16 imm = 0;
36static BitArrayRange R_imm_0(31, 20);
37imm += R_imm_0.read(ba) << 0;
38
39// -----------------------------------------------------------------------------
40
41 {
43
44 cp.code() = std::string("//LWU\n");
45
46// -----------------------------------------------------------------------------
47cp.code() += "etiss_coverage_count(1, 184);\n";
48{ // block
49cp.code() += "etiss_coverage_count(1, 1169);\n";
50cp.code() += "{ // block\n";
51cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
52cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
53cp.code() += "} // block\n";
54} // block
55{ // block
56cp.code() += "etiss_coverage_count(1, 6976);\n";
57cp.code() += "{ // block\n";
58cp.code() += "etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
59cp.code() += "etiss_coverage_count(7, 6952, 6951, 6947, 6946, 6944, 6950, 6948);\n";
60cp.code() += "etiss_uint32 mem_val_0;\n";
61cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 4);\n";
62cp.code() += "if (cpu->exception) { // conditional\n";
63{ // procedure
64cp.code() += "{ // procedure\n";
65cp.code() += "RV64IMACFD_translate_exc_code(cpu, system, plugin_pointers, cpu->exception);\n";
66cp.code() += "goto instr_exit_" + std::to_string(ic.current_address_) + ";\n";
67cp.code() += "} // procedure\n";
68} // procedure
69cp.code() += "} // conditional\n";
70cp.code() += "etiss_uint32 res = (etiss_uint32)(mem_val_0);\n";
71cp.code() += "etiss_coverage_count(4, 6959, 6958, 6956, 6955);\n";
72cp.code() += "etiss_coverage_count(1, 6960);\n";
73if ((rd % 32ULL) != 0LL) { // conditional
74cp.code() += "etiss_coverage_count(5, 6966, 6963, 6961, 6964, 6965);\n";
75cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)(res);\n";
76cp.code() += "etiss_coverage_count(6, 6975, 6971, 6970, 6968, 6974, 6972);\n";
77} // conditional
78cp.code() += "} // block\n";
79} // block
80cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
81cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
82// -----------------------------------------------------------------------------
83 cp.getAffectedRegisters().add("instructionPointer", 32);
84 }
85 {
87
88 cp.code() = std::string("//LWU\n");
89
90// -----------------------------------------------------------------------------
91cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
92// -----------------------------------------------------------------------------
93 }
94
95 return true;
96 },
97 0,
98 [] (BitArray & ba, Instruction & instr)
99 {
100// -----------------------------------------------------------------------------
101etiss_uint8 rd = 0;
102static BitArrayRange R_rd_0(11, 7);
103rd += R_rd_0.read(ba) << 0;
104etiss_uint8 rs1 = 0;
105static BitArrayRange R_rs1_0(19, 15);
106rs1 += R_rs1_0.read(ba) << 0;
107etiss_uint16 imm = 0;
108static BitArrayRange R_imm_0(31, 20);
109imm += R_imm_0.read(ba) << 0;
110
111// -----------------------------------------------------------------------------
112
113 std::stringstream ss;
114// -----------------------------------------------------------------------------
115ss << "lwu" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]");
116// -----------------------------------------------------------------------------
117 return ss.str();
118 }
119);
120
121// LD --------------------------------------------------------------------------
124 "ld",
125 (uint32_t) 0x003003,
126 (uint32_t) 0x00707f,
127 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
128 {
129
130// -----------------------------------------------------------------------------
131
132// -----------------------------------------------------------------------------
133
134// -----------------------------------------------------------------------------
135etiss_uint8 rd = 0;
136static BitArrayRange R_rd_0(11, 7);
137rd += R_rd_0.read(ba) << 0;
138etiss_uint8 rs1 = 0;
139static BitArrayRange R_rs1_0(19, 15);
140rs1 += R_rs1_0.read(ba) << 0;
141etiss_uint16 imm = 0;
142static BitArrayRange R_imm_0(31, 20);
143imm += R_imm_0.read(ba) << 0;
144
145// -----------------------------------------------------------------------------
146
147 {
149
150 cp.code() = std::string("//LD\n");
151
152// -----------------------------------------------------------------------------
153cp.code() += "etiss_coverage_count(1, 185);\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_ + 4) + "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, 7010);\n";
163cp.code() += "{ // block\n";
164cp.code() += "etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
165cp.code() += "etiss_coverage_count(7, 6986, 6985, 6982, 6981, 6979, 6984, 6983);\n";
166cp.code() += "etiss_uint64 mem_val_0;\n";
167cp.code() += "cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\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() += "etiss_int64 res = (etiss_int64)(mem_val_0);\n";
177cp.code() += "etiss_coverage_count(4, 6993, 6992, 6990, 6989);\n";
178cp.code() += "etiss_coverage_count(1, 6994);\n";
179if ((rd % 32ULL) != 0LL) { // conditional
180cp.code() += "etiss_coverage_count(5, 7000, 6997, 6995, 6998, 6999);\n";
181cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)(res);\n";
182cp.code() += "etiss_coverage_count(6, 7009, 7005, 7004, 7002, 7008, 7006);\n";
183} // conditional
184cp.code() += "} // block\n";
185} // block
186cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
187cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
188// -----------------------------------------------------------------------------
189 cp.getAffectedRegisters().add("instructionPointer", 32);
190 }
191 {
193
194 cp.code() = std::string("//LD\n");
195
196// -----------------------------------------------------------------------------
197cp.code() += "if (cpu->return_pending || cpu->exception) return cpu->exception;\n";
198// -----------------------------------------------------------------------------
199 }
200
201 return true;
202 },
203 0,
204 [] (BitArray & ba, Instruction & instr)
205 {
206// -----------------------------------------------------------------------------
207etiss_uint8 rd = 0;
208static BitArrayRange R_rd_0(11, 7);
209rd += R_rd_0.read(ba) << 0;
210etiss_uint8 rs1 = 0;
211static BitArrayRange R_rs1_0(19, 15);
212rs1 += R_rs1_0.read(ba) << 0;
213etiss_uint16 imm = 0;
214static BitArrayRange R_imm_0(31, 20);
215imm += R_imm_0.read(ba) << 0;
216
217// -----------------------------------------------------------------------------
218
219 std::stringstream ss;
220// -----------------------------------------------------------------------------
221ss << "ld" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]");
222// -----------------------------------------------------------------------------
223 return ss.str();
224 }
225);
226
227// SD --------------------------------------------------------------------------
230 "sd",
231 (uint32_t) 0x003023,
232 (uint32_t) 0x00707f,
233 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
234 {
235
236// -----------------------------------------------------------------------------
237
238// -----------------------------------------------------------------------------
239
240// -----------------------------------------------------------------------------
241etiss_uint16 imm = 0;
242static BitArrayRange R_imm_0(11, 7);
243imm += R_imm_0.read(ba) << 0;
244etiss_uint8 rs1 = 0;
245static BitArrayRange R_rs1_0(19, 15);
246rs1 += R_rs1_0.read(ba) << 0;
247etiss_uint8 rs2 = 0;
248static BitArrayRange R_rs2_0(24, 20);
249rs2 += R_rs2_0.read(ba) << 0;
250static BitArrayRange R_imm_5(31, 25);
251imm += R_imm_5.read(ba) << 5;
252
253// -----------------------------------------------------------------------------
254
255 {
257
258 cp.code() = std::string("//SD\n");
259
260// -----------------------------------------------------------------------------
261cp.code() += "etiss_coverage_count(1, 186);\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_ + 4) + "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, 7032);\n";
271cp.code() += "{ // block\n";
272cp.code() += "etiss_uint64 offs = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
273cp.code() += "etiss_coverage_count(7, 7020, 7019, 7016, 7015, 7013, 7018, 7017);\n";
274cp.code() += "etiss_uint64 mem_val_0;\n";
275cp.code() += "mem_val_0 = (etiss_uint64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n";
276cp.code() += "etiss_coverage_count(7, 7031, 7023, 7022, 7030, 7028, 7027, 7025);\n";
277cp.code() += "cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\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("//SD\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_uint16 imm = 0;
310static BitArrayRange R_imm_0(11, 7);
311imm += R_imm_0.read(ba) << 0;
312etiss_uint8 rs1 = 0;
313static BitArrayRange R_rs1_0(19, 15);
314rs1 += R_rs1_0.read(ba) << 0;
315etiss_uint8 rs2 = 0;
316static BitArrayRange R_rs2_0(24, 20);
317rs2 += R_rs2_0.read(ba) << 0;
318static BitArrayRange R_imm_5(31, 25);
319imm += R_imm_5.read(ba) << 5;
320
321// -----------------------------------------------------------------------------
322
323 std::stringstream ss;
324// -----------------------------------------------------------------------------
325ss << "sd" << " # " << ba << (" [imm=" + std::to_string(imm) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
326// -----------------------------------------------------------------------------
327 return ss.str();
328 }
329);
330
331// SLLI ------------------------------------------------------------------------
334 "slli",
335 (uint32_t) 0x001013,
336 (uint32_t) 0xfc00707f,
337 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
338 {
339
340// -----------------------------------------------------------------------------
341
342// -----------------------------------------------------------------------------
343
344// -----------------------------------------------------------------------------
345etiss_uint8 rd = 0;
346static BitArrayRange R_rd_0(11, 7);
347rd += R_rd_0.read(ba) << 0;
348etiss_uint8 rs1 = 0;
349static BitArrayRange R_rs1_0(19, 15);
350rs1 += R_rs1_0.read(ba) << 0;
351etiss_uint8 shamt = 0;
352static BitArrayRange R_shamt_0(25, 20);
353shamt += R_shamt_0.read(ba) << 0;
354
355// -----------------------------------------------------------------------------
356
357 {
359
360 cp.code() = std::string("//SLLI\n");
361
362// -----------------------------------------------------------------------------
363cp.code() += "etiss_coverage_count(1, 187);\n";
364{ // block
365cp.code() += "etiss_coverage_count(1, 1169);\n";
366cp.code() += "{ // block\n";
367cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
368cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
369cp.code() += "} // block\n";
370} // block
371cp.code() += "etiss_coverage_count(1, 7033);\n";
372if ((rd % 32ULL) != 0LL) { // conditional
373cp.code() += "etiss_coverage_count(5, 7039, 7036, 7034, 7037, 7038);\n";
374cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] << " + std::to_string(shamt) + "ULL;\n";
375cp.code() += "etiss_coverage_count(9, 7052, 7044, 7043, 7041, 7051, 7049, 7048, 7046, 7050);\n";
376} // conditional
377cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
378cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
379// -----------------------------------------------------------------------------
380 cp.getAffectedRegisters().add("instructionPointer", 32);
381 }
382
383 return true;
384 },
385 0,
386 [] (BitArray & ba, Instruction & instr)
387 {
388// -----------------------------------------------------------------------------
389etiss_uint8 rd = 0;
390static BitArrayRange R_rd_0(11, 7);
391rd += R_rd_0.read(ba) << 0;
392etiss_uint8 rs1 = 0;
393static BitArrayRange R_rs1_0(19, 15);
394rs1 += R_rs1_0.read(ba) << 0;
395etiss_uint8 shamt = 0;
396static BitArrayRange R_shamt_0(25, 20);
397shamt += R_shamt_0.read(ba) << 0;
398
399// -----------------------------------------------------------------------------
400
401 std::stringstream ss;
402// -----------------------------------------------------------------------------
403ss << "slli" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
404// -----------------------------------------------------------------------------
405 return ss.str();
406 }
407);
408
409// SRLI ------------------------------------------------------------------------
412 "srli",
413 (uint32_t) 0x005013,
414 (uint32_t) 0xfc00707f,
415 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
416 {
417
418// -----------------------------------------------------------------------------
419
420// -----------------------------------------------------------------------------
421
422// -----------------------------------------------------------------------------
423etiss_uint8 rd = 0;
424static BitArrayRange R_rd_0(11, 7);
425rd += R_rd_0.read(ba) << 0;
426etiss_uint8 rs1 = 0;
427static BitArrayRange R_rs1_0(19, 15);
428rs1 += R_rs1_0.read(ba) << 0;
429etiss_uint8 shamt = 0;
430static BitArrayRange R_shamt_0(25, 20);
431shamt += R_shamt_0.read(ba) << 0;
432
433// -----------------------------------------------------------------------------
434
435 {
437
438 cp.code() = std::string("//SRLI\n");
439
440// -----------------------------------------------------------------------------
441cp.code() += "etiss_coverage_count(1, 188);\n";
442{ // block
443cp.code() += "etiss_coverage_count(1, 1169);\n";
444cp.code() += "{ // block\n";
445cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
446cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
447cp.code() += "} // block\n";
448} // block
449cp.code() += "etiss_coverage_count(1, 7053);\n";
450if ((rd % 32ULL) != 0LL) { // conditional
451cp.code() += "etiss_coverage_count(5, 7059, 7056, 7054, 7057, 7058);\n";
452cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] >> " + std::to_string(shamt) + "ULL;\n";
453cp.code() += "etiss_coverage_count(9, 7072, 7064, 7063, 7061, 7071, 7069, 7068, 7066, 7070);\n";
454} // conditional
455cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
456cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
457// -----------------------------------------------------------------------------
458 cp.getAffectedRegisters().add("instructionPointer", 32);
459 }
460
461 return true;
462 },
463 0,
464 [] (BitArray & ba, Instruction & instr)
465 {
466// -----------------------------------------------------------------------------
467etiss_uint8 rd = 0;
468static BitArrayRange R_rd_0(11, 7);
469rd += R_rd_0.read(ba) << 0;
470etiss_uint8 rs1 = 0;
471static BitArrayRange R_rs1_0(19, 15);
472rs1 += R_rs1_0.read(ba) << 0;
473etiss_uint8 shamt = 0;
474static BitArrayRange R_shamt_0(25, 20);
475shamt += R_shamt_0.read(ba) << 0;
476
477// -----------------------------------------------------------------------------
478
479 std::stringstream ss;
480// -----------------------------------------------------------------------------
481ss << "srli" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
482// -----------------------------------------------------------------------------
483 return ss.str();
484 }
485);
486
487// SRAI ------------------------------------------------------------------------
490 "srai",
491 (uint32_t) 0x40005013,
492 (uint32_t) 0xfc00707f,
493 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
494 {
495
496// -----------------------------------------------------------------------------
497
498// -----------------------------------------------------------------------------
499
500// -----------------------------------------------------------------------------
501etiss_uint8 rd = 0;
502static BitArrayRange R_rd_0(11, 7);
503rd += R_rd_0.read(ba) << 0;
504etiss_uint8 rs1 = 0;
505static BitArrayRange R_rs1_0(19, 15);
506rs1 += R_rs1_0.read(ba) << 0;
507etiss_uint8 shamt = 0;
508static BitArrayRange R_shamt_0(25, 20);
509shamt += R_shamt_0.read(ba) << 0;
510
511// -----------------------------------------------------------------------------
512
513 {
515
516 cp.code() = std::string("//SRAI\n");
517
518// -----------------------------------------------------------------------------
519cp.code() += "etiss_coverage_count(1, 189);\n";
520{ // block
521cp.code() += "etiss_coverage_count(1, 1169);\n";
522cp.code() += "{ // block\n";
523cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
524cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
525cp.code() += "} // block\n";
526} // block
527cp.code() += "etiss_coverage_count(1, 7073);\n";
528if ((rd % 32ULL) != 0LL) { // conditional
529cp.code() += "etiss_coverage_count(5, 7079, 7076, 7074, 7077, 7078);\n";
530cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = ((etiss_int64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) >> " + std::to_string(shamt) + "ULL;\n";
531cp.code() += "etiss_coverage_count(11, 7094, 7084, 7083, 7081, 7093, 7090, 7089, 7088, 7086, 7091, 7092);\n";
532} // conditional
533cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
534cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
535// -----------------------------------------------------------------------------
536 cp.getAffectedRegisters().add("instructionPointer", 32);
537 }
538
539 return true;
540 },
541 0,
542 [] (BitArray & ba, Instruction & instr)
543 {
544// -----------------------------------------------------------------------------
545etiss_uint8 rd = 0;
546static BitArrayRange R_rd_0(11, 7);
547rd += R_rd_0.read(ba) << 0;
548etiss_uint8 rs1 = 0;
549static BitArrayRange R_rs1_0(19, 15);
550rs1 += R_rs1_0.read(ba) << 0;
551etiss_uint8 shamt = 0;
552static BitArrayRange R_shamt_0(25, 20);
553shamt += R_shamt_0.read(ba) << 0;
554
555// -----------------------------------------------------------------------------
556
557 std::stringstream ss;
558// -----------------------------------------------------------------------------
559ss << "srai" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
560// -----------------------------------------------------------------------------
561 return ss.str();
562 }
563);
564
565// ADDIW -----------------------------------------------------------------------
568 "addiw",
569 (uint32_t) 0x00001b,
570 (uint32_t) 0x00707f,
571 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
572 {
573
574// -----------------------------------------------------------------------------
575
576// -----------------------------------------------------------------------------
577
578// -----------------------------------------------------------------------------
579etiss_uint8 rd = 0;
580static BitArrayRange R_rd_0(11, 7);
581rd += R_rd_0.read(ba) << 0;
582etiss_uint8 rs1 = 0;
583static BitArrayRange R_rs1_0(19, 15);
584rs1 += R_rs1_0.read(ba) << 0;
585etiss_uint16 imm = 0;
586static BitArrayRange R_imm_0(31, 20);
587imm += R_imm_0.read(ba) << 0;
588
589// -----------------------------------------------------------------------------
590
591 {
593
594 cp.code() = std::string("//ADDIW\n");
595
596// -----------------------------------------------------------------------------
597cp.code() += "etiss_coverage_count(1, 190);\n";
598{ // block
599cp.code() += "etiss_coverage_count(1, 1169);\n";
600cp.code() += "{ // block\n";
601cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
602cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
603cp.code() += "} // block\n";
604} // block
605{ // block
606cp.code() += "etiss_coverage_count(1, 7122);\n";
607cp.code() += "{ // block\n";
608cp.code() += "etiss_coverage_count(1, 7095);\n";
609if ((rd % 32ULL) != 0LL) { // conditional
610cp.code() += "etiss_coverage_count(5, 7101, 7098, 7096, 7099, 7100);\n";
611{ // block
612cp.code() += "etiss_coverage_count(1, 7121);\n";
613cp.code() += "{ // block\n";
614cp.code() += "etiss_int32 res = *((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL] + " + std::to_string(((etiss_int16)(((etiss_int16)imm) << (4)) >> (4))) + "LL;\n";
615cp.code() += "etiss_coverage_count(7, 7111, 7110, 7107, 7106, 7104, 7109, 7108);\n";
616cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(res);\n";
617cp.code() += "etiss_coverage_count(6, 7120, 7116, 7115, 7113, 7119, 7117);\n";
618cp.code() += "} // block\n";
619} // block
620} // conditional
621cp.code() += "} // block\n";
622} // block
623cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
624cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
625// -----------------------------------------------------------------------------
626 cp.getAffectedRegisters().add("instructionPointer", 32);
627 }
628
629 return true;
630 },
631 0,
632 [] (BitArray & ba, Instruction & instr)
633 {
634// -----------------------------------------------------------------------------
635etiss_uint8 rd = 0;
636static BitArrayRange R_rd_0(11, 7);
637rd += R_rd_0.read(ba) << 0;
638etiss_uint8 rs1 = 0;
639static BitArrayRange R_rs1_0(19, 15);
640rs1 += R_rs1_0.read(ba) << 0;
641etiss_uint16 imm = 0;
642static BitArrayRange R_imm_0(31, 20);
643imm += R_imm_0.read(ba) << 0;
644
645// -----------------------------------------------------------------------------
646
647 std::stringstream ss;
648// -----------------------------------------------------------------------------
649ss << "addiw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | imm=" + std::to_string(imm) + "]");
650// -----------------------------------------------------------------------------
651 return ss.str();
652 }
653);
654
655// SLLIW -----------------------------------------------------------------------
658 "slliw",
659 (uint32_t) 0x00101b,
660 (uint32_t) 0xfe00707f,
661 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
662 {
663
664// -----------------------------------------------------------------------------
665
666// -----------------------------------------------------------------------------
667
668// -----------------------------------------------------------------------------
669etiss_uint8 rd = 0;
670static BitArrayRange R_rd_0(11, 7);
671rd += R_rd_0.read(ba) << 0;
672etiss_uint8 rs1 = 0;
673static BitArrayRange R_rs1_0(19, 15);
674rs1 += R_rs1_0.read(ba) << 0;
675etiss_uint8 shamt = 0;
676static BitArrayRange R_shamt_0(24, 20);
677shamt += R_shamt_0.read(ba) << 0;
678
679// -----------------------------------------------------------------------------
680
681 {
683
684 cp.code() = std::string("//SLLIW\n");
685
686// -----------------------------------------------------------------------------
687cp.code() += "etiss_coverage_count(1, 191);\n";
688{ // block
689cp.code() += "etiss_coverage_count(1, 1169);\n";
690cp.code() += "{ // block\n";
691cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
692cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
693cp.code() += "} // block\n";
694} // block
695{ // block
696cp.code() += "etiss_coverage_count(1, 7153);\n";
697cp.code() += "{ // block\n";
698cp.code() += "etiss_coverage_count(1, 7123);\n";
699if ((rd % 32ULL) != 0LL) { // conditional
700cp.code() += "etiss_coverage_count(5, 7129, 7126, 7124, 7127, 7128);\n";
701{ // block
702cp.code() += "etiss_coverage_count(1, 7152);\n";
703cp.code() += "{ // block\n";
704cp.code() += "etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) << " + std::to_string(shamt) + "ULL;\n";
705cp.code() += "etiss_coverage_count(8, 7141, 7140, 7137, 7135, 7134, 7132, 7138, 7139);\n";
706cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";
707cp.code() += "etiss_coverage_count(7, 7151, 7146, 7145, 7143, 7150, 7148, 7147);\n";
708cp.code() += "} // block\n";
709} // block
710} // conditional
711cp.code() += "} // block\n";
712} // block
713cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
714cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
715// -----------------------------------------------------------------------------
716 cp.getAffectedRegisters().add("instructionPointer", 32);
717 }
718
719 return true;
720 },
721 0,
722 [] (BitArray & ba, Instruction & instr)
723 {
724// -----------------------------------------------------------------------------
725etiss_uint8 rd = 0;
726static BitArrayRange R_rd_0(11, 7);
727rd += R_rd_0.read(ba) << 0;
728etiss_uint8 rs1 = 0;
729static BitArrayRange R_rs1_0(19, 15);
730rs1 += R_rs1_0.read(ba) << 0;
731etiss_uint8 shamt = 0;
732static BitArrayRange R_shamt_0(24, 20);
733shamt += R_shamt_0.read(ba) << 0;
734
735// -----------------------------------------------------------------------------
736
737 std::stringstream ss;
738// -----------------------------------------------------------------------------
739ss << "slliw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
740// -----------------------------------------------------------------------------
741 return ss.str();
742 }
743);
744
745// SRLIW -----------------------------------------------------------------------
748 "srliw",
749 (uint32_t) 0x00501b,
750 (uint32_t) 0xfe00707f,
751 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
752 {
753
754// -----------------------------------------------------------------------------
755
756// -----------------------------------------------------------------------------
757
758// -----------------------------------------------------------------------------
759etiss_uint8 rd = 0;
760static BitArrayRange R_rd_0(11, 7);
761rd += R_rd_0.read(ba) << 0;
762etiss_uint8 rs1 = 0;
763static BitArrayRange R_rs1_0(19, 15);
764rs1 += R_rs1_0.read(ba) << 0;
765etiss_uint8 shamt = 0;
766static BitArrayRange R_shamt_0(24, 20);
767shamt += R_shamt_0.read(ba) << 0;
768
769// -----------------------------------------------------------------------------
770
771 {
773
774 cp.code() = std::string("//SRLIW\n");
775
776// -----------------------------------------------------------------------------
777cp.code() += "etiss_coverage_count(1, 192);\n";
778{ // block
779cp.code() += "etiss_coverage_count(1, 1169);\n";
780cp.code() += "{ // block\n";
781cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
782cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
783cp.code() += "} // block\n";
784} // block
785{ // block
786cp.code() += "etiss_coverage_count(1, 7184);\n";
787cp.code() += "{ // block\n";
788cp.code() += "etiss_coverage_count(1, 7154);\n";
789if ((rd % 32ULL) != 0LL) { // conditional
790cp.code() += "etiss_coverage_count(5, 7160, 7157, 7155, 7158, 7159);\n";
791{ // block
792cp.code() += "etiss_coverage_count(1, 7183);\n";
793cp.code() += "{ // block\n";
794cp.code() += "etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) >> " + std::to_string(shamt) + "ULL;\n";
795cp.code() += "etiss_coverage_count(8, 7172, 7171, 7168, 7166, 7165, 7163, 7169, 7170);\n";
796cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";
797cp.code() += "etiss_coverage_count(7, 7182, 7177, 7176, 7174, 7181, 7179, 7178);\n";
798cp.code() += "} // block\n";
799} // block
800} // conditional
801cp.code() += "} // block\n";
802} // block
803cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
804cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
805// -----------------------------------------------------------------------------
806 cp.getAffectedRegisters().add("instructionPointer", 32);
807 }
808
809 return true;
810 },
811 0,
812 [] (BitArray & ba, Instruction & instr)
813 {
814// -----------------------------------------------------------------------------
815etiss_uint8 rd = 0;
816static BitArrayRange R_rd_0(11, 7);
817rd += R_rd_0.read(ba) << 0;
818etiss_uint8 rs1 = 0;
819static BitArrayRange R_rs1_0(19, 15);
820rs1 += R_rs1_0.read(ba) << 0;
821etiss_uint8 shamt = 0;
822static BitArrayRange R_shamt_0(24, 20);
823shamt += R_shamt_0.read(ba) << 0;
824
825// -----------------------------------------------------------------------------
826
827 std::stringstream ss;
828// -----------------------------------------------------------------------------
829ss << "srliw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
830// -----------------------------------------------------------------------------
831 return ss.str();
832 }
833);
834
835// SRAIW -----------------------------------------------------------------------
838 "sraiw",
839 (uint32_t) 0x4000501b,
840 (uint32_t) 0xfe00707f,
841 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
842 {
843
844// -----------------------------------------------------------------------------
845
846// -----------------------------------------------------------------------------
847
848// -----------------------------------------------------------------------------
849etiss_uint8 rd = 0;
850static BitArrayRange R_rd_0(11, 7);
851rd += R_rd_0.read(ba) << 0;
852etiss_uint8 rs1 = 0;
853static BitArrayRange R_rs1_0(19, 15);
854rs1 += R_rs1_0.read(ba) << 0;
855etiss_uint8 shamt = 0;
856static BitArrayRange R_shamt_0(24, 20);
857shamt += R_shamt_0.read(ba) << 0;
858
859// -----------------------------------------------------------------------------
860
861 {
863
864 cp.code() = std::string("//SRAIW\n");
865
866// -----------------------------------------------------------------------------
867cp.code() += "etiss_coverage_count(1, 193);\n";
868{ // block
869cp.code() += "etiss_coverage_count(1, 1169);\n";
870cp.code() += "{ // block\n";
871cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
872cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
873cp.code() += "} // block\n";
874} // block
875{ // block
876cp.code() += "etiss_coverage_count(1, 7214);\n";
877cp.code() += "{ // block\n";
878cp.code() += "etiss_coverage_count(1, 7185);\n";
879if ((rd % 32ULL) != 0LL) { // conditional
880cp.code() += "etiss_coverage_count(5, 7191, 7188, 7186, 7189, 7190);\n";
881{ // block
882cp.code() += "etiss_coverage_count(1, 7213);\n";
883cp.code() += "{ // block\n";
884cp.code() += "etiss_int32 sh_val = ((etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) >> " + std::to_string(shamt) + "ULL;\n";
885cp.code() += "etiss_coverage_count(8, 7203, 7202, 7199, 7197, 7196, 7194, 7200, 7201);\n";
886cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)(sh_val);\n";
887cp.code() += "etiss_coverage_count(6, 7212, 7208, 7207, 7205, 7211, 7209);\n";
888cp.code() += "} // block\n";
889} // block
890} // conditional
891cp.code() += "} // block\n";
892} // block
893cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
894cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
895// -----------------------------------------------------------------------------
896 cp.getAffectedRegisters().add("instructionPointer", 32);
897 }
898
899 return true;
900 },
901 0,
902 [] (BitArray & ba, Instruction & instr)
903 {
904// -----------------------------------------------------------------------------
905etiss_uint8 rd = 0;
906static BitArrayRange R_rd_0(11, 7);
907rd += R_rd_0.read(ba) << 0;
908etiss_uint8 rs1 = 0;
909static BitArrayRange R_rs1_0(19, 15);
910rs1 += R_rs1_0.read(ba) << 0;
911etiss_uint8 shamt = 0;
912static BitArrayRange R_shamt_0(24, 20);
913shamt += R_shamt_0.read(ba) << 0;
914
915// -----------------------------------------------------------------------------
916
917 std::stringstream ss;
918// -----------------------------------------------------------------------------
919ss << "sraiw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | shamt=" + std::to_string(shamt) + "]");
920// -----------------------------------------------------------------------------
921 return ss.str();
922 }
923);
924
925// ADDW ------------------------------------------------------------------------
928 "addw",
929 (uint32_t) 0x00003b,
930 (uint32_t) 0xfe00707f,
931 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
932 {
933
934// -----------------------------------------------------------------------------
935
936// -----------------------------------------------------------------------------
937
938// -----------------------------------------------------------------------------
939etiss_uint8 rd = 0;
940static BitArrayRange R_rd_0(11, 7);
941rd += R_rd_0.read(ba) << 0;
942etiss_uint8 rs1 = 0;
943static BitArrayRange R_rs1_0(19, 15);
944rs1 += R_rs1_0.read(ba) << 0;
945etiss_uint8 rs2 = 0;
946static BitArrayRange R_rs2_0(24, 20);
947rs2 += R_rs2_0.read(ba) << 0;
948
949// -----------------------------------------------------------------------------
950
951 {
953
954 cp.code() = std::string("//ADDW\n");
955
956// -----------------------------------------------------------------------------
957cp.code() += "etiss_coverage_count(1, 194);\n";
958{ // block
959cp.code() += "etiss_coverage_count(1, 1169);\n";
960cp.code() += "{ // block\n";
961cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
962cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
963cp.code() += "} // block\n";
964} // block
965{ // block
966cp.code() += "etiss_coverage_count(1, 7249);\n";
967cp.code() += "{ // block\n";
968cp.code() += "etiss_coverage_count(1, 7215);\n";
969if ((rd % 32ULL) != 0LL) { // conditional
970cp.code() += "etiss_coverage_count(5, 7221, 7218, 7216, 7219, 7220);\n";
971{ // block
972cp.code() += "etiss_coverage_count(1, 7248);\n";
973cp.code() += "{ // block\n";
974cp.code() += "etiss_int32 res = (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) + (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n";
975cp.code() += "etiss_coverage_count(10, 7238, 7237, 7229, 7227, 7226, 7224, 7236, 7234, 7233, 7231);\n";
976cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(res);\n";
977cp.code() += "etiss_coverage_count(6, 7247, 7243, 7242, 7240, 7246, 7244);\n";
978cp.code() += "} // block\n";
979} // block
980} // conditional
981cp.code() += "} // block\n";
982} // block
983cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
984cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
985// -----------------------------------------------------------------------------
986 cp.getAffectedRegisters().add("instructionPointer", 32);
987 }
988
989 return true;
990 },
991 0,
992 [] (BitArray & ba, Instruction & instr)
993 {
994// -----------------------------------------------------------------------------
995etiss_uint8 rd = 0;
996static BitArrayRange R_rd_0(11, 7);
997rd += R_rd_0.read(ba) << 0;
998etiss_uint8 rs1 = 0;
999static BitArrayRange R_rs1_0(19, 15);
1000rs1 += R_rs1_0.read(ba) << 0;
1001etiss_uint8 rs2 = 0;
1002static BitArrayRange R_rs2_0(24, 20);
1003rs2 += R_rs2_0.read(ba) << 0;
1004
1005// -----------------------------------------------------------------------------
1006
1007 std::stringstream ss;
1008// -----------------------------------------------------------------------------
1009ss << "addw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
1010// -----------------------------------------------------------------------------
1011 return ss.str();
1012 }
1013);
1014
1015// SUBW ------------------------------------------------------------------------
1018 "subw",
1019 (uint32_t) 0x4000003b,
1020 (uint32_t) 0xfe00707f,
1021 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1022 {
1023
1024// -----------------------------------------------------------------------------
1025
1026// -----------------------------------------------------------------------------
1027
1028// -----------------------------------------------------------------------------
1029etiss_uint8 rd = 0;
1030static BitArrayRange R_rd_0(11, 7);
1031rd += R_rd_0.read(ba) << 0;
1032etiss_uint8 rs1 = 0;
1033static BitArrayRange R_rs1_0(19, 15);
1034rs1 += R_rs1_0.read(ba) << 0;
1035etiss_uint8 rs2 = 0;
1036static BitArrayRange R_rs2_0(24, 20);
1037rs2 += R_rs2_0.read(ba) << 0;
1038
1039// -----------------------------------------------------------------------------
1040
1041 {
1043
1044 cp.code() = std::string("//SUBW\n");
1045
1046// -----------------------------------------------------------------------------
1047cp.code() += "etiss_coverage_count(1, 195);\n";
1048{ // block
1049cp.code() += "etiss_coverage_count(1, 1169);\n";
1050cp.code() += "{ // block\n";
1051cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
1052cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1053cp.code() += "} // block\n";
1054} // block
1055{ // block
1056cp.code() += "etiss_coverage_count(1, 7284);\n";
1057cp.code() += "{ // block\n";
1058cp.code() += "etiss_coverage_count(1, 7250);\n";
1059if ((rd % 32ULL) != 0LL) { // conditional
1060cp.code() += "etiss_coverage_count(5, 7256, 7253, 7251, 7254, 7255);\n";
1061{ // block
1062cp.code() += "etiss_coverage_count(1, 7283);\n";
1063cp.code() += "{ // block\n";
1064cp.code() += "etiss_int32 res = (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL]) - (etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]);\n";
1065cp.code() += "etiss_coverage_count(10, 7273, 7272, 7264, 7262, 7261, 7259, 7271, 7269, 7268, 7266);\n";
1066cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(res);\n";
1067cp.code() += "etiss_coverage_count(6, 7282, 7278, 7277, 7275, 7281, 7279);\n";
1068cp.code() += "} // block\n";
1069} // block
1070} // conditional
1071cp.code() += "} // block\n";
1072} // block
1073cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1074cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1075// -----------------------------------------------------------------------------
1076 cp.getAffectedRegisters().add("instructionPointer", 32);
1077 }
1078
1079 return true;
1080 },
1081 0,
1082 [] (BitArray & ba, Instruction & instr)
1083 {
1084// -----------------------------------------------------------------------------
1085etiss_uint8 rd = 0;
1086static BitArrayRange R_rd_0(11, 7);
1087rd += R_rd_0.read(ba) << 0;
1088etiss_uint8 rs1 = 0;
1089static BitArrayRange R_rs1_0(19, 15);
1090rs1 += R_rs1_0.read(ba) << 0;
1091etiss_uint8 rs2 = 0;
1092static BitArrayRange R_rs2_0(24, 20);
1093rs2 += R_rs2_0.read(ba) << 0;
1094
1095// -----------------------------------------------------------------------------
1096
1097 std::stringstream ss;
1098// -----------------------------------------------------------------------------
1099ss << "subw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
1100// -----------------------------------------------------------------------------
1101 return ss.str();
1102 }
1103);
1104
1105// SLLW ------------------------------------------------------------------------
1108 "sllw",
1109 (uint32_t) 0x00103b,
1110 (uint32_t) 0xfe00707f,
1111 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1112 {
1113
1114// -----------------------------------------------------------------------------
1115
1116// -----------------------------------------------------------------------------
1117
1118// -----------------------------------------------------------------------------
1119etiss_uint8 rd = 0;
1120static BitArrayRange R_rd_0(11, 7);
1121rd += R_rd_0.read(ba) << 0;
1122etiss_uint8 rs1 = 0;
1123static BitArrayRange R_rs1_0(19, 15);
1124rs1 += R_rs1_0.read(ba) << 0;
1125etiss_uint8 rs2 = 0;
1126static BitArrayRange R_rs2_0(24, 20);
1127rs2 += R_rs2_0.read(ba) << 0;
1128
1129// -----------------------------------------------------------------------------
1130
1131 {
1133
1134 cp.code() = std::string("//SLLW\n");
1135
1136// -----------------------------------------------------------------------------
1137cp.code() += "etiss_coverage_count(1, 196);\n";
1138{ // block
1139cp.code() += "etiss_coverage_count(1, 1169);\n";
1140cp.code() += "{ // block\n";
1141cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
1142cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1143cp.code() += "} // block\n";
1144} // block
1145{ // block
1146cp.code() += "etiss_coverage_count(1, 7325);\n";
1147cp.code() += "{ // block\n";
1148cp.code() += "etiss_coverage_count(1, 7285);\n";
1149if ((rd % 32ULL) != 0LL) { // conditional
1150cp.code() += "etiss_coverage_count(5, 7291, 7288, 7286, 7289, 7290);\n";
1151{ // block
1152cp.code() += "etiss_coverage_count(1, 7324);\n";
1153cp.code() += "{ // block\n";
1154cp.code() += "etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) & 31ULL;\n";
1155cp.code() += "etiss_coverage_count(7, 7301, 7300, 7298, 7297, 7296, 7294, 7299);\n";
1156cp.code() += "etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) << count;\n";
1157cp.code() += "etiss_coverage_count(8, 7313, 7312, 7309, 7307, 7306, 7304, 7310, 7311);\n";
1158cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";
1159cp.code() += "etiss_coverage_count(7, 7323, 7318, 7317, 7315, 7322, 7320, 7319);\n";
1160cp.code() += "} // block\n";
1161} // block
1162} // conditional
1163cp.code() += "} // block\n";
1164} // block
1165cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1166cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1167// -----------------------------------------------------------------------------
1168 cp.getAffectedRegisters().add("instructionPointer", 32);
1169 }
1170
1171 return true;
1172 },
1173 0,
1174 [] (BitArray & ba, Instruction & instr)
1175 {
1176// -----------------------------------------------------------------------------
1177etiss_uint8 rd = 0;
1178static BitArrayRange R_rd_0(11, 7);
1179rd += R_rd_0.read(ba) << 0;
1180etiss_uint8 rs1 = 0;
1181static BitArrayRange R_rs1_0(19, 15);
1182rs1 += R_rs1_0.read(ba) << 0;
1183etiss_uint8 rs2 = 0;
1184static BitArrayRange R_rs2_0(24, 20);
1185rs2 += R_rs2_0.read(ba) << 0;
1186
1187// -----------------------------------------------------------------------------
1188
1189 std::stringstream ss;
1190// -----------------------------------------------------------------------------
1191ss << "sllw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
1192// -----------------------------------------------------------------------------
1193 return ss.str();
1194 }
1195);
1196
1197// SRLW ------------------------------------------------------------------------
1200 "srlw",
1201 (uint32_t) 0x00503b,
1202 (uint32_t) 0xfe00707f,
1203 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1204 {
1205
1206// -----------------------------------------------------------------------------
1207
1208// -----------------------------------------------------------------------------
1209
1210// -----------------------------------------------------------------------------
1211etiss_uint8 rd = 0;
1212static BitArrayRange R_rd_0(11, 7);
1213rd += R_rd_0.read(ba) << 0;
1214etiss_uint8 rs1 = 0;
1215static BitArrayRange R_rs1_0(19, 15);
1216rs1 += R_rs1_0.read(ba) << 0;
1217etiss_uint8 rs2 = 0;
1218static BitArrayRange R_rs2_0(24, 20);
1219rs2 += R_rs2_0.read(ba) << 0;
1220
1221// -----------------------------------------------------------------------------
1222
1223 {
1225
1226 cp.code() = std::string("//SRLW\n");
1227
1228// -----------------------------------------------------------------------------
1229cp.code() += "etiss_coverage_count(1, 197);\n";
1230{ // block
1231cp.code() += "etiss_coverage_count(1, 1169);\n";
1232cp.code() += "{ // block\n";
1233cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
1234cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1235cp.code() += "} // block\n";
1236} // block
1237{ // block
1238cp.code() += "etiss_coverage_count(1, 7366);\n";
1239cp.code() += "{ // block\n";
1240cp.code() += "etiss_coverage_count(1, 7326);\n";
1241if ((rd % 32ULL) != 0LL) { // conditional
1242cp.code() += "etiss_coverage_count(5, 7332, 7329, 7327, 7330, 7331);\n";
1243{ // block
1244cp.code() += "etiss_coverage_count(1, 7365);\n";
1245cp.code() += "{ // block\n";
1246cp.code() += "etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) & 31ULL;\n";
1247cp.code() += "etiss_coverage_count(7, 7342, 7341, 7339, 7338, 7337, 7335, 7340);\n";
1248cp.code() += "etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) >> count;\n";
1249cp.code() += "etiss_coverage_count(8, 7354, 7353, 7350, 7348, 7347, 7345, 7351, 7352);\n";
1250cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";
1251cp.code() += "etiss_coverage_count(7, 7364, 7359, 7358, 7356, 7363, 7361, 7360);\n";
1252cp.code() += "} // block\n";
1253} // block
1254} // conditional
1255cp.code() += "} // block\n";
1256} // block
1257cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1258cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1259// -----------------------------------------------------------------------------
1260 cp.getAffectedRegisters().add("instructionPointer", 32);
1261 }
1262
1263 return true;
1264 },
1265 0,
1266 [] (BitArray & ba, Instruction & instr)
1267 {
1268// -----------------------------------------------------------------------------
1269etiss_uint8 rd = 0;
1270static BitArrayRange R_rd_0(11, 7);
1271rd += R_rd_0.read(ba) << 0;
1272etiss_uint8 rs1 = 0;
1273static BitArrayRange R_rs1_0(19, 15);
1274rs1 += R_rs1_0.read(ba) << 0;
1275etiss_uint8 rs2 = 0;
1276static BitArrayRange R_rs2_0(24, 20);
1277rs2 += R_rs2_0.read(ba) << 0;
1278
1279// -----------------------------------------------------------------------------
1280
1281 std::stringstream ss;
1282// -----------------------------------------------------------------------------
1283ss << "srlw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
1284// -----------------------------------------------------------------------------
1285 return ss.str();
1286 }
1287);
1288
1289// SRAW ------------------------------------------------------------------------
1292 "sraw",
1293 (uint32_t) 0x4000503b,
1294 (uint32_t) 0xfe00707f,
1295 [] (BitArray & ba,etiss::CodeSet & cs,InstructionContext & ic)
1296 {
1297
1298// -----------------------------------------------------------------------------
1299
1300// -----------------------------------------------------------------------------
1301
1302// -----------------------------------------------------------------------------
1303etiss_uint8 rd = 0;
1304static BitArrayRange R_rd_0(11, 7);
1305rd += R_rd_0.read(ba) << 0;
1306etiss_uint8 rs1 = 0;
1307static BitArrayRange R_rs1_0(19, 15);
1308rs1 += R_rs1_0.read(ba) << 0;
1309etiss_uint8 rs2 = 0;
1310static BitArrayRange R_rs2_0(24, 20);
1311rs2 += R_rs2_0.read(ba) << 0;
1312
1313// -----------------------------------------------------------------------------
1314
1315 {
1317
1318 cp.code() = std::string("//SRAW\n");
1319
1320// -----------------------------------------------------------------------------
1321cp.code() += "etiss_coverage_count(1, 198);\n";
1322{ // block
1323cp.code() += "etiss_coverage_count(1, 1169);\n";
1324cp.code() += "{ // block\n";
1325cp.code() += "cpu->nextPc = " + std::to_string(ic.current_address_ + 4) + "ULL;\n";
1326cp.code() += "etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";
1327cp.code() += "} // block\n";
1328} // block
1329{ // block
1330cp.code() += "etiss_coverage_count(1, 7406);\n";
1331cp.code() += "{ // block\n";
1332cp.code() += "etiss_coverage_count(1, 7367);\n";
1333if ((rd % 32ULL) != 0LL) { // conditional
1334cp.code() += "etiss_coverage_count(5, 7373, 7370, 7368, 7371, 7372);\n";
1335{ // block
1336cp.code() += "etiss_coverage_count(1, 7405);\n";
1337cp.code() += "{ // block\n";
1338cp.code() += "etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs2 % 32ULL) + "ULL]) & 31ULL;\n";
1339cp.code() += "etiss_coverage_count(7, 7383, 7382, 7380, 7379, 7378, 7376, 7381);\n";
1340cp.code() += "etiss_int32 sh_val = ((etiss_int32)(*((RV64IMACFD*)cpu)->X[" + std::to_string(rs1 % 32ULL) + "ULL])) >> count;\n";
1341cp.code() += "etiss_coverage_count(8, 7395, 7394, 7391, 7389, 7388, 7386, 7392, 7393);\n";
1342cp.code() += "*((RV64IMACFD*)cpu)->X[" + std::to_string(rd % 32ULL) + "ULL] = (etiss_int64)(sh_val);\n";
1343cp.code() += "etiss_coverage_count(6, 7404, 7400, 7399, 7397, 7403, 7401);\n";
1344cp.code() += "} // block\n";
1345} // block
1346} // conditional
1347cp.code() += "} // block\n";
1348} // block
1349cp.code() += "instr_exit_" + std::to_string(ic.current_address_) + ":\n";
1350cp.code() += "cpu->instructionPointer = cpu->nextPc;\n";
1351// -----------------------------------------------------------------------------
1352 cp.getAffectedRegisters().add("instructionPointer", 32);
1353 }
1354
1355 return true;
1356 },
1357 0,
1358 [] (BitArray & ba, Instruction & instr)
1359 {
1360// -----------------------------------------------------------------------------
1361etiss_uint8 rd = 0;
1362static BitArrayRange R_rd_0(11, 7);
1363rd += R_rd_0.read(ba) << 0;
1364etiss_uint8 rs1 = 0;
1365static BitArrayRange R_rs1_0(19, 15);
1366rs1 += R_rs1_0.read(ba) << 0;
1367etiss_uint8 rs2 = 0;
1368static BitArrayRange R_rs2_0(24, 20);
1369rs2 += R_rs2_0.read(ba) << 0;
1370
1371// -----------------------------------------------------------------------------
1372
1373 std::stringstream ss;
1374// -----------------------------------------------------------------------------
1375ss << "sraw" << " # " << ba << (" [rd=" + std::to_string(rd) + " | rs1=" + std::to_string(rs1) + " | rs2=" + std::to_string(rs2) + "]");
1376// -----------------------------------------------------------------------------
1377 return ss.str();
1378 }
1379);
etiss::instr::InstructionGroup ISA32_RV64IMACFD("ISA32_RV64IMACFD", 32)
static InstructionDefinition lwu_rd_rs1_imm(ISA32_RV64IMACFD, "lwu",(uint32_t) 0x006003,(uint32_t) 0x00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//LWU\n");cp.code()+="etiss_coverage_count(1, 184);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 6976);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 offs = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] + "+std::to_string(((etiss_int16)(((etiss_int16) imm)<<(4)) > >(4)))+"LL;\n";cp.code()+="etiss_coverage_count(7, 6952, 6951, 6947, 6946, 6944, 6950, 6948);\n";cp.code()+="etiss_uint32 mem_val_0;\n";cp.code()+="cpu->exception |= (*(system->dread))(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()+="etiss_uint32 res = (etiss_uint32)(mem_val_0);\n";cp.code()+="etiss_coverage_count(4, 6959, 6958, 6956, 6955);\n";cp.code()+="etiss_coverage_count(1, 6960);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 6966, 6963, 6961, 6964, 6965);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)(res);\n";cp.code()+="etiss_coverage_count(6, 6975, 6971, 6970, 6968, 6974, 6972);\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("//LWU\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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;std::stringstream ss;ss<< "lwu"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | imm="+std::to_string(imm)+"]");return ss.str();})
static InstructionDefinition addw_rd_rs1_rs2(ISA32_RV64IMACFD, "addw",(uint32_t) 0x00003b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//ADDW\n");cp.code()+="etiss_coverage_count(1, 194);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7249);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7215);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7221, 7218, 7216, 7219, 7220);\n";{ cp.code()+="etiss_coverage_count(1, 7248);\n";cp.code()+="{ // block\n";cp.code()+="etiss_int32 res = (etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL]) + (etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]);\n";cp.code()+="etiss_coverage_count(10, 7238, 7237, 7229, 7227, 7226, 7224, 7236, 7234, 7233, 7231);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_int64)(res);\n";cp.code()+="etiss_coverage_count(6, 7247, 7243, 7242, 7240, 7246, 7244);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;std::stringstream ss;ss<< "addw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
static InstructionDefinition srai_rd_rs1_shamt(ISA32_RV64IMACFD, "srai",(uint32_t) 0x40005013,(uint32_t) 0xfc00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRAI\n");cp.code()+="etiss_coverage_count(1, 189);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 7073);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7079, 7076, 7074, 7077, 7078);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = ((etiss_int64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(11, 7094, 7084, 7083, 7081, 7093, 7090, 7089, 7088, 7086, 7091, 7092);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "srai"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition subw_rd_rs1_rs2(ISA32_RV64IMACFD, "subw",(uint32_t) 0x4000003b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SUBW\n");cp.code()+="etiss_coverage_count(1, 195);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7284);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7250);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7256, 7253, 7251, 7254, 7255);\n";{ cp.code()+="etiss_coverage_count(1, 7283);\n";cp.code()+="{ // block\n";cp.code()+="etiss_int32 res = (etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL]) - (etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]);\n";cp.code()+="etiss_coverage_count(10, 7273, 7272, 7264, 7262, 7261, 7259, 7271, 7269, 7268, 7266);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_int64)(res);\n";cp.code()+="etiss_coverage_count(6, 7282, 7278, 7277, 7275, 7281, 7279);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;std::stringstream ss;ss<< "subw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
static InstructionDefinition sllw_rd_rs1_rs2(ISA32_RV64IMACFD, "sllw",(uint32_t) 0x00103b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SLLW\n");cp.code()+="etiss_coverage_count(1, 196);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7325);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7285);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7291, 7288, 7286, 7289, 7290);\n";{ cp.code()+="etiss_coverage_count(1, 7324);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]) & 31ULL;\n";cp.code()+="etiss_coverage_count(7, 7301, 7300, 7298, 7297, 7296, 7294, 7299);\n";cp.code()+="etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) << count;\n";cp.code()+="etiss_coverage_count(8, 7313, 7312, 7309, 7307, 7306, 7304, 7310, 7311);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";cp.code()+="etiss_coverage_count(7, 7323, 7318, 7317, 7315, 7322, 7320, 7319);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;std::stringstream ss;ss<< "sllw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
static InstructionDefinition addiw_rd_rs1_imm(ISA32_RV64IMACFD, "addiw",(uint32_t) 0x00001b,(uint32_t) 0x00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//ADDIW\n");cp.code()+="etiss_coverage_count(1, 190);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7122);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7095);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7101, 7098, 7096, 7099, 7100);\n";{ cp.code()+="etiss_coverage_count(1, 7121);\n";cp.code()+="{ // block\n";cp.code()+="etiss_int32 res = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] + "+std::to_string(((etiss_int16)(((etiss_int16) imm)<<(4)) > >(4)))+"LL;\n";cp.code()+="etiss_coverage_count(7, 7111, 7110, 7107, 7106, 7104, 7109, 7108);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_int64)(res);\n";cp.code()+="etiss_coverage_count(6, 7120, 7116, 7115, 7113, 7119, 7117);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;std::stringstream ss;ss<< "addiw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | imm="+std::to_string(imm)+"]");return ss.str();})
static InstructionDefinition sraw_rd_rs1_rs2(ISA32_RV64IMACFD, "sraw",(uint32_t) 0x4000503b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRAW\n");cp.code()+="etiss_coverage_count(1, 198);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7406);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7367);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7373, 7370, 7368, 7371, 7372);\n";{ cp.code()+="etiss_coverage_count(1, 7405);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]) & 31ULL;\n";cp.code()+="etiss_coverage_count(7, 7383, 7382, 7380, 7379, 7378, 7376, 7381);\n";cp.code()+="etiss_int32 sh_val = ((etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) >> count;\n";cp.code()+="etiss_coverage_count(8, 7395, 7394, 7391, 7389, 7388, 7386, 7392, 7393);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_int64)(sh_val);\n";cp.code()+="etiss_coverage_count(6, 7404, 7400, 7399, 7397, 7403, 7401);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;std::stringstream ss;ss<< "sraw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
static InstructionDefinition srliw_rd_rs1_shamt(ISA32_RV64IMACFD, "srliw",(uint32_t) 0x00501b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRLIW\n");cp.code()+="etiss_coverage_count(1, 192);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7184);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7154);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7160, 7157, 7155, 7158, 7159);\n";{ cp.code()+="etiss_coverage_count(1, 7183);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(8, 7172, 7171, 7168, 7166, 7165, 7163, 7169, 7170);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";cp.code()+="etiss_coverage_count(7, 7182, 7177, 7176, 7174, 7181, 7179, 7178);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "srliw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition sd_imm_rs1_rs2(ISA32_RV64IMACFD, "sd",(uint32_t) 0x003023,(uint32_t) 0x00707f, [](BitArray &ba, etiss::CodeSet &cs, InstructionContext &ic) { etiss_uint16 imm=0;static BitArrayRange R_imm_0(11, 7);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;static BitArrayRange R_imm_5(31, 25);imm+=R_imm_5.read(ba)<< 5;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SD\n");cp.code()+="etiss_coverage_count(1, 186);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7032);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 offs = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] + "+std::to_string(((etiss_int16)(((etiss_int16) imm)<<(4)) > >(4)))+"LL;\n";cp.code()+="etiss_coverage_count(7, 7020, 7019, 7016, 7015, 7013, 7018, 7017);\n";cp.code()+="etiss_uint64 mem_val_0;\n";cp.code()+="mem_val_0 = (etiss_uint64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]);\n";cp.code()+="etiss_coverage_count(7, 7031, 7023, 7022, 7030, 7028, 7027, 7025);\n";cp.code()+="cpu->exception |= (*(system->dwrite))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\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("//SD\n");cp.code()+="if (cpu->return_pending || cpu->exception) return cpu->exception;\n";} return true;}, 0, [](BitArray &ba, Instruction &instr) { etiss_uint16 imm=0;static BitArrayRange R_imm_0(11, 7);imm+=R_imm_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;static BitArrayRange R_imm_5(31, 25);imm+=R_imm_5.read(ba)<< 5;std::stringstream ss;ss<< "sd"<< " # "<< ba<<(" [imm="+std::to_string(imm)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
static InstructionDefinition slliw_rd_rs1_shamt(ISA32_RV64IMACFD, "slliw",(uint32_t) 0x00101b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SLLIW\n");cp.code()+="etiss_coverage_count(1, 191);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7153);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7123);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7129, 7126, 7124, 7127, 7128);\n";{ cp.code()+="etiss_coverage_count(1, 7152);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) << "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(8, 7141, 7140, 7137, 7135, 7134, 7132, 7138, 7139);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";cp.code()+="etiss_coverage_count(7, 7151, 7146, 7145, 7143, 7150, 7148, 7147);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "slliw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition ld_rd_rs1_imm(ISA32_RV64IMACFD, "ld",(uint32_t) 0x003003,(uint32_t) 0x00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//LD\n");cp.code()+="etiss_coverage_count(1, 185);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7010);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint64 offs = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] + "+std::to_string(((etiss_int16)(((etiss_int16) imm)<<(4)) > >(4)))+"LL;\n";cp.code()+="etiss_coverage_count(7, 6986, 6985, 6982, 6981, 6979, 6984, 6983);\n";cp.code()+="etiss_uint64 mem_val_0;\n";cp.code()+="cpu->exception |= (*(system->dread))(system->handle, cpu, offs, (etiss_uint8*)&mem_val_0, 8);\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_int64 res = (etiss_int64)(mem_val_0);\n";cp.code()+="etiss_coverage_count(4, 6993, 6992, 6990, 6989);\n";cp.code()+="etiss_coverage_count(1, 6994);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7000, 6997, 6995, 6998, 6999);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)(res);\n";cp.code()+="etiss_coverage_count(6, 7009, 7005, 7004, 7002, 7008, 7006);\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("//LD\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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint16 imm=0;static BitArrayRange R_imm_0(31, 20);imm+=R_imm_0.read(ba)<< 0;std::stringstream ss;ss<< "ld"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | imm="+std::to_string(imm)+"]");return ss.str();})
static InstructionDefinition slli_rd_rs1_shamt(ISA32_RV64IMACFD, "slli",(uint32_t) 0x001013,(uint32_t) 0xfc00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SLLI\n");cp.code()+="etiss_coverage_count(1, 187);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 7033);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7039, 7036, 7034, 7037, 7038);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] << "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(9, 7052, 7044, 7043, 7041, 7051, 7049, 7048, 7046, 7050);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "slli"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition srli_rd_rs1_shamt(ISA32_RV64IMACFD, "srli",(uint32_t) 0x005013,(uint32_t) 0xfc00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRLI\n");cp.code()+="etiss_coverage_count(1, 188);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} cp.code()+="etiss_coverage_count(1, 7053);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7059, 7056, 7054, 7057, 7058);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = *((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL] >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(9, 7072, 7064, 7063, 7061, 7071, 7069, 7068, 7066, 7070);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(25, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "srli"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition sraiw_rd_rs1_shamt(ISA32_RV64IMACFD, "sraiw",(uint32_t) 0x4000501b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRAIW\n");cp.code()+="etiss_coverage_count(1, 193);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7214);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7185);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7191, 7188, 7186, 7189, 7190);\n";{ cp.code()+="etiss_coverage_count(1, 7213);\n";cp.code()+="{ // block\n";cp.code()+="etiss_int32 sh_val = ((etiss_int32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) >> "+std::to_string(shamt)+"ULL;\n";cp.code()+="etiss_coverage_count(8, 7203, 7202, 7199, 7197, 7196, 7194, 7200, 7201);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)(sh_val);\n";cp.code()+="etiss_coverage_count(6, 7212, 7208, 7207, 7205, 7211, 7209);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 shamt=0;static BitArrayRange R_shamt_0(24, 20);shamt+=R_shamt_0.read(ba)<< 0;std::stringstream ss;ss<< "sraiw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | shamt="+std::to_string(shamt)+"]");return ss.str();})
static InstructionDefinition srlw_rd_rs1_rs2(ISA32_RV64IMACFD, "srlw",(uint32_t) 0x00503b,(uint32_t) 0xfe00707f, [](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;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;{ CodePart &cp=cs.append(CodePart::INITIALREQUIRED);cp.code()=std::string("//SRLW\n");cp.code()+="etiss_coverage_count(1, 197);\n";{ cp.code()+="etiss_coverage_count(1, 1169);\n";cp.code()+="{ // block\n";cp.code()+="cpu->nextPc = "+std::to_string(ic.current_address_+4)+"ULL;\n";cp.code()+="etiss_coverage_count(5, 1168, 1164, 1167, 1165, 1166);\n";cp.code()+="} // block\n";} { cp.code()+="etiss_coverage_count(1, 7366);\n";cp.code()+="{ // block\n";cp.code()+="etiss_coverage_count(1, 7326);\n";if((rd % 32ULL) !=0LL) { cp.code()+="etiss_coverage_count(5, 7332, 7329, 7327, 7330, 7331);\n";{ cp.code()+="etiss_coverage_count(1, 7365);\n";cp.code()+="{ // block\n";cp.code()+="etiss_uint32 count = (etiss_uint64)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs2 % 32ULL)+"ULL]) & 31ULL;\n";cp.code()+="etiss_coverage_count(7, 7342, 7341, 7339, 7338, 7337, 7335, 7340);\n";cp.code()+="etiss_uint32 sh_val = ((etiss_uint32)(*((RV64IMACFD*)cpu)->X["+std::to_string(rs1 % 32ULL)+"ULL])) >> count;\n";cp.code()+="etiss_coverage_count(8, 7354, 7353, 7350, 7348, 7347, 7345, 7351, 7352);\n";cp.code()+="*((RV64IMACFD*)cpu)->X["+std::to_string(rd % 32ULL)+"ULL] = (etiss_uint64)((etiss_int32)(sh_val));\n";cp.code()+="etiss_coverage_count(7, 7364, 7359, 7358, 7356, 7363, 7361, 7360);\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 rd=0;static BitArrayRange R_rd_0(11, 7);rd+=R_rd_0.read(ba)<< 0;etiss_uint8 rs1=0;static BitArrayRange R_rs1_0(19, 15);rs1+=R_rs1_0.read(ba)<< 0;etiss_uint8 rs2=0;static BitArrayRange R_rs2_0(24, 20);rs2+=R_rs2_0.read(ba)<< 0;std::stringstream ss;ss<< "srlw"<< " # "<< ba<<(" [rd="+std::to_string(rd)+" | rs1="+std::to_string(rs1)+" | rs2="+std::to_string(rs2)+"]");return ss.str();})
int16_t etiss_int16
Definition types.h:89
uint8_t etiss_uint8
Definition types.h:87
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