summaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-06-08 15:45:06 -0700
committerPrashanth Mundkur2018-06-08 15:45:06 -0700
commitd71ba6318512ffe7cd5221f20c405a38086e41e5 (patch)
tree44f4be3ade35fd3010027ece152d77f424b3f54a /riscv
parent3d3fb21df7c41cb0d68954775a29893655f09fa2 (diff)
Slightly condense execution trace log.
Diffstat (limited to 'riscv')
-rw-r--r--riscv/riscv_step.sail15
1 files changed, 7 insertions, 8 deletions
diff --git a/riscv/riscv_step.sail b/riscv/riscv_step.sail
index 93060f68..9be11a8c 100644
--- a/riscv/riscv_step.sail
+++ b/riscv/riscv_step.sail
@@ -42,8 +42,8 @@ function fetch() -> FetchResult = {
}
/* returns whether an instruction was executed */
-val step : unit -> bool effect {barr, eamem, escape, exmem, rmem, rreg, wmv, wreg}
-function step() = {
+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);
@@ -59,12 +59,12 @@ function step() = {
F_RVC(h) => {
match decodeCompressed(h) {
None() => {
- print("PC: " ^ BitStr(PC) ^ " instr: " ^ BitStr(h) ^ " : <no-decode>");
+ print("[" ^ string_of_int(step_no) ^ "] " ^ BitStr(PC) ^ " (" ^ BitStr(h) ^ ") <no-decode>");
handle_decode_exception(EXTZ(h));
false
},
Some(ast) => {
- print("PC: " ^ BitStr(PC) ^ " instr: " ^ BitStr(h) ^ " : " ^ ast);
+ print("[" ^ string_of_int(step_no) ^ "] " ^ BitStr(PC) ^ " (" ^ BitStr(h) ^ ") " ^ ast);
nextPC = PC + 2;
execute(ast);
true
@@ -74,12 +74,12 @@ function step() = {
F_Base(w) => {
match decode(w) {
None() => {
- print("PC: " ^ BitStr(PC) ^ " instr: " ^ BitStr(w) ^ " : <no-decode>");
+ print("[" ^ string_of_int(step_no) ^ "] " ^ BitStr(PC) ^ " (" ^ BitStr(w) ^ ") <no-decode>");
handle_decode_exception(EXTZ(w));
false
},
Some(ast) => {
- print("PC: " ^ BitStr(PC) ^ " instr: " ^ BitStr(w) ^ " : " ^ ast);
+ print("[" ^ string_of_int(step_no) ^ "] " ^ BitStr(PC) ^ " (" ^ BitStr(w) ^ ") " ^ ast);
nextPC = PC + 4;
execute(ast);
true
@@ -97,8 +97,7 @@ function loop (tohost_addr) = {
i : int = 0;
while true do {
tick_clock();
- print_int("\nstep: ", i);
- let retired : bool = step();
+ let retired : bool = step(i);
PC = nextPC;
if retired then i = i + 1;