Exemple #1
0
        public Bdd execute()
        {
            Bdd b      = body.execute();
            Bdd result = new Bdd(false);

            foreach (Var v in vars)
            {
                //Bdd b2 = v.execute();
                //result = BDD.And(BDD.Restrict(b.Var, b2.Var, true), BDD.Restrict(b.Var, b2.Var, false));
                result = BDD.Or(result, BDD.ForAll(v.execute().Var, b));
            }
            b.Dispose();
            return(result);
        }
Exemple #2
0
        public static Bdd execute(IBoolExpr AST, string filename)
        {
            if (AST == null)
            {
                return(null);        //Nothing written in textbox, or parser failed.
            }

            BDD.Setup();

            Bdd result = AST.execute();

            result.Serialize(filename, 12);

            return(result);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            /*
             * BDDHash ht = new BDDHash();
             * BddNode b = new BddNode(3, 1, 0);
             * BddNode b1 = new BddNode(2, 1, 1);
             * BddNode b2 = new BddNode(16, 0, 0);
             * int key = ht.GenerateKey(b);
             * int key1 = ht.GenerateKey(b1);
             * int key2 = ht.GenerateKey(b2);
             * Console.WriteLine(key.ToString());
             *
             * Console.WriteLine(ht.count.ToString()); // test count for Add
             *
             * ht.Add(key, b); // test Add
             * ht.Add(key1, b1); // test Add
             * ht.Add(key2, b2); // test Add
             *
             * Console.WriteLine(ht.count.ToString()); // test count for after Add
             * ht.Clear();
             * Console.WriteLine(ht.count.ToString()); // test for Clear()
             * */

            Bdd result = new Bdd(true);

            BDD.Setup();
            {
                Bdd a = new Bdd(1);
                Bdd b = new Bdd(2);
                Bdd c = new Bdd(3);
                Bdd d = new Bdd(4);
                Bdd e;

                e = BDD.Equal(a, b);
                Console.WriteLine(BDD.TCount().ToString());
                c = BDD.Equal(c, d);
                Console.WriteLine(BDD.TCount().ToString());
                result = BDD.And(e, c);
                result = BDD.Or(result, e);
            }
            Console.WriteLine(BDD.TCount().ToString());

            BddSerializer.Serialize(result, "foo");
        }
Exemple #4
0
        public Bdd execute()
        {
            // Calls specific methods from Kernel
            Bdd l      = left.execute();
            Bdd r      = right.execute();
            Bdd result = new Bdd(false);

            switch (op)
            {
            case Kind.DIS:
                result = BDD.Or(l, r);
                break;

            case Kind.CON:
                result = BDD.And(l, r);
                break;

            case Kind.BIMP:
                result = BDD.Equal(l, r);
                break;

            case Kind.NAND:
                result = BDD.Nand(l, r);
                break;

            case Kind.XOR:
                result = BDD.Xor(l, r);
                break;

            case Kind.NOR:
                result = BDD.Nor(l, r);
                break;

            case Kind.NOT:
                result = BDD.Not(r);
                break;
            }
            l.Dispose();                //forced garbage collection
            r.Dispose();

            return(result);
        }
Exemple #5
0
        private static Bdd ExecuteTransition(Bdd R, Bdd T, BddPairList bpl)
        {
            Bdd temp = Kernel.ApplyExists(Op.CON, T, R, bpl);

            return(Kernel.VarListCompose(bpl, temp));
        }