예제 #1
0
        public override bool TestGate()
        {
            int wordBitsFilter         = WordBitsFilter();
            var wsFlags                = new WireSet(6);
            int inputPermutationsCount = (int)Math.Pow(2, Size);
            int flagsPermutationsCount = (int)Math.Pow(2, wsFlags.Size);

            for (int i = 0; i < inputPermutationsCount; i++)
            {
                InputX.SetValue(i);
                for (int j = 0; j < inputPermutationsCount; j++)
                {
                    InputY.SetValue(j);
                    for (int k = 0; k < flagsPermutationsCount; k++)
                    {
                        wsFlags.SetValue(k);
                        SetFlags(wsFlags);
                        bool test = Test(
                            wordBitsFilter,
                            InputX.Get2sComplement(),
                            InputY.Get2sComplement(),
                            ZeroX.Value,
                            NotX.Value,
                            ZeroY.Value,
                            NotY.Value,
                            F.Value,
                            NotOutput.Value
                            );
                        if (!test)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }