diff options
| author | Thomas Bauereiss | 2020-02-25 15:09:06 +0000 |
|---|---|---|
| committer | Thomas Bauereiss | 2020-02-25 15:09:06 +0000 |
| commit | 306d4e2b195b6d28c136e33135dca2da5d0f122d (patch) | |
| tree | c6390a63aa72ea91b9060adc0ded7f576b783d29 /src | |
| parent | 65228f7ea61535fa8961dcb8ce8f030e7359c479 (diff) | |
Implement count_leading_zeros for interpreter
Diffstat (limited to 'src')
| -rw-r--r-- | src/value.ml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/value.ml b/src/value.ml index 3e7782ed..f94ae176 100644 --- a/src/value.ml +++ b/src/value.ml @@ -425,6 +425,10 @@ let value_replicate_bits = function | [v1; v2] -> mk_vector (Sail_lib.replicate_bits (coerce_bv v1, coerce_int v2)) | _ -> failwith "value replicate_bits" +let value_count_leading_zeros = function + | [v1] -> V_int (Sail_lib.count_leading_zeros (coerce_bv v1)) + | _ -> failwith "value count_leading_zeros" + let is_ctor = function | V_ctor _ -> true | _ -> false @@ -755,6 +759,7 @@ let primops = ref ("undefined_string", fun _ -> V_string ""); ("internal_pick", value_internal_pick); ("replicate_bits", value_replicate_bits); + ("count_leading_zeros", value_count_leading_zeros); ("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); |
