summaryrefslogtreecommitdiff
path: root/test/mono/atomsplit.sail
diff options
context:
space:
mode:
Diffstat (limited to 'test/mono/atomsplit.sail')
-rw-r--r--test/mono/atomsplit.sail30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/mono/atomsplit.sail b/test/mono/atomsplit.sail
new file mode 100644
index 00000000..6e5d3e3b
--- /dev/null
+++ b/test/mono/atomsplit.sail
@@ -0,0 +1,30 @@
+$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}
+
+/* Test splitting required because there's a size calculation in the function */
+
+val foo : forall 'n. atom('n) -> unit effect {escape}
+
+function foo(n) = {
+ assert(constraint('n in {2,4}));
+ let 'm = 8 * n in
+ let x : bits('m) = replicate_bits(0b0,m) in
+ let y : bits('n) = replicate_bits(0b0,n) in
+ ()
+}
+
+val run : unit -> unit effect {escape}
+
+function run () = {
+ foo(2);
+ foo(4);
+} \ No newline at end of file