From e499d1d491bfcb4d5cad6a101e0526fb0f3a12b5 Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Tue, 26 Jan 2021 17:06:21 -0800 Subject: MRET and SRET should increment minstret when successful --- model/riscv_insts_base.sail | 14 ++++++-------- 1 file 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" -- cgit v1.1