Digital Electronics: Complete Revision Notes
From fundamentals to advanced VLSI — concepts, formulas, worked examples and exam pointers.
Digital electronics is the branch of electronics built on circuits that process discrete (two-level) signals rather than continuous analog quantities. It is the foundation of every modern computing system, from microcontrollers and smartphones to data-centre processors and AI accelerators. These notes condense a full course into a single reference: number representation and arithmetic, Boolean algebra and minimisation, combinational and sequential building blocks, finite state machines, logic families, memories, data converters, hardware description languages, and advanced VLSI topics — with worked examples and competitive-exam pointers throughout.
Introduction to Digital Electronics
What is Digital Electronics?
Definition
Digital electronics is the branch of electronics that deals with circuits operating on discrete signals — typically two levels, HIGH and LOW — as opposed to analog electronics, which deals with continuous signals.
An analog signal varies continuously and can take infinitely many values (for example a sinusoid). A digital signal takes only two discrete levels, conventionally interpreted as logic 0 (LOW) and logic 1 (HIGH). Modern computing is built on digital logic because of its noise immunity, ease of storage, programmability, and the predictability of binary arithmetic.
Advantages and Disadvantages of Digital Systems
Digital systems dominate modern design for several reasons:
- Noise immunity: small voltage variations do not change the interpreted logic state.
- Accuracy and precision: any desired precision is achievable simply by adding more bits.
- Easy storage: data can be retained on memory devices indefinitely.
- Reproducibility: identical inputs always produce identical outputs.
- Programmability: functionality can be changed in software.
- Integration: VLSI places millions of gates on a single chip.
- Low cost: mass production reduces per-unit cost.
Disadvantages
Real-world signals are analog, so digital systems require ADC/DAC conversion at their boundaries. They can also dissipate more power at high switching frequencies due to dynamic switching losses.
Number Systems
Positional Number Systems
Positional Number System
A number \(N\) in base \(r\) with digits \(d_n d_{n-1} \ldots d_1 d_0 . d_{-1} d_{-2} \ldots d_{-m}\) has the value
| System | Base (radix) | Digits |
|---|---|---|
| Binary | 2 | 0, 1 |
| Octal | 8 | 0, 1, 2, 3, 4, 5, 6, 7 |
| Decimal | 10 | 0–9 |
| Hexadecimal | 16 | 0–9, A, B, C, D, E, F |
The weight of a digit at position \(i\) is \(r^i\).
Binary Number System
Binary to Decimal
Example. Convert \((1011.101)_2\) to decimal:
Powers of 2 to Remember
| \(2^0\) | \(2^1\) | \(2^2\) | \(2^3\) | \(2^4\) | \(2^5\) | \(2^6\) | \(2^7\) | \(2^8\) | \(2^9\) | \(2^{10}\) |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1024 |
Decimal to Binary Conversion
Algorithm
Integer part: repeatedly divide by 2 and read the remainders bottom-up. Fractional part: repeatedly multiply by 2 and read the integer parts top-down.
Example. Convert \((25.375)_{10}\) to binary. For the integer part, successive division of 25 by 2 gives remainders \(1,0,0,1,1\) read bottom-up, so \((25)_{10} = (11001)_2\). For the fraction:
so \((0.375)_{10} = (0.011)_2\). Combining: \(\boxed{(25.375)_{10} = (11001.011)_2}\).
Octal and Hexadecimal
Quick Conversions from Binary
Binary → Octal: group bits in sets of 3 from the binary point. Binary → Hex: group bits in sets of 4 from the binary point.
Example. For \((10110101.11010)_2\):
- Octal: \(\underbrace{010}_{2}\,\underbrace{110}_{6}\,\underbrace{101}_{5}.\underbrace{110}_{6}\,\underbrace{100}_{4} = (265.64)_8\)
- Hex: \(\underbrace{1011}_{B}\,\underbrace{0101}_{5}.\underbrace{1101}_{D}\,\underbrace{0000}_{0} = (\text{B5.D0})_{16}\)
| Dec | Binary | Octal | Hex | Dec | Binary | Octal | Hex |
|---|---|---|---|---|---|---|---|
| 0 | 0000 | 0 | 0 | 8 | 1000 | 10 | 8 |
| 1 | 0001 | 1 | 1 | 9 | 1001 | 11 | 9 |
| 2 | 0010 | 2 | 2 | 10 | 1010 | 12 | A |
| 3 | 0011 | 3 | 3 | 11 | 1011 | 13 | B |
| 4 | 0100 | 4 | 4 | 12 | 1100 | 14 | C |
| 5 | 0101 | 5 | 5 | 13 | 1101 | 15 | D |
| 6 | 0110 | 6 | 6 | 14 | 1110 | 16 | E |
| 7 | 0111 | 7 | 7 | 15 | 1111 | 17 | F |
Binary Arithmetic
Binary Addition and Subtraction
Addition Rules
Subtraction Rules
Example. Adding \((1011)_2 + (1101)_2\) yields \((11000)_2 = (24)_{10}\), which checks out since \(11 + 13 = 24\).
Signed Number Representations
Three representations for negative numbers
For an \(n\)-bit system, the MSB carries the sign: 0 = positive, 1 = negative.
- Sign-magnitude: MSB is the sign, the remaining bits are the magnitude. Range \(-(2^{n-1}-1)\) to \(+(2^{n-1}-1)\); two zeros (\(+0\) and \(-0\)).
- 1's complement: invert all bits to negate. Same range as sign-magnitude; two zeros.
- 2's complement: 1's complement plus 1 (most widely used). Range \(-2^{n-1}\) to \(+(2^{n-1}-1)\); a unique zero.
| Decimal | Sign-Mag | 1's Comp | 2's Comp |
|---|---|---|---|
| \(+5\) | 0101 | 0101 | 0101 |
| \(-5\) | 1101 | 1010 | 1011 |
| \(+0\) | 0000 | 0000 | 0000 |
| \(-0\) | 1000 | 1111 | 0000 (unique) |
2's Complement Arithmetic
2's Complement of \(N\) in \(n\) bits
Shortcut: starting from the LSB, keep bits the same up to and including the first 1, then invert all remaining bits.
For example, the 2's complement of \(01100100\) is \(10011100\) (scanning from the right, keep the trailing \(00\), invert the rest). Subtraction uses \(A - B = A + [B]_{2'c}\). To compute \(7 - 5\) in 4 bits: \(7 = 0111\), \([5]_{2'c} = 1011\), and \(0111 + 1011 = \underline{1}0010\); discarding the carry gives \(0010 = (+2)_{10}\).
Overflow Detection
Overflow occurs when adding two positives gives a negative, or adding two negatives gives a positive. Equivalently, overflow \(= C_{in} \oplus C_{out}\) of the MSB stage.
Binary Codes
Classification of Binary Codes
Binary codes fall into three broad families: weighted codes (BCD/8421, 2421, 5211), non-weighted codes (Gray code, Excess-3), and error-detecting/correcting codes (parity, Hamming).
Key Properties
- Weighted: each bit position has a fixed weight.
- Non-weighted: there are no fixed positional weights.
- Reflective: the code for the 9's complement is obtained by inverting the MSB.
- Sequential: consecutive codes differ by binary addition of 1.
- Self-complementing: the 9's complement equals the bitwise NOT.
BCD and Excess-3 Codes
The BCD (8421) code maps each decimal digit to its 4-bit binary value, with weights 8, 4, 2, 1. The Excess-3 code is formed by adding \(0011\) to the BCD value (\(\text{XS-3} = \text{BCD} + 0011\)) and is self-complementing.
| Dec | BCD | XS-3 | Dec | BCD | XS-3 |
|---|---|---|---|---|---|
| 0 | 0000 | 0011 | 5 | 0101 | 1000 |
| 1 | 0001 | 0100 | 6 | 0110 | 1001 |
| 2 | 0010 | 0101 | 7 | 0111 | 1010 |
| 3 | 0011 | 0110 | 8 | 1000 | 1011 |
| 4 | 0100 | 0111 | 9 | 1001 | 1100 |
Invalid BCD
Codes 1010, 1011, 1100, 1101, 1110 and 1111 are invalid in BCD. BCD addition: if the sum exceeds 9 or generates a carry, add \(0110\) as a correction.
Gray Code (Reflected Binary)
Property
Only one bit changes between consecutive numbers. Gray code is used in rotary encoders, K-maps, and to minimise errors in digital-to-analog conversion.
Binary → Gray
- \(G_{n-1} = B_{n-1}\) (MSB)
- \(G_i = B_i \oplus B_{i+1}\)
Gray → Binary
- \(B_{n-1} = G_{n-1}\) (MSB)
- \(B_i = B_{i+1} \oplus G_i\)
| Dec | Binary | Gray | Dec | Binary | Gray |
|---|---|---|---|---|---|
| 0 | 000 | 000 | 4 | 100 | 110 |
| 1 | 001 | 001 | 5 | 101 | 111 |
| 2 | 010 | 011 | 6 | 110 | 101 |
| 3 | 011 | 010 | 7 | 111 | 100 |
Error Detection and Correction Codes
A parity bit is an extra bit added to make the total number of 1s even (even parity) or odd (odd parity). For example, the data \(1011001\) contains four 1s, so the even-parity bit is 0 and the odd-parity bit is 1.
The code distance \(d\) is the minimum number of bit positions in which two valid codewords differ. A code with distance \(d\) detects \(d-1\) errors and corrects \(\lfloor (d-1)/2 \rfloor\) errors. The Hamming(7,4) code has \(d = 3\): it detects 2-bit errors and corrects single-bit errors.
Hamming Code
Detects and corrects single-bit errors. For \(m\) data bits, the number of parity bits \(k\) satisfies
Parity bits occupy positions \(1, 2, 4, 8, \ldots, 2^{k-1}\) (powers of two); data bits fill the remaining positions.
Hamming(7,4) — Worked Example
Encode the 4 data bits \(D = d_3 d_2 d_1 d_0 = 1011\) using even parity. The parity bit \(p_1\) (position 1) covers positions 1,3,5,7; \(p_2\) (position 2) covers 2,3,6,7; and \(p_3\) (position 4) covers 4,5,6,7.
Computing the parity bits:
giving the codeword \(0\,1\,1\,0\,0\,1\,1\). At the receiver, the syndrome \(S = s_3 s_2 s_1\) is recomputed: if \(S = 000\) there is no error; otherwise \(S\) read in binary points directly to the erroneous bit position.
Boolean Algebra
Fundamentals
Definition
Boolean algebra is the mathematical system developed by George Boole (1854) for analysing logical operations. It forms the theoretical foundation of digital electronics.
The three basic operations are:
- AND (\(\cdot\) or \(\wedge\)): output is 1 if and only if all inputs are 1.
- OR (\(+\) or \(\vee\)): output is 1 if at least one input is 1.
- NOT (\(\overline{X}\) or \(X'\)): output is the complement of the input.
| A | B | \(A\cdot B\) | \(A+B\) | \(\bar{A}\) |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 |
Boolean Laws and Theorems
Basic Laws
Commutative, Associative & Distributive
De Morgan's Theorems
Generalised: \(\overline{A_1 + A_2 + \cdots + A_n} = \bar{A_1} \cdot \bar{A_2} \cdots \bar{A_n}\).
Absorption and Consensus Theorems
Absorption Laws
Consensus Theorem
The term \(BC\) (or \(B+C\)) is redundant.
Proof of \(A + \bar{A}B = A + B\):
Duality Principle and Canonical Forms
Duality Principle
Every Boolean identity remains valid if we interchange AND (\(\cdot\)) with OR (\(+\)), interchange 0 with 1, and leave complements unchanged. For example, the dual of \(A + \bar{A}B = A + B\) is \(A \cdot (\bar{A}+B) = A \cdot B\).
A minterm \(m_i\) is a product term in which every variable appears exactly once (complemented or not); for \(n\) variables there are \(2^n\) minterms. A maxterm \(M_i\) is a sum term in which every variable appears once. They are related by \(m_i = \overline{M_i}\) and \(M_i = \overline{m_i}\).
SOP and POS Forms
The Sum of Products (SOP) form is the sum of the minterms where \(F = 1\): \(F = \sum m(i_1, i_2, \ldots)\). The Product of Sums (POS) form is the product of the maxterms where \(F = 0\): \(F = \prod M(j_1, j_2, \ldots)\).
| A | B | C | F |
|---|---|---|---|
| 0 | 0 | 0 | 0 (\(M_0\)) |
| 0 | 0 | 1 | 1 (\(m_1\)) |
| 0 | 1 | 0 | 1 (\(m_2\)) |
| 0 | 1 | 1 | 0 (\(M_3\)) |
| 1 | 0 | 0 | 1 (\(m_4\)) |
| 1 | 0 | 1 | 1 (\(m_5\)) |
| 1 | 1 | 0 | 0 (\(M_6\)) |
| 1 | 1 | 1 | 1 (\(m_7\)) |
This gives \(F = \sum m(1,2,4,5,7) = \bar{A}\bar{B}C + \bar{A}B\bar{C} + A\bar{B}\bar{C} + A\bar{B}C + ABC\) in SOP form, and \(F = \prod M(0,3,6) = (A+B+C)(A+\bar{B}+\bar{C})(\bar{A}+\bar{B}+C)\) in POS form.
Logic Gates
Basic Logic Gates
The fundamental gates are AND (\(Y = A\cdot B\)), OR (\(Y = A + B\)) and NOT (\(Y = \bar{A}\)). Combining inversion with AND/OR gives NAND (\(Y = \overline{A\cdot B}\)) and NOR (\(Y = \overline{A+B}\)). The exclusive-OR gate produces \(Y = A\oplus B\).
XOR and XNOR
Truth Tables and Universal Gates
| A | B | AND | OR | NAND | NOR | XOR | XNOR | NOT A |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
Universal Gates
NAND and NOR are universal gates because any Boolean function can be implemented using only NAND gates or only NOR gates.
The key identities for universal implementation are \(\bar{A} = \overline{A \cdot A} = \overline{A + A}\) (tie the inputs together), \(A \cdot B = \overline{\overline{A \cdot B}}\), and \(A + B = \overline{\bar{A} \cdot \bar{B}}\) (De Morgan).
NAND-only and NOR-only Implementations
Because NAND and NOR are universal, any function can be built from one gate type alone. Using NAND gates: NOT needs 1 gate, AND needs 2, OR needs 3, and XOR needs 4.
The NOR-only construction is the dual: swap AND with OR, using \(A+B = \overline{\overline{A+B}}\) and \(AB = \overline{\bar{A}+\bar{B}}\).
XOR Properties and Applications
XOR Properties
XOR is used in parity generation and checking, the sum bit of binary adders, equality detection in comparators, controlled inverters and cryptography (the Vernam cipher). As a controlled inverter, \(Y = A \oplus C\): when \(C = 0\) the output equals \(A\); when \(C = 1\) the output is \(\bar{A}\).
Logic Simplification and K-Maps
Karnaugh Maps
K-Map
A graphical method for simplifying Boolean expressions. Cells are arranged using Gray code so that adjacent cells differ by only one variable. A map for \(n\) variables has \(2^n\) cells.
The 2-variable map is a \(2\times2\) grid of minterms \(m_0\ldots m_3\); the 3-variable map is a \(2\times4\) grid with the column headings ordered \(00,01,11,10\); and the 4-variable map is a \(4\times4\) grid with both rows and columns in Gray-code order.
K-Map Simplification Rules
Grouping Rules
- Group sizes must be powers of two: 1, 2, 4, 8, 16, …
- Groups should be as large as possible.
- Every 1 must belong to at least one group.
- Minimise the number of groups.
- Groups may wrap around the edges (the map is toroidal).
- Use don't-cares (X) where they help form larger groups.
The size of a group determines how many variables are eliminated: a group of \(2^k\) cells removes \(k\) variables, leaving \(n-k\) literals. Important terminology: an implicant is any product term that makes \(F = 1\); a prime implicant (PI) cannot be combined into a larger group; and an essential PI covers at least one minterm covered by no other PI.
K-Map Example
Simplify \(F(A,B,C,D) = \sum m(0,1,2,5,8,9,10)\). Plotting the 1s and grouping reveals a four-corner group, a vertical pair group and a small group:
The four corners give \(\bar{B}\bar{D}\), the group \(\{m_0,m_1,m_8,m_9\}\) gives \(\bar{B}\bar{C}\), and the group \(\{m_1,m_5\}\) gives \(\bar{A}\bar{C}D\), yielding
Don't-Care Conditions and Hazards
Don't Cares (X or d)
Input combinations that never occur, or whose output is irrelevant. Each may be freely assigned 0 or 1 to maximise simplification: \(F = \sum m(\ldots) + \sum d(\ldots)\).
A hazard is a momentary, unwanted output transition caused by unequal gate delays. The three types are static-1 (output should stay 1 but dips to 0), static-0 (output should stay 0 but spikes to 1), and dynamic (multiple transitions during a single intended change).
A static-1 hazard arises when two adjacent 1-cells are covered by different prime implicants; during the input transition neither group asserts, producing a glitch. It is removed by adding a redundant prime implicant that bridges the groups: for \(F = AB + \bar{A}C\), the hazard-free form is \(F_{HF} = AB + \bar{A}C + BC\). Static-0 hazards (in POS form) are removed by adding a redundant maxterm, and dynamic hazards require multi-level optimisation.
Quine–McCluskey Method
Tabular Method
A systematic, algorithmic minimisation suitable for functions of more than four variables (where K-maps become impractical) and for computer implementation.
The procedure is: (1) list all minterms and don't-cares in binary, grouped by the number of 1s; (2) compare adjacent groups and combine terms differing in one bit (mark the eliminated bit with “−”); (3) repeat until no further combination is possible; (4) the unchecked terms are the prime implicants; (5) build a prime-implicant chart; and (6) select the essential PIs, using Petrick's method if needed for a minimum cover.
Worked Example — Combining Steps
Minimise \(F(A,B,C,D) = \sum m(0,1,2,5,6,7,8,9,10,14)\). After grouping by the number of 1s and combining adjacent terms, the size-four groups (quads) that emerge are:
| Group | Pattern |
|---|---|
| (0,1,8,9) | −00− |
| (0,2,8,10) | −0−0 |
| (2,6,10,14) | −−10 |
Prime-Implicant Chart and Final Result
| PI | Pattern | Covers | Expression |
|---|---|---|---|
| \(P_1\) | −00− | 0,1,8,9 | \(\bar{B}\bar{C}\) |
| \(P_2\) | −0−0 | 0,2,8,10 | \(\bar{B}\bar{D}\) |
| \(P_3\) | −−10 | 2,6,10,14 | \(C\bar{D}\) |
| \(P_4\) | 0−01 | 1,5 | \(\bar{A}\bar{C}D\) |
| \(P_5\) | 01−1 | 5,7 | \(\bar{A}BD\) |
| \(P_6\) | 011− | 6,7 | \(\bar{A}BC\) |
From the PI chart, \(m_9\) appears only in \(P_1\) and \(m_{14}\) only in \(P_3\), so both are essential. Together \(P_1\) and \(P_3\) cover everything except \(\{5,7\}\), which is covered by \(P_5\). The minimised SOP is therefore
Combinational Circuits
Combinational vs Sequential Circuits
| Combinational | Sequential |
|---|---|
| Output depends only on present inputs | Output depends on present and past inputs |
| No memory elements | Has memory (flip-flops, latches) |
| No feedback paths (typical) | Contains feedback |
| Easier to design and analyse | More complex, needs a clock |
| Examples: adders, MUX, decoders | Examples: registers, counters, FSMs |
Half Adder
Definition
A half adder (HA) adds two single-bit numbers, producing a sum \(S\) and a carry \(C\). It cannot accept a carry-in.
| A | B | S | C |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Full Adder
A full adder (FA) adds three bits (\(A + B + C_{in}\)) and can be cascaded to build \(n\)-bit adders.
| 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 |
Equations
Ripple-Carry and Carry-Look-Ahead Adders
A ripple-carry adder (RCA) cascades \(n\) full adders, with each carry rippling to the next stage.
RCA Problem
Total delay is \(n \cdot t_{FA}\), which becomes slow for large \(n\).
The carry-look-ahead adder (CLA) computes all carries in parallel using generate and propagate signals: \(G_i = A_i B_i\), \(P_i = A_i \oplus B_i\), with \(C_{i+1} = G_i + P_i C_i\) and \(S_i = P_i \oplus C_i\). The carry equations expand as:
| Adder type | Hardware cost | Worst-case delay |
|---|---|---|
| Ripple-carry | \(\mathcal{O}(n)\) | \(\mathcal{O}(n)\) |
| Carry-look-ahead | \(\mathcal{O}(n^2)\) flat / \(\mathcal{O}(n)\) tree | \(\mathcal{O}(\log n)\) |
| Carry-skip / carry-select | \(\mathcal{O}(n)\) | \(\mathcal{O}(\sqrt{n})\) |
Subtractor Circuits
A half subtractor computes \(A - B\) with difference \(D = A \oplus B\) and borrow \(B_{out} = \bar{A}B\). A full subtractor has \(D = A \oplus B \oplus B_{in}\) and \(B_{out} = \bar{A}B + \bar{A}B_{in} + BB_{in}\). Note that the difference equation matches that of the full adder; only the borrow logic differs.
Adder as Subtractor
Using 2's complement, \(A - B = A + \bar{B} + 1\). With XOR gates and a control input \(M\): when \(M = 0\) the XORs pass \(B\) unchanged and \(C_{in} = 0\) (addition); when \(M = 1\) the XORs complement \(B\) and \(C_{in} = 1\) supplies the “+1” (subtraction).
4-bit Adder/Subtractor Circuit
How it works
- \(M = 0\): each XOR output equals \(B_i\) and \(C_0 = 0\), so the result is \(A + B\).
- \(M = 1\): each XOR output equals \(\overline{B_i}\) and \(C_0 = 1\), so the result is \(A + \bar{B} + 1 = A - B\) (2's complement).
Multiplexer (MUX)
Definition
A MUX selects one of \(2^n\) inputs and routes it to a single output using \(n\) select lines.
Output Equation
MUXes are used for data routing, function implementation, and parallel-to-serial conversion. Two \(2^n\):1 MUXes plus one 2:1 MUX form a \(2^{n+1}\):1 MUX.
Implementing Functions Using a MUX
There are two methods. Method 1 uses a \(2^n\):1 MUX for an \(n\)-variable function, with the inputs set to the minterm values (0 or 1). Method 2 (more efficient) uses a \(2^{n-1}\):1 MUX, with \(n-1\) variables as selects and data inputs drawn from \(\{0, 1, X_n, \bar{X_n}\}\).
\(F(A,B,C)=\sum m(1,3,5,6)\) via a 4:1 MUX
Using \(A,B\) as selects and reducing in terms of \(C\): for \(AB = 00,01,10\) the output equals \(C\), and for \(AB = 11\) the output equals \(\bar{C}\). Therefore \(I_0 = I_1 = I_2 = C\) and \(I_3 = \bar{C}\).
Demultiplexer and Decoder
A DEMUX routes one input to one of \(2^n\) outputs — the inverse of a MUX. A decoder converts \(n\) input lines to \(2^n\) output lines with exactly one HIGH per input combination; each output is a minterm, \(Y_i = m_i\).
Encoders
Encoder
The opposite of a decoder: \(2^n\) input lines map to \(n\) output lines, producing the \(n\)-bit code of the active input.
Simple Encoder Issue
Ambiguity arises when multiple inputs are active simultaneously. The solution is a priority encoder, which assigns a priority and provides a valid-output flag \(V\) indicating any active input.
Priority Encoder Equations
\(A_1 = D_2 + D_3\), \(A_0 = D_3 + D_1 \bar{D_2}\), \(V = D_0 + D_1 + D_2 + D_3\). Standard ICs include the 74147 (10-to-4 BCD) and 74148 (8-to-3).
Comparators and Parity Generators
A 1-bit magnitude comparator produces \(A = B:\ \overline{A \oplus B}\), \(A \gt B:\ A\bar{B}\), and \(A \lt B:\ \bar{A}B\).
An \(n\)-bit comparator compares from MSB to LSB:
The IC 7485 is a 4-bit cascadable magnitude comparator. A parity generator/checker uses \(P_{even} = D_1 \oplus D_2 \oplus \cdots \oplus D_n\) and \(P_{odd} = \overline{D_1 \oplus D_2 \oplus \cdots \oplus D_n}\); the checker flags an error when the received parity differs from the computed parity.
Code Converters
The binary-to-Gray converter uses \(G_i = B_i \oplus B_{i+1}\). A BCD-to-seven-segment decoder drives the seven segments (a–g) of a display from a BCD input.
For example, segment \(a\) is on for digits \(\{0,2,3,5,6,7,8,9\}\), so \(a = \sum m(0,2,3,5,6,7,8,9)\); after K-map reduction (with don't-cares for 10–15) this becomes \(a = A + C + B\bar{D} + \bar{B}D\). The driver IC 7447 produces active-LOW outputs for common-anode displays, while the 7448 drives common-cathode displays.
Sequential Circuits: Latches and Flip-Flops
Introduction to Sequential Circuits
Types of Sequential Circuits
- Synchronous: state changes occur only at clock edges.
- Asynchronous: state changes occur whenever inputs change.
The two memory-element types are the latch (level-sensitive, transparent when enabled) and the flip-flop (edge-triggered, changing only at a clock edge). The clock is a periodic timing reference with period \(T\), frequency \(f = 1/T\), duty cycle \(D = (T_{high}/T)\times 100\%\), and finite rise/fall times.
SR Latch (NOR and NAND)
The SR latch built from cross-coupled NOR gates is active-HIGH; the cross-coupled feedback is what gives the latch its memory.
| S | R | \(Q_{next}\) | State |
|---|---|---|---|
| 0 | 0 | \(Q\) | Hold |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | ? | Forbidden |
| \(\bar{S}\) | \(\bar{R}\) | \(Q_{next}\) | State |
|---|---|---|---|
| 1 | 1 | \(Q\) | Hold |
| 1 | 0 | 0 | Reset |
| 0 | 1 | 1 | Set |
| 0 | 0 | ? | Forbidden |
Characteristic Equation
Adding an enable line via two AND gates in front produces a gated SR latch, transparent only when EN = 1.
D and JK Flip-Flops
The D flip-flop is a data latch with a clock; it eliminates the forbidden SR state, with \(Q_{next} = D\). The JK flip-flop is the universal flip-flop.
| D | \(Q_{next}\) |
|---|---|
| 0 | 0 |
| 1 | 1 |
| J | K | \(Q_{next}\) | Action |
|---|---|---|---|
| 0 | 0 | \(Q\) | Hold |
| 0 | 1 | 0 | Reset |
| 1 | 0 | 1 | Set |
| 1 | 1 | \(\bar{Q}\) | Toggle |
Race-Around Condition
In a JK latch with \(J = K = 1\) and the clock held HIGH too long, the output toggles repeatedly. The solution is a master–slave JK or an edge-triggered JK flip-flop.
Latch Circuits from NAND Gates
The active-LOW SR latch uses two cross-coupled NAND gates: \(\bar{S}\bar{R} = 11\) holds, \(01\) sets, \(10\) resets, and \(00\) is forbidden. A gated D latch adds two front-end NAND gates that gate the input with the enable: when EN = 1 the output follows \(D\) (transparent), and when EN = 0 it holds.
Edge-Triggered D Flip-Flop (master–slave)
Two gated D latches in series with complementary enables (\(\overline{\text{CLK}}\) for the master, CLK for the slave) cause \(Q\) to sample \(D\) only at the rising clock edge.
T Flip-Flop and Flip-Flop Conversion
The T (toggle) flip-flop holds when \(T = 0\) and toggles when \(T = 1\), with \(Q_{next} = T \oplus Q = T\bar{Q} + \bar{T}Q\). Flip-flop conversion uses the source flip-flop's excitation table to find the inputs required for each desired transition.
| \(Q\) | \(Q_{next}\) | S | R | J | K | D | T |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | X | 0 | X | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 | X | 1 | 1 |
| 1 | 0 | 0 | 1 | X | 1 | 0 | 1 |
| 1 | 1 | X | 0 | X | 0 | 1 | 0 |
For example, to build a D flip-flop from a JK: set \(J = D\) and \(K = \bar{D}\).
Timing Parameters of Flip-Flops
Key Timing Parameters
- \(t_{su}\): input must be stable before the clock edge.
- \(t_h\): input must be stable after the clock edge.
- \(t_{pd}\): delay from clock edge to output.
- \(t_{CQ}\): clock-to-Q delay (same as \(t_{pd}\)).
Maximum Clock Frequency
Metastability: if \(t_{su}\) or \(t_h\) is violated, the output may oscillate or settle to an undefined value for an unbounded time. A two-flip-flop synchroniser mitigates this: the first flip-flop may go metastable, but the second has nearly a full clock period to settle, giving a mean-time-between-failures of \(\text{MTBF} = e^{t_r/\tau}/(T_w f_{clk} f_{data})\).
Setup and Hold Time
Violations
Setup violation: the clock period is too short and the data has not propagated, so the flip-flop samples an old/incorrect value. Hold violation: the data changes too soon after the edge, so the flip-flop samples next-cycle data. Either violation can drive the output into a metastable state — a voltage between 0 and 1 for an unbounded time.
Registers and Counters
Shift Registers
Register
A group of flip-flops storing a binary word; an \(n\)-bit register uses \(n\) flip-flops.
The four shift-register types, based on how data enters and leaves, are SISO (serial-in serial-out), SIPO (serial-in parallel-out), PISO (parallel-in serial-out) and PIPO (parallel-in parallel-out). Shifting \(n\) bits in serially takes \(n\) clock cycles.
Universal Shift Register
Can hold, shift left, shift right, or parallel-load. A MUX at each flip-flop input, controlled by mode-select lines \(S_1 S_0\), selects the operation.
Ring Counter and Johnson Counter
A ring counter circulates a single 1 around the register: with \(n\) flip-flops it has \(n\) unique states (e.g. \(1000 \to 0100 \to 0010 \to 0001 \to 1000\)) and needs no output decoder, though it uses flip-flops inefficiently. A Johnson (twisted-ring) counter feeds back the complemented last output, giving \(2n\) unique states with \(n\) flip-flops (e.g. \(0000 \to 1000 \to 1100 \to 1110 \to 1111 \to 0111 \to 0011 \to 0001 \to 0000\)).
MOD Comparison
- Ring counter: MOD-\(n\) with \(n\) flip-flops.
- Johnson counter: MOD-\(2n\) with \(n\) flip-flops.
- Binary counter: MOD-\(2^n\) with \(n\) flip-flops.
A bare ring counter has illegal states (such as all-zeros); self-correcting variants detect and force a legal state, typically using a NOR over all flip-flop outputs to re-seed the single 1.
Asynchronous (Ripple) Counters
In a ripple counter each flip-flop's output drives the clock of the next stage, so transitions ripple through and accumulate delay.
MOD-N Ripple Counter
Number of flip-flops: \(n = \lceil \log_2 N \rceil\). For MOD-\(N\) with \(N \lt 2^n\), reset the flip-flops at count \(N\) using NAND detection.
Drawbacks
- Cumulative delay: total \(= n \cdot t_{pd}\).
- \(f_{max} = 1/(n \cdot t_{pd})\).
- Glitches occur during transitions.
Synchronous Counters
In a synchronous counter all flip-flops share the same clock; combinational logic determines when each toggles, so outputs change simultaneously without glitches and \(f_{max} = 1/(t_{pd} + t_{comb})\) is independent of \(n\).
The general design steps are: state diagram → state table → excitation table → K-maps for the flip-flop inputs → circuit.
MOD-N Counter Design
Designing a MOD-6 synchronous counter (states 0–5) with JK flip-flops, the present-state/next-state table together with the JK excitation table yields, after K-map simplification:
Up/Down and Presettable Counters
An up/down counter chooses direction with a control \(M\): \(M = 0\) counts up with \(T_i = Q_0 Q_1 \cdots Q_{i-1}\); \(M = 1\) counts down with \(T_i = \bar{Q_0}\bar{Q_1}\cdots\bar{Q_{i-1}}\). Combined, \(T_i = \bar{M}(Q_0 Q_1 \cdots Q_{i-1}) + M(\bar{Q_0}\bar{Q_1}\cdots\bar{Q_{i-1}})\).
Presettable Counter
Has parallel-load capability: when LOAD = 1 the flip-flops load external data; when LOAD = 0 the counter runs normally. Useful for programmable frequency division.
Common IC counters include the 7490 (decade/MOD-10), 7493 (4-bit binary), 74161/163 (4-bit synchronous with parallel load) and 74192/193 (4-bit up/down BCD/binary).
Finite State Machines
FSM Types: Moore and Mealy
FSM Types
Moore: output depends only on the current state (the output is labelled inside the state). Mealy: output depends on both state and input (the output is labelled on the transitions).
Moore machines have simpler, synchronous outputs but generally more states; Mealy machines have fewer states and respond faster, but their outputs are asynchronous and may glitch.
FSM Design Procedure
- Problem statement → identify inputs and outputs.
- Draw the state diagram.
- Form the state table.
- State assignment: binary encoding.
- Choose the flip-flop type.
- Derive the next-state and output equations using K-maps.
- Draw the logic circuit.
State Encoding Techniques
- Binary: most compact, but may need complex logic.
- Gray code: single-bit transitions, reducing hazards.
- One-hot: one flip-flop per state; fast but uses more flip-flops.
State minimisation combines equivalent states (those producing the same outputs for every input sequence) using row-matching, the implication table, or the partition method.
Sequence Detector Example: “1011” (Overlapping)
The goal is to output \(Z = 1\) whenever the input stream matches 1011, with overlap allowed (e.g. \(11011011\) contains two matches).
In the Moore machine, \(S_0\) means no match, \(S_1\)=“1”, \(S_2\)=“10”, \(S_3\)=“101”, and \(S_4\)=“1011” (where \(Z = 1\)). The Mealy machine reuses the last 1 of a match for overlap and asserts the output the same clock cycle the matching bit arrives, one cycle earlier than the Moore machine.
Mealy State Table and Trace
| Present | Next state | Output Z | ||
|---|---|---|---|---|
| X=0 | X=1 | X=0 | X=1 | |
| \(T_0\) | \(T_0\) | \(T_1\) | 0 | 0 |
| \(T_1\) | \(T_2\) | \(T_1\) | 0 | 0 |
| \(T_2\) | \(T_0\) | \(T_3\) | 0 | 0 |
| \(T_3\) | \(T_2\) | \(T_1\) | 0 | 1 |
With the encoding \(T_0=00\), \(T_1=01\), \(T_2=10\), \(T_3=11\) (two D flip-flops), tracing the input \(11011011\) produces \(Z = 1\) at \(t = 5\) and \(t = 8\) — the two overlapping matches. After K-map reduction the implementation equations are
requiring two D flip-flops plus a small amount of combinational logic, with \(Z\) being a single 3-input AND.
Logic Families
Overview of Logic Families
| Family | Key feature |
|---|---|
| RTL | Resistor-transistor logic (obsolete) |
| DTL | Diode-transistor logic (obsolete) |
| TTL | Transistor-transistor logic (bipolar) |
| ECL | Emitter-coupled logic (fastest bipolar) |
| I²L | Integrated injection logic (high-density bipolar) |
| MOS | NMOS, PMOS logic |
| CMOS | Complementary MOS (dominant today) |
| BiCMOS | Combines bipolar speed with CMOS density |
Key Performance Parameters
- Propagation delay \(t_{pd}\).
- Power dissipation \(P_D\).
- Speed-power product \(= t_{pd} \times P_D\) (joules).
- Noise margin: \(NM_H = V_{OH} - V_{IH}\), \(NM_L = V_{IL} - V_{OL}\).
- Fan-in (max inputs) and fan-out (max loads driven).
TTL vs CMOS Characteristics
| Parameter | Std TTL (74) | CMOS (74HC) |
|---|---|---|
| \(V_{CC}\) | 5 V | 2–6 V |
| \(V_{OH}\) (min) | 2.4 V | \(V_{CC} - 0.1\) |
| \(V_{OL}\) (max) | 0.4 V | 0.1 V |
| \(V_{IH}\) (min) | 2.0 V | \(0.7\,V_{CC}\) |
| \(V_{IL}\) (max) | 0.8 V | \(0.2\,V_{CC}\) |
| Noise margin (H) | 0.4 V | \(\sim 0.3\,V_{CC}\) |
| Power (static) | \(\sim\)10 mW/gate | \(\sim\) nW |
| Power (dynamic) | constant | \(\propto f \cdot C \cdot V^2\) |
| \(t_{pd}\) | 10 ns | 8 ns |
| Fan-out | 10 (TTL) | \(\gt\)50 |
CMOS Power Dissipation
where \(\alpha\) is the activity factor, \(C_L\) the load capacitance and \(f\) the clock frequency.
CMOS Logic Implementation
CMOS Structure
Each gate has a PMOS pull-up network (PUN) between \(V_{DD}\) and the output, and an NMOS pull-down network (PDN) between the output and ground. The two are dual networks: when the PUN conducts, the PDN is off, and vice versa.
The dual-network rules are: series NMOS ↔ parallel PMOS, and parallel NMOS ↔ series PMOS. An \(n\)-input NAND or NOR uses \(2n\) transistors; the CMOS inverter uses 2 (one PMOS and one NMOS).
CMOS Inverter VTC and Power Dissipation
The five operating regions are: (1) \(V_{in} \lt V_{Tn}\): NMOS off, PMOS linear, \(V_{out} = V_{DD}\); (2) \(V_{Tn} \lt V_{in} \lt V_M\): NMOS saturated, PMOS linear; (3) \(V_{in} = V_M\): both saturated (the transition); (4) \(V_M \lt V_{in} \lt V_{DD}-|V_{Tp}|\): NMOS linear, PMOS saturated; (5) \(V_{in} \gt V_{DD}-|V_{Tp}|\): PMOS off, \(V_{out} = 0\).
Switching Threshold
For a symmetric design (\(k_n = k_p\)), \(V_M \approx V_{DD}/2\).
CMOS Power Dissipation Breakdown
Lowering \(V_{DD}\) reduces dynamic power as \(V_{DD}^2\), but leakage rises exponentially in deep-sub-micron CMOS.
TTL Gate Structure and Open Collector
A standard TTL NAND uses a multi-emitter input transistor, a phase splitter, and a totem-pole output stage.
| Series | \(t_{pd}\) (ns) | P (mW) | Notes |
|---|---|---|---|
| 74 (standard) | 10 | 10 | Basic |
| 74L (low power) | 33 | 1 | |
| 74H (high speed) | 6 | 22 | |
| 74S (Schottky) | 3 | 20 | No saturation |
| 74LS (LP Schottky) | 10 | 2 | Most popular |
| 74AS (advanced S) | 1.5 | 20 | |
| 74ALS (advanced LPS) | 4 | 1 |
Open Collector
No internal pull-up; an external resistor is required. This permits wired-AND: \(Y = Y_1 \cdot Y_2 \cdot Y_3 \cdots\)
Tristate Logic and Interfacing
Tristate Gate
Has three output states — logic 0, logic 1 and high-Z (the output effectively disconnected) — selected by an enable. Multiple tristate outputs can share a bus.
A transmission gate (NMOS and PMOS in parallel) passes a full logic 0 and a full \(V_{DD}\) with no threshold drop and is bidirectional. For interfacing, a TTL \(V_{OH}\) of 2.4 V may miss the CMOS \(V_{IH}\) of \(0.7V_{CC}\), so a pull-up resistor is added when driving CMOS from TTL; the reverse direction is usually direct. Fan-out is \(\min(I_{OL}/I_{IL},\,I_{OH}/I_{IH})\).
Semiconductor Memories
Memory Classification
Semiconductor memory divides into two broad families: volatile memory (RAM), which loses its contents when power is removed, and non-volatile memory (ROM), which retains data without power. RAM splits into SRAM and DRAM; ROM spans MROM, PROM, EPROM, and EEPROM/Flash.
Memory Capacity
For \(n\) address lines and an \(m\)-bit word size:
Example: 10 address lines with 8-bit words give \(2^{10}\times 8 = 1024\times 8 = 8\) Kbit.
RAM: SRAM versus DRAM
| Parameter | SRAM | DRAM |
|---|---|---|
| Storage element | Flip-flop (6 transistors) | Capacitor + 1 transistor |
| Refresh required? | No | Yes (every few ms) |
| Access time | Faster (1–10 ns) | Slower (10–50 ns) |
| Cost per bit | High | Low |
| Density | Low | High |
| Power | More (static) | Less (except refresh) |
| Application | Cache memory | Main memory |
DRAM Refresh
The storage capacitor leaks charge and must be periodically recharged. Typical refresh period is 2–64 ms, performed automatically by the memory controller.
DRAM variants: SDRAM (synchronous, clocked); DDR SDRAM (double data rate, both clock edges); and the successive generations DDR2, DDR3, DDR4, and DDR5.
ROM Types
| Type | Programming | Erasing | Application |
|---|---|---|---|
| MROM | Mask at factory | Not possible | Fixed programs |
| PROM | Once, by user (fuse blowing) | Not possible | Small production runs |
| EPROM | Electrically programmed | UV light, whole chip | Development |
| EEPROM | Electrically prog/erase | Electrically, byte level | BIOS, config data |
| Flash | Electrically prog/erase | Block level | SSDs, USB drives |
Memory Expansion
Word expansion uses multiple chips to cover more addresses; bit expansion places chips in parallel for wider words. To build \(4\text{K}\times 8\) from \(1\text{K}\times 8\) chips, use four chips with chip-select driven by a 2-to-4 decoder on \(A_{10}A_{11}\).
Programmable Logic Devices
| Device | AND array | OR array | Outputs |
|---|---|---|---|
| ROM | Fixed (decoder) | Programmable | \(\sum m_i\) for each output |
| PAL | Programmable | Fixed | Limited product terms/output |
| PLA | Programmable | Programmable | Most flexible |
PLA versus PAL
PAL (Programmable Array Logic) is faster and simpler, but product terms cannot be shared. PLA (Programmable Logic Array) is more flexible with shared product terms, at the cost of speed.
CPLD (Complex PLD) combines multiple PLD blocks with interconnect on one chip. An FPGA (Field-Programmable Gate Array) is an array of configurable logic blocks (CLBs) with programmable interconnect and I/O blocks, programmed using an HDL such as VHDL or Verilog.
PLA Structure
The following architecture implements \(F_1 = AB + \bar{A}C\) and \(F_2 = AB + BC\), sharing the product term \(AB\) across both outputs.
How to Read It
Each horizontal line \(P_i\) is a product term fed by literals (dots in the AND plane). Dots in the OR plane select which products feed each output. In a PAL the OR plane is fixed; in a PLA both planes are programmable.
Analog-Digital Conversion
Digital-to-Analog Converters
Basic DAC Operation
A DAC converts an \(n\)-bit binary input \(D = b_{n-1}\cdots b_0\) to an analog voltage:
Types. The binary-weighted resistor DAC uses resistors \(R, 2R, 4R, \ldots, 2^{n-1}R\), but requires a wide range of precise values. The R-2R ladder DAC needs only two resistor values and is the popular choice. A segmented DAC combines both approaches for high resolution.
Performance Parameters
Resolution is the smallest step \(\Delta V = V_{FS}/2^{n}\); accuracy is the agreement with the ideal output; linearity is the deviation from a straight line; and settling time is the time to reach the final value.
Analog-to-Digital Converters
| Type | Speed | Resolution |
|---|---|---|
| Flash (parallel) | Very high (GHz) | Low (4–10 bits) |
| Successive approximation (SAR) | Medium (MHz) | Medium (8–16 bits) |
| Dual-slope integrating | Very low (Hz–kHz) | High (12–22 bits) |
| Sigma-delta (\(\Sigma\Delta\)) | Low to medium | Very high (16–24 bits) |
| Counter / ramp | Low | Medium |
Flash ADC
Uses \(2^{n}-1\) comparators in parallel — the fastest architecture, but with exponential hardware cost. Found in oscilloscopes, video, and RF receivers.
SAR ADC
Performs a binary search starting from the MSB. Conversion takes \(n\) clocks for an \(n\)-bit output. This is the most commonly used ADC type.
The quantization error is \(\epsilon_q = \pm V_{LSB}/2 = \pm V_{FS}/2^{\,n+1}\).
Sampling and the Nyquist Criterion
Nyquist–Shannon Sampling Theorem
A signal with maximum frequency \(f_m\) can be perfectly reconstructed if sampled at a rate
The Nyquist rate is \(2f_m\); the Nyquist frequency is \(f_s/2\).
Aliasing occurs when \(f_s \lt 2f_m\): high-frequency components fold back as lower frequencies. It is prevented by an anti-aliasing filter (a low-pass filter) placed before the ADC.
ADC SNR and Dynamic Range
For an ideal \(n\)-bit ADC with a full-scale sinusoid:
The dynamic range is approximately \(6.02\,n\) dB.
| Resolution | SNR |
|---|---|
| 8-bit | \(\approx 49.9\) dB |
| 12-bit | \(\approx 74.0\) dB |
| 16-bit | \(\approx 98.1\) dB |
| 24-bit | \(\approx 146\) dB |
VHDL / Verilog Basics
Hardware Description Languages
Purpose
HDLs describe digital circuits in textual form, enabling simulation, synthesis, and verification of complex designs.
The two main HDLs are VHDL (VHSIC Hardware Description Language — strongly typed and verbose) and Verilog (C-like syntax, more concise, popular in industry).
Levels of abstraction: (1) gate level — direct gate instantiation; (2) dataflow — Boolean equations via assign statements; (3) behavioral — high-level algorithmic description using always/process blocks; (4) structural — hierarchical composition of modules.
Design flow: specification → HDL coding → simulation → synthesis → place & route → implementation.
Verilog: 2-to-1 Multiplexer
The same multiplexer expressed in three modelling styles — all synthesise to identical hardware.
Gate level
module mux2to1(input a, b, sel, output y);
wire w1, w2, nsel;
not (nsel, sel);
and (w1, a, nsel);
and (w2, b, sel);
or (y, w1, w2);
endmodule
Dataflow
module mux2to1(input a, b, sel, output y);
assign y = sel ? b : a;
endmodule
Behavioral
module mux2to1(input a, b, sel, output reg y);
always @(*) begin
if (sel) y = b;
else y = a;
end
endmodule
Style Choice
Three styles, identical hardware. Behavioral modelling is the most common in modern RTL.
Verilog: D Flip-Flop and Counter
D flip-flop (positive edge, asynchronous reset)
module dff(input clk, rst, d, output reg q);
always @(posedge clk or posedge rst) begin
if (rst) q <= 1'b0;
else q <= d;
end
endmodule
4-bit up-counter
module counter4(input clk, rst, output reg [3:0] count);
always @(posedge clk or posedge rst) begin
if (rst) count <= 4'b0000;
else count <= count + 1;
end
endmodule
Blocking (=) versus Non-blocking (<=)
Use = in combinational blocks (always @(*)); use <= in clocked blocks (always @(posedge clk)). Mixing them causes simulation/synthesis mismatches.
VHDL: Equivalent Examples
2-to-1 MUX (dataflow)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux2to1 is
port(a, b, sel : in STD_LOGIC;
y : out STD_LOGIC);
end mux2to1;
architecture dataflow of mux2to1 is
begin
y <= b when sel = '1' else a;
end dataflow;
D flip-flop (process style)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff is
port(clk, rst, d : in STD_LOGIC;
q : out STD_LOGIC);
end dff;
architecture behav of dff is
begin
process(clk, rst) begin
if rst='1' then q <= '0';
elsif rising_edge(clk) then q <= d;
end if;
end process;
end behav;
Verilog versus VHDL: VHDL is strongly typed and verbose; Verilog is C-like and concise. Both are IEEE standards. SystemVerilog, a Verilog superset, dominates verification today.
Competitive Exam Topics
Must-Remember Numerical Formulas
Quick Formula Sheet
- \(n\)-bit unsigned range: \([0,\,2^{n}-1]\)
- \(n\)-bit signed (2's comp): \([-2^{\,n-1},\,2^{\,n-1}-1]\)
- MOD-\(N\) counter flip-flops: \(\lceil \log_2 N \rceil\)
- Ripple counter: \(f_{max} = 1/(n\cdot t_{pd})\)
- Sync counter: \(f_{max} = 1/(t_{pd}+t_{comb})\)
- Min clock period: \(T_{min}=t_{CQ}+t_{comb}+t_{su}\)
- ADC quantization: \(\Delta V = V_{FS}/2^{n}\)
- ADC SNR: \(\text{SNR}_{dB}=6.02n+1.76\) dB
- Hamming bits: \(2^{k}\geq m+k+1\)
- CMOS power: \(P=\alpha C V^{2} f\)
- Fan-out: \(\min(I_{OL}/I_{IL},\,I_{OH}/I_{IH})\)
- Nyquist rate: \(f_s \geq 2 f_m\)
- DAC output: \(V_o = V_{ref}\cdot D/2^{n}\)
- Johnson counter states \(= 2n\)
- Ring counter states \(= n\)
Flip-Flop Conversion Summary
| From | To | Formula |
|---|---|---|
| SR | JK | \(S = J\bar{Q}\), \(R = KQ\) |
| SR | D | \(S = D\), \(R = \bar{D}\) |
| SR | T | \(S = T\bar{Q}\), \(R = TQ\) |
| JK | D | \(J = D\), \(K = \bar{D}\) |
| JK | T | \(J = T\), \(K = T\) |
| JK | SR | \(J = S\), \(K = R\) (with \(SR=0\)) |
| D | JK | \(D = J\bar{Q} + \bar{K}Q\) |
| D | T | \(D = T \oplus Q\) |
| T | D | \(T = D \oplus Q\) |
| T | JK | \(T = J\bar{Q} + KQ\) |
Procedure for FF Conversion
First write the truth table of the target flip-flop; then use the excitation table of the source flip-flop to find the required inputs; finally apply a K-map to obtain the simplified equations.
Common Tricky Questions
Q1 — Minimum gates
Minimum number of 2-input NAND gates to implement \(Y = A \oplus B\)? Answer: 4 (NAND-only XOR).
Q2 — Race-around
In a JK flip-flop, race-around occurs when \(J=K=1\) and the clock pulse width exceeds the propagation delay.
Q3 — Counter sequence
A 3-bit Johnson counter has 6 unique states (i.e. \(2n = 2\times 3\)).
Q4 — MUX as logic
Minimum-size MUX to implement any 3-variable function? A 4:1 MUX, using the \(2^{\,n-1}\)-to-1 technique.
Q5 — Setup violation
If setup time is violated, the result is metastability — the output may be unpredictable.
Boolean Algebra Identities (Quick Reference)
| Law | Identity |
|---|---|
| Identity | \(A + 0 = A\), \(A\cdot 1 = A\) |
| Null | \(A + 1 = 1\), \(A\cdot 0 = 0\) |
| Idempotent | \(A + A = A\), \(A\cdot A = A\) |
| Complement | \(A + \bar{A} = 1\), \(A\cdot \bar{A} = 0\) |
| Involution | \(\bar{\bar{A}} = A\) |
| Commutative | \(A + B = B + A\), \(AB = BA\) |
| Associative | \((A+B)+C = A+(B+C)\) |
| Distributive | \(A(B+C) = AB + AC\) |
| Absorption | \(A + AB = A\), \(A(A+B) = A\) |
| Redundancy | \(A + \bar{A}B = A + B\) |
| De Morgan | \(\overline{A+B} = \bar{A}\bar{B}\), \(\overline{AB} = \bar{A}+\bar{B}\) |
| Consensus | \(AB + \bar{A}C + BC = AB + \bar{A}C\) |
| XOR identity | \(A \oplus B = A\bar{B} + \bar{A}B\) |
| XOR zero/one | \(A \oplus 0 = A\), \(A \oplus 1 = \bar{A}\) |
| XOR self | \(A \oplus A = 0\), \(A \oplus \bar{A} = 1\) |
| XNOR identity | \(\overline{A \oplus B} = AB + \bar{A}\bar{B}\) |
Number System Conversions Summary
| From → To | Method | Notes |
|---|---|---|
| Any → Decimal | Positional expansion | \(\sum d_i r^{i}\) |
| Decimal → Binary | Divide by 2, take remainders | Bottom-up |
| Decimal fraction → Binary | Multiply by 2, take integers | Top-down |
| Binary → Octal | Group 3 bits | From binary point |
| Binary → Hex | Group 4 bits | From binary point |
| Octal → Binary | Each digit → 3 bits | |
| Hex → Binary | Each digit → 4 bits | |
| Hex ↔ Octal | Via binary | Two-step |
\(r\)'s and \((r-1)\)'s Complement
For base \(r\): the \((r-1)\)'s complement subtracts each digit from \((r-1)\); the \(r\)'s complement is the \((r-1)\)'s complement plus 1. Examples: 9's complement (decimal), 1's complement (binary), 15's complement (hex).
Mealy versus Moore: Quick Comparison
| Mealy Machine | Moore Machine |
|---|---|
| Output \(= f(\text{state, input})\) | Output \(= f(\text{state})\) |
| Output changes asynchronously with input | Output changes synchronously with clock |
| Generally fewer states | Generally more states |
| Responds faster (same clock cycle) | Responds one cycle later |
| Output may have glitches | Glitch-free output |
| Output labelled on arrows: input/output | Output labelled inside states |
State Count Relationship
A Mealy machine with \(m\) states can always be converted to an equivalent Moore machine with at most \(m\cdot k\) states, where \(k\) is the number of distinct outputs.
GATE-Level Conceptual Pitfalls
Watch Out
- Latch versus FF: latches are level-sensitive (transparent); flip-flops are edge-triggered.
- Static versus dynamic hazard: a static hazard is a \(0\to 1\to 0\) (or \(1\to 0\to 1\)) spike; a dynamic hazard is multiple transitions.
- Ripple adder delay: \(n\cdot t_{pd}\), though the first stage's delay may differ from the rest.
- Overflow in 2's complement: only possible when adding same-sign numbers and obtaining the opposite sign.
- BCD addition: add 6 only if the result exceeds 9 or there is a carry to the next BCD digit.
- MUX as function generator: an \(n\)-variable function needs a \(2^{n}{:}1\) MUX directly, or \(2^{\,n-1}{:}1\) with extra logic.
- Johnson counter states: \(2n\), not \(2^{n}\).
- Encoder ambiguity: a simple encoder fails with multiple active inputs — use a priority encoder.
- Clock skew: differences in clock arrival at different flip-flops cause hold-time violations.
Timing Analysis Examples
Example 1 — Ripple counter \(f_{max}\)
A 4-bit ripple counter with \(t_{pd}=10\) ns: \(f_{max} = \dfrac{1}{n\cdot t_{pd}} = \dfrac{1}{4\times 10\,\text{ns}} = 25\) MHz.
Example 2 — Setup-time check
Given \(t_{CQ}=2\) ns, \(t_{comb}=5\) ns, \(t_{su}=1\) ns: \(T_{min}=2+5+1=8\) ns, so \(f_{max}=125\) MHz.
Example 3 — ADC resolution
A 12-bit ADC with \(V_{FS}=5\) V: \(\Delta V = 5/2^{12} = 5/4096 \approx 1.22\) mV.
Example 4 — Power dissipation
CMOS with \(C_L=10\) pF, \(V_{DD}=3.3\) V, \(f=100\) MHz, \(\alpha=0.3\): \(P=\alpha C V^{2} f = 0.3\times 10\text{p}\times 3.3^{2}\times 10^{8} \approx 3.27\) mW.
Practice Problems
- Convert \((ABC.D)_{16}\) to binary, octal, and decimal.
- Express \(-45\) in 8-bit sign-magnitude, 1's complement, and 2's complement.
- Simplify \(F = \sum m(0,1,3,5,7,8,9,11,15) + \sum d(6,14)\).
- Design a MOD-12 synchronous counter using T flip-flops.
- Implement \(F = \bar{A}BC + AB\bar{C} + ABC\) using only NAND gates.
- Design an overlapping "1011" sequence detector using both Moore and Mealy machines.
- Convert an SR flip-flop to a JK flip-flop.
- For a 16-bit ripple adder with \(t_{pd}=3\) ns per full adder, find the maximum operating frequency.
- Design a 4-to-1 MUX using 2-to-1 MUXes.
- Find the minimum number of flip-flops required for a MOD-50 counter.
Study Tip
Practise drawing state diagrams, filling K-maps, and writing truth tables by hand. Speed matters in competitive exams.
Advanced Arithmetic Circuits
Binary Multiplication
Basic Multiplication
Binary multiplication follows the same shift-and-add rules as decimal. For \(n\times n\)-bit multiplication, the product is up to \(2n\) bits wide.
Example: \(1101 \times 1011\):
So \(13 \times 11 = 143 = (10001111)_2\).
Array Multiplier
An array multiplier uses AND gates for partial products and full adders for summation. For an \(n\times n\) multiplier: \(n^{2}\) AND gates, \(n(n-1)\) full adders, \(n\) half adders, and delay \(O(n)\).
Booth's Multiplication Algorithm
Booth's Algorithm
Efficiently handles signed (2's complement) multiplication. It reduces the number of additions by treating runs of consecutive 1s as one subtraction followed by one addition.
For each multiplier bit pair \((Q_i, Q_{i-1})\):
| \(Q_i\) | \(Q_{i-1}\) | Action |
|---|---|---|
| 0 | 0 | ASR |
| 0 | 1 | \(A \leftarrow A+M\), then ASR |
| 1 | 0 | \(A \leftarrow A-M\), then ASR |
| 1 | 1 | ASR |
Booth's Algorithm — Worked Example
Compute \((+4)\times(-3)\) with the 4-bit Booth algorithm. Multiplicand \(M = +4 = 0100\), so \(-M = 1100\); multiplier \(Q = -3 = 1101\); initialise \(A = 0000\) and \(Q_{-1}=0\).
| Step | \(A\) | \(Q\) | \(Q_{-1}\) | Operation |
|---|---|---|---|---|
| Init | 0000 | 1101 | 0 | — |
| 1 (10) | 1100 | 1101 | 0 | \(A \leftarrow A - M\) |
| 1110 | 0110 | 1 | ASR | |
| 2 (01) | 0010 | 0110 | 1 | \(A \leftarrow A + M\) |
| 0001 | 0011 | 0 | ASR | |
| 3 (10) | 1101 | 0011 | 0 | \(A \leftarrow A - M\) |
| 1110 | 1001 | 1 | ASR | |
| 4 (11) | 1110 | 1001 | 1 | ASR only |
| 1111 | 0100 | 1 | ASR |
Final \(AQ = 11110100_2 = -12\), confirming \(+4\times -3 = -12\). Modified (bit-pair) Booth examines three bits at a time, halving the iteration count to \(n/2\).
Binary Division
Restoring Division
Shift \(A|Q\) left (\(A\) = remainder, \(Q\) = quotient); compute \(A \leftarrow A - M\) (\(M\) = divisor); if \(A \lt 0\) (MSB = 1), set \(Q_0=0\) and restore with \(A \leftarrow A + M\); if \(A \geq 0\), set \(Q_0=1\). Repeat \(n\) times.
Non-Restoring Division
Avoids the restoration step: if \(A \geq 0\), shift left and \(A \leftarrow A - M\); if \(A \lt 0\), shift left and \(A \leftarrow A + M\); set \(Q_0=1\) when \(A \geq 0\), else 0. This needs only one add/subtract per cycle.
Division Overflow
Overflow occurs when the quotient does not fit in \(n\) bits; it must be checked before or during division to avoid silent corruption.
BCD Adder Circuit
BCD Addition Rule
Add two BCD digits with a 4-bit binary adder. If the result exceeds 9 or there is a carry-out, add the correction factor \(0110\) (= 6).
The correction condition is
where \(K\) is the carry from the binary adder and \(Z_3 Z_2 Z_1 Z_0\) is the binary sum.
Example — \(8_{BCD} + 7_{BCD}\)
\(1000 + 0111 = 1111\) (15 in binary, an invalid BCD digit). Since the result exceeds 9, add \(0110\): \(1111 + 0110 = 1\,0101\). The final result is carry = 1 with \(0101\), i.e. \(15_{BCD}\).
BCD Subtraction
Uses 9's or 10's complement: \(A - B = A + [B]_{10\text{'c}}\).
IEEE 754 Floating-Point Representation
IEEE 754 Format
| Format | Total | Sign | Exponent | Mantissa |
|---|---|---|---|---|
| Single precision | 32 bits | 1 | 8 (bias 127) | 23 |
| Double precision | 64 bits | 1 | 11 (bias 1023) | 52 |
Special values: zero (\(E=0, M=0\), signed \(\pm 0\)); infinity (\(E=\) all 1s, \(M=0\)); NaN (\(E=\) all 1s, \(M\neq 0\)); denormalised (\(E=0, M\neq 0\)). The single-precision range is approximately \(1.4\times 10^{-45}\) to \(3.4\times 10^{38}\).
Example — \(-6.75\) (single precision)
Binary \(-110.11 = -1.1011\times 2^{2}\), so \(S=1\); \(E = 2+127 = 129 = 10000001\); \(M = 10110000000000000000000\). The encoding is 1 10000001 10110...0.
1's Complement Arithmetic
1's Complement Subtraction
If a carry is generated at the MSB, add it back to the LSB (end-around carry) and the result is positive; if there is no carry, the result is negative and remains in 1's complement form.
Example — \(9 - 5\) (4-bit 1's complement)
\(9 = 1001\), \(5 = 0101\), \([5]_{1\text{'c}} = 1010\). Then \(1001 + 1010 = 1\,0011\) with carry = 1; end-around: \(0011 + 1 = 0100 = +4\).
Example — \(5 - 9\) (4-bit 1's complement)
\(5 = 0101\), \(9 = 1001\), \([9]_{1\text{'c}} = 0110\). Then \(0101 + 0110 = 1011\) with no carry, so the result is negative: \([1011]_{1\text{'c}} = 0100 = 4\), i.e. \(-4\).
Advanced Combinational Topics
Decoder and Multiplexer Expansion
Decoder Expansion
Larger decoders are built from smaller ones. An \(n\)-to-\(2^{n}\) decoder built from \(m\)-to-\(2^{m}\) decoders needs roughly \(\dfrac{2^{n}}{2^{m}}+1\) smaller decoders.
To build a 3-to-8 decoder from two 2-to-4 decoders, use the MSB \(A_2\) as the select/enable: when \(A_2=0\) the first decoder drives \(Y_0\)–\(Y_3\), and when \(A_2=1\) the second drives \(Y_4\)–\(Y_7\). For a 4-to-16 decoder from two 3-to-8 decoders, use \(A_3\) as the enable selector and feed \(A_2 A_1 A_0\) to both.
MUX Cascading
To build a \(2^{n}{:}1\) MUX from \(2^{m}{:}1\) MUXes requires \(\dfrac{2^{n}-1}{2^{m}-1}\) multiplexers. For example, an 8:1 MUX from 2:1 MUXes needs \((8-1)/(2-1) = 7\) MUXes.
Function Implementation Using Decoders
Decoder + OR Gate
Any \(n\)-variable Boolean function can be implemented with an \(n\)-to-\(2^{n}\) decoder and an OR gate combining the minterms where \(F=1\).
For \(F(A,B,C) = \sum m(1,3,5,7)\), use a 3-to-8 decoder and OR together outputs \(Y_1, Y_3, Y_5, Y_7\). For multiple outputs, a single decoder serves all functions with one OR gate per output.
DEMUX for Logic
A DEMUX with a constant input of 1 acts as a decoder: the select lines become the function variables and the outputs are the minterms.
| Method | When to use |
|---|---|
| MUX | Single output, minimal hardware |
| Decoder + OR | Multiple outputs, shared variables |
| K-map minimisation | Standard gate-level design |
| PLA/PAL | Many outputs, programmable |
Hazard-Free Design: Worked Example
Consider \(F = AB + \bar{A}C\). A static-1 hazard appears when \(B=C=1\) and \(A\) transitions: because of gate delays, both \(AB\) and \(\bar{A}C\) may momentarily be 0, producing a brief glitch on \(F\).
Hazard Elimination
Add the redundant (consensus) term \(BC\): \(F_{\text{HF}} = AB + \bar{A}C + BC\). Both prior states now share a common group, so the output stays HIGH throughout the transition. The general rule: every pair of adjacent 1s in the K-map must lie within at least one common prime implicant.
Advanced Sequential Circuits
Master-Slave JK Flip-Flop
Master-Slave Structure
Two JK latches placed back-to-back with complementary clocks. This eliminates race-around by ensuring the output changes only once per clock period.
Operation. When the clock is HIGH the master is enabled and follows JK while the slave is disabled; when the clock is LOW the master latches and the slave copies it to the output. The drawback is "1s catching": if the input glitches to 1 during the master phase, the master captures it. The solution is to use true edge-triggered flip-flops.
Edge-Triggered versus Level-Triggered
| Level-Triggered (Latch) | Edge-Triggered (Flip-Flop) |
|---|---|
| Transparent when enable active | Opaque except at clock edge |
| Output follows input continuously | Output samples input at the edge only |
| Can cause feedback problems | Safe in feedback circuits |
| Smaller area, faster | Larger (\(\approx 2\times\) transistors) |
| Uses: pipeline stages, time borrowing | Uses: registers, counters, FSMs |
Edge Detection
A positive edge is a \(0\to 1\) transition; a negative edge is a \(1\to 0\) transition. A pulse-narrowing circuit generates a short edge pulse: \(\text{PET pulse} = \text{CLK}\cdot \overline{\text{CLK}_{delayed}}\). A gated D latch gives \(Q = D\) when the enable is HIGH and holds when it is LOW.
Clock Skew, Jitter, and Gating
Clock Skew
The difference in clock arrival times at flip-flops caused by wire delays: \(t_{skew} = t_{clk\_dest} - t_{clk\_source}\). It modifies the timing constraints to \(T_{clk} \geq t_{CQ} + t_{comb} + t_{su} + t_{skew}\) (setup) and \(t_{CQ} + t_{comb,min} \geq t_h + t_{skew}\) (hold).
Clock Jitter
Random variation in the clock period; it reduces the effective margin: \(T_{clk,eff} = T_{clk} - t_{jitter}\).
Clock gating disables the clock to unused logic to save dynamic power, with \(P_{saved} \propto \alpha C V^{2} f\cdot(\text{fraction gated})\). Skew is reduced by H-tree distribution, balanced buffers, clock meshes, and PLL-based deskewing.
Asynchronous Sequential Circuits
Asynchronous versus Synchronous
Asynchronous circuits have no clock; state changes occur whenever inputs change. They are modelled in fundamental mode (one input changes at a time and the circuit stabilises before the next change) or in pulse mode.
Key concepts. A stable state has present = next (no change); an unstable state transitions. A primitive flow table has one stable state per row; a merged flow table combines equivalent states. A cycle is a sequence of unstable states leading to a stable state, acceptable only if it terminates uniquely.
Race Conditions
Two or more state variables change simultaneously. A non-critical race reaches the same final state regardless of order; a critical race reaches a different final state depending on order and must be avoided.
Asynchronous Design: State Assignment
Race-Free State Assignment
Adjacent states (differing by exactly one state-variable bit) can be assigned safely. Multi-bit transitions may require additional state variables to break races.
Techniques include shared-row state assignment (inserting an intermediate row), one-hot encoding (one flip-flop per state, no races), and multiple-row assignment (several codes per state). The Huffman design procedure is: state diagram → primitive flow table; merge equivalent states; race-free state assignment; derive excitation and output equations; check for static, dynamic, and essential hazards.
Essential Hazards
Unique to asynchronous circuits, these cannot be removed by logic and require delay insertion in the feedback paths.
ASM (Algorithmic State Machine) Charts
ASM Chart
A flowchart-like representation of sequential-circuit behaviour, more intuitive than state diagrams for complex systems and the basis for RTL design.
The three basic symbols are the state box (rectangle, listing Moore-type outputs), the decision box (diamond, testing input conditions), and the conditional output box (oval, for Mealy-type outputs that depend on the input). An ASM block is a state box plus all decision and conditional boxes reachable from it before the next state box.
ASM versus State Diagram
An ASM chart shows timing (all actions in a block occur in one clock cycle); decision and conditional boxes do not add states, being combinational logic within a state; and it is easier to convert to RTL/HDL code. Complex systems split into a datapath (registers, ALUs, MUXes) and a controller (an FSM expressed as an ASM) — the RTL design paradigm.
Pipelining Basics
Pipelining
Divide combinational logic into stages separated by registers, so multiple operations overlap in execution and throughput rises.
Pipeline Performance
For \(k\) stages with stage delay \(t_s\) and register overhead \(t_{reg}\): \(T_{clk} = t_s + t_{reg}\), throughput \(= 1/(t_s + t_{reg})\), and speedup \(\approx k\) when \(t_{reg}\ll t_s\).
Latency versus throughput: latency is \(k\cdot(t_s + t_{reg})\) and increases, while throughput (operations per second) increases. Hazards — data, control, and structural — are handled by forwarding, stalling, and branch prediction.
Analog Interfacing Circuits
Schmitt Trigger
Schmitt Trigger
A comparator with hysteresis — two threshold voltages for rising and falling inputs — that converts noisy or slow signals into clean digital transitions.
Threshold Voltages
Applications include noise immunity and false-trigger rejection, sine-to-square wave conversion, switch debouncing, and waveform shaping. Example ICs are the 7414 (hex inverter) and 4093 (CMOS).
555 Timer
555 Timer IC
A versatile timer containing two comparators, an SR latch, and a discharge transistor, operating from 4.5–18 V. Its modes are astable, monostable, and bistable.
Monostable
Astable
In the standard astable configuration the duty cycle exceeds 50%; for \(\leq 50\%\), place a diode across \(R_2\).
Sample and Hold Circuit
Purpose
Holds the analog input voltage constant during ADC conversion, preventing errors from input variation. It is essential for most ADC architectures.
Key Parameters
Acquisition time is the time for \(C_H\) to charge to tolerance; aperture time is the time the switch takes to open; aperture jitter is variation in the aperture that causes sampling errors; droop rate is \(dV/dt = I_{leak}/C_H\) during hold; and the hold step is the voltage change at the sample-to-hold transition. The trade-off: a large \(C_H\) lowers droop but slows acquisition.
R-2R Ladder DAC
R-2R Ladder
Uses only two resistor values, \(R\) and \(2R\). Each node presents a Thevenin equivalent resistance of \(R\). It is widely used for its simple fabrication and good linearity.
Total Output
For \(R_f = R\), this reduces to \(V_{out} = -V_{ref}\cdot D/2^{n}\).
Advantages over the weighted-resistor DAC: only two resistor values (easier to fabricate), scalable to any number of bits, and better matching in monolithic ICs.
Successive Approximation (SAR) ADC
SAR Operation
A binary-search algorithm using an internal DAC. Each clock cycle resolves one bit, starting from the MSB.
The MSB-first algorithm: set the MSB to 1 (others 0) and feed the SAR value to the DAC; if \(V_{DAC} \gt V_{in}\) clear that bit, otherwise keep it; move to the next bit and repeat for \(n\) cycles.
SAR Conversion Time
\(T_{conv} = n\cdot T_{clk}\) — linear in resolution.
Example — 5 V input, 4-bit SAR, \(V_{ref}=8\) V
| Step | Try | \(V_{DAC}\) | Action |
|---|---|---|---|
| 1 | 1000 | 4.0 | \(\lt V_{in}\): keep |
| 2 | 1100 | 6.0 | \(\gt V_{in}\): clear |
| 3 | 1010 | 5.0 | \(= V_{in}\): keep |
| 4 | 1011 | 5.5 | \(\gt V_{in}\): clear |
Final digital code: 1010.
Dual-Slope and Sigma-Delta ADC
A dual-slope (integrating) ADC integrates the input for a fixed time \(T_1\), then integrates \(-V_{ref}\) until the integrator returns to zero; the de-integration time \(T_2\) gives \(V_{in} = V_{ref}\cdot T_2/T_1\). It is used in digital multimeters for its accuracy and excellent noise rejection, at the cost of speed.
A sigma-delta (\(\Sigma\Delta\)) ADC uses oversampling (\(f_s \gg\) Nyquist); noise shaping pushes quantisation noise to high frequencies, a digital low-pass filter removes the shaped noise, and the result is high resolution (16–24 bits) at moderate speeds.
Oversampling Ratio (OSR)
\(\text{OSR} = f_s/(2 f_m)\). Each doubling of OSR gives 3 dB more SNR for a first-order modulator, or 9 dB for a second-order modulator.
Advanced Logic Circuits and VLSI
Dynamic CMOS Logic
Dynamic Logic
Uses clock-controlled precharge and evaluate phases instead of a static pull-up network. This reduces transistor count and improves speed, but consumes more power and is harder to design.
Operation. A single clock \(\phi\) controls two phases: in the precharge phase (\(\phi=0\)) the output is charged to \(V_{DD}\) through a PMOS; in the evaluate phase (\(\phi=1\)) the NMOS pull-down network evaluates the inputs.
Advantages: fewer transistors (\(n+2\) versus \(2n\) for an \(n\)-input gate) and faster operation (smaller capacitance). Problems: charge leakage (the output loses charge over time), charge sharing (output-node charge redistributes onto internal nodes), and the inability to cascade directly (glitches cause errors).
Domino Logic and Pass-Transistor Logic
Domino Logic
Dynamic logic with a static inverter at the output. This enables cascading: each stage's output is low during precharge, then "dominoes" high during evaluation.
Properties: only non-inverting functions are directly implementable; it is very fast (used in high-performance CPUs); and all outputs are glitch-free during evaluation.
Pass-Transistor Logic (PTL)
Uses transistors as switches to pass signals rather than as pull-up/pull-down devices, needing fewer transistors for some functions (e.g. XOR uses 4 versus 12 in static CMOS).
PTL drawbacks: a threshold-voltage drop through an NMOS (it passes a weak 1), and signal degradation through cascaded switches. The solution is a transmission gate (NMOS and PMOS in parallel) or level restoration. A transmission gate passes a full \(V_{DD}\) and a full ground, is bidirectional, and is used in multiplexers and latches.
Noise Margin Analysis
Noise Margin Definitions
Levels. \(V_{OH}\) is the minimum output voltage for logic 1 and \(V_{OL}\) the maximum for logic 0; \(V_{IH}\) is the minimum input voltage recognised as 1 and \(V_{IL}\) the maximum recognised as 0; the undefined region is \(V_{IL}\lt V_{in}\lt V_{IH}\). Typical TTL values: \(V_{OH}=2.4\) V and \(V_{IH}=2.0\) V give \(NM_H = 0.4\) V.
Propagation Delay, Rise and Fall Times
Timing Definitions
\(t_{PHL}\) is the propagation delay from the 50% input to the 50% output for a high-to-low output transition; \(t_{PLH}\) is the same for a low-to-high transition; \(t_{pd} = (t_{PHL}+t_{PLH})/2\) is the average; \(t_r\) (rise time) is measured 10% to 90% of the output; and \(t_f\) (fall time) is measured 90% to 10%.
Factors affecting delay: load capacitance (\(t_{pd}\propto C_L\)); supply voltage (\(t_{pd}\propto 1/V_{DD}\), roughly); transistor size (wider transistors lower \(t_{pd}\)); and temperature (higher temperature raises \(t_{pd}\)).
CMOS Delay Model
Fan-in and Fan-out Effects
Fan-in
The number of inputs to a gate. Higher fan-in means more stacked transistors, hence higher delay and area.
Typical limits: in CMOS, practical fan-in is \(\leq 4\) (beyond which multi-level logic is used); in TTL it is limited by transistor \(\beta\) and base currents. Delay scaling with fan-in \(n\) in CMOS: series NMOS gives \(t_{pd}\propto n^{2}\) (roughly, from series resistance plus capacitance), while parallel PMOS gives \(t_{pd}\propto n\).
Fan-out Delay
Each additional load adds to the output capacitance:
where \(N_{load}\) is the number of loads driven.
High fan-out solutions: buffer chains, clock trees, and wire-sizing.
Memory Systems and Testing
Memory Interfacing: Detailed Example
Design a \(16\text{K}\times 8\) memory using \(4\text{K}\times 8\) chips. The number of chips needed is \(16\text{K}/4\text{K}=4\); each chip needs 12 address lines (\(2^{12}=4\text{K}\)); the total address space needs 14 lines (\(2^{14}=16\text{K}\)); the upper 2 bits \(A_{13}A_{12}\) select the chip through a 2-to-4 decoder; and the lower 12 bits \(A_{11}\ldots A_0\) go to all chips in parallel.
| \(A_{13}\) | \(A_{12}\) | Chip selected | Address range |
|---|---|---|---|
| 0 | 0 | Chip 0 | 0000–0FFF |
| 0 | 1 | Chip 1 | 1000–1FFF |
| 1 | 0 | Chip 2 | 2000–2FFF |
| 1 | 1 | Chip 3 | 3000–3FFF |
Bit Expansion (for wider words)
To make \(N\times 16\) from \(N\times 8\) chips, use two chips in parallel sharing the same address lines, with the data pins split (chip 0: \(D_7\)–\(D_0\); chip 1: \(D_{15}\)–\(D_8\)).
Cache Memory Basics
Cache
A small, fast memory between the CPU and main memory. It exploits locality of reference — both spatial (nearby addresses) and temporal (recently accessed data).
Mapping techniques: direct mapping sends each main-memory block to exactly one cache line; fully associative allows any block in any line (flexible but slow to search); set associative is the compromise, mapping a block to a set of lines.
Cache Performance
Replacement policies include LRU (least recently used), FIFO, and random. Write policies are write-through (update both cache and memory) and write-back (update cache, mark dirty).
Cache Mapping — Visual Comparison
| Aspect | Direct | Set assoc. | Fully assoc. |
|---|---|---|---|
| Hardware complexity | Lowest | Medium | Highest |
| Comparators | 1 | \(w\) (per set) | \(n\) (all) |
| Hit ratio | Lowest | Medium | Highest |
| Conflict misses | Many | Few | None |
For direct mapping with \(2^{n}\) main-memory blocks, \(2^{c}\) cache lines, and \(2^{b}\) bytes per block, the address splits into a tag of \(n-c-b\) bits, an index of \(c\) bits, and an offset of \(b\) bits.
Content-Addressable Memory (CAM)
CAM
"Associative memory" that searches contents instead of addresses: the input is data and the output is the address(es) where the data is stored, found by a parallel search in one cycle.
Each cell contains comparison logic plus storage. Binary CAM stores 0 or 1; ternary CAM (TCAM) stores 0, 1, or X (don't care). Applications include network routers (IP lookup, MAC tables), cache tag arrays, the translation lookaside buffer (TLB), pattern matching, and database accelerators.
Drawback
CAM uses roughly 10× more area and power than SRAM because of the comparator in each cell, so it is used only when fast search is critical.
FPGA Architecture Detail
FPGA Components
A configurable logic block (CLB) is the basic unit, containing LUTs, flip-flops, and MUXes; a look-up table (LUT) is SRAM-based memory implementing any \(k\)-input function (\(2^{k}\) entries); a switch matrix provides programmable interconnect; an I/O block (IOB) gives programmable pin functionality; block RAM (BRAM) offers dedicated memory; DSP blocks provide hardware multipliers/MACs; and PLL/DLL handle clock management.
LUT-based implementation: a \(k\)-input LUT can implement any Boolean function of \(k\) variables (typically 4- or 6-input); the truth table is stored in SRAM with the inputs acting as the address. Programming types are SRAM-based (volatile, reprogrammable; Xilinx/Altera), Flash-based (non-volatile), and antifuse (one-time programmable).
Testing and Stuck-At Faults
Fault Models
Abstract representations of physical defects. The most common are stuck-at-0 (a line permanently at logic 0) and stuck-at-1 (permanently at logic 1); bridging, open, and delay faults are more complex.
Test generation relies on controllability (the ability to set a line to a desired value) and observability (the ability to propagate an effect to a primary output); the D-algorithm performs path sensitisation for automatic test-pattern generation (ATPG).
Fault Coverage
Industry target: \(\geq 99\%\).
Design for testability (DFT) techniques: scan chains convert flip-flops into a shift register for test access; BIST (built-in self-test) uses an LFSR to generate patterns and a MISR to compress responses; and boundary scan (JTAG, IEEE 1149.1) enables board-level testing.
Linear Feedback Shift Register (LFSR)
LFSR
A shift register with XOR feedback that produces pseudorandom sequences, used in test-pattern generation, cryptography, CRC, and scrambling.
An \(n\)-bit LFSR with a primitive polynomial generates a sequence of length \(2^{n}-1\) (every state except all-zeros).
| \(n\) | Taps (XOR positions) |
|---|---|
| 3 | 3, 2 |
| 4 | 4, 3 |
| 5 | 5, 3 |
| 8 | 8, 6, 5, 4 |
| 16 | 16, 15, 13, 4 |
Example — 3-bit LFSR (taps 3, 2)
Starting from \(001\): \(001 \to 100 \to 110 \to 111 \to 011 \to 101 \to 010 \to 001 \ldots\), a maximal length of \(2^{3}-1 = 7\) states.
Applications: BIST test vectors, CRC computation, data whitening, and stream ciphers.
Additional Competitive Exam Material
Advanced Topics Formula Summary
Key Formulas from the Advanced Topics
- Array multiplier: \(n^{2}\) ANDs, \(n(n-1)\) FAs, delay \(O(n)\)
- IEEE 754 single: \(N=(-1)^{S}\cdot 1.M\cdot 2^{\,E-127}\)
- Schmitt: \(V_H = V_{UT} - V_{LT}\)
- 555 astable: \(f = 1.44/[(R_1+2R_2)C]\)
- 555 monostable: \(T = 1.1RC\)
- SAR: \(T_{conv} = n\cdot T_{clk}\)
- Dual-slope: \(V_{in} = V_{ref}(T_2/T_1)\)
- Oversampling: \(+3\) dB/octave (first-order \(\Sigma\Delta\))
- Pipeline speedup: \(S = k\,t_s/(t_s + t_{reg})\)
- Cache: \(T_{avg} = h T_c + (1-h)T_m\)
- LFSR max length: \(2^{n}-1\)
- CMOS delay: \(t_{pd}\propto C_L V_{DD}/(V_{DD}-V_T)^{2}\)
- \(k\)-input LUT realises any \(k\)-variable function
- Fan-out: \(t_{pd} = t_{int} + N\,\tau_{load}\)
- Booth (bit-pair): \(n/2\) iterations
Advanced Topics: Tricky Q&A
Q1 — Booth's versus normal multiply
The main advantage of Booth's algorithm is that it handles signed (2's complement) numbers directly and saves operations across runs of consecutive 1s or 0s.
Q2 — IEEE 754 bias
The single-precision exponent bias is 127 (\(=2^{8-1}-1\)); double precision uses 1023.
Q3 — 555 timer at 50%
A standard 555 astable cannot reach exactly 50% duty because it charges through \(R_1+R_2\) but discharges only through \(R_2\), so \(T_H \gt T_L\). The fix is a diode across \(R_2\).
Q4 — LFSR length
The maximum sequence length of an 8-bit LFSR is \(2^{8}-1 = 255\) (the all-zeros state is excluded).
Q5 — Pipelining
Pipelining does not reduce single-operation latency — it adds register overhead but increases throughput.
Q6 — Critical race
Prevent a critical race in asynchronous circuits with a race-free state assignment (adjacent codes) or by inserting intermediate states.
More Practice Problems (Advanced)
- Multiply \((-5)\times(+3)\) using the 4-bit Booth algorithm; show each iteration.
- Represent \(-0.15625\) in IEEE 754 single-precision format.
- Design a 555 astable for 1 kHz with 60% duty cycle; find \(R_1\), \(R_2\), \(C\).
- Given \(V_{OH}=3.3\) V, \(V_{OL}=0.3\) V, \(V_{IH}=2.0\) V, \(V_{IL}=0.8\) V, find \(NM_H\) and \(NM_L\).
- A 12-bit SAR ADC with a 10 MHz clock: find the conversion time.
- A 4-stage pipeline with \(t_s=10\) ns, \(t_{reg}=1\) ns: find throughput and speedup.
- Design a \(32\text{K}\times 16\) memory using \(8\text{K}\times 8\) chips. How many chips?
- Cache hit ratio \(h=0.95\), \(T_c=2\) ns, \(T_m=50\) ns: find \(T_{avg}\).
- 3-bit LFSR (taps 3, 2): list the full sequence starting from 001.
- Implement \(F=\bar{A}B+AC\) using (a) a 4:1 MUX, (b) a 3-to-8 decoder + OR gate.
- Show that a transmission gate passes a full \(V_{DD}\) and full ground, unlike a single NMOS switch.
- Derive the condition for hazard-free SOP via adjacent-1 analysis.
- CMOS NAND with \(C_L=50\) fF, \(V_{DD}=1.8\) V, \(I_D=100\,\mu\)A: estimate \(t_{pd}\).
- Find the oversampling ratio of a \(\Sigma\Delta\) ADC for 24 dB gain (first-order).
- Draw an ASM chart for a traffic-light controller (Green–Yellow–Red).
GATE-Level Master Formula Sheet
Consolidated Reference
Number systems: \((n)_{10}=\sum d_i r^{i}\); \(n\)-bit unsigned \([0,2^{n}-1]\); \(n\)-bit 2's complement \([-2^{\,n-1},2^{\,n-1}-1]\).
Boolean: De Morgan \(\overline{AB}=\bar{A}+\bar{B}\); consensus \(AB+\bar{A}C+BC=AB+\bar{A}C\); XOR \(A\oplus B=A\bar{B}+\bar{A}B\).
K-map: a group of \(2^{k}\) cells eliminates \(k\) variables.
Adders: FA sum \(S=A\oplus B\oplus C_{in}\), \(C_{out}=AB+C_{in}(A\oplus B)\); CLA \(G_i=A_iB_i\), \(P_i=A_i\oplus B_i\).
Flip-flops: SR \(Q^{+}=S+\bar{R}Q\); JK \(Q^{+}=J\bar{Q}+\bar{K}Q\); D \(Q^{+}=D\); T \(Q^{+}=T\oplus Q\).
Counters: MOD-\(N\) needs \(\lceil\log_2 N\rceil\) FFs; ring \(n\) states, Johnson \(2n\) states; ripple \(f_{max}=1/(n\cdot t_{pd})\).
Timing: \(T_{min}=t_{CQ}+t_{comb}+t_{su}\); hold \(t_{CQ}+t_{comb,min}\gt t_h\).
Memory: capacity \(2^{n}\times m\) bits; cache \(T_{avg}=hT_c+(1-h)T_m\).
ADC/DAC: \(\Delta V=V_{FS}/2^{n}\); Nyquist \(f_s\geq 2f_m\); SNR \(=6.02n+1.76\) dB; SAR \(T=n\cdot T_{clk}\).
CMOS: \(P=\alpha CV^{2}f\); NAND/NOR use \(2n\) transistors.
555 timer: monostable \(T=1.1RC\); astable \(f=1.44/[(R_1+2R_2)C]\).
Pipeline: speedup \(\approx k\); throughput \(=1/(t_s+t_{reg})\).
LFSR: max length \(2^{n}-1\). Hamming: \(2^{k}\geq m+k+1\).
Summary and References
What You Have Mastered
Foundations & Combinational Logic
- Number systems and conversions
- Binary arithmetic (2's complement)
- Binary codes (BCD, Gray, Hamming)
- Boolean algebra and theorems
- Logic gates, including the universal gates
- K-map and Quine–McCluskey methods
- Adders, multiplexers, decoders, encoders
- Code converters and comparators
Sequential Logic, Memory & Beyond
- Latches and flip-flops
- Registers and counters
- Finite state machines (Mealy and Moore)
- Logic families (TTL, CMOS, ECL)
- Semiconductor memories (RAM, ROM)
- PLDs, PLA, PAL, FPGA
- ADC and DAC converters
- HDL basics (Verilog, VHDL)
Digital electronics is the foundation of all modern computing — from smartphones to supercomputers, and from the Internet of Things to AI accelerators.
Recommended Textbooks
- Morris Mano & Michael Ciletti — Digital Design, 5th/6th edition, Pearson.
- R. P. Jain — Modern Digital Electronics, Tata McGraw-Hill.
- Thomas L. Floyd — Digital Fundamentals, Pearson.
- Ronald J. Tocci — Digital Systems: Principles and Applications, Pearson.
- A. Anand Kumar — Fundamentals of Digital Circuits, PHI.
- A. Anand Kumar — Switching Theory and Logic Design, PHI.
- Malvino & Leach — Digital Principles and Applications, McGraw-Hill.
- Stephen Brown & Zvonko Vranesic — Fundamentals of Digital Logic with Verilog Design.
- Jan Rabaey — Digital Integrated Circuits: A Design Perspective, Pearson.
- Samir Palnitkar — Verilog HDL: A Guide to Digital Design and Synthesis.
For Competitive Exams
GATE, ESE, ISRO, and DRDO aspirants should focus on Morris Mano for fundamentals, combined with previous years' question papers and standard mock tests.