summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon French2018-05-21 15:20:59 +0100
committerJon French2018-05-21 15:20:59 +0100
commite65dca0c66e3a58c1b295bc0029f519a3eda333d (patch)
tree885b397eb23eb6ee5aa2e4fe367b399be9d955ad /src
parent9ef6c50df79066c3604e2775cbbaf7eeae5e5bc1 (diff)
further RISCV mapping: all extant non-compressed instructions done
Diffstat (limited to 'src')
-rw-r--r--src/gen_lib/sail_string.lem10
-rw-r--r--src/sail_lib.ml10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gen_lib/sail_string.lem b/src/gen_lib/sail_string.lem
index f31e612b..b1f0fbe3 100644
--- a/src/gen_lib/sail_string.lem
+++ b/src/gen_lib/sail_string.lem
@@ -76,6 +76,16 @@ let spaces_matches_prefix s =
| n -> Just ((), n)
end
+let hex_bits_5_matches_prefix s =
+ match maybe_int_of_prefix s with
+ | Nothing -> Nothing
+ | Just (n, len) ->
+ if 0 <= n && n < 32 then
+ Just ((of_int 5 n, len))
+ else
+ Nothing
+ end
+
let hex_bits_6_matches_prefix s =
match maybe_int_of_prefix s with
| Nothing -> Nothing
diff --git a/src/sail_lib.ml b/src/sail_lib.ml
index 6e2deff7..3e304796 100644
--- a/src/sail_lib.ml
+++ b/src/sail_lib.ml
@@ -644,6 +644,16 @@ let spaces_matches_prefix s =
| 0 -> ZNone ()
| n -> ZSome ((), Big_int.of_int n)
+let hex_bits_5_matches_prefix s =
+ match maybe_int_of_prefix s with
+ | ZNone () -> ZNone ()
+ | ZSome (n, len) ->
+ let n = Big_int.to_int n in
+ if 0 <= n && n < 32 then
+ ZSome ((bits_of_int 16 n, len))
+ else
+ ZNone ()
+
let hex_bits_6_matches_prefix s =
match maybe_int_of_prefix s with
| ZNone () -> ZNone ()