summaryrefslogtreecommitdiff
path: root/src/gen_lib/sail_operators_mwords.lem
diff options
context:
space:
mode:
authorBrian Campbell2017-11-01 10:38:44 +0000
committerBrian Campbell2017-11-01 10:39:37 +0000
commit255b77f23a79a08c1d0f5569e613620aae2b4d0e (patch)
tree5d4605bd577af0791c7a95daaaac6f92479e2e8e /src/gen_lib/sail_operators_mwords.lem
parentbc9ed991891718f8b2b9a7ae5398a8ba30333a0a (diff)
Support bitvector-size-parametric functions in Lem output
Translates atom('n) types into itself('n) types that won't be erased Also exports more rewriting functions
Diffstat (limited to 'src/gen_lib/sail_operators_mwords.lem')
-rw-r--r--src/gen_lib/sail_operators_mwords.lem10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gen_lib/sail_operators_mwords.lem b/src/gen_lib/sail_operators_mwords.lem
index d4dca80c..8fb55137 100644
--- a/src/gen_lib/sail_operators_mwords.lem
+++ b/src/gen_lib/sail_operators_mwords.lem
@@ -3,6 +3,16 @@ open import Machine_word
open import Sail_impl_base
open import Sail_values
+(* Translating between a type level number (itself 'n) and an integer *)
+
+let size_itself_int x = integerFromNat (size_itself x)
+
+(* NB: the corresponding sail type is forall 'n. atom('n) -> itself('n),
+ the actual integer is ignored. *)
+
+val make_the_value : forall 'n. integer -> itself 'n
+let inline make_the_value x = the_value
+
(*** Bit vector operations *)
let bitvector_length bs = integerFromNat (word_length bs)