aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--disasm/isa_parser.cc37
-rw-r--r--riscv/isa_parser.h4
2 files changed, 40 insertions, 1 deletions
diff --git a/disasm/isa_parser.cc b/disasm/isa_parser.cc
index 7c607d7..f1ba9f3 100644
--- a/disasm/isa_parser.cc
+++ b/disasm/isa_parser.cc
@@ -38,6 +38,11 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
else
bad_isa_string(str, "ISA strings must begin with RV32 or RV64");
+ vlen = 0;
+ elen = 0;
+ zvf = false;
+ zvd = false;
+
switch (isa_string[4]) {
case 'g':
// G = IMAFD_Zicsr_Zifencei, but Spike includes the latter two
@@ -70,7 +75,8 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
}
switch (*p) {
- case 'v': // even rv32iv implies double float
+ case 'v': vlen = 128; elen = 64; zvf = true; zvd = true;
+ // even rv32iv implies double float
case 'q': extension_table['D'] = true;
// Fall through
case 'd': extension_table['F'] = true;
@@ -314,6 +320,35 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
extension_table[EXT_ZICFILP] = true;
} else if (ext_str == "zicfiss") {
extension_table[EXT_ZICFISS] = true;
+ } else if (ext_str.substr(0, 3) == "zvl") {
+ reg_t new_vlen;
+ try {
+ new_vlen = std::stol(ext_str.substr(3, ext_str.size() - 4));
+ } catch (std::logic_error& e) {
+ new_vlen = 0;
+ }
+ if ((new_vlen & (new_vlen - 1)) != 0 || new_vlen < 32)
+ bad_isa_string(str, ("Invalid Zvl string: " + ext_str).c_str());
+ vlen = std::max(vlen, new_vlen);
+ } else if (ext_str.substr(0, 3) == "zve") {
+ reg_t new_elen;
+ try {
+ new_elen = std::stol(ext_str.substr(3, ext_str.size() - 4));
+ } catch (std::logic_error& e) {
+ new_elen = 0;
+ }
+ if (ext_str.substr(5) == "d") {
+ zvd |= true; zvf |= true;
+ } else if (ext_str.substr(5) == "f") {
+ zvf |= true;
+ } else if (ext_str.substr(5) == "x") {
+ /* do nothing */
+ } else {
+ new_elen = 0;
+ }
+ if (new_elen != 32 && new_elen != 64)
+ bad_isa_string(str, ("Invalid Zve string: " + ext_str).c_str());
+ elen = std::max(elen, new_elen);
} else if (ext_str[0] == 'x') {
extension_table['X'] = true;
if (ext_str.size() == 1) {
diff --git a/riscv/isa_parser.h b/riscv/isa_parser.h
index ae9ed94..8aee293 100644
--- a/riscv/isa_parser.h
+++ b/riscv/isa_parser.h
@@ -116,6 +116,10 @@ public:
protected:
unsigned max_xlen;
reg_t max_isa;
+ reg_t vlen;
+ reg_t elen;
+ bool zvf;
+ bool zvd;
std::bitset<NUM_ISA_EXTENSIONS> extension_table;
std::string isa_string;
std::set<std::string> extensions;