diff --git a/hw2/bin/simulator.ml b/hw2/bin/simulator.ml index 5d01c8d..03cc72d 100644 --- a/hw2/bin/simulator.ml +++ b/hw2/bin/simulator.ml @@ -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. *)