summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Norton2018-06-22 13:23:29 +0100
committerRobert Norton2018-06-22 13:23:29 +0100
commit2f8e0b78531473a5c519b998f0750eec2bb68cb8 (patch)
tree31256131ea9582dc0746a56656ab2c493b6d0ccc
parent7ef0bba057d634f7596f94000233cd36ebdd2fff (diff)
add support for new cycle_limit feature in mips.
-rw-r--r--mips/main.sail17
-rw-r--r--src/sail_lib.ml2
2 files changed, 17 insertions, 2 deletions
diff --git a/mips/main.sail b/mips/main.sail
index f0360870..8790cf66 100644
--- a/mips/main.sail
+++ b/mips/main.sail
@@ -62,14 +62,27 @@ function dump_mips_state () : unit -> unit = {
}
}
-val "load_raw" : (bits(64), string) -> unit
+val "cycle_count" : unit -> unit
val main : unit -> unit effect {barr, eamem, escape, rmem, rreg, undef, wmv, wreg, rmemt, wmvt}
function main () = {
init_registers(to_bits(64, elf_entry()));
startTime = get_time_ns();
- while (fetch_and_execute()) do ();
+ while (fetch_and_execute()) do {
+ cycle_count();
+ /* uncomment to print IPS every 10M instructions (~10s)
+ if (instCount == 10000000) then {
+ endTime = get_time_ns();
+ elapsed = endTime - startTime;
+ inst_1e9 = instCount * 1000000000;
+ ips = inst_1e9 / elapsed;
+ print_int("*IPS*: ", ips);
+ startTime = get_time_ns();
+ instCount = 0;
+ };*/
+ };
+
endTime = get_time_ns();
elapsed = endTime - startTime;
inst_1e9 = instCount * 1000000000;
diff --git a/src/sail_lib.ml b/src/sail_lib.ml
index 08a65b13..ab621342 100644
--- a/src/sail_lib.ml
+++ b/src/sail_lib.ml
@@ -798,3 +798,5 @@ let load_raw (paddr, file) =
with
| End_of_file -> ()
+(* XXX this could count cycles and exit after given limit *)
+let cycle_count () = ()