aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Johnson <scott.johnson@arilinc.com>2021-01-26 17:06:21 -0800
committerScott Johnson <scott.johnson@arilinc.com>2021-01-27 16:30:36 -0800
commite499d1d491bfcb4d5cad6a101e0526fb0f3a12b5 (patch)
tree3a12a0799353fed5b0a976d22f7e8ea51bfb839e
parent41a4072fac3e21c34bd1aa644d57aeb2b2ff8d0b (diff)
downloadsail-riscv-e499d1d491bfcb4d5cad6a101e0526fb0f3a12b5.zip
sail-riscv-e499d1d491bfcb4d5cad6a101e0526fb0f3a12b5.tar.gz
sail-riscv-e499d1d491bfcb4d5cad6a101e0526fb0f3a12b5.tar.bz2
MRET and SRET should increment minstret when successful
-rw-r--r--model/riscv_insts_base.sail14
1 files changed, 6 insertions, 8 deletions
diff --git a/model/riscv_insts_base.sail b/model/riscv_insts_base.sail
index e2ad961..7ec2756 100644
--- a/model/riscv_insts_base.sail
+++ b/model/riscv_insts_base.sail
@@ -717,11 +717,10 @@ mapping clause encdec = MRET()
function clause execute MRET() = {
if cur_privilege != Machine
- then handle_illegal()
+ then { handle_illegal(); RETIRE_FAIL }
else if ~(ext_check_xret_priv (Machine))
- then ext_fail_xret_priv ()
- else set_next_pc(exception_handler(cur_privilege, CTL_MRET(), PC));
- RETIRE_FAIL
+ then { ext_fail_xret_priv(); RETIRE_FAIL }
+ else { set_next_pc(exception_handler(cur_privilege, CTL_MRET(), PC)); RETIRE_SUCCESS }
}
mapping clause assembly = MRET() <-> "mret"
@@ -739,11 +738,10 @@ function clause execute SRET() = {
Machine => ~ (haveSupMode ())
};
if sret_illegal
- then handle_illegal()
+ then { handle_illegal(); RETIRE_FAIL }
else if ~(ext_check_xret_priv (Supervisor))
- then ext_fail_xret_priv ()
- else set_next_pc(exception_handler(cur_privilege, CTL_SRET(), PC));
- RETIRE_FAIL
+ then { ext_fail_xret_priv(); RETIRE_FAIL }
+ else { set_next_pc(exception_handler(cur_privilege, CTL_SRET(), PC)); RETIRE_SUCCESS }
}
mapping clause assembly = SRET() <-> "sret"