forked from chipsalliance/VeeR-ISS
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathIsa.cpp
569 lines (486 loc) · 17.5 KB
/
Isa.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
#include <algorithm>
#include <cassert>
#include <charconv>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include "Isa.hpp"
using namespace WdRiscv;
// Use this constant list to allow a compile-time check to ensure each extension has a
// value.
static constexpr auto STRING_EXT_PAIRS = std::to_array<std::pair<std::string_view, RvExtension>>({
{ "a", RvExtension::A },
{ "b", RvExtension::B },
{ "c", RvExtension::C },
{ "d", RvExtension::D },
{ "e", RvExtension::E },
{ "f", RvExtension::F },
{ "h", RvExtension::H },
{ "i", RvExtension::I },
{ "m", RvExtension::M },
{ "n", RvExtension::N },
{ "s", RvExtension::S },
{ "u", RvExtension::U },
{ "v", RvExtension::V },
{ "zba", RvExtension::Zba },
{ "zbb", RvExtension::Zbb },
{ "zbc", RvExtension::Zbc },
{ "zbs", RvExtension::Zbs },
{ "zfh", RvExtension::Zfh },
{ "zfhmin", RvExtension::Zfhmin },
{ "zlssegh", RvExtension::Zlsseg },
{ "zknd", RvExtension::Zknd },
{ "zkne", RvExtension::Zkne },
{ "zknh", RvExtension::Zknh },
{ "zbkb", RvExtension::Zbkb },
{ "zbkx", RvExtension::Zbkx },
{ "zksed", RvExtension::Zksed },
{ "zksh", RvExtension::Zksh },
{ "zkr", RvExtension::Zkr },
{ "svinval", RvExtension::Svinval },
{ "svnapot", RvExtension::Svnapot },
{ "zicbom", RvExtension::Zicbom },
{ "zicboz", RvExtension::Zicboz },
{ "zicbop", RvExtension::Zicbop },
{ "zawrs", RvExtension::Zawrs },
{ "zmmul", RvExtension::Zmmul },
{ "zvfh", RvExtension::Zvfh },
{ "zvfhmin", RvExtension::Zvfhmin },
{ "zvbb", RvExtension::Zvbb },
{ "zvbc", RvExtension::Zvbc },
{ "zvkg", RvExtension::Zvkg },
{ "zvkned", RvExtension::Zvkned },
{ "zvknha", RvExtension::Zvknha },
{ "zvknhb", RvExtension::Zvknhb },
{ "zvksed", RvExtension::Zvksed },
{ "zvksh", RvExtension::Zvksh },
{ "zvkb", RvExtension::Zvkb },
{ "zicond", RvExtension::Zicond },
{ "zca", RvExtension::Zca },
{ "zcb", RvExtension::Zcb },
{ "zcd", RvExtension::Zcd },
{ "zfa", RvExtension::Zfa },
{ "zfbfmin", RvExtension::Zfbfmin },
{ "zvfbfmin", RvExtension::Zvfbfmin },
{ "zvfbfwma", RvExtension::Zvfbfwma },
{ "zvqdot", RvExtension::Zvqdot },
{ "sstc", RvExtension::Sstc },
{ "svpbmt", RvExtension::Svpbmt },
{ "svadu", RvExtension::Svadu },
{ "svade", RvExtension::Svade },
{ "smaia", RvExtension::Smaia },
{ "ssaia", RvExtension::Ssaia },
{ "zacas", RvExtension::Zacas },
{ "zimop", RvExtension::Zimop },
{ "zcmop", RvExtension::Zcmop },
{ "smrnmi", RvExtension::Smrnmi },
{ "zicsr", RvExtension::Zicsr },
{ "zicntr", RvExtension::Zicntr },
{ "zihpm", RvExtension::Zihpm },
{ "zifencei", RvExtension::Zifencei },
{ "zihintpause", RvExtension::Zihintpause },
{ "smmpm", RvExtension::Smmpm },
{ "ssnpm", RvExtension::Ssnpm },
{ "smnpm", RvExtension::Smnpm },
{ "sscofpmf", RvExtension::Sscofpmf },
{ "smstateen", RvExtension::Smstateen },
{ "ssqosid", RvExtension::Ssqosid },
{ "sdtrig", RvExtension::Sdtrig },
{ "zicfilp", RvExtension::Zicfilp },
{ "zic64b", RvExtension::Zic64b },
{ "ziccamoa", RvExtension::Ziccamoa },
{ "ziccif", RvExtension::Ziccif },
{ "zicclsm", RvExtension::Zicclsm },
{ "ziccrse", RvExtension::Ziccrse },
{ "za64rs", RvExtension::Za64rs },
{ "zaamo", RvExtension::Zaamo },
{ "zalrsc", RvExtension::Zalrsc },
{ "zihintntl", RvExtension::Zihintntl },
});
static_assert(STRING_EXT_PAIRS.size() == static_cast<unsigned>(RvExtension::None));
const std::unordered_map<std::string_view, RvExtension> Isa::stringToExt_(STRING_EXT_PAIRS.cbegin(),
STRING_EXT_PAIRS.cend());
// Use this function to do the constant initialization to allow use of indices
template <size_t N, unsigned (*TO_INDEX)(RvExtension)>
static constexpr std::array<std::string_view, N>
buildExtToStr()
{
std::array<std::string_view, N> extToString;
for (auto&& [name, id] : STRING_EXT_PAIRS)
{
extToString.at(TO_INDEX(id)) = name;
}
return extToString;
}
const std::array<std::string_view, Isa::extIx(RvExtension::None)> Isa::extToString_ =
buildExtToStr<Isa::extIx(RvExtension::None), Isa::extIx>();
Isa::Isa()
{
infoVec_.at(extIx(RvExtension::A)) = Info{ {{2,0}, {2,1}}, {2,1} };
infoVec_.at(extIx(RvExtension::B)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::C)) = Info{ {{1,0}, {2,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::D)) = Info{ {{2,2}}, {2,2} };
infoVec_.at(extIx(RvExtension::E)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::F)) = Info{ {{2,2}}, {2,2} };
infoVec_.at(extIx(RvExtension::H)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::I)) = Info{ {{2,0}, {2,1}}, {2,1} };
infoVec_.at(extIx(RvExtension::M)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::S)) = Info{ {{1,2}}, {1,2} };
infoVec_.at(extIx(RvExtension::U)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::V)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zba)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zbb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zbc)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zbs)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zfh)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zca)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zcb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zcd)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zfa)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zfhmin)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zlsseg)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zknd)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zkne)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zknh)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zbkb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zbkx)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zksed)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zksh)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zkr)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Svinval)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Svnapot)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicbom)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicboz)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicbop)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zawrs)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zmmul)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvfh)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvkb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvkg)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvkned)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvknhb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicond)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvfhmin)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zfbfmin)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvfbfmin)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvfbfwma)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvbb)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvbc)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zvqdot)) = Info{ {{0,1}}, {0,1} };
infoVec_.at(extIx(RvExtension::Sstc)) = Info{ {{0,5}}, {0,5} };
infoVec_.at(extIx(RvExtension::Svpbmt)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Svadu)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Svade)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Smaia)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Ssaia)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zacas)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zimop)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zcmop)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Smrnmi)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicsr)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::Zicntr)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::Zihpm)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::Zifencei)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::Zihintpause)) = Info{ {{2,0}}, {2,0} };
infoVec_.at(extIx(RvExtension::Smmpm)) = Info { {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Ssnpm)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Smnpm)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Sscofpmf)) = Info{ {{0,5}}, {0,5} };
infoVec_.at(extIx(RvExtension::Ssqosid)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Sdtrig)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicfilp)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zic64b)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Ziccamoa)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Ziccif)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zicclsm)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Ziccrse)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Za64rs)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zaamo)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zalrsc)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::Zihintntl)) = Info{ {{1,0}}, {1,0} };
infoVec_.at(extIx(RvExtension::I)).enabled = true; // I always enabled.
}
bool
Isa::selectVersion(RvExtension ext, unsigned version, unsigned subversion)
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
Info& info = infoVec_.at(ix);
if (not info.supported)
return false;
VersionPair target{version, subversion};
for (auto& vp : info.versions)
if (vp == target)
{
info.selected = target;
return true;
}
return false;
}
bool
Isa::isSupported(RvExtension ext) const
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
const Info& info = infoVec_.at(ix);
return info.supported;
}
bool
Isa::isSupported(RvExtension ext, unsigned version, unsigned subversion) const
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
const Info& info = infoVec_.at(ix);
if (not info.supported)
return false;
return std::ranges::any_of(info.versions,
[version, subversion](const auto& vp) {
return vp.first == version and vp.second == subversion;
});
}
bool
Isa::getDefaultVersion(RvExtension ext, unsigned& version, unsigned& subversion) const
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
const Info& info = infoVec_.at(ix);
if (not info.supported)
return false;
version = info.dflt.first;
subversion = info.dflt.second;
return true;
}
bool
Isa::getVersion(RvExtension ext, unsigned& version) const
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
const Info& info = infoVec_.at(ix);
if (not info.supported)
return false;
version = info.selected.first;
return true;
}
bool
Isa::getVersion(RvExtension ext, unsigned& version, unsigned& subversion) const
{
unsigned ix = extIx(ext);
if (ix >= infoVec_.size())
return false;
const Info& info = infoVec_.at(ix);
if (not info.supported)
return false;
version = info.selected.first;
subversion = info.selected.second;
return true;
}
RvExtension
Isa::stringToExtension(std::string_view str)
{
const auto iter = stringToExt_.find(str);
if (iter == stringToExt_.end())
return RvExtension::None;
return iter->second;
}
std::string_view
Isa::extensionToString(RvExtension ext)
{
unsigned ix = extIx(ext);
return ix < extToString_.size()? extToString_.at(ix) : "";
}
/// Parse a string of the form <ext>[<n>p<m>] into <ext>, <n>, and <m>.
/// Return true on success and false on failure.
/// Example strings: a, m1p0
bool
parseIsa(const std::string_view& token, std::string_view& extension,
std::string_view& version, std::string_view& subversion)
{
if (token.empty() or std::isdigit(token.at(0)))
{
std::cerr << "Invalid ISA extension: " << token << '\n';
return false;
}
size_t len = token.size();
// Look for first non-digit from the end of the token.
unsigned ix = len;
while (ix > 0 and std::isdigit(token.at(ix - 1)))
ix--;
if (ix == len or ix == 0)
{
extension = token; // No digits at end of token.
return true;
}
if (token.at(ix - 1) != 'p') // Trailing digits but no 'p'
{
std::cerr << "Invalid ISA extension: " << token << '\n';
return false;
}
size_t pIx = ix - 1;
// Skip all the digits before 'p'
ix = pIx;
while (ix > 0 and std::isdigit(token.at(ix - 1)))
ix--;
if (ix == 0 or ix == pIx) // Token is: <digits>p<digits> or <string>p<digits>
{
std::cerr << "Invalid ISA extension: " << token << '\n';
return false;
}
extension = token.substr(0, ix);
version = token.substr(ix, pIx - ix);
subversion = token.substr(pIx + 1);
return true;
}
// Extract optional version. If next character is a digit, extract
// version and subversion: a sequence of decimal digits followed by a
// 'p' followed by another sequence of decimal digits. Return true on
// success.
bool
extractVersion(std::string_view isa, size_t& i, std::string_view& version,
std::string_view& subversion)
{
size_t len = isa.size();
if (i >= len)
return true;
if (not std::isdigit(isa.at(i)))
return true;
size_t j = i;
for ( ; i < len and std::isdigit(isa.at(i)); i++)
;
version = isa.substr(j, i - j);
if (i >= len or isa.at(i) != 'p')
return false;
i++;
j = i;
for ( ; i < len and std::isdigit(isa.at(i)); i++)
;
subversion = isa.substr(j, i - j);
return i > j;
}
bool
Isa::configIsa(std::string_view isa)
{
return applyIsaString(isa);
}
static bool
isLongExtension(std::string_view str)
{
if (str.size() < 2)
return false;
if (str.at(0) == 'z')
return true;
if (str.at(0) == 's' and not std::isdigit(str.at(1)))
return true;
return false;
}
static
void splitFirstIsaToken(const std::string& tok, std::vector<std::string>& parts)
{
parts.clear();
if (tok.empty())
return;
size_t prev = 0;
for (size_t i = 0; i < tok.size(); ++i)
{
char c = tok.at(i);
if (c == 'z')
{
if (i > 0)
parts.push_back(tok.substr(prev, i-prev));
parts.push_back(tok.substr(i));
return;
}
if (std::isalpha(c) and i > prev and (c != 'p' or not std::isdigit(tok.at(i-1))))
{
parts.push_back(tok.substr(prev, i-prev));
prev = i;
}
}
parts.push_back(tok.substr(prev));
}
bool
Isa::applyIsaString(std::string_view isaStr)
{
using RVE = RvExtension;
std::string_view isa = isaStr;
// Check and skip rv prefix.
if (isa.starts_with("rv32") or isa.starts_with("rv64"))
isa = isa.substr(4);
else if (isa.starts_with("rv") and isa.size() > 2 and std::isdigit(isa.at(2)))
{
std::cerr << "Unsupported ISA: " << isaStr << '\n';
return false;
}
// Split string around '_'.
std::vector<std::string> tokens;
boost::split(tokens, isa, boost::is_any_of("_"));
if (tokens.empty() or (tokens.size() == 1 and tokens[0].empty()))
{
std::cerr << "Invalid ISA string: " << isaStr << '\n';
return false;
}
// First token may have a z-extension without a preceeding underscore. Spilt it:
// split something like a1p0m1p1zbb into: a1p0, m1p1 and zbb
if (not tokens.empty() and not tokens.at(0).empty())
{
std::vector<std::string> parts;
splitFirstIsaToken(tokens.at(0), parts);
if (not parts.empty())
parts.insert(parts.end(), tokens.begin() + 1, tokens.end());
std::swap(tokens, parts);
}
// Once we see a Z (e.g zbb) or S (e.g. sstc) token, then remaining tokens must
// be Z or S.
bool hasLong = false;
for (const auto& token : tokens)
{
if (token.empty())
continue;
std::string_view extension, version, subversion;
if (isLongExtension(token))
hasLong = true;
else if (hasLong and (not isLongExtension(token)))
{
std::cerr << "Misordered ISA: Z/S multi-char extensions must "
<< "be at end: " << isaStr << '\n';
return false;
}
if (not parseIsa(token, extension, version, subversion))
return false;
RVE ext = stringToExtension(extension);
if (ext == RVE::None)
{
std::cerr << "Unknown extension: " << extension << " -- ignored\n";
continue;
}
enable(ext, true);
if (ext == RVE::B)
for (RVE subExt : { RVE::Zba, RVE::Zbb, RVE::Zbs } )
enable(subExt, true);
if (version.empty())
continue;
unsigned v = 0;
std::from_chars(version.begin(), version.end(), v);
unsigned s = 0;
if (not subversion.empty())
std::from_chars(subversion.begin(), subversion.end(), s);
if (not selectVersion(ext, v, s))
{
getDefaultVersion(ext, v, s);
selectVersion(ext, v, s);
std::cerr << "Version " << version << "." << subversion
<< " of extension " << extension << " is not "
<< "supported -- using default\n";
}
}
if (isEnabled(RvExtension::S) and not isEnabled(RvExtension::U))
{
std::cerr << "Having supervisor mode without user mode is not a legal architectural state."
<< "Therefore, if 's' is included in the ISA string, 'u' must be as well.\n";
return false;
}
return true;
}