From 14743958692de092c37f004fdc7d00a6383e0024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sintzoff?= <61976467+ASintzoff@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:10:40 +0100 Subject: [PATCH] decoder.sv: sfence.vma valid only if S mode supported (fix #1866) (#1869) --- core/decoder.sv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/decoder.sv b/core/decoder.sv index 0ebf6b981..4961e9523 100644 --- a/core/decoder.sv +++ b/core/decoder.sv @@ -221,8 +221,9 @@ module decoder default: begin if (instr.instr[31:25] == 7'b1001) begin // check privilege level, SFENCE.VMA can only be executed in M/S mode + // only if S mode is supported // otherwise decode an illegal instruction - illegal_instr = (((CVA6Cfg.RVS && priv_lvl_i == riscv::PRIV_LVL_S) || ((!CVA6Cfg.RVS && !CVA6Cfg.RVU) || priv_lvl_i == riscv::PRIV_LVL_M)) && instr.itype.rd == '0) ? 1'b0 : 1'b1; + illegal_instr = (CVA6Cfg.RVS && (priv_lvl_i inside {riscv::PRIV_LVL_M, riscv::PRIV_LVL_S}) && instr.itype.rd == '0) ? 1'b0 : 1'b1; instruction_o.op = ariane_pkg::SFENCE_VMA; // check TVM flag and intercept SFENCE.VMA call if necessary if (CVA6Cfg.RVS && priv_lvl_i == riscv::PRIV_LVL_S && tvm_i)