summaryrefslogtreecommitdiff
path: root/test/mono/flow_extend.sail
diff options
context:
space:
mode:
authorBrian Campbell2019-01-29 16:54:36 +0000
committerBrian Campbell2019-01-31 10:30:48 +0000
commit20334e0f8d1115bf7f70226f5020df180d5d7f89 (patch)
treec3247575957aab8cb5a0b499c126ac0b4e11f106 /test/mono/flow_extend.sail
parent60164a9a221ed6566f1067100dbea2ec828b47d2 (diff)
Support case splitting on variables as well as sizeof in cast introduction
Diffstat (limited to 'test/mono/flow_extend.sail')
-rw-r--r--test/mono/flow_extend.sail16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/mono/flow_extend.sail b/test/mono/flow_extend.sail
new file mode 100644
index 00000000..7e118993
--- /dev/null
+++ b/test/mono/flow_extend.sail
@@ -0,0 +1,16 @@
+default Order dec
+$include <prelude.sail>
+
+val bitvector_cast_in = "zeroExtend" : forall 'n. bits('n) -> bits('n) effect pure
+val bitvector_cast_out = "zeroExtend" : forall 'n. bits('n) -> bits('n) effect pure
+
+val byte_extend : forall 'n, 'n >= 8. (bits(8), int('n)) -> bits('n)
+
+function byte_extend (v, n) = if (n == 8) then v else sail_zero_extend(v, n)
+
+val run : unit -> unit effect {escape}
+
+function run() = {
+ assert(byte_extend(0x12,8) == 0x12);
+ assert(byte_extend(0x12,16) == 0x0012);
+}