diff options
author | liweiwei <liweiwei@iscas.ac.cn> | 2021-10-14 09:44:54 +0800 |
---|---|---|
committer | Weiwei Li <liweiwei@iscas.ac.cn> | 2022-08-04 10:04:50 +0800 |
commit | 7812b01154c6a2f19e0d4bc9f00e5d5fcb9aec22 (patch) | |
tree | 4ed9ecd9288840e51b6193ccc3562061d6e0e84d | |
parent | 5672c4a41ad7a9af011d385962c175a5a6012fd9 (diff) | |
download | spike-7812b01154c6a2f19e0d4bc9f00e5d5fcb9aec22.zip spike-7812b01154c6a2f19e0d4bc9f00e5d5fcb9aec22.tar.gz spike-7812b01154c6a2f19e0d4bc9f00e5d5fcb9aec22.tar.bz2 |
Add flags for Zfinx/Zdinx/Zhinx{min}
Hardwire mstatus_fs to zero when enable ZFinx
-rw-r--r-- | riscv/csrs.cc | 6 | ||||
-rw-r--r-- | riscv/isa_parser.cc | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/riscv/csrs.cc b/riscv/csrs.cc index 50cbfb3..fc5dce1 100644 --- a/riscv/csrs.cc +++ b/riscv/csrs.cc @@ -394,8 +394,8 @@ base_status_csr_t::base_status_csr_t(processor_t* const proc, const reg_t addr): reg_t base_status_csr_t::compute_sstatus_write_mask() const noexcept { // If a configuration has FS bits, they will always be accessible no // matter the state of misa. - const bool has_fs = proc->extension_enabled('S') || proc->extension_enabled('F') - || proc->extension_enabled('V'); + const bool has_fs = (proc->extension_enabled('S') || proc->extension_enabled('F') + || proc->extension_enabled('V')) && !proc->extension_enabled(EXT_ZFINX); const bool has_vs = proc->extension_enabled('V'); return 0 | (proc->extension_enabled('S') ? (SSTATUS_SIE | SSTATUS_SPIE | SSTATUS_SPP) : 0) @@ -1202,7 +1202,7 @@ float_csr_t::float_csr_t(processor_t* const proc, const reg_t addr, const reg_t void float_csr_t::verify_permissions(insn_t insn, bool write) const { masked_csr_t::verify_permissions(insn, write); require_fp; - if (!proc->extension_enabled('F')) + if (!proc->extension_enabled('F') && !proc->extension_enabled(EXT_ZFINX)) throw trap_illegal_instruction(insn.bits()); } diff --git a/riscv/isa_parser.cc b/riscv/isa_parser.cc index 6ac146b..ddb98c9 100644 --- a/riscv/isa_parser.cc +++ b/riscv/isa_parser.cc @@ -130,6 +130,18 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv) extension_table[EXT_ZBKC] = true; } else if (ext_str == "zbkx") { extension_table[EXT_ZBKX] = true; + } else if (ext_str == "zdinx") { + extension_table[EXT_ZFINX] = true; + extension_table[EXT_ZDINX] = true; + } else if (ext_str == "zfinx") { + extension_table[EXT_ZFINX] = true; + } else if (ext_str == "zhinx") { + extension_table[EXT_ZFINX] = true; + extension_table[EXT_ZHINX] = true; + extension_table[EXT_ZHINXMIN] = true; + } else if (ext_str == "zhinxmin") { + extension_table[EXT_ZFINX] = true; + extension_table[EXT_ZHINXMIN] = true; } else if (ext_str == "zk") { extension_table[EXT_ZBKB] = true; extension_table[EXT_ZBKC] = true; @@ -229,6 +241,10 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv) bad_isa_string(str, ("can't parse: " + std::string(p)).c_str()); } + if (extension_table[EXT_ZFINX] && ((max_isa >> ('f' - 'a')) & 1)) { + bad_isa_string(str, ("Zfinx/ZDinx/Zhinx{min} extensions conflict with Base 'F/D/Q/Zfh{min}' extensions")); + } + std::string lowercase = strtolower(priv); bool user = false, supervisor = false; |