Skip to content

Commit

Permalink
decoder.sv: sfence.vma valid only if S mode supported (fix openhwgrou…
Browse files Browse the repository at this point in the history
  • Loading branch information
ASintzoff authored Feb 23, 2024
1 parent f332688 commit 1474395
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1474395

Please sign in to comment.