Construct a logic expression

Resources | Subject Notes | Computer Science

Logic Gates and Logic Circuits - Logic Expression Construction

Logic Gates and Logic Circuits - Logic Expression Construction

Objective

To construct a logic expression representing a given logic circuit or Boolean function.

1. Boolean Algebra Review

Before constructing logic expressions, a strong understanding of Boolean algebra is crucial. Key concepts include:

  • AND (Suggested diagram: AND gate): Output is 1 only if both inputs are 1. Symbol: Suggested diagram: AND gate. Boolean operator: Suggested diagram: AND gate. Algebraic form: $x \cdot y$ or $xy$
  • OR (Suggested diagram: OR gate): Output is 1 if at least one input is 1. Symbol: Suggested diagram: OR gate. Boolean operator: Suggested diagram: OR gate. Algebraic form: $x + y$ or $x \lor y$
  • NOT (Suggested diagram: NOT gate): Inverts the input. Symbol: Suggested diagram: NOT gate. Boolean operator: Suggested diagram: NOT gate. Algebraic form: $\overline{x}$ or $\neg x$
  • Implication (Suggested diagram: Implication gate): $x \implies y$ is read as "if x, then y". It's equivalent to $\overline{x} \lor y$. Symbol: Suggested diagram: Implication gate.
  • XOR (Exclusive OR) (Suggested diagram: XOR gate): Output is 1 if exactly one input is 1. Symbol: Suggested diagram: XOR gate. Algebraic form: $x \oplus y$ or $x \text{ XOR } y$
  • NAND (Suggested diagram: NAND gate): The inverse of AND. Output is 0 only if both inputs are 1. Symbol: Suggested diagram: NAND gate. Algebraic form: $\overline{x \cdot y}$ or $\overline{xy}$
  • NOR (Suggested diagram: NOR gate): The inverse of OR. Output is 1 only if both inputs are 0. Symbol: Suggested diagram: NOR gate. Algebraic form: $\overline{x + y}$ or $\overline{x \lor y}$

2. Constructing Logic Expressions

The process of constructing a logic expression involves translating a logic circuit diagram into a Boolean algebra expression. Here's a step-by-step approach:

  1. Identify the gates and their inputs.
  2. Apply Boolean algebra laws to simplify the expression. Common laws include:
    • Commutative Law: $x \cdot y = y \cdot x$ and $x + y = y + x$
    • Associative Law: $(x \cdot y) \cdot z = x \cdot (y \cdot z)$ and $(x + y) + z = x + (y + z)$
    • Distributive Law: $x \cdot (y + z) = (x \cdot y) + (x \cdot z)$ and $x + (y \cdot z) = (x + y) \cdot (x + z)$
    • Identity Law: $x \cdot 1 = x$ and $x + 0 = x$
    • Complement Law: $x \cdot \overline{x} = 0$ and $x + \overline{x} = 1$
    • Absorption Law: $x \cdot (x + y) = x$ and $x + (x \cdot y) = x$
    • De Morgan's Laws: $\overline{x \cdot y} = \overline{x} + \overline{y}$ and $\overline{x + y} = \overline{x} \cdot \overline{y}$
  3. Simplify the expression using Boolean algebra identities.

3. Examples

Example 1: Simple AND gate

Circuit: A single AND gate with inputs A and B.

Logic Expression: $A \cdot B$ or $AB$

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

Example 2: OR gate with multiple inputs

Circuit: A single OR gate with inputs A, B, and C.

Logic Expression: $A + B + C$ or $A \lor B \lor C$

A B C A OR B OR C
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1

Example 3: A more complex circuit

Circuit: A circuit with an AND gate, followed by an OR gate.

Logic Expression: $(A \cdot B) + C$ or $(AB) + C$

A B C A AND B (A AND B) + C
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 1

4. Truth Tables and Logic Expressions

Truth tables provide a systematic way to determine the logic expression for a given circuit. By analyzing the output of the circuit for all possible input combinations, we can deduce the Boolean expression that represents its behavior.