summaryrefslogtreecommitdiff
path: root/riscv/riscv_step.sail
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-06-22 16:41:00 -0700
committerPrashanth Mundkur2018-06-22 17:46:59 -0700
commit66ae0071f94a1ee33b021a5a0d34acbd510a8827 (patch)
treec8936b5a0ea5a4b31f85ad213f91a69a0553ac8b /riscv/riscv_step.sail
parentc3b10065d3918be2d63cf12612ac00b59b02640b (diff)
Some more riscv trace log tweaking for spike compatibility.
Diffstat (limited to 'riscv/riscv_step.sail')
-rw-r--r--riscv/riscv_step.sail10
1 files changed, 6 insertions, 4 deletions
diff --git a/riscv/riscv_step.sail b/riscv/riscv_step.sail
index de823f53..acbab1f6 100644
--- a/riscv/riscv_step.sail
+++ b/riscv/riscv_step.sail
@@ -42,9 +42,8 @@ function fetch() -> FetchResult = {
}
/* returns whether an instruction was retired */
-val step : unit -> bool effect {barr, eamem, escape, exmem, rmem, rreg, wmv, wreg}
-function step() = {
- let step_no = unsigned(minstret);
+val step : int -> bool effect {barr, eamem, escape, exmem, rmem, rreg, wmv, wreg}
+function step(step_no) = {
match curInterrupt(mip, mie, mideleg) {
Some(intr, priv) => {
print_bits("Handling interrupt: ", intr);
@@ -94,13 +93,16 @@ val loop : unit -> unit effect {barr, eamem, escape, exmem, rmem, rreg, wmv, wre
function loop () = {
let insns_per_tick = plat_insns_per_tick();
i : int = 0;
+ step_no : int = 0;
while true do {
tick_clock();
minstret_written = false; /* see note for minstret */
- let retired = step();
+ let retired = step(step_no);
PC = nextPC;
if retired then retire_instruction();
+ step_no = step_no + 1;
+
/* check htif exit */
if htif_done then {
let exit_val = unsigned(htif_exit_code);