summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-09-20 16:16:30 +0100
committerAlasdair Armstrong2018-09-27 12:06:05 +0100
commitdc9bbf26befc9e1ec0c8e4dd93a5041d71954ec6 (patch)
tree6556c6fb848ad96d5acfa8b8c2d703a33c6707b6
parent57380afc09bf5ce5748d2e21584474827c7eb76b (diff)
Add an additional type checking test
-rw-r--r--test/typecheck/fpthreesimp.sail14
1 files changed, 14 insertions, 0 deletions
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