Review: Logic Gates, DeMorgan's, and K-Maps
مراجعة سريعة على البوابات، جداول الحقيقة، (SOP/POS)، وقوانين (DeMorgan)، مع أمثلة على (K-Maps).
ملخص المحاضرة
📜 Comprehensive Summary: Digital Engineering (Lectures 1-6)
This summary covers the foundational concepts of digital engineering, from basic number systems to logic gates, Boolean algebra, and circuit simplification techniques.
Lecture 1: Introduction to Digital Engineering
This lecture introduces the core concepts of digital systems and number theory.
Key Concepts
- Hardware vs. Software: Electronic devices consist of physical circuits (Hardware) and the programs that run on them (Software). This course focuses on Digital Logic Design, which is the design of the hardware.
- Digital vs. Analog:
- Analog: A continuous signal (e.g., a sound wave) that can have any value within a range.
- Digital: A discrete signal that can only have two distinct values: 0 (Low, Off) or 1 (High, On). Digital systems are preferred for their accuracy and noise immunity.
- Logic Levels: The binary 0 and 1 are physically represented by voltage ranges. For example, 0V-0.8V might be Logic 0, and 2V-5V might be Logic 1.
- Building Blocks: The basic units of all digital circuits are Logic Gates (AND, OR, NOT).
- Number Systems:
- Binary (Base 2): Uses digits 0 and 1.
- Octal (Base 8): Uses digits 0-7.
- Decimal (Base 10): Uses digits 0-9.
- Hexadecimal (Base 16): Uses digits 0-9 and letters A (10) through F (15).
- Number Conversions:
- Decimal to Base-N: Use repeated division by the base (e.g., divide by 2 for binary) and read the remainders from bottom to top.
- Base-N to Decimal: Use the sum of powers (e.g., for binary
1101, calculate1*2^3 + 1*2^2 + 0*2^1 + 1*2^0 = 13).
Lecture 2: Basic Gates
This lecture defines the fundamental logic gates, their symbols, expressions, and truth tables.
Key Concepts
- NOT Gate (Inverter): A 1-input gate. The output is the inverse of the input.
- Expression:
X = A'
- Expression:
- AND Gate: The output is 1 if and only if ALL inputs are 1.
- Expression:
X = A · B
- Expression:
- OR Gate: The output is 1 if AT LEAST ONE input is 1.
- Expression:
X = A + B
- Expression:
- XOR Gate (Exclusive-OR): The output is 1 if and only if the inputs are DIFFERENT. For 3+ inputs, it outputs 1 if there is an odd number of 1s.
- Expression:
X = A ⊕ B
- Expression:
- NAND Gate (Not-AND): An AND gate followed by an inverter. The output is 0 only when all inputs are 1.
- Expression:
X = (A · B)'
- Expression:
- NOR Gate (Not-OR): An OR gate followed by an inverter. The output is 1 only when all inputs are 0.
- Expression:
X = (A + B)'
- Expression:
- XNOR Gate (Exclusive-NOR): An XOR gate followed by an inverter. The output is 1 if and only if the inputs are the SAME.
- Expression:
X = (A ⊕ B)'
- Expression:
- Universal Gates: NAND and NOR are "universal" because any other gate can be built from them. For example, tying both inputs of a NAND gate together creates a NOT gate.
- Circuit Analysis: The lecture shows how to derive the truth table for a complex circuit, proving
(A NAND B) AND (A OR B)is equivalent toA XOR B.
Lecture 3: Truth Tables
This lecture details the process of constructing truth tables, which describe a circuit's output for every possible input.
Key Concepts
- Purpose: A truth table is the first step in logic design. It lists all possible input combinations (
2^nrows forninputs) and the corresponding desired output. - Filling Inputs: A systematic method is used to list all combinations:
- The right-most input (e.g., C) alternates: 0, 1, 0, 1...
- The next input (e.g., B) alternates: 0, 0, 1, 1...
- The left-most input (e.g., A) alternates: 0, 0, 0, 0, 1, 1, 1, 1...
- Creating a Truth Table From...
- A Word Description: (e.g., "3-bit prime number detector"). You analyze the problem (primes are 2, 3, 5, 7) and place a
1in the output column for those input rows (010, 011, 101, 111) and0for all others. - A Boolean Equation: (e.g.,
F = A·B' + C). You substitute the A, B, and C values from each row into the equation to find the resultingF. - An Unknown Circuit: (Reverse Engineering). You empirically test the circuit by applying every input combination (e.g., 000 to 111) and measuring the output (Low=0, High=1) to fill the table.
- A Word Description: (e.g., "3-bit prime number detector"). You analyze the problem (primes are 2, 3, 5, 7) and place a
Lecture 4: Minterms and Maxterms
This lecture explains how to convert a truth table into a formal Boolean equation using two standard (canonical) forms.
Key Concepts
-
Minterms (m) & Sum of Products (SOP)
- Minterm: A product (AND) term that corresponds to a single row where the function
F=1. - Rule: If the input variable is
0, it is complemented (A'). If it is1, it is uncomplemented (A). - Example: Input
A=0, B=1, C=0(Decimal 2) is Mintermm2 = A'BC'. - SOP (Sum of Products): The final function is the sum (OR) of all minterms where
F=1. - On-Set: The list of minterms where F=1. (e.g.,
F = Σm(2, 3, 5, 7)). - Circuit: Implemented as an AND-OR circuit.
- Minterm: A product (AND) term that corresponds to a single row where the function
-
Maxterms (M) & Product of Sums (POS)
- Maxterm: A sum (OR) term that corresponds to a single row where the function
F=0. - Rule (Opposite of Minterms): If the input variable is
0, it is uncomplemented (A). If it is1, it is complemented (A'). - Example: Input
A=0, B=0, C=1(Decimal 1) is MaxtermM1 = A + B + C'. - POS (Product of Sums): The final function is the product (AND) of all maxterms where
F=0. - Off-Set: The list of maxterms where F=0. (e.g.,
F = ΠM(0, 1, 4, 6)). - Circuit: Implemented as an OR-AND circuit.
- Maxterm: A sum (OR) term that corresponds to a single row where the function
-
Implementation: Both SOP and POS forms create circuits for the same function. SOP (AND-OR) circuits can be converted to NAND-NAND circuits, and POS (OR-AND) can be converted to NOR-NOR.
Lecture 5: Boolean Algebra & Simplification
This lecture introduces the mathematical rules of Boolean Algebra, which are used to simplify complex expressions into smaller, cheaper, and faster circuits.
Key Concepts
- DeMorgan's Laws:
(X + Y)' = X' · Y'(Break the bar, change the OR to AND)(X · Y)' = X' + Y'(Break the bar, change the AND to OR)
- Basic Boolean Laws:
- Identity:
X + 0 = XandX · 1 = X - Annihilator:
X + 1 = 1andX · 0 = 0 - Idempotent:
X + X = XandX · X = X - Complementarity:
X + X' = 1andX · X' = 0 - Distributive:
X(Y + Z) = XY + XZandX + YZ = (X + Y)(X + Z)
- Identity:
- Duality (F^D):
- To find the Dual, swap all
+and·and swap all0and1. - Variables and complements (like
A'orB') are left unchanged. - Example: The Dual of
F = A·B' + CisF^D = (A + B') · C.
- To find the Dual, swap all
- Key Simplification Theorems:
- Absorption:
X + XY = X(and its dualX(X + Y) = X) - Adjacency:
XY + XY' = X(and its dual(X+Y)(X+Y') = X) - Redundancy:
XY + X'Z + YZ = XY + X'Z(TheYZterm is redundant).
- Absorption:
- Minimization Example: The prime detector function
f = A'BC' + A'BC + AB'C + ABCis simplified using these laws.(A'BC' + A'BC)simplifies toA'B(Adjacency).(A'BC + ABC)simplifies toBC(Adjacency).(AB'C + ABC)simplifies toAC(Adjacency).- The expression becomes
f = A'B + BC + AC. - Using the Redundancy theorem (
XY + X'Z + YZ), theBCterm is redundant. - Final Simplified Function:
f = A'B + AC.
Lecture 6: Karnaugh Maps (K-Maps)
This lecture introduces the Karnaugh Map (K-map), a graphical and systematic method for simplifying Boolean expressions, serving as a visual alternative to Boolean algebra.
Key Concepts
- Purpose: K-maps provide a simple, visual, and systematic way to perform Boolean simplification.
- K-Map Structure (3-Variable):
- An 8-cell grid (
2^3 = 8). - The rows are labeled for one variable (e.g.,
Aas0or1). - The columns are labeled for the other variables (e.g.,
BC).
- An 8-cell grid (
- Gray Code: The column/row labels must be in Gray code order (00, 01, 11, 10). This is not a standard binary count. This ordering is critical because it ensures any two adjacent cells differ by only one bit.
- Adjacency: The map "wraps around," meaning the first column (00) is adjacent to the last column (10).
- SOP Simplification Steps:
- Draw & Fill Map: Draw the 3-variable map. Place a
1in each cell corresponding to a minterm in the function's On-Set (e.g., forf = Σm(2, 3, 5, 7)). - Group the 1s: Draw loops around adjacent
1s.- Groups must contain a power of 2 (1, 2, 4, 8) cells.
- Groups must be as large as possible.
- You must use the minimum number of groups to cover all the
1s. - Groups can overlap and wrap around.
- Read the Groups: For each group, find the variable(s) that do not change value.
- If a variable is
0in the whole group, it's complemented (e.g.,A'). - If a variable is
1in the whole group, it's uncomplemented (e.g.,A). - If a variable changes (is both 0 and 1) within the group, it is eliminated.
- If a variable is
- Sum the Terms: The final simplified expression is the sum (OR) of all the group terms.
- Draw & Fill Map: Draw the 3-variable map. Place a
- Example (Prime Detector):
f = Σm(2, 3, 5, 7)- Group 1: A loop around
m2 (010)andm3 (011).Ais0(A').Bis1(B).Cchanges (0->1) (eliminated).- Term = A'B
- Group 2: A loop around
m5 (101)andm7 (111).Ais1(A).Bchanges (0->1) (eliminated).Cis1(C).- Term = AC
- (Note: A group of
(m3, m7)forBCis redundant, as its 1s are already covered). - Final Result:
f = A'B + AC.
- Group 1: A loop around