Introduction to Digital Logic
Digital Logic is the foundation of digital electronics and computer systems. It deals with circuits that operate on digital signals (0s and 1s) and forms the basis of all modern computing devices.
Key Concepts
- Digital vs Analog: Digital systems use discrete values, while analog systems use continuous values
- Binary System: Base-2 number system using only 0 and 1
- Logic Gates: Basic building blocks of digital circuits
- Boolean Algebra: Mathematical framework for digital logic
Advantages of Digital Systems
- Noise immunity
- Easy storage and transmission
- Error detection and correction
- Programmability
- Integration capability
Number Systems
Digital systems use different number systems for various purposes.
Common Number Systems
| System | Base | Digits | Usage |
|---|---|---|---|
| Binary | 2 | 0, 1 | Computer internal operations |
| Octal | 8 | 0-7 | Compact representation of binary |
| Decimal | 10 | 0-9 | Human-readable numbers |
| Hexadecimal | 16 | 0-9, A-F | Memory addresses, color codes |
Number Conversions
- Binary to Decimal: Multiply each bit by 2position and sum
- Decimal to Binary: Repeated division by 2
- Binary to Hexadecimal: Group bits in 4s and convert
- Hexadecimal to Binary: Convert each digit to 4 bits
Logic Gates
Logic gates are the fundamental building blocks of digital circuits that perform basic logical functions.
Basic Logic Gates
| Gate | Symbol | Boolean Expression | Truth Table |
|---|---|---|---|
| AND | AND | Y = A · B | Output 1 only if all inputs are 1 |
| OR | OR | Y = A + B | Output 1 if any input is 1 |
| NOT | NOT | Y = A' | Output is complement of input |
| NAND | NAND | Y = (A · B)' | AND followed by NOT |
| NOR | NOR | Y = (A + B)' | OR followed by NOT |
| XOR | XOR | Y = A ⊕ B | Output 1 if inputs are different |
| XNOR | XNOR | Y = (A ⊕ B)' | Output 1 if inputs are same |
Universal Gates
- NAND Gate: Can implement any Boolean function
- NOR Gate: Can implement any Boolean function
Boolean Algebra
Boolean algebra is the mathematics of digital logic, dealing with binary variables and logical operations.
Basic Laws and Theorems
| Law/Theorem | Expression |
|---|---|
| Identity Law | A + 0 = A, A · 1 = A |
| Null Law | A + 1 = 1, A · 0 = 0 |
| Idempotent Law | A + A = A, A · A = A |
| Inverse Law | A + A' = 1, A · A' = 0 |
| Commutative Law | A + B = B + A, A · B = B · A |
| Associative Law | (A + B) + C = A + (B + C) |
| Distributive Law | A · (B + C) = A·B + A·C |
| De Morgan's Theorem | (A + B)' = A' · B', (A · B)' = A' + B' |
Boolean Expression Forms
- Sum of Products (SOP): OR of AND terms
- Product of Sums (POS): AND of OR terms
- Canonical Forms: SOP/POS with all variables in each term
Karnaugh Maps (K-Maps)
Karnaugh Maps are graphical methods for simplifying Boolean expressions.
K-Map Basics
- 2-variable K-Map: 2×2 grid
- 3-variable K-Map: 2×4 grid
- 4-variable K-Map: 4×4 grid
- Cell Adjacency: Cells differ by only one variable
K-Map Simplification Rules
- Group cells containing 1s in powers of 2 (1, 2, 4, 8...)
- Groups should be as large as possible
- Groups can wrap around edges
- Each group should contain at least one ungrouped cell
- Overlapping groups are allowed
Combinational Circuits
Combinational circuits have outputs that depend only on the current inputs (no memory).
Common Combinational Circuits
-
Adders:
- Half Adder: Adds 2 bits
- Full Adder: Adds 3 bits (including carry)
-
Subtractors:
- Half Subtractor: Subtracts 2 bits
- Full Subtractor: Subtracts 3 bits (including borrow)
- Multiplexers (MUX): Selects one of many inputs
- Demultiplexers (DEMUX): Routes input to one of many outputs
- Encoders: Converts 2n inputs to n outputs
- Decoders: Converts n inputs to 2n outputs
Multiplexer Applications
- Data routing
- Function implementation
- Parallel to serial conversion
- Logic function generation
Sequential Circuits
Sequential circuits have outputs that depend on both current inputs and previous states (have memory).
Sequential vs Combinational
| Aspect | Combinational Circuits | Sequential Circuits |
|---|---|---|
| Memory | No memory | Has memory elements |
| Output depends on | Current inputs only | Current inputs and previous state |
| Feedback | No feedback | Has feedback |
| Clock | Not required | Usually required |
| Examples | Adders, Multiplexers | Flip-flops, Counters |
Types of Sequential Circuits
- Synchronous: Operations synchronized by clock
- Asynchronous: Operations not synchronized by clock
Flip-Flops
Flip-flops are basic memory elements that store one bit of information.
Types of Flip-Flops
| Flip-Flop | Description | Trigger |
|---|---|---|
| SR Flip-Flop | Set-Reset, basic flip-flop | Level-triggered |
| D Flip-Flop | Data or Delay flip-flop | Edge-triggered |
| JK Flip-Flop | Universal flip-flop | Edge-triggered |
| T Flip-Flop | Toggle flip-flop | Edge-triggered |
Flip-Flop Characteristics
- Setup Time: Minimum time input must be stable before clock edge
- Hold Time: Minimum time input must remain stable after clock edge
- Propagation Delay: Time from clock edge to output change
Registers
Registers are groups of flip-flops used to store multiple bits of data.
Types of Registers
-
Shift Registers:
- SISO (Serial-In Serial-Out)
- SIPO (Serial-In Parallel-Out)
- PISO (Parallel-In Serial-Out)
- PIPO (Parallel-In Parallel-Out)
- Buffer Registers: Temporary storage
- Control Registers: Store control information
Shift Register Applications
- Serial to parallel conversion
- Parallel to serial conversion
- Sequence generation
- Data delay
Counters
Counters are sequential circuits that progress through a predetermined sequence of states.
Counter Classification
| Classification | Types |
|---|---|
| By Counting Sequence | Binary, BCD, Up/Down |
| By Clocking | Synchronous, Asynchronous |
| By Modulus | Mod-N, Decade, Ring |
Common Counters
- Asynchronous (Ripple) Counter: Simple but slower
- Synchronous Counter: All flip-flops clocked simultaneously
- Ring Counter: Circulates single 1 through register
- Johnson Counter: Twisted ring counter
Logic Families
Logic families are groups of logic devices with similar circuit characteristics.
Common Logic Families
| Family | Full Name | Characteristics |
|---|---|---|
| TTL | Transistor-Transistor Logic | Fast, high power consumption |
| CMOS | Complementary MOS | Low power, high density |
| ECL | Emitter-Coupled Logic | Very fast, high power |
Important Parameters
- Propagation Delay: Time from input to output change
- Power Dissipation: Power consumed by the gate
- Fan-out: Maximum number of similar gates that can be driven
- Noise Margin: Immunity to noise