library colibrilib.bitwise_rules — module ExportThe rules of the ground terms, without precondition: the meaning of the term is given by its interpretation (Term.view), the constant arguments by their values when they are known (else no equation yet: the wiring calls again when they are known)
module Export923use int.Int924use list.List925use option.Option926use colibrilib.env.Env927use colibrilib.bv_sem.Sem928use Term929use TermView930use Rules931use Intervals932use colibrilib.sbdd.SNode933use colibrilib.bddbitv.Export934use colibrilib.spec.Opt935use TermSize as TS936
The size of a node, from its value, its domain and its types (Dom_genrelbitv.get_bv_size)
Valid (60ms) (colibri2)let size (d:env) (n:Node.t) : option int940ensures { when_some (has_size d n) result }941= TS.size d n942
The term of a node, of its size if it is known (Dom_genrelbitv.monome_int)
Valid (56ms) (colibri2)let monome (d:env) (n:Node.t) : IBDD.t946ensures { is_term d n result }947= TS.monome d n948
The known bits of the interval of n in its term
Valid (258ms) (colibri2)let partial bits_of_interval (d:env) (n:Node.t) : unit951raises { Contradiction -> not live d }952raises { Unsupported -> false }953raises { Overflow -> false }954= Intervals.bits_of_interval d n955
The bit–level term of a ground term (except the value of a testbit)
Valid (954ms) (colibri2 56) (split_vc) (depth 1)let partial term (d:env) (g:ground) : unit958raises { Contradiction -> not live d }959= let r = node g in960match view g with961| Some (And, Cons a (Cons b Nil)) -> logand d r a b962| Some (Or, Cons a (Cons b Nil)) -> logor d r a b963| Some (Xor, Cons a (Cons b Nil)) -> logxor d r a b964| Some (Not, Cons a Nil) -> lognot d r a965| Some (Asr, Cons a (Cons o Nil)) ->966match int_value d o with967| Some off -> shift_right d r a off968| None -> ()969end970| Some (Extract, Cons a (Cons o (Cons l Nil))) ->971match int_value d o, int_value d l with972| Some off, Some len -> extract d r a off len973| _ -> ()974end975| Some (SignedExtract, Cons a (Cons o (Cons l Nil))) ->976match int_value d o, int_value d l with977| Some off, Some len -> signed_extract d r a off len978| _ -> ()979end980| Some (Update, Cons dst (Cons o (Cons l (Cons src Nil)))) ->981match int_value d o, int_value d l with982| Some off, Some len -> update d r dst src off len983| _ -> ()984end985| Some (Test, Cons a (Cons kn Nil)) ->986match int_value d kn with987| Some k -> testbit d r a k988| None -> ()989end990| Some (Sbv2int s, Cons a Nil) ->991sbv2int_spec s (pure { ienv d a }); signed_extract d r a 0 s992| Some ((BvAnd n | BvOr n | BvXor n) as op, Cons a (Cons b Nil)) ->993bv_binop d r a b n op994| Some ((BvNot _ | BvExtract _ _ _ | BvSignExtend _ _ | BvRotl _ _ | BvRotr _ _) as op,995Cons a Nil) -> bv_unop d r a op996| Some ((BvShl n | BvLshr n | BvAshr n) as op, Cons a (Cons o Nil)) ->997match int_value d o with998| Some off -> bv_shift d r a o n off op999| None -> ()1000end1001| _ -> ()1002end1003
The value of a testbit node is known
Valid (910ms) (colibri2)let partial test_value (d:env) (g:ground) : unit1006raises { Contradiction -> not live d }1007= let r = node g in1008match view g with1009| Some (Test, Cons a (Cons kn Nil)) ->1010match int_value d kn, bool_value d r with1011| Some k, Some v -> testbit_value d r a k v1012| _ -> ()1013end1014| _ -> ()1015end1016end1017