Comprehensive Guide to Machine Logic and Logic Gates

Introduction to Machine Logic and Logic Gates

  • Definition of a Computer: A computer is a device that possesses a special facility for manipulating large quantities of zeroes (00) and ones (11).

  • Physical Reality of Binary: Computers do not literally contain strings of zeroes and ones. In physical terms, computers consist of numerous switches that are constantly being turned on and off in specific patterns. These patterns depend entirely on the instructions being executed.

  • Binary and Switches: In binary logic, the state of these switches and their respective combinations determine data processing.

  • Logic Gates:

    • Defined as the switches that turn ON or OFF depending on user actions.

    • They serve as the fundamental building blocks for how computers work.

    • They are electronic components that perform specific logical operations.

Single-Input and N-Input Logic Gates

Logic gates are classified by the number of inputs they receive and the logical function they perform on those inputs.

NOT Gate (1-Input)
  • Function: The NOT gate inverts the input signal. If the input is 00, the output is 11. If the input is 11, the output is 00.

  • Boolean Expression: X=AˉX = \bar{A}

  • Truth Table:

Input (AA)

Output (XX)

00

11

11

00

OR Gate (N-Input)
  • Function: The output is 11 if at least one of the inputs is 11. It only outputs 00 if both inputs are 00.

  • Boolean Expression: X=A+BX = A + B

  • Truth Table:

AA

BB

A+BA + B

00

00

00

00

11

11

11

00

11

11

11

11

AND Gate (N-Input)
  • Function: The output is 11 only if all inputs are 11. If any input is 00, the output is 00.

  • Boolean Expression: X=A×BX = A \times B (often represented as ABA \cdot B)

  • Truth Table:

AA

BB

ABA \cdot B

00

00

00

00

11

00

11

00

00

11

11

11

XOR Gate (Exclusive OR)
  • Function: The output is 11 if the inputs are different (00 and 11 or 11 and 00). The output is 00 if the inputs are the same (0,00,0 or 1,11,1).

  • Boolean Expression: X=ABX = A \oplus B

  • Truth Table:

AA

BB

ABA \oplus B

00

00

00

00

11

11

11

00

11

11

11

00

NOR Gate (N-Input)
  • Function: The NOR gate is an inverted OR gate (NOT OR). The output is 11 only when all inputs are 00.

  • Boolean Expression: X=A+BX = \overline{A + B}

  • Truth Table:

AA

BB

Output

00

00

11

00

11

00

11

00

00

11

11

00

NAND Gate (N-Input)
  • Function: The NAND gate is an inverted AND gate (NOT AND). The output is 00 only when all inputs are 11.

  • Boolean Expression: X=ABX = \overline{A \cdot B}

  • Truth Table:

AA

BB

Output

00

00

11

00

11

11

11

00

11

11

11

00

XNOR Gate (Exclusive NOR)
  • Function: The XNOR gate is an inverted XOR gate. The output is 11 if the inputs are identical (0,00,0 or 1,11,1).

  • Boolean Expression: X=ABX = \overline{A \oplus B}

  • Truth Table:

AA

BB

Output

00

00

11

00

11

00

11

00

00

11

11

11

Universal Logic Gates

  • Concept: NOR and NAND gates are referred to as universal gates. They are called so because they can be combined in various configurations to form any other kind of logic gate (NOT, AND, OR, etc.).

  • Economic Advantage: Because they can replicate any gate, NAND and NOR gates are more economical to manufacture and serve as the basic gates used in integrated circuits.

  • NAND Representations:

    • NAND as NOT: A single NAND gate with tied inputs replicates a NOT gate.

    • NAND as AND: A NAND gate followed by another NAND gate (acting as a NOT) replicates an AND gate.

    • NAND as OR: Inputs are inverted using NAND gates before entering a final NAND gate, replicating an OR gate.

Logic Circuits and Boolean Expressions

  • Logic Circuits: Several logic gates can be connected together to provide an output based on specific input criteria.

  • Representation: Logical reasoning can be clearly represented in two primary forms:

    1. Boolean Expressions: Mathematical notation of logic.

    2. Logical Circuits: Visual diagrams of gate connections.

  • Truth Tables: Used to document every possible combination of inputs and their respective outputs for a specific logical circuit.

Circuit Truth Table Examples

Example 1: X=(A+B)CˉX = (A + B) \cdot \bar{C}

AA

BB

CC

A+BA + B

Cˉ\bar{C}

XX

00

00

00

00

11

00

00

00

11

00

00

00

00

11

00

11

11

11

00

11

11

11

00

00

11

00

00

11

11

11

11

00

11

11

00

00

11

11

00

11

11

11

11

11

11

11

00

00

Example 2: X=AˉB+BˉCX = \bar{A} \cdot B + \bar{B} \cdot C

AA

BB

CC

Aˉ\bar{A}

Bˉ\bar{B}

AˉB\bar{A} \cdot B

BˉC\bar{B} \cdot C

XX

00

00

00

11

11

00

00

00

00

00

11

11

11

00

11

11

00

11

00

11

00

11

00

11

00

11

11

11

00

11

00

11

11

00

00

00

11

00

00

00

11

00

11

00

11

00

11

11

11

11

00

00

00

00

00

00

11

11

11

00

00

00

00

00

Example 3: X=AB+(B+C)(BC)X = A \cdot B + (B + C) \cdot (B \cdot C)

AA

BB

CC

ABA \cdot B

B+CB + C

BCB \cdot C

(B+C)(BC)(B + C) \cdot (B \cdot C)

XX

00

00

00

00

00

00

00

00

00

00

11

00

11

00

00

00

00

11

00

00

11

00

00

00

00

11

11

00

11

11

11

11

11

00

00

00

00

00

00

00

11

00

11

00

11

00

00

00

11

11

00

11

11

00

00

11

11

11

11

11

11

11

11

11

Creating Logic Circuits from Boolean Expressions

Methodology
  1. Split the Expression: Break the Boolean expression down into single gates.

  2. Inside-Out Approach: Start from the innermost expression (the part inside parentheses) and move outward.

  3. Completion: Continue until all gates in the expression are covered and join the parts to complete the circuit diagram.

Practice Problem 1: X=Aˉ(B+C)X = \bar{A} \cdot (B + C)
  • Step 1: Identify inputs A,B,A, B, and CC.

  • Step 2: Address the inner term (B+C)(B + C). This requires an OR gate with inputs BB and CC.

  • Step 3: Address the inversion of AA, which is Aˉ\bar{A}. This requires a NOT gate for input AA.

  • Step 4: Combine the results of Step 2 and Step 3 into an AND gate to satisfy the multiplication operation.

Practice Problem 2: X=AB+BC+CX = A \cdot B + B \cdot C + C
  • Step 1: Create an AND gate for the first term: ABA \cdot B.

  • Step 2: Create an AND gate for the second term: BCB \cdot C.

  • Step 3: Use an OR gate to combine the result of ABA \cdot B and BCB \cdot C.

  • Step 4: Use a final OR gate to combine the result from Step 3 with the final input CC.