Digital Logic
Logic Gates

Digital Logic Gates

In digital computers, binary information is represented by physical quantities known as signals. These signals, typically in the form of electrical voltages, can exist in one of two states, corresponding to the binary values 0 and 1. For instance, a digital computer might use a voltage of 3 volts to represent binary 1 and 0.5 volts to represent binary 0. The input terminals of digital circuits receive these binary signals, and the circuits respond with output signals of 3 and 0.5 volts to represent binary 1 and 0, respectively.

Binary logic is the foundation of digital circuit design, dealing with binary variables and logical operations. These operations are performed by logic circuits known as gates. Gates are hardware components that produce binary outputs based on specific input conditions. Each type of gate has a unique graphical symbol and can be described algebraically. The relationship between inputs and outputs for each gate can be represented using a truth table.

Fundamental Gates

AND Gate

Description

The AND gate performs a logical conjunction operation. It produces an output of 1 only if all its inputs are 1. If any input is 0, the output is 0.

Symbol

AND Gate Symbol

Algebraic Functions

  • x=ABx = A \cdot B
  • x=ABx = AB
  • x=ABx = A \land B

Truth Table

ABx
000
010
100
111

Characteristics

  • AND gates can have more than two inputs.
  • The output is 1 if and only if all inputs are 1.

OR Gate

Description

The OR gate performs a logical disjunction operation. It produces an output of 1 if any of its inputs are 1. The output is 0 only when all inputs are 0.

Symbol

OR Gate Symbol

Algebraic Functions

  • x=A+Bx = A + B
  • x=ABx = A \lor B

Truth Table

ABx
000
011
101
111

Characteristics

  • OR gates can have more than two inputs.
  • The output is 1 if any input is 1.

NOT Gate

Description

The NOT gate, also known as an inverter, performs a logical negation operation. It inverts the input signal; if the input is 1, the output is 0, and vice versa.

Symbol

NOT Gate Symbol

Algebraic Functions

  • x=Ax = \overline{A}
  • x=Ax = A'
  • x=¬Ax = \neg A

Truth Table

Ax
01
10

Characteristics

  • The NOT gate has only one input and one output.
  • It is used to complement binary signals.

Buffer

Description

A buffer is a logic gate that outputs the same value as its input. It does not perform any logical operation but is used for signal amplification and isolation.

Symbol

Buffer Symbol

Algebraic Functions

  • x=Ax = A

Truth Table

Ax
00
11

Characteristics

  • Buffers are used to strengthen signals so they can drive more gates.
  • They provide no logical transformation of the input signal.

NAND Gate

Description

The NAND gate is the complement of the AND gate. It produces an output of 0 only if all its inputs are 1. If any input is 0, the output is 1.

Symbol

Buffer Symbol

Algebraic Functions

  • x=ABx = \overline{A \cdot B}
  • x=ABx = \overline{AB}
  • x=ABx = \overline{A \land B}

Truth Table

ABx
001
011
101
110

Characteristics

  • NAND gates can have more than two inputs.
  • The output is the complement of the AND function.

NOR Gate

Description

The NOR gate is the complement of the OR gate. It produces an output of 0 if any of its inputs are 1. The output is 1 only when all inputs are 0.

Symbol

NOR Gate Symbol

Algebraic Functions

  • x=A+Bx = \overline{A + B}
  • x=ABx = \overline{A \lor B}

Truth Table

ABx
001
010
100
110

Characteristics

  • NOR gates can have more than two inputs.
  • The output is the complement of the OR function.

XOR Gate

Description

The XOR (exclusive-OR) gate produces an output of 1 if the inputs are different. If both inputs are the same, the output is 0.

Symbol

XOR Gate Symbol

Algebraic Functions

  • x=ABx = A \oplus B
  • x=(AB)+(AB)x = (A \cdot \overline{B}) + (\overline{A} \cdot B)
  • x=(A¬B)(¬AB)x = (A \land \neg B) \lor (\neg A \land B)

Truth Table

ABx
000
011
101
110

Characteristics

  • XOR gates are often used in arithmetic circuits like adders.
  • It is also known as an odd function gate.

XNOR Gate

Description

The XNOR (exclusive-NOR) gate is the complement of the XOR gate. It produces an output of 1 if the inputs are the same. If the inputs are different, the output is 0.

Symbol

XNOR Gate Symbol

Algebraic Functions

  • x=ABx = \overline{A \oplus B}
  • x=(AB)+(AB)x = (A \cdot B) + (\overline{A} \cdot \overline{B})
  • x=(AB)(¬A¬B)x = (A \land B) \lor (\neg A \land \neg B)

Truth Table

ABx
001
010
100
111

Characteristics

  • XNOR gates are used in equality detectors.
  • The output is 1 when the number of 1's in the input is even.

Constructing Truth Tables

Truth tables are essential tools for understanding and analyzing digital logic circuits. They provide a comprehensive view of all possible input combinations and their corresponding outputs. Here's how to construct a truth table:

  1. Identify all input variables.
  2. Determine the number of rows needed (2^n, where n is the number of input variables).
  3. List all possible input combinations.
  4. Evaluate the output for each input combination.
  5. Fill in the output column(s).

Example: Constructing a Truth Table for A · B + C

Let's construct a truth table for the expression A · B + C:

  1. Inputs: A, B, and C
  2. Number of rows: 2^3 = 8
  3. List input combinations:
ABC
000
001
010
011
100
101
110
111
  1. Evaluate the output for each row:

    • First, evaluate A · B
    • Then, add the result to C
  2. Fill in the output column:

ABCA · B(A · B) + C
00000
00101
01000
01101
10000
10101
11011
11111

This truth table now completely describes the behavior of the circuit for all possible input combinations.

More Complex Circuits

When dealing with more complex circuits, it's important to break them down into smaller, manageable parts. Here's a step-by-step approach to analyze these circuits:

  1. Identify the gates and their connections.
  2. Label intermediate outputs.
  3. Evaluate the circuit stage by stage.
  4. Combine the results to get the final output.

Example: Analyzing a Complex Circuit

Consider the following circuit:

   A ---[AND]--+
               |
   B ---[AND]--+--[OR]--- X
               |
   C ---[NOT]--+

To analyze this circuit:

  1. Identify gates: Two AND gates, one OR gate, and one NOT gate.
  2. Label intermediate outputs:
    • Y1 = A · B (output of first AND gate)
    • Y2 = ¬C (output of NOT gate)
  3. Evaluate stage by stage:
    • X = Y1 + Y2
  4. Combine results:
    • X = (A · B) + ¬C

Now we can construct the truth table:

ABCY1 (A · B)Y2 (¬C)X ((A · B) + ¬C)
000011
001000
010011
011000
100011
101000
110111
111101

This approach allows us to break down complex circuits into manageable parts and understand their overall behavior.

NAND Completeness

NAND gates have a special property known as functional completeness. This means that any Boolean function can be implemented using only NAND gates. This property makes the NAND gate a universal gate in digital logic design.

Implementing Basic Gates with NAND

  1. NOT Gate:

    • A NAND gate with both inputs connected together acts as a NOT gate.
    A ---[NAND]--- ¬A
    |
    +---+
  2. AND Gate:

    • An AND gate can be created by inverting the output of a NAND gate.
    A ---[NAND]---[NAND]--- A · B
    B ---+
  3. OR Gate:

    • Using De Morgan's laws, we can create an OR gate with NAND gates.
    A ---[NAND]---+
                  |
    B ---[NAND]---+---[NAND]--- A + B
  4. NOR Gate:

    • A NOR gate can be implemented using NAND gates as follows:
    A ---[NAND]---+
                  |
    B ---[NAND]---+---[NAND]---[NAND]--- ¬(A + B)

The ability to implement all basic logic functions using only NAND gates demonstrates the gate's versatility and importance in digital circuit design. This property allows for simplified manufacturing processes and reduced costs in integrated circuit production.