Implement interp_cnd.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2025-01-30 21:04:32 -08:00
parent 81944dbf11
commit bf76aced95

View file

@ -169,7 +169,14 @@ let ( >=. ) a b = Int64.compare a b >= 0
(* Interpret a condition code with respect to the given flags. *)
(* !!! Check the Specification for Help *)
let interp_cnd { fo; fs; fz } : cnd -> bool = fun x -> failwith "interp_cnd unimplemented"
let interp_cnd { fo; fs; fz } : cnd -> bool = fun c ->
match c with
| Eq -> fz
| Neq -> not fz
| Gt -> fo = fs && not fz
| Ge -> fo = fs
| Lt -> fo <> fs
| Le -> fo <> fs || fz
(* Maps an X86lite address into Some OCaml array index,
or None if the address is not within the legal address space. *)