summaryrefslogtreecommitdiff
path: root/mips
diff options
context:
space:
mode:
Diffstat (limited to 'mips')
-rw-r--r--mips/Makefile2
-rw-r--r--mips/main.sail5
-rw-r--r--mips/prelude.sail6
3 files changed, 8 insertions, 5 deletions
diff --git a/mips/Makefile b/mips/Makefile
index 6abf1848..007d56c7 100644
--- a/mips/Makefile
+++ b/mips/Makefile
@@ -19,7 +19,7 @@ mips.c: $(MIPS_PRE) $(MIPS_TLB) $(MIPS_SAILS) $(MIPS_MAIN) Makefile ../sail
$(SAIL) -O -memo_z3 -c $(filter %.sail, $^) 1> $@
mips_c: mips.c ../lib/sail.h Makefile
- gcc -O2 -g -I ../lib $< -l gmp -o $@
+ gcc -O2 -g -I ../lib $< ../lib/*.c -lgmp -lz -o $@
mips_no_tlb.lem: $(MIPS_PRE) $(MIPS_TLB_STUB) $(MIPS_SAILS)
$(SAIL) -lem -o mips_no_tlb -lem_mwords -lem_lib Mips_extras -undefined_gen -memo_z3 $^
diff --git a/mips/main.sail b/mips/main.sail
index 8b1e01d7..6f7d377e 100644
--- a/mips/main.sail
+++ b/mips/main.sail
@@ -16,7 +16,7 @@ function fetch_and_execute () = {
/* the following skips are required on mips to fake the tag effects otherwise type checker complains */
skip_rmemt();
skip_wmvt();
- prerr_bits("PC: ", PC);
+ /* prerr_bits("PC: ", PC); */
loop_again = true;
try {
let pc_pa = TranslatePC(PC);
@@ -62,9 +62,12 @@ function dump_mips_state () : unit -> unit = {
}
}
+val "load_raw" : (bits(64), string) -> unit
+
val main : unit -> unit effect {barr, eamem, escape, rmem, rreg, undef, wmv, wreg, rmemt, wmvt}
function main () = {
+ load_raw(0x0000000000100000, "/home/aa2019/mips_freebsd/kernel");
init_registers(to_bits(64, elf_entry()));
startTime = get_time_ns();
while (fetch_and_execute()) do ();
diff --git a/mips/prelude.sail b/mips/prelude.sail
index f0ce2e5e..e2f1e0d4 100644
--- a/mips/prelude.sail
+++ b/mips/prelude.sail
@@ -103,10 +103,10 @@ val quotient = {ocaml: "quotient", lem: "integerDiv"} : (int, int) -> int
overload operator / = {quotient_nat, quotient}
-val quot_round_zero = {ocaml: "quot_round_zero", lem: "hardware_quot", _ : "div_int"} : (int, int) -> int
-val rem_round_zero = {ocaml: "rem_round_zero", lem: "hardware_mod", _ : "mod_int"} : (int, int) -> int
+val quot_round_zero = {ocaml: "quot_round_zero", lem: "hardware_quot", _ : "tdiv_int"} : (int, int) -> int
+val rem_round_zero = {ocaml: "rem_round_zero", lem: "hardware_mod", _ : "tmod_int"} : (int, int) -> int
-val modulus = {ocaml: "modulus", lem: "hardware_mod", _ : "mod_int"} : forall 'n, 'n > 0 . (int, atom('n)) -> range(0, 'n - 1)
+val modulus = {ocaml: "modulus", lem: "hardware_mod", _ : "tmod_int"} : forall 'n, 'n > 0 . (int, atom('n)) -> range(0, 'n - 1)
overload operator % = {modulus}