diff options
author | Andrew Waterman <andrew@sifive.com> | 2023-01-13 14:21:15 -0800 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2023-01-13 14:55:47 -0800 |
commit | 830324dcd2fc75adc621939eed5a6639c62075bf (patch) | |
tree | 3846353050bae80fcfaebfbec27dd6e39202bd98 | |
parent | 23718cb9b1ef2447b765e0b8cafb2ad15b469135 (diff) | |
download | spike-830324dcd2fc75adc621939eed5a6639c62075bf.zip spike-830324dcd2fc75adc621939eed5a6639c62075bf.tar.gz spike-830324dcd2fc75adc621939eed5a6639c62075bf.tar.bz2 |
Lift artificial limit of 191 extensions
Add new accessors that accept the isa_extension_t enum.
Retain the original ones that accept unsigned char to avoid churn.
-rw-r--r-- | riscv/isa_parser.cc | 2 | ||||
-rw-r--r-- | riscv/isa_parser.h | 4 | ||||
-rw-r--r-- | riscv/processor.h | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/riscv/isa_parser.cc b/riscv/isa_parser.cc index 9893c8a..9600a69 100644 --- a/riscv/isa_parser.cc +++ b/riscv/isa_parser.cc @@ -28,7 +28,7 @@ static void bad_priv_string(const char* priv) } isa_parser_t::isa_parser_t(const char* str, const char *priv) - : extension_table(256, false) + : extension_table(NUM_ISA_EXTENSIONS, false) { isa_string = strtolower(str); const char* all_subsets = "mafdqchpv"; diff --git a/riscv/isa_parser.h b/riscv/isa_parser.h index 1426e42..69df34a 100644 --- a/riscv/isa_parser.h +++ b/riscv/isa_parser.h @@ -62,6 +62,7 @@ typedef enum { EXT_XZBR, EXT_XZBT, EXT_SSTC, + NUM_ISA_EXTENSIONS } isa_extension_t; typedef enum { @@ -83,6 +84,9 @@ public: reg_t get_max_isa() const { return max_isa; } std::string get_isa_string() const { return isa_string; } bool extension_enabled(unsigned char ext) const { + return extension_enabled(isa_extension_t(ext)); + } + bool extension_enabled(isa_extension_t ext) const { if (ext >= 'A' && ext <= 'Z') return (max_isa >> (ext - 'A')) & 1; else diff --git a/riscv/processor.h b/riscv/processor.h index c03f2de..5daa6f4 100644 --- a/riscv/processor.h +++ b/riscv/processor.h @@ -217,6 +217,9 @@ public: return !custom_extensions.empty(); } bool extension_enabled(unsigned char ext) const { + return extension_enabled(isa_extension_t(ext)); + } + bool extension_enabled(isa_extension_t ext) const { if (ext >= 'A' && ext <= 'Z') return state.misa->extension_enabled(ext); else @@ -226,6 +229,9 @@ public: // possibly be disabled dynamically. Useful for documenting // assumptions about writable misa bits. bool extension_enabled_const(unsigned char ext) const { + return extension_enabled_const(isa_extension_t(ext)); + } + bool extension_enabled_const(isa_extension_t ext) const { if (ext >= 'A' && ext <= 'Z') return state.misa->extension_enabled_const(ext); else |