Exemple #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Element memory   = new Register.Memory();
            Element register = new Register("Register");
            Element comb     = new CombinationalElement("CombinationalElement", 8);

            TestElement(ref memory, 0, 0);
            TestElement(ref memory, 1, 0);
            TestElement(ref memory, 0, 1);
            TestElement(ref memory, 0, 0);
            TestElement(ref memory, 1, 0);
            TestElement(ref memory, 1, 1);

            TestElement(ref register, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);
            TestElement(ref register, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);

            TestElement(ref comb, 1, 1, 1, 1, 1, 1, 0, 0);
            TestElement(ref comb, 0, 0, 0, 0, 0, 0, 0, 0);
            TestElement(ref comb, 1, 1, 1, 1, 1, 1, 1, 1);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Element memory   = new Register.Memory();
            Element register = new Register("Register");
            Element comb     = new CombinationalElement("CombinationalElement", 8);

            TestElement(ref memory, 0, 0);
            TestElement(ref memory, 1, 0);
            TestElement(ref memory, 0, 1);
            TestElement(ref memory, 0, 0);
            TestElement(ref memory, 1, 0);
            TestElement(ref memory, 1, 1);

            TestElement(ref register, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);
            TestElement(ref register, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);

            TestElement(ref comb, 1, 1, 1, 1, 1, 1, 0, 0);
            TestElement(ref comb, 0, 0, 0, 0, 0, 0, 0, 0);
            TestElement(ref comb, 1, 1, 1, 1, 1, 1, 1, 1);

            List <Element> elements = new List <Element>();

            elements.Add(memory);
            elements.Add(register);
            elements.Add(comb);

            // Test IComparable<Element>
            elements.Sort();

            foreach (Element el in elements)
            {
                Console.WriteLine(el.Name + ": " + el.Inputs);
            }

            Console.ReadKey();
        }