Skip to content

Commit

Permalink
insts_base: ignore architecture in SFENCE_VMA
Browse files Browse the repository at this point in the history
architecture doesn't change the behavior, so there is no reason to
complicate the code with it.

The code is still suboptimal because of rhs duplication, so this should
be rewritten if (when) Sail supports multiple matches like:
  User    or (Supervisor if mstatus[TVM] == 0b1) => ...
  Machine or (Supervisor if mstatus[TVM] == 0b0) => ...

(Separately mapping those four cases into two and matching on the two is
 also an option, but I'm not sure it would be clearer.)

Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
  • Loading branch information
radimkrcmar authored and Timmmm committed Feb 10, 2025
1 parent 9fc6e8a commit f07976f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions model/riscv_insts_base.sail
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,9 @@ function clause execute SFENCE_VMA(rs1, rs2) = {
let asid = if rs2 != zreg then Some(X(rs2)[asidlen - 1 .. 0]) else None();
match cur_privilege {
User => { handle_illegal(); RETIRE_FAIL },
Supervisor => match (architecture(get_mstatus_SXL(mstatus)), mstatus[TVM]) {
(_, 0b1) => { handle_illegal(); RETIRE_FAIL },
(_, 0b0) => { flush_TLB(asid, addr); RETIRE_SUCCESS },
Supervisor => match mstatus[TVM] {
0b1 => { handle_illegal(); RETIRE_FAIL },
0b0 => { flush_TLB(asid, addr); RETIRE_SUCCESS },
},
Machine => { flush_TLB(asid, addr); RETIRE_SUCCESS }
}
Expand Down

0 comments on commit f07976f

Please sign in to comment.