File: existential_ast.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 (54 lines) | stat: -rw-r--r-- 1,360 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
50
51
52
53
54
default Order dec

$include <prelude.sail>

type datasize('n: Int) -> Bool = 'n in {32, 64}

type regno = range(0, 31)

union ast = {
  Ctor1 : {'d, datasize('d). (bits(4), int('d), bits(4))},
  Ctor2 : {'d, datasize('d). (regno, int('d), bits(4))}
}

val decode : bits(16) -> option(ast)

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000110) = {
  let x : {|32, 64|} = if b == 0b0 then 32 else 64;
  y : {'d, datasize('d). (bits(4), int('d), bits(4))} = (a, x, c);

  Some(Ctor1(y))
}

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000111) = {
  x : {|32, 64|} = if b == 0b0 then 32 else 64;

  Some(Ctor1(a, x, c))
}

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000101) = {
  let x : {|32, 64|} = if b == 0b0 then 32 else 64;

  Some(Ctor1(a, x, c))
}

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000111) = {
  let y = unsigned(a @ 0b0);
  x : {|32, 64|} = if b == 0b0 then 32 else 64;

  Some(Ctor2(y, x, c))
}

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000111) = {
  y = unsigned(a @ 0b0);
  x : {|32, 64|} = if b == 0b0 then 32 else 64;

  Some(Ctor2(y, x, c))
}

function clause decode(a : bits(4) @ b : bits(1) @ c : bits(4) @ 0b0000111) = {
  y = unsigned(a);
  x : {|32, 64|} = if b == 0b0 then 32 else 64;

  Some(Ctor2(y, x, c))
}