decoder.sv: sfence.vma valid only if S mode supported (fix #1866) (#1869)

This commit is contained in:
André Sintzoff 2024-02-23 23:10:40 +01:00 committed by GitHub
parent f332688fc0
commit 1474395869
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)