π Search Course Content
Digital Logic Design
Complete Course
Number Systems Β· Boolean Algebra Β· Logic Gates Β· Combinational & Sequential Circuits β Complete Guide in Easy English
π Table of Contents β 8 Units
Number Systems & Codes
Understanding Binary, Octal, Decimal, Hexadecimal, BCD, Gray Code, ASCII and conversions
What is a Number System?
A number system is a mathematical notation for representing numbers using a consistent set of digits or symbols. In digital electronics and computers, different number systems are used to represent data.
Types of Number Systems
| System | Base | Digits Used | Example |
|---|---|---|---|
| Binary | 2 | 0, 1 | (1010)β |
| Octal | 8 | 0-7 | (752)β |
| Decimal | 10 | 0-9 | (125)ββ |
| Hexadecimal | 16 | 0-9, A-F | (3A7)ββ |
1. Binary Number System (Base 2)
Binary is the fundamental language of computers and digital circuits. It uses only two digits: 0 and 1.
Why Binary?
- Digital circuits work with two states: ON (1) and OFF (0)
- Easy to implement using electronic switches (transistors)
- High noise immunity (clear distinction between 0 and 1)
- All data in computers is ultimately stored in binary
Binary Number Representation
Position: 7 6 5 4 3 2 1 0
Value: 128 64 32 16 8 4 2 1
Binary: 1 0 1 0 1 1 0 1
(10101101)β = 128 + 32 + 8 + 4 + 1 = (173)ββ
2. Decimal Number System (Base 10)
The standard number system we use in everyday life. Uses digits 0-9.
Position: 3 2 1 0 Value: 1000 100 10 1 Decimal: 5 2 7 3 (5273)ββ = 5Γ10Β³ + 2Γ10Β² + 7Γ10ΒΉ + 3Γ10β° = 5000 + 200 + 70 + 3
3. Octal Number System (Base 8)
Uses digits 0-7. Often used as a shorthand for binary (each octal digit = 3 binary bits).
Position: 2 1 0 Value: 64 8 1 Octal: 7 5 2 (752)β = 7Γ8Β² + 5Γ8ΒΉ + 2Γ8β° = 448 + 40 + 2 = (490)ββ
4. Hexadecimal Number System (Base 16)
Uses digits 0-9 and letters A-F (A=10, B=11, C=12, D=13, E=14, F=15). Widely used in programming and memory addressing.
| Decimal | Binary | Hexadecimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
(3A7)ββ = 3Γ16Β² + 10Γ16ΒΉ + 7Γ16β° = 768 + 160 + 7 = (935)ββ
Number System Conversions
1. Binary to Decimal
Example: Convert (1101)β to Decimal
(1101)β = 1Γ2Β³ + 1Γ2Β² + 0Γ2ΒΉ + 1Γ2β°
= 8 + 4 + 0 + 1
= (13)ββ
2. Decimal to Binary
Example: Convert (25)ββ to Binary
25 Γ· 2 = 12 remainder 1 (LSB)
12 Γ· 2 = 6 remainder 0
6 Γ· 2 = 3 remainder 0
3 Γ· 2 = 1 remainder 1
1 Γ· 2 = 0 remainder 1 (MSB)
Read from bottom to top: (11001)β
3. Binary to Octal
Group binary digits in groups of 3 from right to left
(101110101)β
= 101 110 101
= 5 6 5
= (565)β
4. Binary to Hexadecimal
Group binary digits in groups of 4 from right to left
(10111010)β
= 1011 1010
= B A
= (BA)ββ
5. Octal to Binary
Convert each octal digit to 3-bit binary
(746)β
7 = 111
4 = 100
6 = 110
= (111100110)β
6. Hexadecimal to Binary
Convert each hex digit to 4-bit binary
(2F)ββ
2 = 0010
F = 1111
= (00101111)β
Quick Conversion Table
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Binary Codes
1. Binary Coded Decimal (BCD)
BCD represents each decimal digit (0-9) using 4 binary bits. Also called 8421 code.
Example: Convert (579)ββ to BCD
5 = 0101
7 = 0111
9 = 1001
(579)ββ = 0101 0111 1001 (BCD)
| Decimal | BCD (8421) | Binary |
|---|---|---|
| 0 | 0000 | 0000 |
| 1 | 0001 | 0001 |
| 5 | 0101 | 0101 |
| 9 | 1001 | 1001 |
| 12 | 0001 0010 | 1100 |
| 25 | 0010 0101 | 11001 |
2. Gray Code (Reflected Binary Code)
A binary code where two successive values differ by only one bit. Used in rotary encoders, error correction, and analog-to-digital converters.
| Decimal | Binary | Gray Code | Bits Changed |
|---|---|---|---|
| 0 | 0000 | 0000 | - |
| 1 | 0001 | 0001 | 1 bit |
| 2 | 0010 | 0011 | 1 bit |
| 3 | 0011 | 0010 | 1 bit |
| 4 | 0100 | 0110 | 1 bit |
| 5 | 0101 | 0111 | 1 bit |
| 6 | 0110 | 0101 | 1 bit |
| 7 | 0111 | 0100 | 1 bit |
Binary to Gray Code Conversion:
Method: MSB stays same, then XOR each adjacent pair Binary: 1 0 1 1 β β β β Gray: 1 1 1 0 Step by step: Gβ = Bβ = 1 Gβ = Bβ β Bβ = 1 β 0 = 1 Gβ = Bβ β Bβ = 0 β 1 = 1 Gβ = Bβ β Bβ = 1 β 1 = 0
Gray to Binary Conversion:
Method: MSB stays same, then XOR with previous binary bit Gray: 1 1 1 0 β β β β Binary: 1 0 1 1 Step by step: Bβ = Gβ = 1 Bβ = Bβ β Gβ = 1 β 1 = 0 Bβ = Bβ β Gβ = 0 β 1 = 1 Bβ = Bβ β Gβ = 1 β 0 = 1
ASCII Code (American Standard Code for Information Interchange)
A 7-bit code (128 characters) used to represent text in computers. Extended ASCII uses 8 bits (256 characters).
| Character | Decimal | Binary | Hexadecimal |
|---|---|---|---|
| A | 65 | 01000001 | 41 |
| B | 66 | 01000010 | 42 |
| Z | 90 | 01011010 | 5A |
| a | 97 | 01100001 | 61 |
| b | 98 | 01100010 | 62 |
| 0 | 48 | 00110000 | 30 |
| 1 | 49 | 00110001 | 31 |
| Space | 32 | 00100000 | 20 |
ASCII Ranges:
- 0-31: Control characters (non-printable)
- 32-47: Special characters and space
- 48-57: Digits 0-9
- 65-90: Uppercase letters A-Z
- 97-122: Lowercase letters a-z
Signed Number Representation
1. Sign-Magnitude
MSB indicates sign (0=positive, 1=negative). Remaining bits represent magnitude.
+5 = 0101 (MSB=0 means positive)
-5 = 1101 (MSB=1 means negative)
Problem: Two representations of zero (+0 and -0)
+0 = 0000
-0 = 1000
2. 1's Complement
Positive numbers: normal binary. Negative numbers: invert all bits.
+5 = 0101
-5 = 1010 (invert all bits of +5)
+7 = 0111
-7 = 1000 (invert all bits of +7)
Problem: Still has two zeros
+0 = 0000
-0 = 1111
3. 2's Complement (Most Common)
Positive numbers: normal binary. Negative numbers: invert all bits and add 1.
Example: Find 2's complement of +5 +5 = 0101 Invert: 1010 Add 1: 1011 -5 = 1011 Example: Find 2's complement of +7 +7 = 0111 Invert: 1000 Add 1: 1001 -7 = 1001 Advantage: Only one representation of zero +0 = 0000
2's Complement Range for n bits:
- Range: -2n-1 to +2n-1-1
- 4-bit: -8 to +7
- 8-bit: -128 to +127
- 16-bit: -32,768 to +32,767
Binary Arithmetic
Binary Addition Rules:
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 10 (0 with carry 1) 1 + 1 + 1 = 11 (1 with carry 1)
Example: 1011 + 1101
βββ (carries)
1011 (11 in decimal)
+ 1101 (13 in decimal)
------
11000 (24 in decimal)
Binary Subtraction Rules:
0 - 0 = 0 1 - 0 = 1 1 - 1 = 0 0 - 1 = 1 (with borrow 1)
Example: 1101 - 1011
1101 (13 in decimal)
- 1011 (11 in decimal)
------
0010 (2 in decimal)
Boolean Algebra
Laws, theorems, De Morgan's rules, simplification techniques and truth tables
What is Boolean Algebra?
Boolean Algebra is a branch of algebra that deals with binary variables and logical operations. Developed by George Boole in 1854, it forms the foundation of digital logic design.
Boolean Variables: Can have only two values: 0 (False) or 1 (True)
Basic Boolean Operations
1. AND Operation (Β·)
Output is 1 only when ALL inputs are 1. Symbol: Β· or β§
Z = A Β· B or Z = A AND B or Z = AB
Truth Table:
A B | Z=AΒ·B
0 0 | 0
0 1 | 0
1 0 | 0
1 1 | 1
2. OR Operation (+)
Output is 1 when AT LEAST ONE input is 1. Symbol: + or β¨
Z = A + B or Z = A OR B
Truth Table:
A B | Z=A+B
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 1
3. NOT Operation (')
Output is the complement/inverse of input. Symbol: ' or Β¬ or βΎ
Z = A' or Z = NOT A or Z = Δ
Truth Table:
A | Z=A'
0 | 1
1 | 0
Boolean Algebra Laws
1. Identity Laws
2. Null (Dominance) Laws
3. Idempotent Laws
4. Complement Laws
5. Commutative Laws
6. Associative Laws
7. Distributive Laws
8. Absorption Laws
De Morgan's Theorems
De Morgan's Laws are fundamental theorems for complementing Boolean expressions:
Theorem 1:
(A + B)' = A' Β· B' The complement of OR equals AND of complements Proof by Truth Table: A B | A+B (A+B)' | A' B' A'Β·B' 0 0 | 0 1 | 1 1 1 β 0 1 | 1 0 | 1 0 0 β 1 0 | 1 0 | 0 1 0 β 1 1 | 1 0 | 0 0 0 β
Theorem 2:
(A Β· B)' = A' + B' The complement of AND equals OR of complements Proof by Truth Table: A B | AΒ·B (AΒ·B)' | A' B' A'+B' 0 0 | 0 1 | 1 1 1 β 0 1 | 0 1 | 1 0 1 β 1 0 | 0 1 | 0 1 1 β 1 1 | 1 0 | 0 0 0 β
Extended De Morgan's:
(A + B + C)' = A' Β· B' Β· C' (A Β· B Β· C)' = A' + B' + C' (A + BΒ·C)' = A' Β· (B'+C') (AΒ·B + CΒ·D)' = (A'+B') Β· (C'+D')
Boolean Expression Simplification
Example 1: Simplify AΒ·B + AΒ·B'
AΒ·B + AΒ·B' = AΒ·(B + B') Distributive law = AΒ·1 Complement law: B+B'=1 = A Identity law: AΒ·1=A
Example 2: Simplify (A+B)Β·(A+B')
(A+B)Β·(A+B') = A + BΒ·B' Distributive law = A + 0 Complement law: BΒ·B'=0 = A Identity law: A+0=A
Example 3: Simplify A + AΒ·B
A + AΒ·B = AΒ·1 + AΒ·B Identity law: A=AΒ·1 = AΒ·(1 + B) Distributive law = AΒ·1 Null law: 1+B=1 = A Identity law
Example 4: Simplify A'Β·BΒ·C + AΒ·BΒ·C + AΒ·BΒ·C'
A'Β·BΒ·C + AΒ·BΒ·C + AΒ·BΒ·C' = BΒ·CΒ·(A'+A) + AΒ·BΒ·C' Factor out BΒ·C = BΒ·CΒ·1 + AΒ·BΒ·C' Complement law = BΒ·C + AΒ·BΒ·C' Identity law = BΒ·(C + AΒ·C') Factor out B = BΒ·(C + A) Absorption law = AΒ·B + BΒ·C Distributive law
Standard Forms of Boolean Expressions
1. Sum of Products (SOP)
OR of AND terms. Each AND term is called a minterm.
F = A'Β·BΒ·C + AΒ·B'Β·C + AΒ·BΒ·C'
Example: F(A,B,C) = Ξ£m(1,3,5,7)
F = A'Β·B'Β·C + A'Β·BΒ·C + AΒ·B'Β·C + AΒ·BΒ·C
2. Product of Sums (POS)
AND of OR terms. Each OR term is called a maxterm.
F = (A+B+C)Β·(A+B'+C)Β·(A'+B+C')
Example: F(A,B,C) = Ξ M(0,2,4,6)
F = (A+B+C)Β·(A+B+C')Β·(A+B'+C)Β·(A+B'+C')
Truth Table to Boolean Expression
Example: Create expression from truth table
Truth Table: A B C | F 0 0 0 | 0 0 0 1 | 1 β mβ = A'Β·B'Β·C 0 1 0 | 0 0 1 1 | 1 β mβ = A'Β·BΒ·C 1 0 0 | 1 β mβ = AΒ·B'Β·C' 1 0 1 | 0 1 1 0 | 1 β mβ = AΒ·BΒ·C' 1 1 1 | 0 SOP Form (use rows where F=1): F = A'Β·B'Β·C + A'Β·BΒ·C + AΒ·B'Β·C' + AΒ·BΒ·C' Simplified: F = A'Β·CΒ·(B'+B) + AΒ·C'Β·(B'+B) F = A'Β·C + AΒ·C'
Canonical Forms
Minterms (m): Product terms with all variables present (in normal or complement form)
| Row | A B C | Minterm | Notation |
|---|---|---|---|
| 0 | 0 0 0 | A'Β·B'Β·C' | mβ |
| 1 | 0 0 1 | A'Β·B'Β·C | mβ |
| 2 | 0 1 0 | A'Β·BΒ·C' | mβ |
| 3 | 0 1 1 | A'Β·BΒ·C | mβ |
| 4 | 1 0 0 | AΒ·B'Β·C' | mβ |
| 5 | 1 0 1 | AΒ·B'Β·C | mβ |
| 6 | 1 1 0 | AΒ·BΒ·C' | mβ |
| 7 | 1 1 1 | AΒ·BΒ·C | mβ |
Maxterms (M): Sum terms with all variables present
| Row | A B C | Maxterm | Notation |
|---|---|---|---|
| 0 | 0 0 0 | A+B+C | Mβ |
| 1 | 0 0 1 | A+B+C' | Mβ |
| 2 | 0 1 0 | A+B'+C | Mβ |
| 3 | 0 1 1 | A+B'+C' | Mβ |
| 4 | 1 0 0 | A'+B+C | Mβ |
| 5 | 1 0 1 | A'+B+C' | Mβ |
| 6 | 1 1 0 | A'+B'+C | Mβ |
| 7 | 1 1 1 | A'+B'+C' | Mβ |
Consensus Theorem
AΒ·B + A'Β·C + BΒ·C = AΒ·B + A'Β·C The term BΒ·C is redundant (consensus term) Dual form: (A+B)Β·(A'+C)Β·(B+C) = (A+B)Β·(A'+C)
Logic Gates
AND, OR, NOT, NAND, NOR, XOR, XNOR gates with symbols, truth tables, and diagrams
What is a Logic Gate?
A logic gate is a basic building block of digital circuits. It performs a logical operation on one or more binary inputs and produces a single binary output.
1. AND Gate
Output is HIGH (1) only when ALL inputs are HIGH.
Symbol: A βββββ ββ² β β² β ββββ Y = AΒ·B β β± ββ± B βββββ Boolean Expression: Y = A Β· B or Y = AB Truth Table: βββββ¬ββββ¬ββββββββ β A β B β Y=AΒ·B β βββββΌββββΌββββββββ€ β 0 β 0 β 0 β β 0 β 1 β 0 β β 1 β 0 β 0 β β 1 β 1 β 1 β βββββ΄ββββ΄ββββββββ
Applications: Enable/disable signals, multiplication in ALU, conditional operations
2. OR Gate
Output is HIGH when AT LEAST ONE input is HIGH.
Symbol: A βββββ β) β ) β ββββ Y = A+B β ) β) B βββββ Boolean Expression: Y = A + B Truth Table: βββββ¬ββββ¬ββββββββ β A β B β Y=A+B β βββββΌββββΌββββββββ€ β 0 β 0 β 0 β β 0 β 1 β 1 β β 1 β 0 β 1 β β 1 β 1 β 1 β βββββ΄ββββ΄ββββββββ
Applications: Combining multiple enable signals, addition in ALU, error detection
3. NOT Gate (Inverter)
Output is the inverse of input. Single input gate.
Symbol: A βββββ·ββββ Y = A' Boolean Expression: Y = A' or Y = Δ Truth Table: βββββ¬βββββββ β A β Y=A' β βββββΌβββββββ€ β 0 β 1 β β 1 β 0 β βββββ΄βββββββ
Applications: Inverting signals, creating complement, clock signal inversion
4. NAND Gate (NOT-AND)
Output is LOW only when ALL inputs are HIGH. Complement of AND gate.
Symbol: A βββββ ββ² β β² β βββββ Y = (AΒ·B)' β β± ββ± B βββββ Boolean Expression: Y = (A Β· B)' or Y = AΜ Β·Μ BΜ Truth Table: βββββ¬ββββ¬ββββββββββ β A β B β Y=(AΒ·B)'β βββββΌββββΌββββββββββ€ β 0 β 0 β 1 β β 0 β 1 β 1 β β 1 β 0 β 1 β β 1 β 1 β 0 β βββββ΄ββββ΄ββββββββββ
5. NOR Gate (NOT-OR)
Output is HIGH only when ALL inputs are LOW. Complement of OR gate.
Symbol: A βββββ β) β ) β βββββ Y = (A+B)' β ) β) B βββββ Boolean Expression: Y = (A + B)' or Y = AΜ +Μ BΜ Truth Table: βββββ¬ββββ¬ββββββββββ β A β B β Y=(A+B)'β βββββΌββββΌββββββββββ€ β 0 β 0 β 1 β β 0 β 1 β 0 β β 1 β 0 β 0 β β 1 β 1 β 0 β βββββ΄ββββ΄ββββββββββ
6. XOR Gate (Exclusive-OR)
Output is HIGH when inputs are DIFFERENT.
Symbol: A βββββ )) ) ) ) ββββ Y = AβB ) ) )) B βββββ Boolean Expression: Y = A β B = A'Β·B + AΒ·B' Truth Table: βββββ¬ββββ¬ββββββββ β A β B β Y=AβB β βββββΌββββΌββββββββ€ β 0 β 0 β 0 β β 0 β 1 β 1 β β 1 β 0 β 1 β β 1 β 1 β 0 β βββββ΄ββββ΄ββββββββ
Applications: Addition circuits (Half Adder, Full Adder), parity checkers, data encryption
7. XNOR Gate (Exclusive-NOR)
Output is HIGH when inputs are SAME. Complement of XOR.
Symbol: A βββββ )) ) ) ) βββββ Y = (AβB)' ) ) )) B βββββ Boolean Expression: Y = (A β B)' = AΒ·B + A'Β·B' Truth Table: βββββ¬ββββ¬ββββββββββ β A β B β Y=(AβB)'β βββββΌββββΌββββββββββ€ β 0 β 0 β 1 β β 0 β 1 β 0 β β 1 β 0 β 0 β β 1 β 1 β 1 β βββββ΄ββββ΄ββββββββββ
Applications: Equality checker, comparators, error detection
Summary of All Gates
| Gate | Expression | Output 1 when | Type |
|---|---|---|---|
| AND | AΒ·B | ALL inputs are 1 | Basic |
| OR | A+B | AT LEAST ONE input is 1 | Basic |
| NOT | A' | Input is 0 | Basic |
| NAND | (AΒ·B)' | AT LEAST ONE input is 0 | Universal |
| NOR | (A+B)' | ALL inputs are 0 | Universal |
| XOR | AβB | Inputs are DIFFERENT | Special |
| XNOR | (AβB)' | Inputs are SAME | Special |
Complete Truth Table Comparison
βββββ¬ββββ¬ββββββ¬βββββ¬ββββββ¬βββββββ¬ββββββ¬ββββββ¬βββββββ β A β B β AND β OR β NOT β NAND β NOR β XOR β XNOR β βββββΌββββΌββββββΌβββββΌββββββΌβββββββΌββββββΌββββββΌβββββββ€ β 0 β 0 β 0 β 0 β 1,0 β 1 β 1 β 0 β 1 β β 0 β 1 β 0 β 1 β 1,0 β 1 β 0 β 1 β 0 β β 1 β 0 β 0 β 1 β 0,1 β 1 β 0 β 1 β 0 β β 1 β 1 β 1 β 1 β 0,1 β 0 β 0 β 0 β 1 β βββββ΄ββββ΄ββββββ΄βββββ΄ββββββ΄βββββββ΄ββββββ΄ββββββ΄βββββββ
Implementing Gates Using NAND
1. NOT using NAND: A ββββNANDββββ A' (Connect both inputs together) β A βββββ 2. AND using NAND: A βββββ NANDββNANDββ AΒ·B B βββββ 3. OR using NAND: A ββNANDβββ NANDββ A+B B ββNANDβββ 4. NOR using NAND: A ββNANDβββ NANDββNANDββ (A+B)' B ββNANDβββ
Implementing Gates Using NOR
1. NOT using NOR: A ββββNORββββ A' (Connect both inputs together) β A βββββ 2. OR using NOR: A βββββ NORββNORββ A+B B βββββ 3. AND using NOR: A ββNORβββ NORββ AΒ·B B ββNORβββ 4. NAND using NOR: A ββNORβββ NORββNORββ (AΒ·B)' B ββNORβββ
Multiple-Input Gates
3-Input AND Gate:
Y = AΒ·BΒ·C
A B C | Y
0 0 0 | 0
0 0 1 | 0
0 1 0 | 0
0 1 1 | 0
1 0 0 | 0
1 0 1 | 0
1 1 0 | 0
1 1 1 | 1 β Only when ALL are 1
3-Input OR Gate:
Y = A+B+C
A B C | Y
0 0 0 | 0 β Only when ALL are 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
3-Input XOR Gate:
Y = AβBβC (Output 1 when ODD number of 1s)
A B C | Y
0 0 0 | 0
0 0 1 | 1 β Odd (1)
0 1 0 | 1 β Odd (1)
0 1 1 | 0
1 0 0 | 1 β Odd (1)
1 0 1 | 0
1 1 0 | 0
1 1 1 | 1 β Odd (3)
Tri-State Buffer
A special gate with 3 output states: HIGH (1), LOW (0), and HIGH-IMPEDANCE (Z - disconnected).
Symbol: Data βββββ·ββββ Output β Enable Truth Table: Enable Data | Output 0 X | Z (High-impedance, disconnected) 1 0 | 0 1 1 | 1
Applications: Bus systems, memory interfacing, bidirectional data lines
Logic Gate IC Packages
| IC Number | Gate Type | Description |
|---|---|---|
| 7400 | NAND | Quad 2-input NAND gates |
| 7402 | NOR | Quad 2-input NOR gates |
| 7404 | NOT | Hex inverters |
| 7408 | AND | Quad 2-input AND gates |
| 7432 | OR | Quad 2-input OR gates |
| 7486 | XOR | Quad 2-input XOR gates |
| 74266 | XNOR | Quad 2-input XNOR gates |
Combinational Circuits
Adders, Subtractors, Multiplexers, Demultiplexers, Encoders, Decoders, Comparators
What are Combinational Circuits?
Combinational circuits are logic circuits whose outputs depend ONLY on present inputs (no memory). Output changes immediately when input changes.
Characteristics:
- No feedback loops
- No memory elements (no flip-flops)
- Output = f(present inputs only)
- Faster than sequential circuits
1. Half Adder
Adds two 1-bit binary numbers. Produces SUM and CARRY.
Truth Table: A B | Sum Carry 0 0 | 0 0 0 1 | 1 0 1 0 | 1 0 1 1 | 0 1 Boolean Expressions: Sum = A β B (XOR) Carry = A Β· B (AND) Circuit Diagram: A ββββ XORββββ Sum B ββββ A ββββ ANDββββ Carry B ββββ
2. Full Adder
Adds THREE 1-bit binary numbers (A, B, and Carry-in). Produces SUM and CARRY-out.
Truth Table: A B Cin | Sum Cout 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 Boolean Expressions: Sum = A β B β Cin Cout = AΒ·B + CinΒ·(AβB) = AΒ·B + BΒ·Cin + AΒ·Cin Implementation using Two Half Adders: A βββ ββββ Sum HA1 ββ S βββHA2 B βββ C β β Cin βββORββββββ Cout
4-bit Binary Adder (Ripple Carry)
Connects 4 Full Adders in series
AβBβ AβBβ AβBβ AβBβ
β β β β β β β β
FA FA FA FA
β β β β
CβββββCβββββCβββββCβββββCβ(0)
Sum: Sβ Sβ Sβ Sβ
Carry: Cβ
3. Half Subtractor
Subtracts two 1-bit binary numbers.
Truth Table: A B | Diff Borrow 0 0 | 0 0 0 1 | 1 1 1 0 | 1 0 1 1 | 0 0 Boolean Expressions: Diff = A β B Borrow = A'Β·B
4. Full Subtractor
Subtracts three bits (A - B - Bin).
Boolean Expressions:
Diff = A β B β Bin
Bout = A'Β·B + BinΒ·(AβB)'
= A'Β·B + A'Β·Bin + BΒ·Bin
5. Multiplexer (MUX)
Data selector. Selects ONE of many inputs and forwards it to output based on select lines.
2:1 Multiplexer (2 inputs, 1 select line)
Block Diagram: Iβ βββ β MUX Iβ βββ€ 2:1 ββββ Y β S βββ Truth Table: S | Y 0 | Iβ 1 | Iβ Boolean Expression: Y = S'Β·Iβ + SΒ·Iβ
4:1 Multiplexer (4 inputs, 2 select lines)
Block Diagram: Iβ βββ Iβ βββ€ MUX Iβ βββ€ 4:1 ββββ Y Iβ βββ SβSβ Truth Table: Sβ Sβ | Y 0 0 | Iβ 0 1 | Iβ 1 0 | Iβ 1 1 | Iβ Boolean Expression: Y = Sβ'Β·Sβ'Β·Iβ + Sβ'Β·SβΒ·Iβ + SβΒ·Sβ'Β·Iβ + SβΒ·SβΒ·Iβ
Applications: Data routing, parallel-to-serial conversion, function generators, ALU input selection
6. Demultiplexer (DEMUX)
Data distributor. Routes ONE input to ONE of many outputs based on select lines.
1:4 Demultiplexer
Block Diagram: βββββ Yβ β Dβββββ€DEMUX Yβ 1:4 β βββββ Yβ β βββββ Yβ SβSβ Truth Table: Sβ Sβ | Yβ Yβ Yβ Yβ 0 0 | D 0 0 0 0 1 | 0 D 0 0 1 0 | 0 0 D 0 1 1 | 0 0 0 D Boolean Expressions: Yβ = Sβ'Β·Sβ'Β·D Yβ = Sβ'Β·SβΒ·D Yβ = SβΒ·Sβ'Β·D Yβ = SβΒ·SβΒ·D
Applications: Serial-to-parallel conversion, address decoding, communication systems
7. Encoder
Converts 2βΏ input lines to n output lines. Only ONE input should be active at a time.
4:2 Encoder (4 inputs to 2 outputs)
Truth Table: Iβ Iβ Iβ Iβ | Yβ Yβ 0 0 0 1 | 0 0 0 0 1 0 | 0 1 0 1 0 0 | 1 0 1 0 0 0 | 1 1 Boolean Expressions: Yβ = Iβ + Iβ Yβ = Iβ + Iβ
Priority Encoder: When multiple inputs are active, encodes the highest priority input.
Applications: Keyboard encoding, interrupt handling, data compression
8. Decoder
Converts n input lines to 2βΏ output lines. Only ONE output is active for each input combination.
2:4 Decoder (2 inputs to 4 outputs)
Truth Table: Aβ Aβ | Yβ Yβ Yβ Yβ 0 0 | 0 0 0 1 0 1 | 0 0 1 0 1 0 | 0 1 0 0 1 1 | 1 0 0 0 Boolean Expressions: Yβ = Aβ'Β·Aβ' Yβ = Aβ'Β·Aβ Yβ = AβΒ·Aβ' Yβ = AβΒ·Aβ
Applications: Memory address decoding, instruction decoding, display drivers (7-segment)
9. 7-Segment Display Decoder
Converts 4-bit BCD to 7-segment display output.
7-Segment Display Layout: aaa f b ggg e c ddd BCD to 7-Segment: BCD | abcdefg | Display 0000 | 1111110 | 0 0001 | 0110000 | 1 0010 | 1101101 | 2 0011 | 1111001 | 3 0100 | 0110011 | 4 0101 | 1011011 | 5 0110 | 1011111 | 6 0111 | 1110000 | 7 1000 | 1111111 | 8 1001 | 1111011 | 9
10. Magnitude Comparator
Compares two binary numbers and indicates whether they are equal, or one is greater/less than the other.
1-bit Comparator:
Truth Table:
A B | A>B A=B ABoolean Expressions:
A > B = AΒ·B'
A = B = A'Β·B' + AΒ·B = (AβB)'
A < B = A'Β·B
2-bit Comparator:
Compare AβAβ with BβBβ
A=B when: (AββBβ)' Β· (AββBβ)'
A>B when: AβΒ·Bβ' + (AββBβ)'Β·AβΒ·Bβ'
AApplications: Sorting algorithms, control circuits, microprocessor ALU
Combinational Circuit Design Steps
Step-by-step Design Process:
- Step 1: Problem Statement - Understand what the circuit should do
- Step 2: Input/Output Identification - Determine number and type of I/O
- Step 3: Truth Table - List all input combinations and desired outputs
- Step 4: Boolean Expression - Derive from truth table (SOP or POS)
- Step 5: Simplification - Use Boolean algebra or K-map
- Step 6: Logic Diagram - Draw circuit using gates
- Step 7: Verification - Test with all input combinations
Parity Generator & Checker
Even Parity Generator (3-bit):
Adds parity bit to make total 1s even
A B C | P (Parity bit)
0 0 0 | 0 (0 ones β even, add 0)
0 0 1 | 1 (1 one β odd, add 1)
0 1 0 | 1
0 1 1 | 0
1 0 0 | 1
1 0 1 | 0
1 1 0 | 0
1 1 1 | 1
P = A β B β C
Even Parity Checker:
Checks if total 1s (including parity bit) is even
Error = A β B β C β P
Error = 0 β No error (even parity maintained)
Error = 1 β Error detected (odd parity)
Applications: Error detection in data transmission, memory systems, communication protocols
Code Converter Circuits
1. Binary to Gray Code Converter:
For 3-bit (BβBβBβ β GβGβGβ):
Gβ = Bβ
Gβ = Bβ β Bβ
Gβ = Bβ β Bβ
2. Gray to Binary Code Converter:
For 3-bit (GβGβGβ β BβBβBβ):
Bβ = Gβ
Bβ = Bβ β Gβ
Bβ = Bβ β Gβ
3. BCD to Excess-3 Converter:
Excess-3 = BCD + 3. Used in arithmetic operations to avoid 0000 representation.
Arithmetic Logic Unit (ALU)
A combinational circuit that performs arithmetic (add, subtract) and logic (AND, OR, XOR) operations.
Simple 4-function ALU:
Inputs: A, B (n-bit data)
SβSβ (2-bit operation select)
Sβ Sβ | Operation
0 0 | A AND B
0 1 | A OR B
1 0 | A XOR B
1 1 | A + B
Sequential Circuits
Flip-flops (SR, JK, D, T), Latches, State diagrams, and Timing diagrams
What are Sequential Circuits?
Sequential circuits are logic circuits whose outputs depend on BOTH present inputs AND past outputs (memory). They have feedback loops and memory elements.
Combinational vs Sequential:
| Feature | Combinational | Sequential |
|---|---|---|
| Memory | No memory | Has memory |
| Output depends on | Present inputs only | Present inputs + past state |
| Feedback | No feedback | Feedback present |
| Clock | Not needed | Usually clock-driven |
| Elements | Gates only | Gates + Flip-flops |
| Examples | Adder, MUX, Decoder | Counter, Register, FSM |
Types of Sequential Circuits
- Synchronous: State changes only at clock edges (clock-driven)
- Asynchronous: State changes immediately when inputs change (no clock)
Memory Elements
1. Latch
Level-sensitive memory element. Changes output when enable signal is HIGH.
2. Flip-Flop
Edge-sensitive memory element. Changes output only at clock edge (rising or falling).
SR Latch (Set-Reset Latch)
Most basic memory element using NAND or NOR gates.
SR Latch using NOR gates:
Circuit: S ββNORβββ¬ββββ Q ββββββ β ββββββ R ββNORβββ΄ββββ Q' Truth Table: S R | Q Q' | State 0 0 | Q Q' | Hold (No change) 0 1 | 0 1 | Reset 1 0 | 1 0 | Set 1 1 | 0 0 | Invalid (Not allowed!) Characteristic Equation: Q(next) = S + R'Β·Q
SR Latch using NAND gates:
Truth Table (Active LOW inputs):
SΜ RΜ | Q Q' | State
0 0 | 1 1 | Invalid
0 1 | 1 0 | Set
1 0 | 0 1 | Reset
1 1 | Q Q' | Hold
Gated SR Latch
SR Latch with enable signal. Changes only when Enable=1.
Block Diagram: S βββ Enableββββ SR Latch ββββ Q R βββ βββββ Q' EN Truth Table: EN S R | Q(next) 0 X X | Q (Hold) 1 0 0 | Q (Hold) 1 0 1 | 0 (Reset) 1 1 0 | 1 (Set) 1 1 1 | Invalid
D Latch (Data Latch)
Eliminates invalid state of SR latch. Has only one data input.
Circuit: D βββ¬βββββββββ S β SR Latch ββββ Q βββNOTββ R Truth Table: EN D | Q(next) 0 X | Q (Hold) 1 0 | 0 1 1 | 1 When EN=1: Q follows D When EN=0: Q holds previous value
Flip-Flops (Edge-Triggered)
Clock Triggering Types:
- Positive Edge Triggered: Changes at rising edge (0β1) β
- Negative Edge Triggered: Changes at falling edge (1β0) β
1. SR Flip-Flop
Edge-triggered version of SR latch.
Symbol: S ββββββ β SR CLK ββββ€ FF ββββ Q β βββββ Q' R ββββββ Truth Table (Positive Edge Triggered): S R | Q(t+1) | Comment 0 0 | Q(t) | No change 0 1 | 0 | Reset 1 0 | 1 | Set 1 1 | Invalid | Not allowed Characteristic Equation: Q(t+1) = S + R'Β·Q(t)
2. JK Flip-Flop
Most versatile flip-flop. Eliminates invalid state by toggling output when J=K=1.
Symbol: J ββββββ β JK CLK ββββ€ FF ββββ Q β βββββ Q' K ββββββ Truth Table: J K | Q(t+1) | Comment 0 0 | Q(t) | No change (Hold) 0 1 | 0 | Reset 1 0 | 1 | Set 1 1 | Q'(t) | Toggle Characteristic Equation: Q(t+1) = JΒ·Q'(t) + K'Β·Q(t)
Timing Diagram:
CLK βββ βββ βββ βββ βββ
βββ βββ βββ βββ
J βββββββββ βββββ
K βββ βββββββ
βββββββββββββββββ
Q βββ βββββ ββββ
βββββ βββββ
J=0,K=1 β Reset (Q=0)
J=1,K=0 β Set (Q=1)
J=1,K=1 β Toggle
J=0,K=0 β Hold
3. D Flip-Flop (Data/Delay Flip-Flop)
Stores one bit of data. Output Q follows input D at clock edge.
Symbol: D ββββββ β D CLK ββββ€ FF ββββ Q β βββββ Q' β Truth Table: D | Q(t+1) 0 | 0 1 | 1 Characteristic Equation: Q(t+1) = D Note: No invalid state, simplest to use
Applications: Shift registers, data storage, delay elements, frequency division
4. T Flip-Flop (Toggle Flip-Flop)
Toggles output when T=1. Used in counters.
Symbol: T ββββββ β T CLK ββββ€ FF ββββ Q β βββββ Q' β Truth Table: T | Q(t+1) | Comment 0 | Q(t) | No change 1 | Q'(t) | Toggle Characteristic Equation: Q(t+1) = TΒ·Q'(t) + T'Β·Q(t) = T β Q(t)
T Flip-Flop from JK: Connect J and K together β T input
T Flip-Flop from D: Feed Q' XOR T to D input
Flip-Flop Conversion
Conversion Table:
| Convert From | To | Method |
|---|---|---|
| JK to D | D | D = J = K' |
| JK to T | T | J = K = T |
| D to JK | JK | J = D, K = D' |
| D to T | T | D = T β Q |
| T to JK | JK | J = K = T |
| T to D | D | D = T β Q |
Example: Convert SR to JK
Excitation Table Comparison: Q(t) Q(t+1) | S R | J K 0 0 | 0 X | 0 X 0 1 | 1 0 | 1 X 1 0 | 0 1 | X 1 1 1 | X 0 | X 0 Conversion Logic: S = JΒ·Q' R = KΒ·Q
Master-Slave Flip-Flop
Two flip-flops in series. Master captures input, slave outputs after clock.
Block Diagram: J βββ ββββ βββ Q Master FF β β Slave FF β K βββ Qβββββ ββββ Q ββββββ Q' CLK βββ¬ββββββββββNOTβββββ β β βββββββββββββββββββ Operation: 1. When CLK=1: Master enabled, Slave disabled Master captures J, K inputs 2. When CLK=0: Master disabled, Slave enabled Slave copies Master output Advantage: Prevents race conditions
Preset and Clear Inputs
Asynchronous inputs that override clock. Used for initialization.
Flip-Flop with Preset (PRE) and Clear (CLR): PRE βββββ β FF D βββββ€ ββββ Q CLK βββββ€ βββββ Q' β CLR βββββ Truth Table: PRE CLR | Q Q' | Comment 0 0 | 1 1 | Invalid 0 1 | 1 0 | Preset (Set Q=1) 1 0 | 0 1 | Clear (Set Q=0) 1 1 | Operates normally with CLK/D
State Diagrams
Graphical representation of sequential circuit behavior showing states and transitions.
Example: 2-bit Binary Counter βββββββ ββββ 00 ββββ β βββββββ β β β β β βββββββ β ββββ 01 ββββ βββββββ β βββββββ ββββ 10 ββββ β βββββββ β β β β β βββββββ β ββββ 11 ββββ βββββββ β (back to 00) States: 00 β 01 β 10 β 11 β 00...
State Table
Tabular representation of state transitions.
Example: JK Flip-Flop State Table
Present Inputs | Next
State J K | State
0 0 0 | 0
0 0 1 | 0
0 1 0 | 1
0 1 1 | 1
1 0 0 | 1
1 0 1 | 0
1 1 0 | 1
1 1 1 | 0
Excitation Tables
Shows required inputs to achieve desired state transitions. Used in flip-flop conversions.
| Flip-Flop | Q(t)βQ(t+1): 0β0 | 0β1 | 1β0 | 1β1 |
|---|---|---|---|---|
| SR | S=0, R=X | S=1, R=0 | S=0, R=1 | S=X, R=0 |
| JK | J=0, K=X | J=1, K=X | J=X, K=1 | J=X, K=0 |
| D | D=0 | D=1 | D=0 | D=1 |
| T | T=0 | T=1 | T=1 | T=0 |
Counters & Registers
Up/Down counters, Ring counters, Shift registers, and Applications
What is a Counter?
A counter is a sequential circuit that goes through a predetermined sequence of states upon application of clock pulses. Counts number of clock pulses.
Types of Counters
1. Asynchronous (Ripple) Counter
Flip-flops are NOT clocked simultaneously. Output of one triggers the next.
2-bit Asynchronous Up Counter:
Circuit: CLK βββ T-FF β β T-FF β β T=1 βQβ β T=1 βQβ ββββββββ ββββββββ Timing Diagram: CLK βββ βββ βββ βββ ββ βββ βββ βββ βββ Qβ βββ βββββ ββββ βββββ βββββ Qβ βββ ββββββββ βββββββββ Count: 00 β 01 β 10 β 11 β 00... MOD-4 Counter (counts 0-3)
3-bit Asynchronous Up Counter:
Counts: 000 β 001 β 010 β 011 β 100 β 101 β 110 β 111 β 000 MOD-8 Counter (8 states) Disadvantage: Propagation delay (ripple effect)
2. Synchronous Counter
All flip-flops are clocked simultaneously. No ripple delay.
2-bit Synchronous Up Counter:
Circuit using JK Flip-Flops: ββββββββ ββββββββ Jβ=1βββ JK βββQββββ JK βββQβ Kβ=1βββ FF0 β β FF1 β CLKββββ΄βββββββ Jββββ΄βββββββ Kβ Jβ = Kβ = Qβ State Table: Qβ Qβ | JβKβ JβKβ | Next 0 0 | 0X 11 | 01 0 1 | 1X 11 | 10 1 0 | X0 11 | 11 1 1 | X1 11 | 00
3. Decade Counter (MOD-10)
Counts from 0 to 9, then resets to 0. Uses 4 flip-flops but only 10 states.
BCD Counter: Count: 0000 β 0001 β 0010 β ... β 1001 β 0000 IC 7490: Decade Counter chip
4. Ring Counter
Shift register with output fed back to input. Circulates single '1' bit.
4-bit Ring Counter: D-FFβ β D-FFβ β D-FFβ β D-FFβ ββ β β ββββββββββββββββββββββββββββββββ Sequence: QβQβQβQβ 1000 β 0100 β 0010 β 0001 β 1000... Applications: State machines, sequence generators
5. Johnson Counter (Twisted Ring)
Ring counter with inverted feedback. Has 2N states for N flip-flops.
4-bit Johnson Counter: D-FFβ β D-FFβ β D-FFβ β D-FFβ ββ β NOT ββββββββββββββββββββββββββββββββ Sequence (8 states): 0000 β 1000 β 1100 β 1110 β 1111 β 0111 β 0011 β 0001 β 0000
Registers
A register is a group of flip-flops used to store multiple bits of data. Each flip-flop stores one bit.
1. Parallel-In Parallel-Out (PIPO) Register
All bits loaded and read simultaneously.
4-bit PIPO Register: DβββD-FFβββQβ DβββD-FFβββQβ DβββD-FFβββQβ DβββD-FFβββQβ β β β β CLK βββββββββββββββββββββββββββββββββββββββββββββ All data loaded at once on clock edge All data read at once
2. Serial-In Serial-Out (SISO) Register
Data shifted in and out one bit at a time. Basic shift register.
4-bit SISO (Right Shift): DIN ββ D-FFβ β D-FFβ β D-FFβ β D-FFβ ββ DOUT β β β β CLK ββββββββββββββββββββββββββ Example: Input 1011 (MSB first) CLK State 0 0000 (Initial) 1 1000 (Input 1) 2 1100 (Input 0) 3 1110 (Input 1) 4 1111 (Input 1)
3. Serial-In Parallel-Out (SIPO) Register
Data shifted in serially, read out in parallel. Serial-to-parallel conversion.
Application: UART receiver, SPI communication
4. Parallel-In Serial-Out (PISO) Register
Data loaded in parallel, shifted out serially. Parallel-to-serial conversion.
Application: UART transmitter, data serialization
Shift Register Modes
| Mode | Description | Application |
|---|---|---|
| Right Shift | Bits shift right, divide by 2 | Division, serial output |
| Left Shift | Bits shift left, multiply by 2 | Multiplication, serial output |
| Rotate Right | MSBβLSB (circular) | Rotation, code generation |
| Rotate Left | LSBβMSB (circular) | Rotation, code generation |
| Bidirectional | Shift both directions | Universal shift register |
Universal Shift Register
Can perform all shift operations: left, right, parallel load, parallel read.
Mode Select (SβSβ): Sβ Sβ | Operation 0 0 | No change (Hold) 0 1 | Shift Right 1 0 | Shift Left 1 1 | Parallel Load IC 74195: 4-bit universal shift register
Applications of Counters
- Frequency Division: MOD-N counter divides frequency by N
- Digital Clock: MOD-60 for seconds/minutes, MOD-24 for hours
- Event Counting: Counting products, pulses, events
- Timing Circuits: Generating time delays
- Address Generation: Memory addressing in CPUs
- Sequence Generation: State machines, control logic
Applications of Registers
- Data Storage: CPU registers (accumulator, program counter)
- Data Transfer: Buffer between components
- Serial Communication: UART, SPI, I2C
- Arithmetic Operations: Shifting for multiply/divide
- Timing & Synchronization: Pipeline registers
- Data Serialization: Parallel to serial conversion
Counter ICs
| IC Number | Type | Description |
|---|---|---|
| 7490 | Decade | MOD-10 asynchronous counter |
| 7493 | Binary | 4-bit binary counter (MOD-16) |
| 74190 | Up/Down | Synchronous BCD up/down counter |
| 74191 | Up/Down | Synchronous binary up/down counter |
| 74193 | Up/Down | 4-bit binary up/down counter |
Memory Systems
RAM, ROM, SRAM, DRAM, Memory organization, and Address decoding
What is Memory?
Memory is a digital circuit that stores data in binary form. Essential component of all computer systems.
Memory Classification
Memory Hierarchy:
Memory
β
βββββββββββ΄ββββββββββ
β β
Volatile Non-Volatile
(RAM) (ROM)
β β
ββββββ΄βββββ ββββββ΄βββββ
β β β β
SRAM DRAM ROM EPROM
EEPROM
Flash
1. RAM (Random Access Memory)
Volatile memory: Data lost when power off. Read and Write operations.
Types:
A) SRAM (Static RAM)
- Uses flip-flops (6 transistors per bit)
- Faster than DRAM
- No refresh required
- More expensive
- Lower density
- Used in: Cache memory, CPU registers
B) DRAM (Dynamic RAM)
- Uses capacitors (1 transistor + 1 capacitor per bit)
- Slower than SRAM
- Requires periodic refresh (capacitor leaks)
- Cheaper
- Higher density
- Used in: Main memory (system RAM)
| Feature | SRAM | DRAM |
|---|---|---|
| Speed | Fast (2-10 ns) | Slower (50-70 ns) |
| Cost | Expensive | Cheap |
| Density | Low | High |
| Power | Low | High |
| Refresh | Not needed | Needed |
| Complexity | Complex (6T) | Simple (1T1C) |
| Usage | Cache | Main memory |
2. ROM (Read-Only Memory)
Non-volatile memory: Data retained when power off. Primarily read operations.
Types:
A) Mask ROM
- Programmed during manufacturing
- Cannot be modified
- Used in: BIOS, firmware, embedded systems
B) PROM (Programmable ROM)
- One-time programmable by user
- Uses fuses that can be blown
- Cannot be erased once programmed
C) EPROM (Erasable PROM)
- Can be erased using UV light
- Reprogrammable
- Has transparent window on top
- Erase time: 15-20 minutes
D) EEPROM (Electrically Erasable PROM)
- Can be erased electrically (byte-by-byte)
- No UV light needed
- Slower write, faster read
- Used in: Configuration data, calibration
E) Flash Memory
- Type of EEPROM, erases in blocks
- Fast, high density
- Used in: USB drives, SSDs, memory cards
| Type | Erase Method | Write Speed | Application |
|---|---|---|---|
| Mask ROM | Cannot erase | N/A | BIOS, firmware |
| PROM | Cannot erase | Fast | One-time programming |
| EPROM | UV light | Slow | Development, testing |
| EEPROM | Electrical (byte) | Very slow | Config, calibration |
| Flash | Electrical (block) | Medium | Storage, USB, SSD |
Memory Organization
Memory Specifications:
- Capacity: Total number of bits (M Γ N)
- M: Number of words (addressable locations)
- N: Number of bits per word (word size)
- Address lines: logβ(M) lines needed
Example: 1K Γ 8 Memory 1K = 1024 words 8 = 8 bits per word Total capacity: 1024 Γ 8 = 8192 bits = 8 Kb = 1 KB Address lines needed: logβ(1024) = 10 lines Data lines: 8 lines Memory Block Diagram: Aβ-Aβ (10 lines) βββββ β 1KΓ8 CS (Chip Select) ββββββ€ Memory ββββ Dβ-Dβ (8 lines) R/WΜ (Read/Write) ββββββ€ β Address Range: 0x000 to 0x3FF (0 to 1023)
Common Memory Sizes:
| Specification | Words | Address Bits | Total Capacity |
|---|---|---|---|
| 256 Γ 4 | 256 | 8 | 1 Kb |
| 1K Γ 8 | 1024 | 10 | 8 Kb = 1 KB |
| 4K Γ 8 | 4096 | 12 | 32 Kb = 4 KB |
| 64K Γ 8 | 65,536 | 16 | 512 Kb = 64 KB |
| 1M Γ 8 | 1,048,576 | 20 | 8 Mb = 1 MB |
Memory Expansion
1. Word Expansion (Increasing Word Size)
Example: Create 1KΓ16 using two 1KΓ8 chips Aβ-Aβ βββ¬βββ 1KΓ8 ββββ Dβ-Dβ β Chip 1 CS βββββΌβββ 1KΓ8 ββββ Dβ-Dββ β Chip 2 R/WΜ βββββ Same addresses, more data bits
2. Word Count Expansion (Increasing Number of Words)
Example: Create 2KΓ8 using two 1KΓ8 chips Aβ-Aβ βββ¬βββ 1KΓ8 βββ β Chip 1 ββββ Dβ-Dβ Aββ βββββ€ β Decoder β 1KΓ8 ββββ ββββ Chip 2 Aββ=0: Chip 1 (0x000-0x3FF) Aββ=1: Chip 2 (0x400-0x7FF)
Address Decoding
Process of selecting specific memory chip based on address.
Linear Decoding (Simple but wasteful): Aββ ββNOTββ CSΜβ (Chip 1: Aββ=0) Aββ ββββββββ CSΜβ (Chip 2: Aββ=1) Full Decoding (Using Decoder): Aββ-Aββ ββββ 2:4 CSΜβ β Chip 0 Decoder CSΜβ β Chip 1 CSΜβ β Chip 2 CSΜβ β Chip 3
Memory Timing
Read Cycle Timing:
Memory Read Timing Diagram: Address βββ Valid Address ββββ βββββββββββββββββββββ CSΜ βββββ ββββ ββββββββββββββββββββ R/WΜ ββββββββββββββββββββββββββ (High for Read) Data βββββββββ Valid Data ββββββ ββββββββββββββ ββ tACC ββ (Access Time) tACC: Time from address valid to data valid
Write Cycle Timing:
Address βββ Valid Address ββββ
βββββββββββββββββββββ
CSΜ βββββ ββββ
ββββββββββββββββββββ
R/WΜ βββββ ββββ (Low for Write)
ββββββββββββββββββββ
Data ββββββ Valid Data βββββ
βββββββββββββββββββ
ββ tWR ββ (Write Time)
Memory ICs
| IC Number | Type | Capacity | Organization |
|---|---|---|---|
| 2114 | SRAM | 4 Kb | 1K Γ 4 |
| 6116 | SRAM | 16 Kb | 2K Γ 8 |
| 6264 | SRAM | 64 Kb | 8K Γ 8 |
| 2732 | EPROM | 32 Kb | 4K Γ 8 |
| 2764 | EPROM | 64 Kb | 8K Γ 8 |
| 27C256 | EPROM | 256 Kb | 32K Γ 8 |
Advanced Topics
PLDs, FPGAs, Karnaugh Maps, Quine-McCluskey method, and Modern Digital Design
Karnaugh Maps (K-Maps)
Karnaugh Map is a graphical method for simplifying Boolean expressions. Alternative to Boolean algebra.
2-Variable K-Map:
B
A 0 1
ββββββββββ
0 β 0 1
1 β 2 3
Example: F(A,B) = Ξ£m(1,2,3)
B
A 0 1
ββββββββββ
0 β 0 1
1 β 1 1
Grouping:
Group 1 (1,3): B
Group 2 (2,3): A
F = A + B
3-Variable K-Map:
BC
A 00 01 11 10
ββββββββββββββββ
0 β 0 1 3 2
1 β 4 5 7 6
Example: F(A,B,C) = Ξ£m(1,3,5,7)
BC
A 00 01 11 10
ββββββββββββββββ
0 β 0 1 1 0
1 β 0 1 1 0
Grouping: Vertical column (1,3,5,7)
F = C
Gray code ordering! (00,01,11,10)
4-Variable K-Map:
CD
AB 00 01 11 10
βββββββββββββββββββ
00 β 0 1 3 2
01 β 4 5 7 6
11 β 12 13 15 14
10 β 8 9 11 10
Rules for Grouping:
1. Group size: 1, 2, 4, 8, 16 (powers of 2)
2. Groups should be rectangular
3. Make largest possible groups
4. Groups can overlap
5. Groups can wrap around edges
6. Minimize number of groups
Example: Simplify using K-Map
F(A,B,C,D) = Ξ£m(0,2,5,7,8,10,13,15)
CD
AB 00 01 11 10
βββββββββββββββββββ
00 β 1 0 0 1 Group 1: m(0,2,8,10) = B'D'
01 β 0 1 1 0 Group 2: m(5,7,13,15) = BD
11 β 0 1 1 0
10 β 1 0 0 1
F = B'D' + BD = B β D
Don't Care Conditions (X):
F(A,B,C) = Ξ£m(1,3,7) + d(5,6) d = don't care (can be 0 or 1) Use X strategically to make larger groups! BC A 00 01 11 10 ββββββββββββββββ 0 β 0 1 1 0 1 β 0 X 1 X Include d(5) in group with m(1,7) F = C
Quine-McCluskey Method
Tabular method for simplification. Better for >4 variables and computer implementation.
Steps:
- Step 1: List minterms in binary grouped by number of 1s
- Step 2: Compare adjacent groups, combine terms differing by 1 bit
- Step 3: Replace differing bit with dash (-)
- Step 4: Repeat until no more combinations possible
- Step 5: Create prime implicant table
- Step 6: Select minimum set of prime implicants
Example: F(A,B,C) = Ξ£m(1,3,5,6,7) Step 1: List by number of 1s Group 0: mβ = 001 Group 1: mβ = 011 mβ = 101 Group 2: mβ = 110 mβ = 111 Step 2: Combine (differ by 1 bit) mβ,mβ: 0-1 (BC) mβ,mβ : -01 (A'C) mβ,mβ: -11 (BC) mβ ,mβ: 1-1 (AC) mβ,mβ: 11- (AB) Step 3: Prime Implicants BC, A'C, AC, AB Step 4: Minimum cover F = A'C + AB + BC
Programmable Logic Devices (PLDs)
ICs that can be programmed to implement custom logic functions. User-configurable hardware.
Types of PLDs
1. PROM (Programmable ROM)
- Fixed AND array, programmable OR array
- Simple, but limited flexibility
2. PAL (Programmable Array Logic)
- Programmable AND array, fixed OR array
- Fast, low cost
- Cannot share product terms between outputs
3. PLA (Programmable Logic Array)
- Both AND and OR arrays programmable
- More flexible than PAL
- Can share product terms
- Slower than PAL
PLD Structure: Inputs β AND Array β OR Array β Outputs PAL: Programmable AND, Fixed OR PLA: Programmable AND, Programmable OR PROM: Fixed AND, Programmable OR
| Feature | PAL | PLA | PROM |
|---|---|---|---|
| AND Array | Programmable | Programmable | Fixed |
| OR Array | Fixed | Programmable | Programmable |
| Speed | Fast | Medium | Fast |
| Flexibility | Medium | High | Low |
| Cost | Low | Medium | Low |
Complex PLDs (CPLDs)
Multiple PAL/PLA blocks connected via programmable interconnects.
- More logic capacity than simple PLDs
- Non-volatile (retains configuration when powered off)
- Predictable timing
- Examples: Xilinx CoolRunner, Altera MAX
- Applications: Glue logic, state machines, interface logic
Field-Programmable Gate Arrays (FPGAs)
Most advanced and flexible PLDs. Array of configurable logic blocks (CLBs).
FPGA Structure:
βββββββββββββββββββββββββββββββββ β CLB CLB CLB CLB CLB β β β β β β β β β CLB CLB CLB CLB CLB β β Configurable Logic Blocks β β β β β β β β CLB CLB CLB CLB CLB β βββββββββββββββββββββββββββββββββ Programmable Interconnects Each CLB contains: - Look-Up Tables (LUTs) for logic - Flip-flops for storage - Multiplexers for routing
FPGA Features:
- Very high logic capacity (millions of gates)
- Reconfigurable (can be reprogrammed)
- Contains RAM blocks, DSP blocks, I/O blocks
- Volatile configuration (needs external memory)
- Complex, requires specialized tools
FPGA vs CPLD:
| Feature | CPLD | FPGA |
|---|---|---|
| Capacity | 10K gates | 1M+ gates |
| Architecture | PAL-based | LUT-based |
| Configuration | Non-volatile | Volatile (SRAM) |
| Timing | Predictable | Unpredictable |
| Power | Low | High |
| Cost | Low | High |
| Use | Simple logic | Complex systems |
FPGA Applications
- Prototyping: ASIC design verification
- DSP: Signal processing, image processing
- Communication: Modems, routers, base stations
- Aerospace: Satellites, avionics (radiation-tolerant)
- Industrial: Motor control, robotics
- AI/ML: Neural network acceleration
- Automotive: ADAS, autonomous driving
- Medical: Medical imaging, diagnostics
FPGA Vendors
| Vendor | FPGA Family | Features |
|---|---|---|
| Xilinx (AMD) | Spartan, Artix, Kintex, Virtex | Market leader, high performance |
| Intel (Altera) | Cyclone, Arria, Stratix | Good tools, wide adoption |
| Lattice | iCE40, ECP5, CrossLink | Low power, small size |
| Microchip | PolarFire, IGLOO | Low power, secure |
Hardware Description Languages (HDLs)
Used to design and program FPGAs/CPLDs.
1. Verilog
// 2-to-1 Multiplexer in Verilog module mux2to1 ( input a, b, sel, output y ); assign y = sel ? b : a; endmodule
2. VHDL
-- 2-to-1 Multiplexer in VHDL entity mux2to1 is port (a, b, sel : in std_logic; y : out std_logic); end mux2to1; architecture behav of mux2to1 is begin y <= b when sel = '1' else a; end behav;
ASIC (Application-Specific Integrated Circuit)
Custom-designed ICs for specific applications. Not programmable like FPGAs.
ASIC vs FPGA:
| Feature | ASIC | FPGA |
|---|---|---|
| Flexibility | Fixed (cannot change) | Reconfigurable |
| Development Cost | Very high (millions) | Low |
| Unit Cost | Low (in volume) | High |
| Performance | Highest | Lower |
| Power | Lowest | Higher |
| Time-to-Market | Long (months) | Short (days) |
| Use Case | High volume products | Low volume, prototyping |
Modern Digital Design Flow
1. Specification Define requirements, features, constraints β 2. Architecture Design Block diagrams, high-level design β 3. RTL Design (HDL Coding) Write Verilog/VHDL code β 4. Simulation & Verification Testbenches, functional verification β 5. Synthesis Convert HDL to gate-level netlist β 6. Place & Route Map logic to physical layout β 7. Timing Analysis Check timing constraints, optimize β 8. Bitstream Generation Create configuration file for FPGA β 9. Programming & Testing Load onto hardware, test in real environment
Timing Concepts
Setup Time (tsu): Minimum time data must be stable BEFORE clock edge
Hold Time (th): Minimum time data must be stable AFTER clock edge
Clock-to-Q Delay (tCQ): Time from clock edge to output change
Propagation Delay (tp): Time for signal to pass through gate
Timing Diagram: CLK βββ βββββββ ββ βββββ βββββ DATA βββββββ βββ βββββββββββ βtsuβ βthβ β CLK edge Violation: - Setup Violation: Data changes too close to clock edge - Hold Violation: Data changes too soon after clock edge
Clock Frequency & Period
Maximum Clock Frequency: fmax = 1 / (tCQ + tlogic + tsu) Where: tCQ = Clock-to-Q delay of source FF tlogic = Combinational logic delay tsu = Setup time of destination FF Example: tCQ = 2 ns, tlogic = 8 ns, tsu = 1 ns fmax = 1 / (2+8+1) ns = 1/11 ns = 90.9 MHz
Metastability
When a flip-flop violates setup/hold time, output may become unstable (neither 0 nor 1).
- Cause: Asynchronous inputs violating timing
- Solution: Use synchronizers (2-FF chain)
- Impact: Unpredictable behavior, system failure
Power Consumption in Digital Circuits
Types:
- Dynamic Power: Power when switching (CVΒ²f)
- Static Power: Leakage power when idle
- Short-Circuit Power: During transition
Dynamic Power: P = C Γ VΒ² Γ f Γ Ξ± C = Load capacitance V = Supply voltage f = Clock frequency Ξ± = Switching activity factor (0 to 1) Reducing Power: - Lower voltage - Reduce clock frequency - Clock gating (disable unused blocks) - Power gating (turn off unused blocks)
Future of Digital Logic Design
- 3D ICs: Stacking multiple die layers
- Quantum Computing: Qubits instead of bits
- Neuromorphic Computing: Brain-inspired architectures
- Optical Computing: Light-based logic
- DNA Computing: Biological computation
- Spintronics: Using electron spin
π Congratulations!
You've completed Digital Logic Design course! You now have solid foundation in DLD - from number systems to advanced FPGAs and modern digital design. Keep practicing and building circuits! β‘π

