Exemple #1
0
 public static LogicItem CreateFromMintermIndex(int index, int chars, bool? value)
 {
     var ret = new LogicItem();
     ret.Index = index;
     ret.BinaryValue = GetBinaryValue(index, chars);
     ret.Checked = value;
     return ret;
 }
Exemple #2
0
        public static LogicItem CreateFromMintermIndex(int index, int chars, bool?value)
        {
            var ret = new LogicItem();

            ret.Index       = index;
            ret.BinaryValue = GetBinaryValue(index, chars);
            ret.Checked     = value;
            return(ret);
        }
Exemple #3
0
        public static string GetSimplified(IEnumerable <LogicItem> List, int variables, bool hazardsafe = false, bool lsba = false, bool negate = false)
        {
            var implicants = new ImplicantCollection();

            var items        = (from i in List where i.Checked == true || i.Checked == null orderby i.Index ascending select i.Index).ToArray();
            var careminterms = (from i in List where i.Checked == true orderby i.Index ascending select i.Index).ToArray();



            foreach (var item in items)
            {
                var m = new Implicant();
                m.Mask = LogicItem.GetBinaryValue(item, variables);
                m.Minterms.Add(item);
                implicants.Add(m);
            }

            //int count = 0;
            while (Simplify(ref implicants))
            {
                //Populate a matrix.
                bool[,] matrix = new bool[implicants.Count, items.Length]; //x, y
                PopulateMatrix(ref matrix, implicants, items);
            }
            ImplicantCollection selected;

            if (hazardsafe)
            {
                selected = implicants;
            }
            else
            {
                selected = SelectImplicants(implicants, careminterms);
            }
            return(GetFinalExpression(selected, lsba, negate));
        }
 public void SetSelected(LogicItem[] vals)
 {
     MintermTableHelpers.SetMintermTableValues(Minterm5x, vals);
 }