Exemple #1
0
 public OrGate()
 {
     //your code here
     m_gNotA = new NotGate();
     m_gNotB = new NotGate();
     m_gNand = new NAndGate();
     m_gNand.ConnectInput1(m_gNotA.Output);
     m_gNand.ConnectInput2(m_gNotB.Output);
     Input1 = m_gNotA.Input;
     Input2 = m_gNotB.Input;
     Output = m_gNand.Output;
 }
Exemple #2
0
 public AndGate()
 {
     //init the gates
     m_gNand = new NAndGate();
     m_gNot  = new NotGate();
     //wire the output of the nand gate to the input of the not
     m_gNot.ConnectInput(m_gNand.Output);
     //set the inputs and the output of the and gate
     Output = m_gNot.Output;
     Input1 = m_gNand.Input1;
     Input2 = m_gNand.Input2;
 }
Exemple #3
0
        public OrGate()
        {
            var mGNand = new NAndGate();
            var mGNot  = new NotGate();
            var mGNot2 = new NotGate();

            mGNand.ConnectInput1(mGNot.Output);
            mGNand.ConnectInput2(mGNot2.Output);

            Input1 = mGNot.Input;
            Input2 = mGNot2.Input;
            Output = mGNand.Output;
        }
Exemple #4
0
        public OrGate()
        {
            m_gNand = new NAndGate();
            m_gNotX = new NotGate();
            m_gNotY = new NotGate();

            m_gNand.ConnectInput1(m_gNotX.Output);
            m_gNand.ConnectInput2(m_gNotY.Output);

            Input1 = m_gNotX.Input;
            Input2 = m_gNotY.Input;
            Output = m_gNand.Output;
        }
Exemple #5
0
 public OrGate()
 {
     //init the gates
     m_gNand = new NAndGate();
     m_gNot1 = new NotGate();
     m_gNot2 = new NotGate();
     //wire the output of the NOT gates to the inputs of the NAND
     m_gNand.ConnectInput1(m_gNot1.Output);
     m_gNand.ConnectInput2(m_gNot2.Output);
     //set the inputs and the output of the OR gate
     Output = m_gNand.Output;
     Input1 = m_gNot1.Input;
     Input2 = m_gNot2.Input;
 }
Exemple #6
0
        public OrGate()
        {
            //init the gates
            m_gNand = new NAndGate();
            m_gNot  = new NotGate();
            m_gNot2 = new NotGate();
            //wire the output of the nand gate to the input of the not
            m_gNand.ConnectInput1(m_gNot.Output);
            m_gNand.ConnectInput2(m_gNot2.Output);
            //set the inputs and the output of the and gate

            Input1 = m_gNot.Input;
            Input2 = m_gNot2.Input;
            Output = m_gNand.Output;
        }
Exemple #7
0
        public OrGate()
        {
            //init the gates.
            not1 = new NotGate();
            not2 = new NotGate();
            Nand = new NAndGate();



            Nand.ConnectInput1(not1.Output);
            Nand.ConnectInput2(not2.Output);

            Output = Nand.Output;
            Input1 = not1.Input;
            Input2 = not2.Input;
        }
Exemple #8
0
        public XorGate()
        {
            or   = new OrGate();
            NAnd = new NAndGate();
            and  = new AndGate();



            Input1 = or.Input1;
            Input2 = or.Input2;

            NAnd.ConnectInput1(Input1);
            NAnd.ConnectInput2(Input2);
            and.ConnectInput1(or.Output);
            and.ConnectInput2(NAnd.Output);
            Output = and.Output;
        }
Exemple #9
0
        public XorGate()
        {
            m_gNand = new NAndGate();
            m_gOr   = new OrGate();
            m_gAnd  = new AndGate();

            m_gOr.ConnectInput1(Input1);
            m_gOr.ConnectInput2(Input2);

            m_gNand.ConnectInput1(Input1);
            m_gNand.ConnectInput2(Input2);

            m_gAnd.ConnectInput1(m_gOr.Output);
            m_gAnd.ConnectInput2(m_gNand.Output);

            Output = m_gAnd.Output;
        }
Exemple #10
0
        //Xor gate is possible to get by combining with and gate the results of the nand and or gates.
        public XorGate()
        {
            nand_input = new NAndGate();
            or_input   = new OrGate();
            and_output = new AndGate();

            nand_input.ConnectInput1(Input1);
            nand_input.ConnectInput2(Input2);

            or_input.ConnectInput1(Input1);
            or_input.ConnectInput2(Input2);


            and_output.ConnectInput1(nand_input.Output);
            and_output.ConnectInput2(or_input.Output);

            Output = and_output.Output;
        }
Exemple #11
0
        public XorGate()
        {
            //your code here
            m_gAnd  = new AndGate();
            m_gNand = new NAndGate();
            m_gOr   = new OrGate();

            m_gAnd.ConnectInput1(m_gNand.Output);
            m_gAnd.ConnectInput2(m_gOr.Output);


            Input1 = m_gOr.Input1;
            Input2 = m_gOr.Input2;

            m_gNand.ConnectInput1(Input1);
            m_gNand.ConnectInput2(Input2);

            Output = m_gAnd.Output;
        }
Exemple #12
0
        public XorGate()
        {
            //init the variables
            m_gNand1 = new NAndGate();
            m_gNand2 = new NAndGate();
            m_gNand3 = new NAndGate();
            m_gNot1  = new NotGate();
            m_gNot2  = new NotGate();

            //wire the gates
            m_gNand1.ConnectInput1(m_gNot1.Output);
            m_gNand1.ConnectInput2(Input2);

            m_gNand2.ConnectInput1(Input1);
            m_gNand2.ConnectInput2(m_gNot2.Output);

            m_gNand3.ConnectInput1(m_gNand1.Output);
            m_gNand3.ConnectInput2(m_gNand2.Output);

            //set the inputs and the output of the OR gate
            Output = m_gNand3.Output;
            m_gNot1.Input.ConnectInput(Input1);
            m_gNot2.Input.ConnectInput(Input2);
        }