Skip to content

Commit

Permalink
fix parsing of >64-bit numbers in repl.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Sep 14, 2023
1 parent f7fd0e8 commit f20cec4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bin/asli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let rec process_command (tcenv: TC.Env.t) (cpu: Cpu.cpu) (fname: string) (input0
List.iter (fun (nm, v) -> Printf.printf " %s%s\n" (if !v then "+" else "-") nm) flags
| [":opcode"; iset; opcode] ->
(* todo: make this code more robust *)
let op = Z.of_int (int_of_string opcode) in
let op = Z.of_string opcode in
Printf.printf "Decoding and executing instruction %s %s\n" iset (Z.format "%x" op);
cpu.opcode iset op
| [":opcodes"; iset; instr] ->
Expand All @@ -189,7 +189,7 @@ let rec process_command (tcenv: TC.Env.t) (cpu: Cpu.cpu) (fname: string) (input0
) encodings;
| [":sem"; iset; opcode] ->
let cpu' = Cpu.mkCPU cpu.env cpu.denv in
let op = Z.of_int (int_of_string opcode) in
let op = Z.of_string opcode in
Printf.printf "Decoding instruction %s %s\n" iset (Z.format "%x" op);
cpu'.sem iset op
| ":dump" :: iset :: opcode :: rest ->
Expand All @@ -200,7 +200,7 @@ let rec process_command (tcenv: TC.Env.t) (cpu: Cpu.cpu) (fname: string) (input0
| _ -> invalid_arg "expected at most 3 arguments to :dump")
in
let cpu' = Cpu.mkCPU (Eval.Env.copy cpu.env) cpu.denv in
let op = Z.of_int (int_of_string opcode) in
let op = Z.of_string opcode in
let bits = VBits (Primops.prim_cvt_int_bits (Z.of_int 32) op) in
let decoder = Eval.Env.getDecoder cpu'.env (Ident iset) in
let stmts = Dis.dis_decode_entry cpu'.env cpu.denv decoder bits in
Expand Down
2 changes: 1 addition & 1 deletion libASL/dis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1465,4 +1465,4 @@ let retrieveDisassembly ?(address:string option) (env: Eval.Env.t) (lenv: env) (
let lenv = match address with
| Some v -> setPC env lenv (Z.of_string v)
| None -> lenv in
dis_decode_entry env lenv decoder (Value.VBits (Primops.prim_cvt_int_bits (Z.of_int 32) (Z.of_int (int_of_string opcode))))
dis_decode_entry env lenv decoder (Value.VBits (Primops.prim_cvt_int_bits (Z.of_int 32) (Z.of_string opcode)))

0 comments on commit f20cec4

Please sign in to comment.