summaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-07-08 21:36:09 -0700
committerPrashanth Mundkur2018-07-08 21:36:09 -0700
commitb9d6151e8671a03eb58f2065e85367fff0a27cf0 (patch)
treebef1863221efebc4b4fc9ca7f16d081111b234c2 /riscv
parent24860b61c062175fc4db391c8bb5113a108ea82f (diff)
Make the riscv fetch-execute loop return instead of exiting when done.
Diffstat (limited to 'riscv')
-rw-r--r--riscv/riscv_step.sail21
1 files changed, 10 insertions, 11 deletions
diff --git a/riscv/riscv_step.sail b/riscv/riscv_step.sail
index af41c098..a095c9cb 100644
--- a/riscv/riscv_step.sail
+++ b/riscv/riscv_step.sail
@@ -94,7 +94,7 @@ function loop () = {
let insns_per_tick = plat_insns_per_tick();
i : int = 0;
step_no : int = 0;
- while true do {
+ while (~ (htif_done)) do {
minstret_written = false; /* see note for minstret */
let (retired, stepped) = step(step_no);
PC = nextPC;
@@ -107,16 +107,15 @@ function loop () = {
let exit_val = unsigned(htif_exit_code);
if exit_val == 0 then print("SUCCESS")
else print_int("FAILURE: ", exit_val);
- exit(());
- };
-
- /* update time */
- i = i + 1;
- if i == insns_per_tick then {
- tick_clock();
- /* for now, we drive the platform i/o at every clock tick. */
- tick_platform();
- i = 0;
+ } else {
+ /* update time */
+ i = i + 1;
+ if i == insns_per_tick then {
+ tick_clock();
+ /* for now, we drive the platform i/o at every clock tick. */
+ tick_platform();
+ i = 0;
+ }
}
}
}