Data Representation, Digital Logic, and Logic Gates

Data Representation in Digital Computers

  • Binary Representation:
    • Digital computers represent all forms of data—including numbers, text, images, and sound—using binary digits: 00 and 11.
    • Bit:
    • A bit is defined as a single binary digit, taking the value of either 00 or 11.
    • Byte:
    • A byte is defined as a group of 88 bits.
    • Calculation example: A group of 33 bytes equals 3×8=243 \times 8 = 24 bits.
    • Character Encoding:
    • In ASCII encoding, the 8-bit binary sequence 0100000101000001 represents the uppercase letter A.

Analog and Digital Signals

  • Nature of Signals:
    • A signal functions to carry information from one physical location to another.
    • Noise is defined as unwanted interference that disturbs a signal during transmission or processing.
  • Comparison Between Analog and Digital Signals:
    • Signal Variation:
    • Analog signals change continuously and can take any value within a continuous range.
    • Digital signals use discrete, distinct levels. Modern computers typically operate using two voltage levels representing 00 and 11.
    • Concrete Examples:
    • An example of an analog signal is the sound waves produced by a human voice.
    • An example of a digital signal is the electrical signaling transmitted between computer components.
    • Susceptibility to Interference:
    • Analog signals are more affected by noise.
    • Digital signals are generally more resistant to noise.

Digital Logic and Fundamental Logic Gates

  • Definition of a Logic Gate:
    • A logic gate is an electronic circuit that performs a specific logical operation on binary inputs to produce a single binary output.
  • Standard Gate Types, Expressions, and Output Rules:
    • AND Gate:
    • Boolean expression: F=A⋅BF = A \cdot B
    • Output rule: Produces an output of 11 only when both inputs are 11.
    • OR Gate:
    • Boolean expression: F=A+BF = A + B
    • Output rule: Produces an output of 11 when at least one input is 11.
    • NOT Gate (Inverter):
    • Boolean expression: F=A‾F = \overline{A}
    • Output rule: Reverses the input value (inverts 00 to 11, and 11 to 00).
    • NAND Gate:
    • Boolean expression: F=A⋅B‾F = \overline{A \cdot B}
    • Output rule: Produces an output of 00 only when both inputs are 11.
    • NOR Gate:
    • Boolean expression: F=A+B‾F = \overline{A + B}
    • Output rule: Produces an output of 11 only when both inputs are 00.
    • XOR Gate (Exclusive OR):
    • Boolean expression: F=A⊕BF = A \oplus B
    • Output rule: Produces an output of 11 when the two inputs are different from each other.
  • Universal Gates:
    • NAND and NOR are classified as universal gates.
    • Either NAND gates alone or NOR gates alone can be combined to construct any other type of logic gate.

Truth Tables and Input Combinations

  • Function of Truth Tables:
    • A truth table provides an exhaustive tabular listing of every possible input combination alongside its corresponding logic output.
  • Input-to-Combination Scaling:
    • For a system with nn binary inputs, the total number of unique input combinations is given by 2n2^n.
    • 11 input yields 21=22^1 = 2 combinations.
    • 22 inputs yield 22=42^2 = 4 combinations.
    • 33 inputs yield 23=82^3 = 8 combinations.
  • Combined Truth Table for Two-Input Gates:
    • Input combination A=0A = 0, B=0B = 0:
    • AND output: 00
    • OR output: 00
    • NAND output: 11
    • NOR output: 11
    • XOR output: 00
    • Input combination A=0A = 0, B=1B = 1:
    • AND output: 00
    • OR output: 11
    • NAND output: 11
    • NOR output: 00
    • XOR output: 11
    • Input combination A=1A = 1, B=0B = 0:
    • AND output: 00
    • OR output: 11
    • NAND output: 11
    • NOR output: 00
    • XOR output: 11
    • Input combination A=1A = 1, B=1B = 1:
    • AND output: 11
    • OR output: 11
    • NAND output: 00
    • NOR output: 00
    • XOR output: 00
  • Truth Table for the Single-Input NOT Gate:
    • Input A=0A = 0 yields output NOT A=1A = 1.
    • Input A=1A = 1 yields output NOT A=0A = 0.

Boolean Algebra Principles and Laws

  • Operational Foundations:
    • Boolean algebra relies on binary values 00 and 11 alongside logical operators to represent and simplify digital circuits.
    • Operator definitions:
    • The centered dot symbol ⋅\cdot denotes the logical AND operation.
    • The plus symbol ++ denotes the logical OR operation.
    • An overbar denotes the logical NOT operation (inversion/complement).
    • Note on Boolean addition: The expression 1+1=11 + 1 = 1 holds true because ++ represents the logical OR operator rather than standard arithmetic addition.
  • Evaluation Example:
    • Expression to evaluate: F=A+(B⋅C)F = A + (B \cdot C)
    • Given input assignments: A=0A = 0, B=1B = 1, C=0C = 0
    • Step-by-step substitution: F=0+(1⋅0)=0+0=0F = 0 + (1 \cdot 0) = 0 + 0 = 0
  • Fundamental Algebraic Laws:
    • Identity Law:
    • AND form: A⋅1=AA \cdot 1 = A
    • OR form: A+0=AA + 0 = A
    • Null Law / Domination Law:
    • AND form: A⋅0=0A \cdot 0 = 0
    • OR form: A+1=1A + 1 = 1
    • Idempotent Law:
    • AND form: A⋅A=AA \cdot A = A
    • OR form: A+A=AA + A = A
    • Complement Law:
    • AND form: A⋅A‾=0A \cdot \overline{A} = 0
    • OR form: A+A‾=1A + \overline{A} = 1
    • Commutative Law:
    • AND form: A⋅B=B⋅AA \cdot B = B \cdot A
    • OR form: A+B=B+AA + B = B + A
    • Associative Law:
    • AND form: (A⋅B)⋅C=A⋅(B⋅C)(A \cdot B) \cdot C = A \cdot (B \cdot C)
    • OR form: (A+B)+C=A+(B+C)(A + B) + C = A + (B + C)
    • Absorption Law:
    • AND form: A⋅(A+B)=AA \cdot (A + B) = A
    • OR form: A+(A⋅B)=AA + (A \cdot B) = A
    • Double Complement / Involution Law:
    • Inverting a variable twice returns its original state: A‾‾=A\overline{\overline{A}} = A
    • Distributive Laws:
    • Distributing AND over OR: A⋅(B+C)=(A⋅B)+(A⋅C)A \cdot (B + C) = (A \cdot B) + (A \cdot C)
    • Distributing OR over AND: A+(B⋅C)=(A+B)⋅(A+C)A + (B \cdot C) = (A + B) \cdot (A + C)
    • De Morgan's Laws:
    • Negated AND expression: A⋅B‾=A‾+B‾\overline{A \cdot B} = \overline{A} + \overline{B}
    • Negated OR expression: A+B‾=A‾⋅B‾\overline{A + B} = \overline{A} \cdot \overline{B}
    • Operational procedure: Change AND to OR (or OR to AND) and invert/complement each individual term when eliminating an overbar across an entire grouped expression.

Simplification of Boolean Expressions

  • Purpose of Algebraic Simplification:
    • Simplifying Boolean expressions directly decreases the number of logic gates and wiring required to fabricate physical hardware circuits.
  • Worked Derivation Example:
    • Initial Boolean function:
    • F=(A⋅B)+(A⋅B‾)F = (A \cdot B) + (A \cdot \overline{B})
    • Factoring using the Distributive Law:
    • F=A⋅(B+B‾)F = A \cdot (B + \overline{B})
    • Substituting using the Complement Law (B+B‾=1B + \overline{B} = 1):
    • F=A⋅1F = A \cdot 1
    • Reducing using the Identity Law (A⋅1=AA \cdot 1 = A):
    • F=AF = A

Implementation and Circuit Conversion

  • Gate Mapping Procedure:
    • To construct physical circuits from Boolean equations, map each mathematical operator directly to its corresponding logic gate symbol.
  • Worked Mapping Examples:
    • Composite Expression F=(A⋅B)+C‾F = (A \cdot B) + \overline{C}:
    • Step 1: Use an AND gate to combine inputs AA and BB.
    • Step 2: Use a NOT gate to invert input CC, yielding C‾\overline{C}.
    • Step 3: Route the outputs of both the AND gate and the NOT gate into an OR gate to produce FF.
    • Inverted Product Expression F=A⋅B‾F = A \cdot \overline{B}:
    • Invert variable BB first using a NOT gate.
    • Combine the inverted output B‾\overline{B} with input AA using an AND gate.

Karnaugh Maps (K-Maps) and Optimization

  • Functional Overview:
    • A Karnaugh map (K-map) provides a visual, diagrammatic approach for minimizing Boolean logic expressions by identifying and clustering adjacent groups of 11s.
  • Sizing Configurations:
    • Two-variable maps contain 44 square boxes.
    • Three-variable maps contain 88 square boxes.
  • Strict Grouping Rules:
    • Rule 1 (Group sizes): Group sizes must always be integer powers of two, such as 11, 22, 44, 88, and so forth.
    • Rule 2 (Geometry): Groups must only form rectangular or square clusters.
    • Rule 3 (Adjacency direction): Adjacent elements connect horizontally or vertically; grouping diagonally is strictly prohibited.
    • Rule 4 (Maximal size): Each formed group must be made as large as mathematically possible.
    • Rule 5 (Complete coverage): Every 11 in the matrix must be included in at least one group; groups are permitted to overlap.
    • Rule 6 (Wrap-around property): The opposing outer edges of the map are considered adjacent and connect continuously.
    • Rule 7 (Zero exclusion): Boxes containing 00 must never be included inside a grouping of 11s.
  • Formulating Simplified Terms from Groups:
    • If a variable remains constantly at logic 11 across the entire group: Retain the uncomplemented variable (e.g., AA).
    • If a variable remains constantly at logic 00 across the entire group: Retain the complemented variable (e.g., A‾\overline{A}).
    • If a variable alternates between 00 and 11 within the group: Eliminate the variable from the resulting term entirely.
  • Gray Code Order:
    • In a three-variable map, column coordinates must follow Gray code ordering:
    • Sequence: 0000, 0101, 1111, 1010
    • Under this system, only a single binary bit transitions between adjacent neighboring columns, which extends continuously between the first and last column.
  • Three-Variable K-Map Worked Example:
    • Grid Layout (Rows represent input AA, Columns represent input pair BCBC):
    • Top row (A=1A = 1): 00 (at 0000), 11 (at 0101), 11 (at 1111), 00 (at 1010)
    • Bottom row (A=0A = 0): 00 (at 0000), 11 (at 0101), 11 (at 1111), 00 (at 1010)
    • Grouping Execution:
    • The four adjacent 11s occupying the center columns (0101 and 1111) form a single quad group of size 44.
    • Variable Analysis:
    • Variable AA toggles between 11 and 00 (eliminated).
    • Variable BB toggles between 00 (in column 0101) and 11 (in column 1111) (eliminated).
    • Variable CC maintains a constant value of 11 across all four cells.
    • Minimized Boolean result: F=CF = C

Three-variable Karnaugh map showing cells arranged by Gray code columns

The Principle of Duality

  • Core Axiom:
    • If any given Boolean algebraic identity is mathematically valid, its corresponding dual statement is guaranteed to be true.
  • Transformation Procedure to Find the Dual:
    • Swap all AND operators with OR operators (⋅↔+\cdot \leftrightarrow +).
    • Swap all OR operators with AND operators (+↔⋅+ \leftrightarrow \cdot).
    • Swap every binary constant 00 with 11, and every 11 with 00.
    • Maintain all variable identities and existing complement bars unchanged.
    • Maintain identical precedence groupings and parentheses.
    • Critical distinction: Duality does not invert or complement the logical variables themselves.
  • Standard Duality Pairings:
    • Identity Pair 1:
    • Base identity: A+0=AA + 0 = A
    • Dual expression: A⋅1=AA \cdot 1 = A
    • Identity Pair 2:
    • Base identity: A+1=1A + 1 = 1
    • Dual expression: A⋅0=0A \cdot 0 = 0
    • Identity Pair 3:
    • Base identity: A+A‾=1A + \overline{A} = 1
    • Dual expression: A⋅A‾=0A \cdot \overline{A} = 0
    • Identity Pair 4:
    • Base identity: A+B=B+AA + B = B + A
    • Dual expression: A⋅B=B⋅AA \cdot B = B \cdot A

Real-World Applications of Logic Gates

  • Functional Sectors and Implementations:
    • Computers and Calculators:
    • Utilized to execute arithmetic operations and digital logical comparisons.
    • Digital Memory Circuits:
    • Utilized to store individual binary bits through sequential circuit configurations such as flip-flops.
    • Security and Alarm Systems:
    • Utilized to trigger alarms based on inputs collected from physical environmental sensors.
    • Automatic Control Systems:
    • Utilized to govern and automate mechanical or electrical devices based on predefined conditional inputs.
  • Real-World Logic Scenarios:
    • Industrial AND Application:
    • A factory machine operates only when both safety conditions are simultaneously satisfied: the safety guard is fully closed AND the start button is depressed.
    • Building Security OR Application:
    • An alarm activates if any intrusion sensor trips: when the door sensor detects danger OR the window sensor detects danger.