diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/mono/assert2.sail | 13 | ||||
| -rw-r--r-- | test/mono/atomsplit.sail | 13 | ||||
| -rw-r--r-- | test/mono/set.sail | 11 | ||||
| -rw-r--r-- | test/mono/varpatterns.sail | 37 |
4 files changed, 10 insertions, 64 deletions
diff --git a/test/mono/assert2.sail b/test/mono/assert2.sail index edf92710..90874b68 100644 --- a/test/mono/assert2.sail +++ b/test/mono/assert2.sail @@ -1,14 +1,5 @@ -$include <smt.sail> -$include <flow.sail> default Order dec -type bits ('n : Int) = vector('n, dec, bit) -val operator & = "and_bool" : (bool, bool) -> bool -val eq_vec = {ocaml: "eq_list", lem: "eq_vec"} : forall 'n. (bits('n), bits('n)) -> bool -overload operator == = {eq_int, eq_vec} -val mult_int = {ocaml: "mult", lem: "integerMult"} : (int, int) -> int -overload operator * = {mult_range, mult_int, mult_real} -val replicate_bits = "replicate_bits" : forall 'n 'm. (bits('n), atom('m)) -> bits('n * 'm) -overload operator < = {lt_atom, lt_int} +$include <prelude.sail> /* Should find a set constraint below the let */ @@ -28,4 +19,4 @@ val run : unit -> unit effect {escape} function run () = { f(8); f(16); -}
\ No newline at end of file +} diff --git a/test/mono/atomsplit.sail b/test/mono/atomsplit.sail index 6e5d3e3b..23a1b0fb 100644 --- a/test/mono/atomsplit.sail +++ b/test/mono/atomsplit.sail @@ -1,14 +1,5 @@ -$include <smt.sail> -$include <flow.sail> default Order dec -type bits ('n : Int) = vector('n, dec, bit) -val operator & = "and_bool" : (bool, bool) -> bool -val eq_vec = {ocaml: "eq_list", lem: "eq_vec"} : forall 'n. (bits('n), bits('n)) -> bool -overload operator == = {eq_int, eq_vec} -val mult_int = {ocaml: "mult", lem: "integerMult"} : (int, int) -> int -overload operator * = {mult_range, mult_int, mult_real} -val replicate_bits = "replicate_bits" : forall 'n 'm. (bits('n), atom('m)) -> bits('n * 'm) -overload operator < = {lt_atom, lt_int} +$include <prelude.sail> /* Test splitting required because there's a size calculation in the function */ @@ -27,4 +18,4 @@ val run : unit -> unit effect {escape} function run () = { foo(2); foo(4); -}
\ No newline at end of file +} diff --git a/test/mono/set.sail b/test/mono/set.sail index 74d4693e..4b97aeef 100644 --- a/test/mono/set.sail +++ b/test/mono/set.sail @@ -1,14 +1,5 @@ default Order dec -$include <flow.sail> -type bits ('n : Int) = vector('n, dec, bit) -val operator & = "and_bool" : (bool, bool) -> bool -val eq_vec = {ocaml: "eq_list", lem: "eq_vec"} : forall 'n. (bits('n), bits('n)) -> bool -val eq_int = {ocaml: "eq_int", lem: "eq"} : (int, int) -> bool -overload operator == = {eq_int, eq_vec} -val vector_subrange = {ocaml: "subrange", lem: "subrange_vec_dec"} : forall ('n : Int) ('m : Int) ('o : Int), 'o <= 'm <= 'n. - (bits('n), atom('m), atom('o)) -> bits('m - ('o - 1)) -val mult_int = {ocaml: "mult", lem: "integerMult"} : (int, int) -> int -overload operator * = {mult_range, mult_int, mult_real} +$include <prelude.sail> val "extz_vec" : forall 'n 'm. (atom('m),vector('n, dec, bit)) -> vector('m, dec, bit) effect pure val extz : forall 'n 'm. (implicit('m), vector('n, dec, bit)) -> vector('m, dec, bit) effect pure function extz(m,v) = extz_vec(m,v) diff --git a/test/mono/varpatterns.sail b/test/mono/varpatterns.sail index b2c9e7ee..a583cbfc 100644 --- a/test/mono/varpatterns.sail +++ b/test/mono/varpatterns.sail @@ -1,32 +1,5 @@ -$include <smt.sail> -$include <flow.sail> default Order dec -type bits ('n : Int) = vector('n, dec, bit) -val operator & = "and_bool" : (bool, bool) -> bool -val eq_vec = {ocaml: "eq_list", lem: "eq_vec"} : forall 'n. (bits('n), bits('n)) -> bool -overload operator == = {eq_int, eq_vec} -val neq_vec = {lem: "neq"} : forall 'n. (bits('n), bits('n)) -> bool -function neq_vec (x, y) = not_bool(eq_vec(x, y)) -overload operator != = {neq_atom, neq_vec} -val vector_subrange = {ocaml: "subrange", lem: "subrange_vec_dec"} : forall ('n : Int) ('m : Int) ('o : Int), 'o <= 'm <= 'n. - (bits('n), atom('m), atom('o)) -> bits('m - ('o - 1)) -val mult_int = {ocaml: "mult", lem: "integerMult"} : (int, int) -> int -overload operator * = {mult_range, mult_int, mult_real} -/*val "extz_vec" : forall 'n 'm. (atom('m),vector('n, dec, bit)) -> vector('m, dec, bit) effect pure -val extz : forall 'n 'm. vector('n, dec, bit) -> vector('m, dec, bit) effect pure -function extz(v) = extz_vec(sizeof('m),v) -val "exts_vec" : forall 'n 'm. (atom('m),vector('n, dec, bit)) -> vector('m, dec, bit) effect pure -val exts : forall 'n 'm. vector('n, dec, bit) -> vector('m, dec, bit) effect pure -function exts(v) = exts_vec(sizeof('m),v)*/ -val UInt = { - ocaml: "uint", - lem: "uint", - interpreter: "uint", - c: "sail_uint" -} : forall 'n. bits('n) -> range(0, 2 ^ 'n - 1) -val bitvector_cast = "zeroExtend" : forall 'n. bits('n) -> bits('n) effect pure -val slice = "slice" : forall ('n : Int) ('m : Int), 'm >= 0 & 'n >= 0. - (bits('m), int, atom('n)) -> bits('n) +$include <prelude.sail> /* Test constant propagation on some variable patterns in let expressions */ @@ -35,7 +8,7 @@ val test : bool -> unit effect {escape} function test(b) = { let 'n : {|8,16|} = if b then 8 else 16; let x : bits('n) = match 'n { 8 => 0x12, 16 => 0x1234 }; - assert(UInt(x) == (match n { 8 => 18, 16 => 4660 }) : int, "UInt"); + assert(unsigned(x) == (match n { 8 => 18, 16 => 4660 }) : int, "unsigned"); } val test2 : bool -> unit effect {escape} @@ -43,7 +16,7 @@ val test2 : bool -> unit effect {escape} function test2(b) = { let 'n = (if b then 8 else 16) : {|8,16|}; let x : bits('n) = match 'n { 8 => 0x12, 16 => 0x1234 }; - assert(UInt(x) == (match n { 8 => 18, 16 => 4660 }) : int, "UInt"); + assert(unsigned(x) == (match n { 8 => 18, 16 => 4660 }) : int, "unsigned"); } val test_mult : {|4,8|} -> unit effect {escape} @@ -51,7 +24,7 @@ val test_mult : {|4,8|} -> unit effect {escape} function test_mult('m) = { let 'n = 2 * 'm; let x : bits('n) = match 'n { 8 => 0x12, 16 => 0x1234 }; - assert(UInt(x) == (match n { 8 => 18, 16 => 4660 }) : int, "UInt"); + assert(unsigned(x) == (match n { 8 => 18, 16 => 4660 }) : int, "unsigned"); } val run : unit -> unit effect {escape} @@ -63,4 +36,4 @@ function run() = { test2(false); test_mult(4); test_mult(8); -}
\ No newline at end of file +} |
