Digital LogicUnit 211 min read
Logic Gates, Combinational Circuits & Boolean Laws
Unit 2 of Digital Logic explores fundamental logic gates (AND, OR, NOT, NAND, NOR, XOR, XNOR), their symbols, truth tables, and Boolean algebra laws. It covers combinational circuits (adders, multiplexers, decoders) and their real-world applications in digital systems, including simplification techniques and practical
TAKEAWAYS:
- Understand the 7 basic logic gates (AND, OR, NOT, NAND, NOR, XOR, XNOR) and their symbols, truth tables, and Boolean expressions.
- Learn how to design combinational circuits (half-adders, full-adders, multiplexers, decoders) using gates and analyze their functionality.
- Apply Boolean algebra laws (De Morgan’s, distributive, associative, etc.) to simplify logic expressions and optimize circuits.
- Recognize real-world applications of logic gates in digital systems (e.g., eSewa’s payment validation, Daraz’s order processing, and Ncell’s call routing).
- Differentiate between combinational vs. sequential circuits and understand why combinational circuits are memoryless.
- Master practical design techniques like cascading gates, using truth tables, and implementing arithmetic circuits (adders, subtractors).
1. Logic Gates: The Building Blocks of Digital Logic
Logic gates are the fundamental components of digital circuits. They perform basic logical operations on binary inputs (0 or 1) to produce a binary output. Gates are classified into two categories:
- Basic gates: AND, OR, NOT.
- Universal gates: NAND, NOR (can implement any logic function).
- Special gates: XOR, XNOR (used for parity checks and arithmetic operations).
1.1 Basic Logic Gates
| Gate | Symbol (Standard) | Truth Table | Boolean Expression |
|---|---|---|---|
| AND | `A B | Y<br>0 0 |
|
| OR | `A B | Y<br>0 0 |
|
| NOT | `A | Y<br>0 |
Example 1: Traffic Light Controller (AND Gate Application)
Imagine a traffic light system where two sensors detect vehicles from perpendicular roads. The light turns green only if both sensors detect a vehicle (i.e., A · B = 1). This is a classic AND gate application.
1.2 Universal Gates (NAND and NOR)
NAND and NOR gates are called universal because they can implement any other logic gate. This is crucial in digital design for minimizing components.
| Gate | Symbol (Standard) | Truth Table | Boolean Expression |
|---|---|---|---|
| NAND | `A B | Y<br>0 0 |
|
| NOR | `A B | Y<br>0 0 |
Example 2: eSewa Payment Validation (NAND Gate)
eSewa uses a NAND gate to validate transactions. If both the user’s PIN (A) and the bank’s verification (B) are correct, the output is 1 (valid). If either fails, the transaction is rejected (Y = (A · B)').
1.3 Special Gates (XOR and XNOR)
XOR (Exclusive OR) and XNOR gates are used in parity checks, encryption, and arithmetic operations.
| Gate | Symbol (Standard) | Truth Table | Boolean Expression |
|---|---|---|---|
| XOR | `A B | Y<br>0 0 |
|
| XNOR | `A B | Y<br>0 0 |
Example 3: WhatsApp Message Encryption (XOR Gate)
WhatsApp uses XOR gates in its encryption algorithm. If two identical messages (A = B) are XORed, the output is 0 (no change). If they differ, the output is 1, enabling secure data transmission.
2. Boolean Algebra Laws and Simplification
Boolean algebra is the math behind logic gates. Key laws include:
- Commutative Law:
A + B = B + A,A · B = B · A - Associative Law:
(A + B) + C = A + (B + C),(A · B) · C = A · (B · C) - Distributive Law:
A + (B · C) = (A + B) · (A + C),A · (B + C) = (A · B) + (A · C) - De Morgan’s Law:
(A + B)' = A' · B',(A · B)' = A' + B' - Identity Law:
A + 0 = A,A · 1 = A - Complement Law:
A + A' = 1,A · A' = 0
Example 4: Simplifying a Boolean Expression (De Morgan’s Law)
Given: Y = (A + B)' · C
Using De Morgan’s Law:
Y = (A' · B') · C
This simplification reduces the number of gates needed in a circuit.
3. Combinational Circuits
Combinational circuits are digital circuits where the output depends only on the current inputs (no memory). Examples include:
- Adders (Half-Adder, Full-Adder)
- Multiplexers (MUX)
- Decoders
- Encoders
3.1 Half-Adder and Full-Adder
Adders are fundamental in arithmetic operations (e.g., CPUs, calculators).
Half-Adder (Adds 2 bits)
")
- Inputs:
A,B - Outputs:
Sum (S),Carry (C) - Truth Table:
A B S C 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1
Full-Adder (Adds 3 bits: A, B, Carry-in)
")
- Inputs:
A,B,C_in - Outputs:
Sum (S),Carry-out (C_out) - Truth Table:
A B C_in S C_out 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1
Example 5: Daraz Order Processing (Full-Adder in Inventory)
Daraz’s inventory system uses full-adders to track stock levels. When an order is placed, the system adds the quantity (A), checks stock (B), and propagates carry (C_in) to update the remaining stock (S and C_out).
3.2 Multiplexer (MUX)
A multiplexer selects one of many inputs and forwards it to a single output based on select lines.
```mermaid
flowchart LR
A["Input 0"] --> MUX["MUX"]
B["Input 1"] --> MUX
S0["Select 0"] --> MUX
S1["Select 1"] --> MUX
MUX --> Y["Output"]
Example 6: Ncell Call Routing (MUX)
Ncell uses multiplexers to route calls to the correct tower. The select lines determine which base station (Input 0 or Input 1) handles the call based on signal strength.
3.3 Decoder
A decoder converts n inputs into 2ⁿ outputs, activating one output line at a time.
Example 7: NTC Traffic Signal Control (Decoder)
NTC uses decoders to control traffic lights. A 2-bit input (00, 01, 10, 11) activates one of four traffic signals in sequence.
4. Combinational vs. Sequential Circuits
| Feature | Combinational Circuit | Sequential Circuit |
|---|---|---|
| Memory | No memory (output depends only on current inputs) | Has memory (output depends on current and past inputs) |
| Examples | Adders, MUX, Decoders | Flip-flops, Counters, Registers |
| Speed | Faster (no delay from memory) | Slower (depends on clock speed) |
| Applications | Arithmetic operations, data routing | Timing circuits, memory storage |
Example 8: eSewa vs. Bank Transaction (Combinational vs. Sequential)
- eSewa payment validation (combinational): Output depends only on current inputs (PIN, amount).
- Bank loan approval (sequential): Output depends on current credit score and past transaction history.
## In the Real World
eSewa’s Payment Validation (NAND Gate)
- eSewa uses NAND gates to validate transactions. If both the user’s PIN (
A) and the bank’s verification (B) are correct, the output is1(valid). If either fails, the transaction is rejected (Y = (A · B)'). This ensures secure and instantaneous validation.
- eSewa uses NAND gates to validate transactions. If both the user’s PIN (
Daraz’s Order Processing (Full-Adder)
- Daraz’s inventory system uses full-adders to manage stock levels. When an order is placed, the system adds the ordered quantity (
A), checks the available stock (B), and propagates any carry (C_in) to update the remaining stock (SandC_out). This prevents overselling and ensures accurate inventory tracking.
- Daraz’s inventory system uses full-adders to manage stock levels. When an order is placed, the system adds the ordered quantity (
Ncell’s Call Routing (Multiplexer)
- Ncell’s network uses multiplexers to efficiently route calls to the nearest base station. The select lines (signal strength) determine which tower (
Input 0orInput 1) handles the call, optimizing network performance and reducing latency.
- Ncell’s network uses multiplexers to efficiently route calls to the nearest base station. The select lines (signal strength) determine which tower (
NTC Traffic Light Control (Decoder)
- NTC’s traffic management system uses decoders to control signals at intersections. A 2-bit input (
00,01,10,11) activates one of four traffic lights in sequence, ensuring smooth traffic flow.
- NTC’s traffic management system uses decoders to control signals at intersections. A 2-bit input (
WhatsApp Encryption (XOR Gate)
- WhatsApp’s end-to-end encryption relies on XOR gates to scramble and unscramble messages. If two identical messages (
A = B) are XORed, the output is0(no change). If they differ, the output is1, enabling secure communication.
- WhatsApp’s end-to-end encryption relies on XOR gates to scramble and unscramble messages. If two identical messages (
## Exam Tip
Memorize Truth Tables and Gate Symbols
- Exams often test your ability to draw gate symbols and write truth tables from Boolean expressions. Practice sketching AND, OR, NOT, NAND, NOR, XOR, and XNOR gates quickly.
Simplify Boolean Expressions Using Laws
- Questions may ask you to simplify expressions using De Morgan’s, distributive, or associative laws. Always show step-by-step simplification to earn partial marks.
Design Circuits from Truth Tables
- A common exam question is to design a circuit (e.g., half-adder, MUX) from a given truth table. Start by identifying the SOP (Sum of Products) or POS (Product of Sums) form and then implement it using gates.
Understand Combinational vs. Sequential Circuits
- Examiners often ask to differentiate between combinational and sequential circuits. Key points:
- Combinational: No memory, output depends only on current inputs.
- Sequential: Has memory, output depends on current and past inputs.
- Examiners often ask to differentiate between combinational and sequential circuits. Key points:
Real-World Applications
- Expect application-based questions (e.g., "How does a bank use adders?" or "Explain the role of MUX in call routing"). Relate logic gates to eSewa, Daraz, Ncell, or NTC for full marks.
Practice Karnaugh Maps (K-Maps)
- While K-Maps are covered in Unit 8, simplifying expressions using Boolean laws is tested here. Be ready to simplify expressions like
(A + B)(A' + C)using distributive laws.
- While K-Maps are covered in Unit 8, simplifying expressions using Boolean laws is tested here. Be ready to simplify expressions like
Final Note: Logic gates and combinational circuits are the foundation of digital systems. Mastering this unit will help you understand how CPUs work, how data is processed in apps like eSewa, and how networks like Ncell route calls. Always draw circuits, write truth tables, and relate concepts to real-world examples to score full marks!
Based on the TU BIM syllabus for Digital Logic (IT233), unit 2.
Discussion
Loading…