module Bddreg:Arithmetic with BDDssig
..end
The type handled by the module is an array of BDDs, which represent a processor-like register with the Least Significant Bit in first position.
This module requires the mlcuddidl library.
typet =
Bdd.t array
val lnot : t -> t
val shift_left : Manager.t -> int -> t -> t * Bdd.t
shift_left man t n
shifts the register to the left by n
bits. Returns the resulting register and the carry, which
contains the last bit shifted out of the register. Assume, as
for the following functions, that n
is between 1
and
the size of the register.val shift_right : Manager.t -> int -> t -> t * Bdd.t
shift_right t n
shifts the register to the right by n
bits. This an arithmetical shift: the sign is inserted
as the new most significant bits. Returns the resulting
register and the carry, which contains the last bit shifted
out of the register.val shift_right_logical : Manager.t -> int -> t -> t * Bdd.t
shift_right
, but here logical shift: a zero
is always inserted.val extend : Manager.t -> signed:bool -> int -> t -> t
extend ~signed:b n x
extends the register x by adding n
most
significant bits, if n>0
, or truncate the -n
most significant bits if
n<0
. b
indicates whether the register is considered as a signed one or
not.val succ : Manager.t -> t -> t * Bdd.t
val pred : Manager.t -> t -> t * Bdd.t
val add : Manager.t -> t -> t -> t * Bdd.t * Bdd.t
val sub : Manager.t -> t -> t -> t * Bdd.t * Bdd.t
val neg : t -> t
n
,
the negation of -2^(n-1)
is itself.val scale : int -> t -> t
val ite : Bdd.t -> t -> t -> t
val is_cst : t -> bool
val zero : Manager.t -> t -> Bdd.t
val equal : Manager.t -> t -> t -> Bdd.t
val greatereq : Manager.t -> t -> t -> Bdd.t
val greater : Manager.t -> t -> t -> Bdd.t
val highereq : Manager.t -> t -> t -> Bdd.t
val higher : Manager.t -> t -> t -> Bdd.t
val min_size : int -> int
min_size cst
computes the minimum number of bits required
to represent the given constant. We have for example min_size
0=0
, min_size 1 = 2
, min_size 3 = 2
, min_size (-8) = 4
.val of_int : Manager.t -> int -> int -> t
of_int size cst
puts the constant integer cst
in a constant register
of size size
. The fact that size
is big enough is checked using the
previous function, and a Failure "..."
exception is raised in case of
problem.val to_int : signed:bool -> t -> int
to_int sign x
converts a constant register to an integer. sign
indicates whether the register is to be interpreted as a signed or
unsigned.val equal_int : Manager.t -> t -> int -> Bdd.t
val greatereq_int : Manager.t -> t -> int -> Bdd.t
val greater_int : Manager.t -> t -> int -> Bdd.t
val highereq_int : Manager.t -> t -> int -> Bdd.t
val higher_int : Manager.t -> t -> int -> Bdd.t
module Minterm:sig
..end
val guard_of_minterm : Manager.t -> t -> Minterm.t -> Bdd.t
val guard_of_int : Manager.t -> t -> int -> Bdd.t
val guardints : Manager.t -> signed:bool -> t -> (Bdd.t * int) list
g -> n
represented by the BDD register.val print : (int -> string) -> Format.formatter -> t -> unit
print f fmt t
prints the register t
using the formatter
fmt
and the function f
to convert BDDs indices to
names.val print_minterm : signed:bool ->
(Format.formatter -> Bdd.t -> unit) -> Format.formatter -> t -> unit
print_minterm f fmt t
prints the register t
using the formatter
fmt
and the function f
to convert BDDs indices to
names.