aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Berger <contact@martinfriedrichberger.net>2024-04-30 00:47:04 +0100
committerBill McSpadden <bill@riscv.org>2024-05-07 19:56:04 -0500
commit418cf128bf212058dfc6a9a3d952edf2a61ce920 (patch)
tree7a88a31f95bda7f68e60f39f8b7937f4d8a767f5
parent0f2f54cb43c1fe84da1d1cd2f96ea6a0500c93d4 (diff)
downloadsail-riscv-418cf128bf212058dfc6a9a3d952edf2a61ce920.zip
sail-riscv-418cf128bf212058dfc6a9a3d952edf2a61ce920.tar.gz
sail-riscv-418cf128bf212058dfc6a9a3d952edf2a61ce920.tar.bz2
fixup! fixup! fixup! Add Svinval extension.
-rw-r--r--Makefile2
-rw-r--r--model/riscv_insts_base.sail46
-rw-r--r--model/riscv_insts_svinval.sail52
3 files changed, 54 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 7068968..a7e441e 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@ SAIL_DEFAULT_INST = riscv_insts_base.sail riscv_insts_aext.sail riscv_insts_cext
SAIL_DEFAULT_INST += riscv_insts_fext.sail riscv_insts_cfext.sail
SAIL_DEFAULT_INST += riscv_insts_dext.sail riscv_insts_cdext.sail
+SAIL_DEFAULT_INST += riscv_insts_svinval.sail
+
SAIL_DEFAULT_INST += riscv_insts_zba.sail
SAIL_DEFAULT_INST += riscv_insts_zbb.sail
SAIL_DEFAULT_INST += riscv_insts_zbc.sail
diff --git a/model/riscv_insts_base.sail b/model/riscv_insts_base.sail
index f102cbd..9c4630b 100644
--- a/model/riscv_insts_base.sail
+++ b/model/riscv_insts_base.sail
@@ -794,49 +794,3 @@ function clause execute SFENCE_VMA(rs1, rs2) = {
mapping clause assembly = SFENCE_VMA(rs1, rs2)
<-> "sfence.vma" ^ spc() ^ reg_name(rs1) ^ sep() ^ reg_name(rs2)
-
-/* ****************************************************************** */
-union clause ast = SINVAL_VMA : (regidx, regidx)
-
-mapping clause encdec =
- SINVAL_VMA(rs1, rs2) if haveSvinval()
- <-> 0b0001011 @ rs2 : regidx @ rs1 : regidx @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
-
-function clause execute SINVAL_VMA(rs1, rs2) = {
- execute(SFENCE_VMA(rs1, rs2))
-}
-
-mapping clause assembly = SINVAL_VMA(rs1, rs2)
- <-> "sinval.vma" ^ spc() ^ reg_name(rs1) ^ sep() ^ reg_name(rs2)
-
-/* ****************************************************************** */
-union clause ast = SFENCE_W_INVAL : unit
-
-mapping clause encdec =
- SFENCE_W_INVAL() if haveSvinval()
- <-> 0b0001100 @ 0b00000 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
-
-function clause execute SFENCE_W_INVAL() = {
- if cur_privilege == User
- then { handle_illegal(); RETIRE_FAIL }
- else { RETIRE_SUCCESS }
-}
-
-mapping clause assembly = SFENCE_W_INVAL() <-> "sfence.w.inval"
-
-/* ****************************************************************** */
-union clause ast = SFENCE_INVAL_IR : unit
-
-mapping clause encdec =
- SFENCE_INVAL_IR() if haveSvinval()
- <-> 0b0001100 @ 0b00001 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
-
-function clause execute SFENCE_INVAL_IR() = {
- if cur_privilege == User
- then { handle_illegal(); RETIRE_FAIL }
- else { RETIRE_SUCCESS }
-}
-
-mapping clause assembly = SFENCE_INVAL_IR() <-> "sfence.inval.ir"
-
-/* ****************************************************************** */
diff --git a/model/riscv_insts_svinval.sail b/model/riscv_insts_svinval.sail
new file mode 100644
index 0000000..ea74838
--- /dev/null
+++ b/model/riscv_insts_svinval.sail
@@ -0,0 +1,52 @@
+/*=======================================================================================*/
+/* This Sail RISC-V architecture model, comprising all files and */
+/* directories except where otherwise noted is subject the BSD */
+/* two-clause license in the LICENSE file. */
+/* */
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*=======================================================================================*/
+
+union clause ast = SINVAL_VMA : (regidx, regidx)
+
+mapping clause encdec =
+ SINVAL_VMA(rs1, rs2) if haveSvinval()
+ <-> 0b0001011 @ rs2 : regidx @ rs1 : regidx @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
+
+function clause execute SINVAL_VMA(rs1, rs2) = {
+ execute(SFENCE_VMA(rs1, rs2))
+}
+
+mapping clause assembly = SINVAL_VMA(rs1, rs2)
+ <-> "sinval.vma" ^ spc() ^ reg_name(rs1) ^ sep() ^ reg_name(rs2)
+
+/* ****************************************************************** */
+
+union clause ast = SFENCE_W_INVAL : unit
+
+mapping clause encdec =
+ SFENCE_W_INVAL() if haveSvinval()
+ <-> 0b0001100 @ 0b00000 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
+
+function clause execute SFENCE_W_INVAL() = {
+ if cur_privilege == User
+ then { handle_illegal(); RETIRE_FAIL }
+ else { RETIRE_SUCCESS }
+}
+
+mapping clause assembly = SFENCE_W_INVAL() <-> "sfence.w.inval"
+
+/* ****************************************************************** */
+
+union clause ast = SFENCE_INVAL_IR : unit
+
+mapping clause encdec =
+ SFENCE_INVAL_IR() if haveSvinval()
+ <-> 0b0001100 @ 0b00001 @ 0b00000 @ 0b000 @ 0b00000 @ 0b1110011 if haveSvinval()
+
+function clause execute SFENCE_INVAL_IR() = {
+ if cur_privilege == User
+ then { handle_illegal(); RETIRE_FAIL }
+ else { RETIRE_SUCCESS }
+}
+
+mapping clause assembly = SFENCE_INVAL_IR() <-> "sfence.inval.ir"