diff options
| author | Alasdair Armstrong | 2017-09-07 16:54:20 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-09-07 16:54:20 +0100 |
| commit | 842165c1171fde332bd42e7520338c59a797f76b (patch) | |
| tree | 75b61297b6d9b6e4810542390eb1371afc2f183f /lib/ocaml_rts/linksem/src_lem_library/bit.ml | |
| parent | 8124c487b576661dfa7a0833415d07d0978bc43e (diff) | |
Add ocaml run-time and updates to sail for ocaml backend
Diffstat (limited to 'lib/ocaml_rts/linksem/src_lem_library/bit.ml')
| -rw-r--r-- | lib/ocaml_rts/linksem/src_lem_library/bit.ml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/ocaml_rts/linksem/src_lem_library/bit.ml b/lib/ocaml_rts/linksem/src_lem_library/bit.ml new file mode 100644 index 00000000..bd972008 --- /dev/null +++ b/lib/ocaml_rts/linksem/src_lem_library/bit.ml @@ -0,0 +1,19 @@ +type bit = Zero | One + +let to_bool b = match b with | Zero -> false | _ -> true +let bn b = match b with | Zero -> One | One -> Zero +let bor b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero + | _ -> One +let xor b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero + | Zero,One | One,Zero -> One + | _ -> Zero +let band b1 b2 = match (b1,b2) with + | One,One -> One + | _ -> Zero + +let add b1 b2 = match (b1,b2) with + | Zero,Zero -> Zero, false + | Zero,One | One,Zero -> One, false + | One,One -> Zero, true |
