예제 #1
0
파일: FullAdder.cs 프로젝트: roinissan/C-
        // full addr operation is accomplished by using 2 half addrs and or gate for the output carrier
        public FullAdder()
        {
            // initilaize the gates
            CarryInput       = new Wire();
            CarryOutput      = new Wire();
            first_half_addr  = new HalfAdder();
            second_half_addr = new HalfAdder();
            or_op            = new OrGate();

            //connecting the first addr
            first_half_addr.ConnectInput1(Input1);
            first_half_addr.ConnectInput2(Input2);

            //connecting the second addr
            second_half_addr.ConnectInput1(first_half_addr.Output);
            second_half_addr.ConnectInput2(CarryInput);

            //or_op for the carry output
            or_op.ConnectInput1(second_half_addr.CarryOutput);
            or_op.ConnectInput2(first_half_addr.CarryOutput);

            //connecting the outputs
            Output.ConnectInput(second_half_addr.Output);
            CarryOutput.ConnectInput(or_op.Output);
        }
예제 #2
0
        public HalfAdder()
        {
            CarryOutput = new Wire();
            m_xorGate   = new XorGate();
            m_andGate   = new AndGate();

            m_xorGate.Input1.ConnectInput(Input1);
            m_xorGate.Input2.ConnectInput(Input2);
            Output.ConnectInput(m_xorGate.Output);

            m_andGate.Input1.ConnectInput(Input1);
            m_andGate.Input2.ConnectInput(Input2);
            CarryOutput.ConnectInput(m_andGate.Output);
        }
예제 #3
0
파일: HalfAdder.cs 프로젝트: LueeAkasha/ECS
        public HalfAdder()
        {
            CarryOutput = new Wire();
            xor         = new XorGate();
            and         = new AndGate();

            xor.ConnectInput1(Input1);
            xor.ConnectInput2(Input2);
            and.ConnectInput1(Input1);
            and.ConnectInput2(Input2);

            CarryOutput.ConnectInput(and.Output);
            Output.ConnectInput(xor.Output);
        }
예제 #4
0
파일: HalfAdder.cs 프로젝트: boaz23/ECS
        public HalfAdder()
        {
            //your code here
            m_gXor = new XorGate();
            m_gAnd = new AndGate();

            m_gXor.ConnectInput1(Input1);
            m_gXor.ConnectInput2(Input2);
            Output.ConnectInput(m_gXor.Output);

            m_gAnd.ConnectInput1(Input1);
            m_gAnd.ConnectInput2(Input2);
            CarryOutput = new Wire();
            CarryOutput.ConnectInput(m_gAnd.Output);
        }
예제 #5
0
 public MultiBitAndGate(int iInputCount)
     : base(iInputCount)
 {
     //your code here
     and    = new AndGate[iInputCount - 1];
     and[0] = new AndGate();
     and[0].ConnectInput1(m_wsInput[0]);
     and[0].ConnectInput2(m_wsInput[1]);
     for (int i = 2; i < iInputCount; i++)
     {
         and[i - 1] = new AndGate();
         and[i - 1].ConnectInput1(and[i - 2].Output);
         and[i - 1].ConnectInput2(m_wsInput[i]);
     }
     Output.ConnectInput(and[iInputCount - 2].Output);
 }
예제 #6
0
        //your code here

        public MultiBitAndGate(int iInputCount)
            : base(iInputCount)
        {
            AndGate[] and = new AndGate[iInputCount - 1]; // reminder - make the first one outside the for loop
            and[0] = new AndGate();
            and[0].ConnectInput1(m_wsInput[0]);           //assuming there are at least two bits
            and[0].ConnectInput2(m_wsInput[1]);

            for (int i = 1; i < iInputCount - 1; i++)
            {
                and[i] = new AndGate();
                and[i].ConnectInput1(and[i - 1].Output);
                and[i].ConnectInput2(m_wsInput[i + 1]);
            }
            Output.ConnectInput(and[iInputCount - 2].Output);
        }
예제 #7
0
        public BitwiseAndGate(int iSize)
            : base(iSize)
        {
            m_gAnd = new AndGate[iSize];

            WireSet ws_resault = new WireSet(iSize);

            //your code here
            for (int i = 0; i < iSize; i++)
            {
                m_gAnd[i] = new AndGate();
                m_gAnd[i].ConnectInput1(Input1[i]);
                m_gAnd[i].ConnectInput2(Input2[i]);

                ws_resault[i].ConnectInput(m_gAnd[i].Output);
            }
            Output.ConnectInput(ws_resault);
        }
예제 #8
0
파일: HalfAdder.cs 프로젝트: roinissan/C-
        // creating the halfadder by using the "xor" and "and gates" for the output and the carry
        public HalfAdder()
        {
            // initilaize the gates
            CarryOutput = new Wire();
            xor_op      = new XorGate();
            and_op      = new AndGate();

            //xor operation for the sum output
            xor_op.ConnectInput1(Input1);
            xor_op.ConnectInput2(Input2);

            //and operation for the carry output
            and_op.ConnectInput1(Input1);
            and_op.ConnectInput2(Input2);

            //connecting outputs
            Output.ConnectInput(xor_op.Output);
            CarryOutput.ConnectInput(and_op.Output);
        }
예제 #9
0
        public FullAdder()
        {
            CarryInput  = new Wire();
            CarryOutput = new Wire();
            half1       = new HalfAdder();
            half2       = new HalfAdder();
            or          = new OrGate();

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


            half2.ConnectInput1(CarryInput);
            half2.ConnectInput2(half1.Output);

            or.ConnectInput1(half1.CarryOutput);
            or.ConnectInput2(half2.CarryOutput);

            CarryOutput.ConnectInput(or.Output);
            Output.ConnectInput(half2.Output);
        }
예제 #10
0
        public BitwiseMux(int iSize)
            : base(iSize)
        {
            ControlInput = new Wire();
            //your code here
            m_gMux = new MuxGate[iSize];

            WireSet ws_resault = new WireSet(iSize);

            //your code here
            for (int i = 0; i < iSize; i++)
            {
                m_gMux[i] = new MuxGate();
                m_gMux[i].ConnectInput1(Input1[i]);
                m_gMux[i].ConnectInput2(Input2[i]);
                m_gMux[i].ConnectControl(ControlInput);

                ws_resault[i].ConnectInput(m_gMux[i].Output);
            }
            Output.ConnectInput(ws_resault);
        }
예제 #11
0
        public FullAdder()
        {
            CarryInput = new Wire();
            //your code here
            CarryOutput  = new Wire();
            m_halfAdder1 = new HalfAdder();
            m_halfAdder2 = new HalfAdder();
            m_xorGate    = new XorGate();

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

            m_halfAdder2.ConnectInput1(m_halfAdder1.Output);
            m_halfAdder2.ConnectInput2(CarryInput);

            m_xorGate.ConnectInput1(m_halfAdder1.CarryOutput);
            m_xorGate.ConnectInput2(m_halfAdder2.CarryOutput);

            Output.ConnectInput(m_halfAdder2.Output);
            CarryOutput.ConnectInput(m_xorGate.Output);
        }
예제 #12
0
파일: FullAdder.cs 프로젝트: boaz23/ECS
        public FullAdder()
        {
            CarryInput = new Wire();
            //your code here

            CarryOutput = new Wire();

            m_gHf = new HalfAdder();
            m_gHf.ConnectInput1(Input1);
            m_gHf.ConnectInput2(Input2);

            m_gHfCin = new HalfAdder();
            m_gHfCin.ConnectInput1(m_gHf.Output);
            m_gHfCin.ConnectInput2(CarryInput);
            Output.ConnectInput(m_gHfCin.Output);

            m_gOrCout = new OrGate();
            m_gOrCout.ConnectInput1(m_gHf.CarryOutput);
            m_gOrCout.ConnectInput2(m_gHfCin.CarryOutput);
            CarryOutput.ConnectInput(m_gOrCout.Output);
        }
예제 #13
0
파일: Memory.cs 프로젝트: boaz23/ECS
 private void ConnectReadingMux()
 {
     m_outputMux = new BitwiseMultiwayMux(WordSize, AddressSize);
     m_outputMux.ConnectControl(Address);
     Output.ConnectInput(m_outputMux.Output);
 }