summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/flow.sail2
-rw-r--r--lib/vector_dec.sail8
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/flow.sail b/lib/flow.sail
index 5ee9a74a..cdc6b2fd 100644
--- a/lib/flow.sail
+++ b/lib/flow.sail
@@ -11,7 +11,7 @@ therefore be included in just about every Sail specification.
val eq_unit : (unit, unit) -> bool
-val "eq_bit" : (bit, bit) -> bool
+val eq_bit = { lem : "eq", _ : "eq_bit" } : (bit, bit) -> bool
function eq_unit(_, _) = true
diff --git a/lib/vector_dec.sail b/lib/vector_dec.sail
index 7011a55c..a4d1a0b1 100644
--- a/lib/vector_dec.sail
+++ b/lib/vector_dec.sail
@@ -5,8 +5,6 @@ $include <flow.sail>
type bits ('n : Int) = vector('n, dec, bit)
-val eq_bit = { lem : "eq", _ : "eq_bit" } : (bit, bit) -> bool
-
val eq_bits = {
ocaml: "eq_list",
lem: "eq_vec",
@@ -135,6 +133,9 @@ val slice = "slice" : forall 'n 'm 'o, 0 <= 'o < 'm & 'o + 'n <= 'm & 0 <= 'n.
val replicate_bits = "replicate_bits" : forall 'n 'm. (bits('n), atom('m)) -> bits('n * 'm)
+/*!
+converts a bit vector of length $n$ to an integer in the range $0$ to $2^n - 1$.
+ */
val unsigned = {
ocaml: "uint",
lem: "uint",
@@ -144,6 +145,9 @@ val unsigned = {
} : forall 'n. bits('n) -> range(0, 2 ^ 'n - 1)
/* We need a non-empty vector so that the range makes sense */
+/*!
+converts a bit vector of length $n$ to an integer in the range $-2^{n-1}$ to $2^{n-1} - 1$ using twos-complement.
+ */
val signed = {
c: "sail_signed",
_: "sint"