summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/c/if_opt_typ.expect2
-rw-r--r--test/c/if_opt_typ.sail12
-rw-r--r--test/typecheck/fpthreesimp.sail14
3 files changed, 28 insertions, 0 deletions
diff --git a/test/c/if_opt_typ.expect b/test/c/if_opt_typ.expect
new file mode 100644
index 00000000..d92227c0
--- /dev/null
+++ b/test/c/if_opt_typ.expect
@@ -0,0 +1,2 @@
+x2:18446744073709551615
+x3:18446744073709551615
diff --git a/test/c/if_opt_typ.sail b/test/c/if_opt_typ.sail
new file mode 100644
index 00000000..e51c69ec
--- /dev/null
+++ b/test/c/if_opt_typ.sail
@@ -0,0 +1,12 @@
+default Order dec
+$include <vector_dec.sail>
+$include <string.sail>
+
+val main : unit -> unit
+function main () = {
+ let x1 = 0xffffffffffffffff;
+ let x2 : int = unsigned(x1);
+ let x3 : int = if false then signed(x1) else unsigned(x1);
+ print_int("x2:", x2);
+ print_int("x3:", x3);
+} \ No newline at end of file
diff --git a/test/typecheck/fpthreesimp.sail b/test/typecheck/fpthreesimp.sail
new file mode 100644
index 00000000..3f759ba4
--- /dev/null
+++ b/test/typecheck/fpthreesimp.sail
@@ -0,0 +1,14 @@
+default Order dec
+
+$include <prelude.sail>
+
+val Zeros : forall 'N, 'N >= 0. int('N) -> bits('N)
+
+type FPExponent ('N : Int) = {'E, ('N = 16 & 'E = 5) | ('N = 32 & 'E = 8) | ('N = 64 & 'E = 11). int('E)}
+
+val FPThree : forall 'N, 'N in {16, 32, 64}. bits(1) -> bits('N)
+
+function FPThree(sign) = {
+ let E : FPExponent('N) = if 'N == 16 then 5 else if 'N == 32 then 8 else 11;
+ sign @ 0b1 @ Zeros(E - 1) @ 0b1 @ Zeros('N - E - 2)
+} \ No newline at end of file