diff options
| author | Robert Norton | 2018-03-27 15:57:28 +0100 |
|---|---|---|
| committer | Robert Norton | 2018-03-27 15:58:53 +0100 |
| commit | a1127a39d7a49e6cb1cf50f5cc528628669b4725 (patch) | |
| tree | 35269cd9dc8590f091b83ee2caf13af0ea8c4fc1 /mips | |
| parent | 8ada249efc7ae202c4a70af396ce5c771acd3de4 (diff) | |
print IPS after running cheri model.
Diffstat (limited to 'mips')
| -rw-r--r-- | mips/main.sail | 14 | ||||
| -rw-r--r-- | mips/prelude.sail | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/mips/main.sail b/mips/main.sail index e3ffa262..2c4ee064 100644 --- a/mips/main.sail +++ b/mips/main.sail @@ -1,5 +1,5 @@ - +register instCount : int val fetch_and_execute : unit -> unit effect {barr, eamem, escape, rmem, rreg, wmv, wreg, undef, wmvt, rmemt} function fetch_and_execute () = { @@ -9,7 +9,7 @@ function fetch_and_execute () = { branchPending = 0b0; nextPC = if inBranchDelay then delayedPC else PC + 4; cp2_next_pc(); - + instCount = instCount + 1; print_bits("PC: ", PC); try { let pc_pa = TranslatePC(PC); @@ -54,7 +54,15 @@ function main () = { init_cp0_state(); init_cp2_state(); nextPC = to_bits(64, elf_entry()); + startTime = get_time_ns(); fetch_and_execute(); + endTime = get_time_ns(); + elapsed = endTime - startTime; + inst_1e9 = instCount * 1000000000; + ips = inst_1e9 / elapsed; dump_mips_state (); - dump_cp2_state () + dump_cp2_state (); + print_int("Executed instructions: ", instCount); + print_int("Nanoseconds elapsed: ", elapsed); + print_int("Instructions per second: ", ips); } diff --git a/mips/prelude.sail b/mips/prelude.sail index 5a7f1351..cf44f6de 100644 --- a/mips/prelude.sail +++ b/mips/prelude.sail @@ -395,3 +395,5 @@ overload vector_update_subrange = {vector_update_subrange_dec, vector_update_sub val mask : forall 'm 'n , 'm >= 'n > 0 . bits('m) -> bits('n) function mask bs = bs['n - 1 .. 0] + +val "get_time_ns" : unit -> int |
