summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/vector_dec.sail6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/vector_dec.sail b/lib/vector_dec.sail
index 37e10c2f..bfe1dae7 100644
--- a/lib/vector_dec.sail
+++ b/lib/vector_dec.sail
@@ -133,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",
@@ -142,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"