Пример #1
0
        public void ShapingCNFResolution(Blif blif)
        {
            int lstIndex = 0;

            for (int j = 0; j < blif.NamesAndBoolVectors.Count; j++)
            {
                lstIndex = this.ListAllVariablesWithIndex.IndexOf(blif.NamesAndBoolVectors[j].Names[blif.NamesAndBoolVectors[j].Names.Count - 1]);
                if (lstIndex >= this.ListAllVariablesWithIndex.Count - blif.Outputs_.Count && blif.NamesAndBoolVectors[j].Names.Count == 2 && blif.NamesAndBoolVectors[j].NamesBool[0] == '0')
                {
                    Dictionary <int, char> keyValues = new Dictionary <int, char>
                    {
                        { this.ListAllVariablesWithIndex.IndexOf(blif.NamesAndBoolVectors[j].Names[0]), blif.NamesAndBoolVectors[j].NamesBool[0] },
                        { lstIndex, '-' }
                    };
                    this._CnfResolution.Add(keyValues);
                }
                if (blif.NamesAndBoolVectors[j].Names.Count == 3)
                {
                    ForJStrInBlifForminKeyValue(j);
                    ForJStrInBlifForminKeyValueZeroOne(j);
                }
            }

            CnfResolutionBefore = new List <Dictionary <int, char> >(this._CnfResolution);
        }
Пример #2
0
        public void Reduction(Blif blif)
        {
            bool check = Check_cnf_K_ones_zeros(blif.Inputs_z.Count);

            this.FormationOfConjunctionKForLastBlock(blif.Outputs_.Count, check); // forming the conjunction K for the last block z1 = 0 ... zk = 0 and deleting executable lines
            for (int i = 0; i < this._CnfResolution.Count; i++)
            {
                foreach (KeyValuePair <int, char> item in this._CnfResolution[i])
                {
                    if (item.Key < blif.Outputs_.Count)
                    {
                        if (check)
                        {
                            ReductionCondition(ref i, item, '1', '0');// Z1=0, Z2=0...
                        }
                        else
                        {
                            ReductionCondition(ref i, item, '0', '1');//Z1=1,Z2=1....
                        }
                        break;
                    }
                }
            }
            ReductionRules();
        } // simplification for the first block replacement z1 = 1, z2 = 1 ... or z1 = 0, z2 = 0 ...
Пример #3
0
 public CnfResolution()
 {
     Blif                      = new Blif();
     _CnfResolution            = new List <Dictionary <int, char> >();
     CnfResolutionBefore       = new List <Dictionary <int, char> >();
     ListAllVariablesWithIndex = new List <string>();
     Cnf_K                     = new Dictionary <int, char>();
 }