Skip to content

Commit

Permalink
Add cross-checking for operands with constants
Browse files Browse the repository at this point in the history
Operands with constants `(uimm,0b000)` were previously split and the constant
discarded. While this did not cause errors, the change now cross-checks both
parts to an `inputl` list before retaining the relevant components.
This ensures accuracy and robustness.
  • Loading branch information
Linda-Njau authored and ThinkOpenly committed Oct 30, 2024
1 parent 39c73b8 commit 0afe610
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sail_json_backend/json.ml
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,15 @@ let json_of_syntax k =
else if String.equal s "\"(\"" then "("
else if String.equal s "\")\"" then ")"
else if String.starts_with ~prefix:"maybe_" s then "[," ^ remove_identity_funcs s ^ "]"
else if String.contains s ',' then List.hd (Str.split (Str.regexp ",") (remove_identity_funcs s))
else if String.contains s ',' then (
let elements = Str.split (Str.regexp ",") (remove_identity_funcs s) in
let filtered_elements =
match Hashtbl.find_opt inputs k with
| None -> []
| Some inputl -> List.filter (fun element -> List.mem element inputl) elements
in
String.concat "," filtered_elements
)
else remove_identity_funcs s
)
(List.tl (Hashtbl.find assembly_clean k))
Expand Down

0 comments on commit 0afe610

Please sign in to comment.