aboutsummaryrefslogtreecommitdiff
path: root/model/riscv_step.sail
diff options
context:
space:
mode:
authorPrashanth Mundkur <prashanth.mundkur@gmail.com>2019-05-10 13:37:31 -0700
committerPrashanth Mundkur <prashanth.mundkur@gmail.com>2019-05-10 13:37:31 -0700
commit360685d92fc5e027f14ad105786c7663f3a482a5 (patch)
treeb42d60c13b4e5f432afa935852b698c6156df4b9 /model/riscv_step.sail
parent860f3dba67d45b4b6461b8af9edacaa3f9182fdb (diff)
parent2b0984ab49d48651e6daff0bcc3c37b8b49e2602 (diff)
downloadsail-riscv-inst_extensions.zip
sail-riscv-inst_extensions.tar.gz
sail-riscv-inst_extensions.tar.bz2
Merge branch 'master' into inst_extensionsinst_extensions
Diffstat (limited to 'model/riscv_step.sail')
-rw-r--r--model/riscv_step.sail18
1 files changed, 12 insertions, 6 deletions
diff --git a/model/riscv_step.sail b/model/riscv_step.sail
index c6b7fc1..4b5c1c5 100644
--- a/model/riscv_step.sail
+++ b/model/riscv_step.sail
@@ -7,12 +7,12 @@ function step(step_no) = {
ext_pre_step_hook();
minstret_written = false; /* see note for minstret */
- let (retired, stepped) : (bool, bool) =
+ let (retired, stepped) : (Retired, bool) =
match dispatchInterrupt(cur_privilege) {
Some(intr, priv) => {
print_bits("Handling interrupt: ", intr);
handle_interrupt(intr, priv);
- (false, false)
+ (RETIRE_FAIL, false)
},
None() => {
/* the extension hook interposes on the fetch result */
@@ -21,12 +21,12 @@ function step(step_no) = {
/* extension error */
F_Ext_Error(e) => {
ext_handle_fetch_check_error(e);
- (false, false)
+ (RETIRE_FAIL, false)
},
/* standard error */
F_Error(e, addr) => {
handle_mem_exception(addr, e);
- (false, false)
+ (RETIRE_FAIL, false)
},
/* non-error cases: */
F_RVC(h) => {
@@ -38,7 +38,7 @@ function step(step_no) = {
(execute(ext_post_decode_hook(ast)), true)
} else {
handle_illegal();
- (false, true)
+ (RETIRE_FAIL, true)
}
},
F_Base(w) => {
@@ -50,8 +50,14 @@ function step(step_no) = {
}
}
};
+
tick_pc();
- if retired then retire_instruction();
+
+ /* update minstret */
+ match retired {
+ RETIRE_SUCCESS => retire_instruction(),
+ RETIRE_FAIL => ()
+ };
/* for step extensions */
ext_post_step_hook();