From c4da9fa2a17ee965fb465da7943f1665dca4ffec Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 18 Sep 2018 14:45:53 +0100 Subject: Add string mapping functions to interpreter --- src/value.ml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/value.ml') diff --git a/src/value.ml b/src/value.ml index 76d02850..6c9990a1 100644 --- a/src/value.ml +++ b/src/value.ml @@ -514,6 +514,10 @@ let value_gteq_real = function | [v1; v2] -> V_bool (Sail_lib.gteq_real (coerce_real v1, coerce_real v2)) | _ -> failwith "value gteq_real" +let value_string_append = function + | [v1; v2] -> V_string (Sail_lib.string_append (coerce_string v1, coerce_string v2)) + | _ -> failwith "value string_append" + let primops = List.fold_left (fun r (x, y) -> StringMap.add x y r) @@ -612,4 +616,8 @@ let primops = ("replicate_bits", value_replicate_bits); ("Elf_loader.elf_entry", fun _ -> V_int (!Elf_loader.opt_elf_entry)); ("Elf_loader.elf_tohost", fun _ -> V_int (!Elf_loader.opt_elf_tohost)); + ("string_append", value_string_append); + ("string_length", value_string_length); + ("string_startswith", value_string_startswith); + ("string_drop", value_string_drop); ] -- cgit v1.2.3