File: assert.sail

package info (click to toggle)
sail-ocaml 0.19.1%2Bdfsg5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,008 kB
  • sloc: ml: 75,941; ansic: 8,848; python: 1,342; exp: 560; sh: 474; makefile: 218; cpp: 36
file content (49 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
default Order dec
$include <prelude.sail>
$include <smt.sail>

/* Tests set constraints in different constraints */

val f : forall 'n 'm. (int('n), int('m)) -> unit

function f(n,m) = {
    assert(constraint('n in {8,16} & 'm < 'n), "nconstraint");
    let 'p = 2 * n in
    let x : bits('p) = replicate_bits(0b0,'p) in
    ()
}

val f' : forall 'n 'm. (int('n), int('m)) -> unit

function f'(n,m) = {
    assert(constraint(('n == 8 | 'n == 16) & 'm < 'n), "nconstraint");
    let 'p = 2 * n in
    let x : bits('p) = replicate_bits(0b0,'p) in
    ()
}

val g : forall 'n 'm. (int('n), int('m)) -> unit

function g(n,m) = {
    assert(constraint('n in {8,16}) & 'm < 'n, "set and exp");
    let 'p = 2 * n in
    let x : bits('p) = replicate_bits(0b0,'p) in
    ()
}
val h : forall 'n 'm. (int('n), int('m)) -> unit

function h(n,m) = {
    assert(('n == 8 | 'n == 16) & 'm < 'n, "all exp");
    let 'p = 2 * n in
    let x : bits('p) = replicate_bits(0b0,'p) in
    ()
}

val run : unit -> unit

function run () = {
    f(8,3);
    f'(8,3);
    g(16,3);
    h(8,3);
}