Esempio n. 1
0
        public Inc4()
        {
            input0 = new Nibble();
            output0 = new Nibble();

            input0.Deletable = false;
            input0.Draggable = false;
            output0.Deletable = false;
            output0.Draggable = false;

            one = new Bit();
            add = new Add4();

            Connections.CrossConnect(input0.OutputPoint0, add.Input0.InputPoint0);
            Connections.CrossConnect(input0.OutputPoint1, add.Input0.InputPoint1);
            Connections.CrossConnect(input0.OutputPoint2, add.Input0.InputPoint2);
            Connections.CrossConnect(input0.OutputPoint3, add.Input0.InputPoint3);
            Connections.CrossConnect(one.OutputPoint, add.Input1.InputPoint1);
            Connections.CrossConnect(add.Output0.OutputPoint0, output0.InputPoint0);
            Connections.CrossConnect(add.Output0.OutputPoint1, output0.InputPoint1);
            Connections.CrossConnect(add.Output0.OutputPoint2, output0.InputPoint2);
            Connections.CrossConnect(add.Output0.OutputPoint3, output0.InputPoint3);

            one.Input = true;

            this.Controls.Add(input0);
            this.Controls.Add(output0);
            this.ContextMenuStrip = cms;
        }
Esempio n. 2
0
        public Sub4()
        {
            input0 = new Nibble();
            input1 = new Nibble();
            output0 = new Nibble();
            borrow = new Bit();
            borrow.Bittype = Bit.BitType.Output;

            input0.Deletable = false;
            input0.Draggable = false;

            input1.Deletable = false;
            input1.Draggable = false;

            output0.Deletable = false;
            output0.Draggable = false;

            borrow.Deletable = false;
            borrow.Draggable = false;

            fs1 = new FullSubtractor();
            fs2 = new FullSubtractor();
            fs3 = new FullSubtractor();
            fs4 = new FullSubtractor();

            Connections.CrossConnect(input0.OutputPoint0, fs1.Input0);
            Connections.CrossConnect(input1.OutputPoint0, fs1.Input1);
            Connections.CrossConnect(fs1.OutputB, fs2.InputB);
            Connections.CrossConnect(input0.OutputPoint1, fs2.Input0);
            Connections.CrossConnect(input1.OutputPoint1, fs2.Input1);
            Connections.CrossConnect(fs2.OutputB, fs3.InputB);
            Connections.CrossConnect(input0.OutputPoint2, fs3.Input0);
            Connections.CrossConnect(input1.OutputPoint2, fs3.Input1);
            Connections.CrossConnect(fs3.OutputB, fs4.InputB);
            Connections.CrossConnect(input0.OutputPoint3, fs4.Input0);
            Connections.CrossConnect(input1.OutputPoint3, fs4.Input1);
            Connections.CrossConnect(fs4.OutputB, borrow.InputPoint);
            Connections.CrossConnect(fs1.OutputS, output0.InputPoint0);
            Connections.CrossConnect(fs2.OutputS, output0.InputPoint1);
            Connections.CrossConnect(fs3.OutputS, output0.InputPoint2);
            Connections.CrossConnect(fs4.OutputS, output0.InputPoint3);

            fs1.InputB.IO = false;

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

            this.ContextMenuStrip = cms;
        }
Esempio n. 3
0
        public Add4()
        {
            input0 = new Nibble();
            input1 = new Nibble();
            output0 = new Nibble();
            carry = new Bit();

            carry.Bittype = Bit.BitType.Output;

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

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

            fa1 = new FullAdder();
            fa2 = new FullAdder();
            fa3 = new FullAdder();
            fa4 = new FullAdder();

            Connections.CrossConnect(input0.OutputPoint0, fa1.Input0);
            Connections.CrossConnect(input1.OutputPoint0, fa1.Input1);
            Connections.CrossConnect(fa1.OutputC, fa2.InputC);
            Connections.CrossConnect(input0.OutputPoint1, fa2.Input0);
            Connections.CrossConnect(input1.OutputPoint1, fa2.Input1);
            Connections.CrossConnect(fa2.OutputC, fa3.InputC);
            Connections.CrossConnect(input0.OutputPoint2, fa3.Input0);
            Connections.CrossConnect(input1.OutputPoint2, fa3.Input1);
            Connections.CrossConnect(fa3.OutputC, fa4.InputC);
            Connections.CrossConnect(input0.OutputPoint3, fa4.Input0);
            Connections.CrossConnect(input1.OutputPoint3, fa4.Input1);
            Connections.CrossConnect(fa4.OutputC, carry.InputPoint);
            Connections.CrossConnect(fa1.OutputS, output0.InputPoint0);
            Connections.CrossConnect(fa2.OutputS, output0.InputPoint1);
            Connections.CrossConnect(fa3.OutputS, output0.InputPoint2);
            Connections.CrossConnect(fa4.OutputS, output0.InputPoint3);

            fa1.InputC.IO = false;

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

            this.ContextMenuStrip = cms;
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        public And4()
        {
            input0 = new Nibble();
            input1 = new Nibble();
            output0 = new Nibble();

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

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

            and0 = new AndGate();
            and1 = new AndGate();
            and2 = new AndGate();
            and3 = new AndGate();

            Connections.CrossConnect(input0.OutputPoint0, and0.InputPoint0);
            Connections.CrossConnect(input0.OutputPoint1, and1.InputPoint0);
            Connections.CrossConnect(input0.OutputPoint2, and2.InputPoint0);
            Connections.CrossConnect(input0.OutputPoint3, and3.InputPoint0);
            Connections.CrossConnect(input1.OutputPoint0, and0.InputPoint1);
            Connections.CrossConnect(input1.OutputPoint1, and1.InputPoint1);
            Connections.CrossConnect(input1.OutputPoint2, and2.InputPoint1);
            Connections.CrossConnect(input1.OutputPoint3, and3.InputPoint1);
            Connections.CrossConnect(and0.OutputPoint, output0.InputPoint0);
            Connections.CrossConnect(and1.OutputPoint, output0.InputPoint1);
            Connections.CrossConnect(and2.OutputPoint, output0.InputPoint2);
            Connections.CrossConnect(and3.OutputPoint, output0.InputPoint3);

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

            this.ContextMenuStrip = cms;
        }
Esempio n. 6
0
 protected void UpdateNibbleLocation(Nibble nibble)
 {
     nibble.Offset = this.Location;
 }
Esempio n. 7
0
 protected void SetSize(Nibble nibble)
 {
     if (this.Size.Equals(LGComponent4.small)) nibble.Size = Nibble.small;
     else if (this.Size.Equals(LGComponent4.medium)) nibble.Size = Nibble.medium;
     else nibble.Size = Nibble.large;
 }
Esempio n. 8
0
 private void nibbleToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Nibble g = new Nibble();
     g.Location = calcLocation();
     g.Size = s.Equals(LogicGate.small) ? Nibble.small : s.Equals(LogicGate.medium) ? Nibble.medium : Nibble.large;
     g.Font = new Font(g.Font.FontFamily, fs);
     g.Value = 0;
     //g.ContextMenuStrip = cmsControl;
     g.Name = g.GetType().Name + namecntr++;
     this.Controls.Add(g);
 }