Exemplo n.º 1
0
        public Full_Adder() : base(3, 2)
        {
            Gate gateA = AddGateIndexed(new XORGate());
            Gate gateB = AddGateIndexed(new XORGate());
            Gate gateC = AddGateIndexed(new ANDGate());
            Gate gateD = AddGateIndexed(new ANDGate());
            Gate gateE = AddGateIndexed(new ORGate());

            // Gate A
            AddInputWire(new Wire(0, 0, gateA));
            AddInputWire(new Wire(1, 1, gateA));
            AddWires(gateA, Wire.Create(0, 0, false, gateB, gateC));

            // Gate B
            AddInputWire(new Wire(2, 1, gateB));
            AddWire(gateB, new Wire(0, 0, -1, true));

            // Gate C
            AddInputWire(new Wire(2, 1, gateC));
            AddWire(gateC, new Wire(0, 0, gateE));

            // Gate D
            AddInputWire(new Wire(0, 0, gateD));
            AddInputWire(new Wire(1, 1, gateD));
            AddWire(gateD, new Wire(0, 1, gateE));

            // Gate E
            AddWire(gateE, new Wire(0, 1, -1, true));
        }
Exemplo n.º 2
0
        /// <summary>
        /// CLK = 0,
        /// 1 = CLR
        /// </summary>
        public Binary_Counter_4Bit() : base(2, 4)
        {
            Chip chip0 = AddChipIndexed(new JK_FlipFlop_Clr());

            chip0.SetInputBit(0, true);
            chip0.SetInputBit(1, true);

            Chip chip1 = AddChipIndexed(new JK_FlipFlop_Clr());

            chip1.SetInputBit(0, true);
            chip1.SetInputBit(1, true);

            Chip chip2 = AddChipIndexed(new JK_FlipFlop_Clr());

            chip2.SetInputBit(0, true);
            chip2.SetInputBit(1, true);

            Chip chip3 = AddChipIndexed(new JK_FlipFlop_Clr());

            chip3.SetInputBit(0, true);
            chip3.SetInputBit(1, true);

            AddInputWire(new Wire(0, 2, chip0));

            AddInputWires(Wire.Create(1, 3, false, chip0, chip1, chip2, chip3));

            AddWire(chip0, new Wire(0, 2, chip1));
            AddWire(chip1, new Wire(0, 2, chip2));
            AddWire(chip2, new Wire(0, 2, chip3));

            AddWire(chip0, new Wire(0, 0, -1, true));
            AddWire(chip1, new Wire(0, 1, -1, true));
            AddWire(chip2, new Wire(0, 2, -1, true));
            AddWire(chip3, new Wire(0, 3, -1, true));
        }
Exemplo n.º 3
0
        public Decoder_3_To_8() : base(4, 8)
        {
            Gate notA  = AddGateIndexed(new NotGate());
            Gate notB  = AddGateIndexed(new NotGate());
            Gate notC  = AddGateIndexed(new NotGate());
            Gate gate0 = AddGateIndexed(new ANDGate(4));
            Gate gate1 = AddGateIndexed(new ANDGate(4));
            Gate gate2 = AddGateIndexed(new ANDGate(4));
            Gate gate3 = AddGateIndexed(new ANDGate(4));
            Gate gate4 = AddGateIndexed(new ANDGate(4));
            Gate gate5 = AddGateIndexed(new ANDGate(4));
            Gate gate6 = AddGateIndexed(new ANDGate(4));
            Gate gate7 = AddGateIndexed(new ANDGate(4));

            AddInputWire(new Wire(0, 0, notA));
            AddInputWire(new Wire(1, 0, notB));
            AddInputWire(new Wire(2, 0, notC));

            AddInputWires(Wire.Create(0, 0, false, gate1, gate3, gate5, gate7));
            AddInputWires(Wire.Create(1, 1, false, gate2, gate3, gate6, gate7));
            AddInputWires(Wire.Create(2, 2, false, gate4, gate5, gate6, gate7));

            // Enable
            AddInputWires(Wire.Create(3, 3, false, gate0, gate1, gate2, gate3, gate4, gate5, gate6, gate7));

            AddWires(notA, Wire.Create(0, 0, false, gate0, gate2, gate4, gate6));
            AddWires(notB, Wire.Create(0, 1, false, gate0, gate1, gate4, gate5));
            AddWires(notC, Wire.Create(0, 2, false, gate0, gate1, gate2, gate3));

            AddWire(gate0, new Wire(0, 0, -1, true));
            AddWire(gate1, new Wire(0, 1, -1, true));
            AddWire(gate2, new Wire(0, 2, -1, true));
            AddWire(gate3, new Wire(0, 3, -1, true));
            AddWire(gate4, new Wire(0, 4, -1, true));
            AddWire(gate5, new Wire(0, 5, -1, true));
            AddWire(gate6, new Wire(0, 6, -1, true));
            AddWire(gate7, new Wire(0, 7, -1, true));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Data = 0-7,
        /// Clk = 8,
        /// OE = 9
        ///
        /// Q = 0-7
        /// </summary>
        public Octal_D_FlipFlop() : base(10, 8)
        {
            D_FlipFlop_Re chip1  = new D_FlipFlop_Re();
            int           index1 = AddChip(chip1);

            D_FlipFlop_Re chip2  = new D_FlipFlop_Re();
            int           index2 = AddChip(chip2);

            D_FlipFlop_Re chip3  = new D_FlipFlop_Re();
            int           index3 = AddChip(chip3);

            D_FlipFlop_Re chip4  = new D_FlipFlop_Re();
            int           index4 = AddChip(chip4);

            D_FlipFlop_Re chip5  = new D_FlipFlop_Re();
            int           index5 = AddChip(chip5);

            D_FlipFlop_Re chip6  = new D_FlipFlop_Re();
            int           index6 = AddChip(chip6);

            D_FlipFlop_Re chip7  = new D_FlipFlop_Re();
            int           index7 = AddChip(chip7);

            D_FlipFlop_Re chip8  = new D_FlipFlop_Re();
            int           index8 = AddChip(chip8);

            ANDGate gate1 = new ANDGate();
            int     i1    = AddGate(gate1);

            ANDGate gate2 = new ANDGate();
            int     i2    = AddGate(gate2);

            ANDGate gate3 = new ANDGate();
            int     i3    = AddGate(gate3);

            ANDGate gate4 = new ANDGate();
            int     i4    = AddGate(gate4);

            ANDGate gate5 = new ANDGate();
            int     i5    = AddGate(gate5);

            ANDGate gate6 = new ANDGate();
            int     i6    = AddGate(gate6);

            ANDGate gate7 = new ANDGate();
            int     i7    = AddGate(gate7);

            ANDGate gate8 = new ANDGate();
            int     i8    = AddGate(gate8);

            Gate gateA = AddGateIndexed(new NotGate());

            // OE
            AddInputWire(new Wire(9, 0, gateA));

            // Clk
            AddInputWires(Wire.Create(8, 0, false, chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8));

            // Data
            AddWire(ID, new Wire(0, 1, index1, true));
            AddWire(ID, new Wire(1, 1, index2, true));
            AddWire(ID, new Wire(2, 1, index3, true));
            AddWire(ID, new Wire(3, 1, index4, true));
            AddWire(ID, new Wire(4, 1, index5, true));
            AddWire(ID, new Wire(5, 1, index6, true));
            AddWire(ID, new Wire(6, 1, index7, true));
            AddWire(ID, new Wire(7, 1, index8, true));

            // Gate A
            AddWires(gateA, Wire.Create(0, 1, false, gate1, gate2, gate3, gate4, gate5, gate6, gate7, gate8));

            // D FF
            AddWire(chip1, new Wire(0, 0, i1));
            AddWire(chip2, new Wire(0, 0, i2));
            AddWire(chip3, new Wire(0, 0, i3));
            AddWire(chip4, new Wire(0, 0, i4));
            AddWire(chip5, new Wire(0, 0, i5));
            AddWire(chip6, new Wire(0, 0, i6));
            AddWire(chip7, new Wire(0, 0, i7));
            AddWire(chip8, new Wire(0, 0, i8));

            // Output
            AddWire(gate1, new Wire(0, 0, -1, true));
            AddWire(gate2, new Wire(0, 1, -1, true));
            AddWire(gate3, new Wire(0, 2, -1, true));
            AddWire(gate4, new Wire(0, 3, -1, true));
            AddWire(gate5, new Wire(0, 4, -1, true));
            AddWire(gate6, new Wire(0, 5, -1, true));
            AddWire(gate7, new Wire(0, 6, -1, true));
            AddWire(gate8, new Wire(0, 7, -1, true));
        }
Exemplo n.º 5
0
        /// <summary>
        /// OE = 0,
        /// RCLK = 1,
        /// SRCLR = 2,
        /// SRCLK = 3,
        /// SER = 4
        /// </summary>
        public Shift_Register_8Bit() : base(6, 9)
        {
            KeepDirty = true;

            // Shift Latches
            Chip S1 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S2 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S3 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S4 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S5 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S6 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S7 = AddChipIndexed(new D_FlipFlop_Re());
            Chip S8 = AddChipIndexed(new D_FlipFlop_Re());

            // Register Latches
            Chip R1 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R2 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R3 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R4 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R5 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R6 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R7 = AddChipIndexed(new D_FlipFlop_Re());
            Chip R8 = AddChipIndexed(new D_FlipFlop_Re());

            // Output Enables
            Gate O1 = AddGateIndexed(new ANDGate());
            Gate O2 = AddGateIndexed(new ANDGate());
            Gate O3 = AddGateIndexed(new ANDGate());
            Gate O4 = AddGateIndexed(new ANDGate());
            Gate O5 = AddGateIndexed(new ANDGate());
            Gate O6 = AddGateIndexed(new ANDGate());
            Gate O7 = AddGateIndexed(new ANDGate());
            Gate O8 = AddGateIndexed(new ANDGate());

            // INs
            Gate OE   = AddGateIndexed(new NotGate());
            Gate RCLK = AddGateIndexed(new BufferGate());

            // SER
            AddInputWire(new Wire(4, 1, S1));

            // SRCLR
            AddInputWires(Wire.Create(2, 2, true, S1, S2, S3, S4, S5, S6, S7, S8));

            AddInputWires(Wire.Create(5, 3, false, S1, S2, S3, S4, S5, S6, S7, S8, R1, R2, R3, R4, R5, R6, R7, R8));

            // SRCLK
            AddInputWires(Wire.Create(3, 0, false, S1, S2, S3, S4, S5, S6, S7, S8));

            // RCLK
            AddInputWire(new Wire(1, 0, RCLK));
            AddWires(RCLK, Wire.Create(0, 0, false, R1, R2, R3, R4, R5, R6, R7, R8));

            // OE
            AddInputWire(new Wire(0, 0, OE));
            AddWires(OE, Wire.Create(0, 1, false, O1, O2, O3, O4, O5, O6, O7, O8));

            // OEs
            AddWire(O1, new Wire(0, 0, -1, true));
            AddWire(O2, new Wire(0, 1, -1, true));
            AddWire(O3, new Wire(0, 2, -1, true));
            AddWire(O4, new Wire(0, 3, -1, true));
            AddWire(O5, new Wire(0, 4, -1, true));
            AddWire(O6, new Wire(0, 5, -1, true));
            AddWire(O7, new Wire(0, 6, -1, true));
            AddWire(O8, new Wire(0, 7, -1, true));
            //AddWire(S1, new Wire(0, 0, -1, true));
            //AddWire(S2, new Wire(0, 1, -1, true));
            //AddWire(S3, new Wire(0, 2, -1, true));
            //AddWire(S4, new Wire(0, 3, -1, true));
            //AddWire(S5, new Wire(0, 4, -1, true));
            //AddWire(S6, new Wire(0, 5, -1, true));
            //AddWire(S7, new Wire(0, 6, -1, true));
            //AddWire(S8, new Wire(0, 7, -1, true));

            //SR->R
            AddWires(S1, Wire.Create(0, 1, false, R1, S2));
            AddWires(S2, Wire.Create(0, 1, false, R2, S3));
            AddWires(S3, Wire.Create(0, 1, false, R3, S4));
            AddWires(S4, Wire.Create(0, 1, false, R4, S5));
            AddWires(S5, Wire.Create(0, 1, false, R5, S6));
            AddWires(S6, Wire.Create(0, 1, false, R6, S7));
            AddWires(S7, Wire.Create(0, 1, false, R7, S8));

            AddWire(S8, new Wire(0, 1, R8));
            AddWire(S8, new Wire(1, 8, -1, true));

            //R->OE
            AddWire(R1, new Wire(0, 0, O1));
            AddWire(R2, new Wire(0, 0, O2));
            AddWire(R3, new Wire(0, 0, O3));
            AddWire(R4, new Wire(0, 0, O4));
            AddWire(R5, new Wire(0, 0, O5));
            AddWire(R6, new Wire(0, 0, O6));
            AddWire(R7, new Wire(0, 0, O7));
            AddWire(R8, new Wire(0, 0, O8));
        }
Exemplo n.º 6
0
        /// <summary>
        /// DIR = 0,
        /// E' = 1,
        /// A1-9 = 2-9
        /// B1-9 = 10-17
        /// </summary>
        public Octal_Bus_Gates() : base(18, 16)
        {
            // Control Gates
            Gate gateA = AddGateIndexed(new ANDGate());
            Gate gateB = AddGateIndexed(new ANDGate());

            // Buffers
            Gate gateE = AddGateIndexed(new TriBufferGate());
            Gate gateF = AddGateIndexed(new TriBufferGate());
            Gate gateG = AddGateIndexed(new TriBufferGate());
            Gate gateH = AddGateIndexed(new TriBufferGate());
            Gate gateI = AddGateIndexed(new TriBufferGate());
            Gate gateJ = AddGateIndexed(new TriBufferGate());
            Gate gateK = AddGateIndexed(new TriBufferGate());
            Gate gateL = AddGateIndexed(new TriBufferGate());
            Gate gateM = AddGateIndexed(new TriBufferGate());
            Gate gateN = AddGateIndexed(new TriBufferGate());
            Gate gateO = AddGateIndexed(new TriBufferGate());
            Gate gateP = AddGateIndexed(new TriBufferGate());
            Gate gateQ = AddGateIndexed(new TriBufferGate());
            Gate gateR = AddGateIndexed(new TriBufferGate());
            Gate gateS = AddGateIndexed(new TriBufferGate());
            Gate gateT = AddGateIndexed(new TriBufferGate());

            //Inputs
            AddInputWire(new Wire(0, 0, gateA));
            AddInputWire(new Wire(0, 0, gateB, true));
            AddInputWire(new Wire(1, 1, gateA, true));
            AddInputWire(new Wire(1, 1, gateB, true));
            AddInputWire(new Wire(2, 0, gateE));
            AddInputWire(new Wire(3, 0, gateF));
            AddInputWire(new Wire(4, 0, gateG));
            AddInputWire(new Wire(5, 0, gateH));
            AddInputWire(new Wire(6, 0, gateI));
            AddInputWire(new Wire(7, 0, gateJ));
            AddInputWire(new Wire(8, 0, gateK));
            AddInputWire(new Wire(9, 0, gateL));
            AddInputWire(new Wire(10, 0, gateM));
            AddInputWire(new Wire(11, 0, gateN));
            AddInputWire(new Wire(12, 0, gateO));
            AddInputWire(new Wire(13, 0, gateP));
            AddInputWire(new Wire(14, 0, gateQ));
            AddInputWire(new Wire(15, 0, gateR));
            AddInputWire(new Wire(16, 0, gateS));
            AddInputWire(new Wire(17, 0, gateT));

            //Gate A
            AddWires(gateA, Wire.Create(0, 1, false, gateE, gateF, gateG, gateH, gateI, gateJ, gateK, gateL));

            //Gate B
            AddWires(gateB, Wire.Create(0, 1, false, gateM, gateN, gateO, gateP, gateQ, gateR, gateS, gateT));

            //Outputs
            AddWire(gateE, new Wire(0, 8, -1, true));
            AddWire(gateF, new Wire(0, 9, -1, true));
            AddWire(gateG, new Wire(0, 10, -1, true));
            AddWire(gateH, new Wire(0, 11, -1, true));
            AddWire(gateI, new Wire(0, 12, -1, true));
            AddWire(gateJ, new Wire(0, 13, -1, true));
            AddWire(gateK, new Wire(0, 14, -1, true));
            AddWire(gateL, new Wire(0, 15, -1, true));
            AddWire(gateM, new Wire(0, 0, -1, true));
            AddWire(gateN, new Wire(0, 1, -1, true));
            AddWire(gateO, new Wire(0, 2, -1, true));
            AddWire(gateP, new Wire(0, 3, -1, true));
            AddWire(gateQ, new Wire(0, 4, -1, true));
            AddWire(gateR, new Wire(0, 5, -1, true));
            AddWire(gateS, new Wire(0, 6, -1, true));
            AddWire(gateT, new Wire(0, 7, -1, true));
        }