From 734e23d5f0bfc6fcd2a723bc0c692b97e515088e Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 4 Sep 2018 17:46:07 +0100 Subject: C: Tweaks to RISC-V to get compiling to C Revert a change to string_of_bits because it broke all the RISC-V tests in OCaml. string_of_int (int_of_string x) is not valid because x may not fit within an integer. --- src/sail_lib.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sail_lib.ml b/src/sail_lib.ml index 41b7c383..505227ef 100644 --- a/src/sail_lib.ml +++ b/src/sail_lib.ml @@ -373,9 +373,9 @@ let string_of_hex = function | _ -> failwith "Cannot convert binary sequence to hex" let string_of_bits bits = - (* if List.length bits mod 4 == 0 - * then "0x" ^ String.concat "" (List.map string_of_hex (break 4 bits)) *) - string_of_int (int_of_string ("0b" ^ String.concat "" (List.map string_of_bit bits))) + if List.length bits mod 4 == 0 + then "0x" ^ String.concat "" (List.map string_of_hex (break 4 bits)) + else "0b" ^ String.concat "" (List.map string_of_bit bits) let hex_slice (str, n, m) = let bits = List.concat (List.map hex_char (list_of_string (String.sub str 2 (String.length str - 2)))) in -- cgit v1.2.3