Exemplo n.º 1
0
        /// <summary>
        /// Assumes that set is a union of some minterms (or empty).
        /// If null then null is returned.
        /// </summary>
        public BitVector ConvertFromCharSet(BDDAlgebra alg, BDD set)
        {
            BDD[] partition = _minterms;

            BitVector res = False;

            for (int i = 0; i < partition.Length; i++)
            {
                if (alg.IsSatisfiable(alg.And(partition[i], set)))
                {
                    res = BitVector.Or(res, _mintermVectors[i]);
                }
            }

            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Assumes that set is a union of some minterms (or empty).
        /// If null then 0 is returned.
        /// </summary>
        public ulong ConvertFromCharSet(BDDAlgebra alg, BDD set)
        {
            BDD[] partition = _minterms;

            ulong res = 0;

            for (int i = 0; i < partition.Length; i++)
            {
                // Set the i'th bit if the i'th minterm is in the set.
                if (alg.IsSatisfiable(alg.And(partition[i], set)))
                {
                    res |= (ulong)1 << i;
                }
            }

            return(res);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Assumes that set is a union of some minterms (or empty).
        /// If null then 0 is returned.
        /// </summary>
        public ulong ConvertFromCharSet(BDDAlgebra alg, BDD?set)
        {
            ulong res = _false;

            if (set is not null)
            {
                for (int i = 0; i < _bits; i++)
                {
                    Debug.Assert(_partition is not null);

                    // set the i'th bit if the i'th minterm is in the set
                    if (alg.IsSatisfiable(alg.And(_partition[i], set)))
                    {
                        res |= (ulong)1 << i;
                    }
                }
            }

            return(res);
        }
Exemplo n.º 4
0
        public BV?ConvertFromCharSet(BDDAlgebra alg, BDD set)
        {
            if (set == null)
            {
                return(null);
            }

            Debug.Assert(_partition is not null);

            BV res = False;

            for (int i = 0; i < _bits; i++)
            {
                BDD bdd_i = _partition[i];
                BDD conj  = alg.And(bdd_i, set);
                if (alg.IsSatisfiable(conj))
                {
                    res |= _minterms[i];
                }
            }

            return(res);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Identity function, returns s.
 /// </summary>
 public BDD ConvertFromCharSet(BDDAlgebra _, BDD s) => s;