Skip to content

Commit

Permalink
Add Svinval extension.
Browse files Browse the repository at this point in the history
These changes add the "Svinval" Standard Extension for Fine-Grained
Address-Translation Cache Invalidation, Version 1.0 to the sail-riscv
model.

This extension defines five new instructions: SINVAL.VMA,
SFENCE.W.INVAL, SFENCE.INVAL.IR, HINVAL.VVMA, HINVAL.GVMA.

HINVAL.VVMA & HINVAL.GVMA are omitted since they build on the
Hypervisor Extension which is yet to be included in the model.

SFENCE.W.INVAL & SFENCE.INVAL.IR are treated as nops pending
integration of the coherency model (rmem) with sail.

The specification says that SINVAL.VMA behaves just as SFENCE.VMA,
except there are additional ordering constraints with respect to the
new SFENCE.W.INVAL & SFENCE.INVAL.IR instructions. Since these are
nops, we can treat SINVAL.VMA as if it were SFENCE.VMA.

Co-authored-by: Kristin Barber <kristinbarber@google.com>
  • Loading branch information
2 people authored and billmcspadden-riscv committed May 8, 2024
1 parent 418cf12 commit 5c55b5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion c_emulator/riscv_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const char *RV32ISA = "RV32IMAC";
#define OPT_ENABLE_WRITABLE_FIOM 1001
#define OPT_PMP_COUNT 1002
#define OPT_PMP_GRAIN 1003
#define OPT_ENABLE_SVINVAL 10017
#define OPT_ENABLE_SVINVAL 1004
#define OPT_ENABLE_ZCB 10014

static bool do_dump_dts = false;
Expand Down
4 changes: 2 additions & 2 deletions model/riscv_insts_svinval.sail
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mapping clause encdec =
function clause execute SFENCE_W_INVAL() = {
if cur_privilege == User
then { handle_illegal(); RETIRE_FAIL }
else { RETIRE_SUCCESS }
else { RETIRE_SUCCESS } // Implemented as no-op as all memory operations are visible immediately the current Sail model
}

mapping clause assembly = SFENCE_W_INVAL() <-> "sfence.w.inval"
Expand All @@ -46,7 +46,7 @@ mapping clause encdec =
function clause execute SFENCE_INVAL_IR() = {
if cur_privilege == User
then { handle_illegal(); RETIRE_FAIL }
else { RETIRE_SUCCESS }
else { RETIRE_SUCCESS } // Implemented as no-op as all memory operations are visible immediately in current Sail model
}

mapping clause assembly = SFENCE_INVAL_IR() <-> "sfence.inval.ir"

0 comments on commit 5c55b5b

Please sign in to comment.