예제 #1
0
        public FullSubtractor()
        {
            input0 = new Bit();
            input1 = new Bit();
            inputB = new Bit();
            outputS = new Bit();
            outputB = new Bit();

            input0.Draggable = false;
            input1.Draggable = false;
            inputB.Draggable = false;
            outputS.Draggable = false;
            outputB.Draggable = false;

            input0.Deletable = false;
            input1.Deletable = false;
            inputB.Deletable = false;
            outputS.Deletable = false;
            outputB.Deletable = false;

            input0.Bittype = Bit.BitType.Input;
            input1.Bittype = Bit.BitType.Input;
            inputB.Bittype = Bit.BitType.Input;

            outputS.Bittype = Bit.BitType.Output;
            outputB.Bittype = Bit.BitType.Output;

            xor1 = new XOrGate();
            xor2 = new XOrGate();
            and1 = new AndGate();
            and2 = new AndGate();
            or1 = new OrGate();
            not1 = new NotGate();
            not2 = new NotGate();

            Connections.CrossConnect(input0.OutputPoint, xor1.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint, xor1.InputPoint1);
            Connections.CrossConnect(input0.OutputPoint, not1.InputPoint);
            Connections.CrossConnect(not1.OutputPoint, and1.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint, and1.InputPoint1);
            Connections.CrossConnect(xor1.OutputPoint, xor2.InputPoint0);
            Connections.CrossConnect(inputB.OutputPoint, xor2.InputPoint1);
            Connections.CrossConnect(xor1.OutputPoint, not2.InputPoint);
            Connections.CrossConnect(not2.OutputPoint, and2.InputPoint0);
            Connections.CrossConnect(inputB.OutputPoint, and2.InputPoint1);
            Connections.CrossConnect(xor2.OutputPoint, outputS.InputPoint);
            Connections.CrossConnect(and1.OutputPoint, or1.InputPoint0);
            Connections.CrossConnect(and2.OutputPoint, or1.InputPoint1);
            Connections.CrossConnect(or1.OutputPoint, outputB.InputPoint);

            this.Controls.Add(input0);
            this.Controls.Add(input1);
            this.Controls.Add(inputB);
            this.Controls.Add(outputS);
            this.Controls.Add(outputB);

            this.ContextMenuStrip = cms;
        }
예제 #2
0
        public XOr4()
        {
            input0 = new Nibble();
            input1 = new Nibble();
            output0 = new Nibble();

            input0.Draggable = false;
            input1.Draggable = false;
            output0.Draggable = false;

            input0.Deletable = false;
            input1.Deletable = false;
            output0.Deletable = false;

            xor1 = new XOrGate();
            xor2 = new XOrGate();
            xor3 = new XOrGate();
            xor4 = new XOrGate();

            Connections.CrossConnect(input0.OutputPoint0, xor1.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint0, xor1.InputPoint1);
            Connections.CrossConnect(input0.OutputPoint1, xor2.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint1, xor2.InputPoint1);
            Connections.CrossConnect(input0.OutputPoint2, xor3.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint2, xor3.InputPoint1);
            Connections.CrossConnect(input0.OutputPoint3, xor4.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint3, xor4.InputPoint1);
            Connections.CrossConnect(xor1.OutputPoint, output0.InputPoint0);
            Connections.CrossConnect(xor2.OutputPoint, output0.InputPoint1);
            Connections.CrossConnect(xor3.OutputPoint, output0.InputPoint2);
            Connections.CrossConnect(xor4.OutputPoint, output0.InputPoint3);

            this.Controls.Add(input0);
            this.Controls.Add(input1);
            this.Controls.Add(output0);

            this.ContextMenuStrip = cms;
        }