Then type the following code:
structure Bdd = LOGIC();
open Bdd;
bdd_start();
Here is a small example program you can type interactively to get you started:
val ff = FALSE(); (* the zero BDD *)
val a = V(NEW()); (* NEW() creates a variable *)
SIZE a; (* V builds the corresponding three-node BDD *)
val b = V(NEW());
val c = V(NEW());
val x = ORL[++a, ++b, NOT (++c)];
SIZE x;
x = ff;
val y = ++x AND ANDL[NOT (++a), NOT (++b), ++c];
SIZE y;
y = ff;
(* Given a seed, mkRandom returns a psuedo-random number generator
which takes an integer argument of one more than the maximum
return value required. ( Linear Congruential, after Sedgewick,
"Algorithms", Addison-Wesley, 1983, Chapter 3 pp 37-38.) *)
fun mkRandom seed =
let val r = ref seed
val a = 31415821
val m = 100000000
fun f n =
let val rand = (r := ((a * !r + 1) mod m);
(!r * n) div m)
in if n < 0 then rand + 1 else rand
end
in f
end;
Revision 1.1 by
neilb
2004/08/09 22:04:03
Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk Please contact our webadmin with any comments or corrections. Logging and Cookies Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh |