summaryrefslogtreecommitdiff
path: root/test/ocaml/vec_32_64/vec_32_64.sail
blob: 5dc58cc34dbb87c43ab8ba712c244309674cf228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* This example is more testing the typechecker flow typing rather
than the ocaml backend, but it does test that recursive functions work
correctly */

val get_size : unit -> {|32, 64|}

function get_size () = 32

val only64 = { ocaml: "(fun _ -> ())" } : bits(64) -> unit

val main : unit -> unit

function main () = {
  let 'len = get_size ();
  let xs = sail_zeros(len);
  if (len == 32) then {
    ()
  } else {
    only64(xs)
  };
  print_bits("xs = ", xs);
  print_bits("zeros(64) = ", sail_zeros(64))
}