Digital Electronics: Complete Revision Notes

From fundamentals to advanced VLSI — concepts, formulas, worked examples and exam pointers.

Author: Dr. Mithun MondalCategory: Electrical & Electronics EngineeringLevel: GATE / ESE / University

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.

SECTION 01

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.

Side-by-side comparison of a continuous sinusoidal analog waveform and a two-level rectangular digital waveform switching between logic LOW and logic HIGH.
Comparison of a continuous analog signal, which can take infinitely many voltage values, with a digital signal that is restricted to two discrete logic levels (0 and 1).

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.

SECTION 02

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

\[ N = \sum_{i=-m}^{n} d_i \cdot r^i \]
Common number systems and their digit sets.
SystemBase (radix)Digits
Binary20, 1
Octal80, 1, 2, 3, 4, 5, 6, 7
Decimal100–9
Hexadecimal160–9, A, B, C, D, E, F

The weight of a digit at position \(i\) is \(r^i\).

Binary Number System

Binary to Decimal

\[ (b_n b_{n-1} \ldots b_1 b_0 . b_{-1} b_{-2})_2 = \sum_{i} b_i \cdot 2^i \]

Example. Convert \((1011.101)_2\) to decimal:

\[ \begin{aligned} &= 1 \cdot 2^3 + 0 \cdot 2^2 + 1 \cdot 2^1 + 1 \cdot 2^0 + 1 \cdot 2^{-1} + 0 \cdot 2^{-2} + 1 \cdot 2^{-3}\\ &= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125 = (11.625)_{10} \end{aligned} \]

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}\)
12481632641282565121024

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:

\[ \begin{aligned} 0.375 \times 2 &= 0.75 \rightarrow 0 \\ 0.75 \times 2 &= 1.5 \rightarrow 1 \\ 0.5 \times 2 &= 1.0 \rightarrow 1 \end{aligned} \]

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}\)
Decimal, binary, octal and hexadecimal equivalents for digits 0–15.
DecBinaryOctalHexDecBinaryOctalHex
000000081000108
100011191001119
200102210101012A
300113311101113B
401004412110014C
501015513110115D
601106614111016E
701117715111117F
SECTION 03

Binary Arithmetic

Binary Addition and Subtraction

Addition Rules

\[ \begin{aligned} 0 + 0 &= 0 \\ 0 + 1 &= 1 \\ 1 + 0 &= 1 \\ 1 + 1 &= 10 \;(\text{carry } 1) \\ 1 + 1 + 1 &= 11 \;(\text{carry } 1) \end{aligned} \]

Subtraction Rules

\[ \begin{aligned} 0 - 0 &= 0 \\ 1 - 0 &= 1 \\ 1 - 1 &= 0 \\ 0 - 1 &= 1 \;(\text{borrow } 1) \end{aligned} \]

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.

  1. 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\)).
  2. 1's complement: invert all bits to negate. Same range as sign-magnitude; two zeros.
  3. 2's complement: 1's complement plus 1 (most widely used). Range \(-2^{n-1}\) to \(+(2^{n-1}-1)\); a unique zero.
4-bit representations of selected signed values.
DecimalSign-Mag1's Comp2's Comp
\(+5\)010101010101
\(-5\)110110101011
\(+0\)000000000000
\(-0\)100011110000 (unique)

2's Complement Arithmetic

2's Complement of \(N\) in \(n\) bits

\[ [N]_{2'c} = 2^n - N \]

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.

SECTION 04

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).

Tree diagram classifying binary codes into weighted codes such as BCD and 2421, non-weighted codes such as Gray and Excess-3, and error-detecting codes such as parity and Hamming.
Classification of binary codes into weighted, non-weighted, and error-detecting/correcting families, with representative examples of each.

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.

BCD and Excess-3 codes for decimal digits 0–9.
DecBCDXS-3DecBCDXS-3
000000011501011000
100010100601101001
200100101701111010
300110110810001011
401000111910011100

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\)
3-bit binary and Gray code equivalents.
DecBinaryGrayDecBinaryGray
00000004100110
10010015101111
20100116110101
30110107111100

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

\[ 2^k \ge m + k + 1 \]

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.

Hamming 7,4 codeword layout showing parity bits at positions 1, 2 and 4 and data bits at positions 3, 5, 6 and 7, with coverage brackets indicating which positions each parity bit checks.
Bit-position layout of the Hamming(7,4) code, showing parity bits at the power-of-two positions and the coverage of each parity bit over the data bits.

Computing the parity bits:

\[ \begin{aligned} p_1 &= d_3 \oplus d_2 \oplus d_0 = 1 \oplus 0 \oplus 1 = 0 \\ p_2 &= d_3 \oplus d_1 \oplus d_0 = 1 \oplus 1 \oplus 1 = 1 \\ p_3 &= d_2 \oplus d_1 \oplus d_0 = 0 \oplus 1 \oplus 1 = 0 \end{aligned} \]

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.

SECTION 05

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.
Truth table for the three basic Boolean operations.
AB\(A\cdot B\)\(A+B\)\(\bar{A}\)
00001
01011
10010
11110

Boolean Laws and Theorems

Basic Laws

\[ \begin{aligned} \text{Identity:}\;& A + 0 = A,\; A \cdot 1 = A \\ \text{Null:}\;& A + 1 = 1,\; A \cdot 0 = 0 \\ \text{Idempotent:}\;& A + A = A,\; A \cdot A = A \\ \text{Complement:}\;& A + \bar{A} = 1,\; A \cdot \bar{A} = 0 \\ \text{Involution:}\;& \bar{\bar{A}} = A \end{aligned} \]

Commutative, Associative & Distributive

\[ \begin{aligned} A + B &= B + A,\quad A \cdot B = B \cdot A \\ (A+B)+C &= A+(B+C) \\ (AB)C &= A(BC) \\ A(B+C) &= AB + AC \\ A + BC &= (A+B)(A+C) \end{aligned} \]

De Morgan's Theorems

\[ \overline{A + B} = \bar{A} \cdot \bar{B} \qquad \overline{A \cdot B} = \bar{A} + \bar{B} \]

Generalised: \(\overline{A_1 + A_2 + \cdots + A_n} = \bar{A_1} \cdot \bar{A_2} \cdots \bar{A_n}\).

Bubble pushing diagram showing a NOR gate equivalent to an AND gate with inverted inputs, and a NAND gate equivalent to an OR gate with inverted inputs.
Graphical “bubble pushing” interpretation of De Morgan's theorems: pushing an inversion bubble through a gate swaps AND with OR, so a NOR equals an AND with inverted inputs and a NAND equals an OR with inverted inputs.

Absorption and Consensus Theorems

Absorption Laws

\[ \begin{aligned} A + AB &= A,\quad A(A+B) = A \\ A + \bar{A}B &= A + B,\quad A(\bar{A}+B) = AB \end{aligned} \]

Consensus Theorem

\[ AB + \bar{A}C + BC = AB + \bar{A}C \]
\[ (A+B)(\bar{A}+C)(B+C) = (A+B)(\bar{A}+C) \]

The term \(BC\) (or \(B+C\)) is redundant.

Proof of \(A + \bar{A}B = A + B\):

\[ \begin{aligned} A + \bar{A}B &= A \cdot 1 + \bar{A}B = A(1+B) + \bar{A}B \\ &= A + AB + \bar{A}B = A + (A+\bar{A})B = A + B \end{aligned} \]

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)\).

Truth table for an example function \(F(A,B,C)\), with minterm/maxterm tags.
ABCF
0000 (\(M_0\))
0011 (\(m_1\))
0101 (\(m_2\))
0110 (\(M_3\))
1001 (\(m_4\))
1011 (\(m_5\))
1100 (\(M_6\))
1111 (\(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.

SECTION 06

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\).

Standard distinctive-shape symbols for AND, OR, NOT, NAND, NOR and XOR logic gates with their Boolean output expressions.
Standard distinctive-shape symbols for the six common logic gates — AND, OR, NOT, NAND, NOR and XOR — together with their Boolean output expressions.

XOR and XNOR

\[ A \oplus B = A\bar{B} + \bar{A}B \qquad \overline{A \oplus B} = AB + \bar{A}\bar{B}\;(\text{XNOR}) \]
\[ A \oplus B \oplus C = 1 \text{ when an odd number of inputs are 1} \]

Truth Tables and Universal Gates

Truth tables of all common two-input gates plus the inverter.
ABANDORNANDNORXORXNORNOT A
000011011
010110101
100110100
111100010

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.

Circuit diagrams realising NOT with one NAND gate, AND with two NAND gates, and OR with three NAND gates.
Realising the NOT, AND and OR functions using only NAND gates, illustrating why NAND is a universal gate.

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

\[ \begin{aligned} A \oplus 0 &= A, & A \oplus 1 &= \bar{A} \\ A \oplus A &= 0, & A \oplus \bar{A} &= 1 \\ A \oplus B &= B \oplus A & &(\text{commutative}) \\ (A \oplus B) \oplus C &= A \oplus (B \oplus C) & &(\text{associative}) \\ A \oplus B \oplus A &= B & &(\text{self-inverse}) \end{aligned} \]

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}\).

SECTION 07

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

  1. Group sizes must be powers of two: 1, 2, 4, 8, 16, …
  2. Groups should be as large as possible.
  3. Every 1 must belong to at least one group.
  4. Minimise the number of groups.
  5. Groups may wrap around the edges (the map is toroidal).
  6. 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:

Four-variable Karnaugh map for the example function with three coloured groups highlighting the four-corner term, an adjacent pair and a single pair, including toroidal wrap-around arrows.
Four-variable K-map grouping for \(F = \sum m(0,1,2,5,8,9,10)\). The dashed connectors indicate toroidal wrap-around, where the left/right and top/bottom edges of the map are adjacent.

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

\[ F = \bar{B}\bar{D} + \bar{B}\bar{C} + \bar{A}\bar{C}D \]

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).

Three timing waveforms illustrating a static-1 hazard glitching low, a static-0 hazard glitching high, and a dynamic hazard with multiple transitions.
Output behaviour of static-1, static-0 and dynamic hazards compared with the ideal response, showing the momentary glitches caused by unequal propagation delays.

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:

Size-four implicant groups (quads) found during Quine–McCluskey combination.
GroupPattern
(0,1,8,9)−00−
(0,2,8,10)−0−0
(2,6,10,14)−−10

Prime-Implicant Chart and Final Result

Prime implicants identified for the example function.
PIPatternCoversExpression
\(P_1\)−00−0,1,8,9\(\bar{B}\bar{C}\)
\(P_2\)−0−00,2,8,10\(\bar{B}\bar{D}\)
\(P_3\)−−102,6,10,14\(C\bar{D}\)
\(P_4\)0−011,5\(\bar{A}\bar{C}D\)
\(P_5\)01−15,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

\[ F = \bar{B}\bar{C} + C\bar{D} + \bar{A}BD \quad (\text{3 product terms, 7 literals}) \]
SECTION 08

Combinational Circuits

Combinational vs Sequential Circuits

Key differences between combinational and sequential logic.
CombinationalSequential
Output depends only on present inputsOutput depends on present and past inputs
No memory elementsHas memory (flip-flops, latches)
No feedback paths (typical)Contains feedback
Easier to design and analyseMore complex, needs a clock
Examples: adders, MUX, decodersExamples: registers, counters, FSMs
Two block diagrams: a combinational block with inputs and outputs only, and a sequential block with combinational logic feeding a memory register that feeds state back, clocked by a clock edge.
Block-level contrast between a purely combinational circuit and a sequential circuit, where memory elements feed the present state back into the combinational logic under control of a clock.

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.

ABSC
0000
0110
1010
1101
\[ S = A \oplus B \qquad C = AB \]
Half adder circuit with an XOR gate producing the sum and an AND gate producing the carry from inputs A and B.
Half-adder logic circuit: an XOR gate generates the sum bit and an AND gate generates the carry bit.

Full Adder

A full adder (FA) adds three bits (\(A + B + C_{in}\)) and can be cascaded to build \(n\)-bit adders.

AB\(C_{in}\)S\(C_{out}\)
00000
00110
01010
01101
10010
10101
11001
11111

Equations

\[ S = A \oplus B \oplus C_{in} \qquad C_{out} = AB + (A\oplus B)C_{in} \]
Full adder built from two half adders and an OR gate, with two XOR gates forming the sum and AND/OR gates forming the carry out.
Full adder constructed from two half adders and an OR gate: cascaded XOR gates form the sum while the AND gates and OR gate form the carry-out.

Ripple-Carry and Carry-Look-Ahead Adders

A ripple-carry adder (RCA) cascades \(n\) full adders, with each carry rippling to the next stage.

Four full adders cascaded in series with the carry rippling from the least significant stage to the most significant stage, producing sum bits and a final carry out.
Four-bit ripple-carry adder: full adders are chained so that each stage's carry-out becomes the next stage's carry-in, giving a total delay proportional to the number of bits.

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:

\[ \begin{aligned} C_1 &= G_0 + P_0 C_0 \\ C_2 &= G_1 + P_1 G_0 + P_1 P_0 C_0 \\ C_3 &= G_2 + P_2 G_1 + P_2 P_1 G_0 + P_2 P_1 P_0 C_0 \\ C_4 &= G_3 + \cdots + P_3 P_2 P_1 P_0 C_0 \end{aligned} \]
Hardware cost versus worst-case delay for common adder architectures.
Adder typeHardware costWorst-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

Four-bit adder/subtractor with four full adders, an XOR gate on each B input controlled by a mode line M, and M also driving the initial carry-in.
Reconfigurable 4-bit adder/subtractor: each \(B_i\) passes through an XOR gate controlled by the mode line \(M\), which also feeds the carry-in, selecting addition (\(M=0\)) or 2's-complement subtraction (\(M=1\)).

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.

A 4-to-1 multiplexer shown as a trapezoidal symbol with four data inputs and two select lines, alongside its AND-OR gate-level implementation with select-line inverters.
The 4-to-1 multiplexer: symbol with four data inputs \(I_0\)–\(I_3\) and two select lines, together with the AND–OR gate-level realisation.

Output Equation

\[ Y = \bar{S_1}\bar{S_0}I_0 + \bar{S_1}S_0 I_1 + S_1\bar{S_0}I_2 + S_1 S_0 I_3 \]

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\).

A 1-to-4 demultiplexer symbol with one data input, four outputs and two select lines, alongside a 2-to-4 decoder gate-level circuit using inverters and AND gates.
A 1-to-4 demultiplexer (left) and a 2-to-4 decoder (right). The DEMUX outputs are \(Y_0 = \bar{S_1}\bar{S_0}D\), \(Y_1 = \bar{S_1}S_0 D\), \(Y_2 = S_1\bar{S_0}D\) and \(Y_3 = S_1 S_0 D\).

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.

A 4-to-2 encoder block with four one-hot data inputs D0 to D3 and two coded outputs A1 and A0.
A 4-to-2 encoder converts a one-hot input into a 2-bit code, with \(A_0 = D_1 + D_3\) and \(A_1 = D_2 + D_3\).

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\).

A 1-bit magnitude comparator circuit producing A greater-than B, A equal-to B and A less-than B outputs from AND, XNOR and inverter gates.
A 1-bit magnitude comparator generating the three relational outputs \(A\gt B\), \(A=B\) and \(A\lt B\).

An \(n\)-bit comparator compares from MSB to LSB:

\[ A \gt B = \sum_{i=n-1}^{0} \left[ \prod_{j=n-1}^{i+1}\overline{(A_j \oplus B_j)} \right] A_i \bar{B_i} \]

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.

A seven-segment display layout with segments labelled a through g around the digit outline.
The seven-segment display with its segments labelled a–g; each segment is driven by its own minimised SOP expression of the BCD inputs.

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.

SECTION 09

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.

An SR latch made from two cross-coupled NOR gates with set and reset inputs and complementary outputs Q and Q-bar.
SR latch using cross-coupled NOR gates; the feedback paths (highlighted) store the latched state.
NOR SR latch (active-HIGH).
SR\(Q_{next}\)State
00\(Q\)Hold
010Reset
101Set
11?Forbidden
NAND SR latch (active-LOW).
\(\bar{S}\)\(\bar{R}\)\(Q_{next}\)State
11\(Q\)Hold
100Reset
011Set
00?Forbidden

Characteristic Equation

\[ Q_{next} = S + \bar{R} \cdot Q \quad \text{with constraint } S \cdot R = 0 \]

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 flip-flop.
D\(Q_{next}\)
00
11
JK flip-flop, \(Q_{next} = J\bar{Q} + \bar{K}Q\).
JK\(Q_{next}\)Action
00\(Q\)Hold
010Reset
101Set
11\(\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.

An SR latch from two cross-coupled NAND gates next to a gated D latch with front-end NAND gates, an inverter and an enable line.
NAND-based SR latch (left) and gated D latch (right), in which the enable input controls transparency.

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.

Excitation table giving the inputs required for each \(Q \rightarrow Q_{next}\) transition.
\(Q\)\(Q_{next}\)SRJKDT
000X0X00
01101X11
1001X101
11X0X010

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

\[ T_{clk,min} = t_{CQ} + t_{comb} + t_{su},\qquad f_{max} = \tfrac{1}{T_{clk,min}} \]

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})\).

Two D flip-flops in series clocked by the same clock, used to synchronise an asynchronous input and reduce metastability.
Two-flip-flop synchroniser used to bring an asynchronous signal safely into a clocked domain.

Setup and Hold Time

Timing diagram showing the clock, data and output waveforms with the setup window before the rising clock edge and the hold window after it, plus the clock-to-Q delay.
Setup-and-hold timing diagram: the data input must remain stable through the setup window (before the clock edge) and the hold window (after it); \(t_{CQ}\) marks the clock-to-output delay.

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.

SECTION 10

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.

Four D flip-flops chained so the output of each feeds the data input of the next, with a serial input, serial output and parallel Q taps, all sharing one clock.
A 4-bit shift register built from D flip-flops; the Q taps provide the parallel output for SIPO operation.

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\)).

A ring counter with direct feedback from the last flip-flop to the first, and a Johnson counter with complemented (twisted) feedback.
Ring counter (direct feedback) and Johnson counter (complemented “twisted” feedback) built from four flip-flops.

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.

Four flip-flops chained in a ripple counter where each output clocks the next stage, with a timing diagram showing cumulative propagation delay across the bits.
Asynchronous ripple counter and its timing: each stage triggers the next, so the total delay grows as \(n \cdot t_{pd}\).

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\).

A 3-bit synchronous up-counter using T flip-flops with an AND gate generating the toggle condition for the most significant bit, plus the MOD-8 output waveforms.
A 3-bit synchronous up-counter using T flip-flops, with the MOD-8 output waveforms. The toggle conditions are \(T_0 = 1\), \(T_1 = Q_0\), \(T_2 = Q_0 Q_1\), i.e. \(T_i = \prod_{j=0}^{i-1} Q_j\).

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:

\[ \begin{aligned} J_0 &= 1, & K_0 &= 1 \\ J_1 &= Q_0\bar{Q_2}, & K_1 &= Q_0 \\ J_2 &= Q_0 Q_1, & K_2 &= Q_0 \end{aligned} \]

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).

SECTION 11

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).

Two simple state diagrams: a Moore machine with outputs labelled inside the states, and a Mealy machine with outputs labelled on the transition arrows.
Comparison of Moore and Mealy state diagrams. In Moore machines outputs are tied to states; in Mealy machines outputs appear 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.

Block diagrams of a Moore machine, where the output logic is driven only by the state register, and a Mealy machine, where the input is also routed directly to the output logic.
Structural difference between Moore and Mealy machines: the direct input-to-output path in the Mealy structure is why its outputs are asynchronous.

FSM Design Procedure

  1. Problem statement → identify inputs and outputs.
  2. Draw the state diagram.
  3. Form the state table.
  4. State assignment: binary encoding.
  5. Choose the flip-flop type.
  6. Derive the next-state and output equations using K-maps.
  7. 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).

State diagrams for a 1011 sequence detector: a five-state Moore machine and a four-state Mealy machine.
State diagrams for the overlapping “1011” sequence detector: the Moore version needs five states (a separate output state), while the Mealy version needs only four.

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

Mealy state table for the “1011” detector (next state and output \(Z\)).
PresentNext stateOutput Z
X=0X=1X=0X=1
\(T_0\)\(T_0\)\(T_1\)00
\(T_1\)\(T_2\)\(T_1\)00
\(T_2\)\(T_0\)\(T_3\)00
\(T_3\)\(T_2\)\(T_1\)01

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

\[ D_1 = Q_0\bar{X} + Q_1 X, \qquad D_0 = X, \qquad Z = Q_1 Q_0 X \]

requiring two D flip-flops plus a small amount of combinational logic, with \(Z\) being a single 3-input AND.

SECTION 12

Logic Families

Overview of Logic Families

Major digital logic families and their key features.
FamilyKey feature
RTLResistor-transistor logic (obsolete)
DTLDiode-transistor logic (obsolete)
TTLTransistor-transistor logic (bipolar)
ECLEmitter-coupled logic (fastest bipolar)
I²LIntegrated injection logic (high-density bipolar)
MOSNMOS, PMOS logic
CMOSComplementary MOS (dominant today)
BiCMOSCombines 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

Comparison of standard TTL (74) and CMOS (74HC) characteristics.
ParameterStd TTL (74)CMOS (74HC)
\(V_{CC}\)5 V2–6 V
\(V_{OH}\) (min)2.4 V\(V_{CC} - 0.1\)
\(V_{OL}\) (max)0.4 V0.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 ns8 ns
Fan-out10 (TTL)\(\gt\)50

CMOS Power Dissipation

\[ P_{total} = P_{static} + P_{dynamic} = P_{leak} + \alpha \cdot C_L \cdot V_{DD}^2 \cdot f \]

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).

Transistor-level CMOS circuits for an inverter, a two-input NAND with parallel PMOS and series NMOS, and a two-input NOR with series PMOS and parallel NMOS.
Transistor-level CMOS inverter, NAND and NOR gates. In the NAND the PMOS devices are in parallel and the NMOS in series; in the NOR the arrangement is reversed, illustrating the duality of the pull-up and pull-down networks.

CMOS Inverter VTC and Power Dissipation

CMOS inverter voltage transfer characteristic curve with five operating regions marked and the switching threshold VM at the centre.
CMOS inverter voltage transfer characteristic, showing the five operating regions and the switching threshold \(V_M\) where both transistors are saturated.

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

\[ V_M = \frac{V_{Tn}+\sqrt{k_p/k_n}\,(V_{DD}+V_{Tp})}{1+\sqrt{k_p/k_n}} \]

For a symmetric design (\(k_n = k_p\)), \(V_M \approx V_{DD}/2\).

CMOS Power Dissipation Breakdown

\[ P_{total} = \underbrace{\alpha\, C_L\, V_{DD}^{2}\, f}_{\text{dynamic}} + \underbrace{I_{SC}\, V_{DD}}_{\text{short-circuit}} + \underbrace{I_{leak}\, V_{DD}}_{\text{static (leakage)}} \]

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.

Common TTL sub-families with typical propagation delay and power.
Series\(t_{pd}\) (ns)P (mW)Notes
74 (standard)1010Basic
74L (low power)331
74H (high speed)622
74S (Schottky)320No saturation
74LS (LP Schottky)102Most popular
74AS (advanced S)1.520
74ALS (advanced LPS)41

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\)

Three open-collector NAND gates whose outputs are tied to a common line with a single external pull-up resistor, forming a wired-AND.
Wired-AND of three open-collector gates: any output can pull the shared line LOW, so the line is HIGH only when all outputs are HIGH.

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 tristate buffer with enable, a CMOS transmission gate using parallel NMOS and PMOS, and three tristate buffers driving a shared bus.
Tristate buffer (with enable \(E\)), CMOS transmission gate, and three tristate drivers sharing a bus. Exactly one enable may be active at a time to avoid bus contention.

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})\).

13

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.

Tree diagram classifying semiconductor memory into volatile RAM (SRAM, DRAM) and non-volatile ROM (MROM, PROM, EPROM, EEPROM, Flash).
Classification of semiconductor memories into volatile RAM and non-volatile ROM, with the principal device types under each branch.

Memory Capacity

For \(n\) address lines and an \(m\)-bit word size:

\[ \text{Capacity} = 2^{n}\ \text{words} \times m\ \text{bits} = m\cdot 2^{n}\ \text{bits} \]

Example: 10 address lines with 8-bit words give \(2^{10}\times 8 = 1024\times 8 = 8\) Kbit.

RAM: SRAM versus DRAM

Comparison of static and dynamic RAM across the key design parameters.
ParameterSRAMDRAM
Storage elementFlip-flop (6 transistors)Capacitor + 1 transistor
Refresh required?NoYes (every few ms)
Access timeFaster (1–10 ns)Slower (10–50 ns)
Cost per bitHighLow
DensityLowHigh
PowerMore (static)Less (except refresh)
ApplicationCache memoryMain 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

Read-only memory families ordered by programming and erasing flexibility.
TypeProgrammingErasingApplication
MROMMask at factoryNot possibleFixed programs
PROMOnce, by user (fuse blowing)Not possibleSmall production runs
EPROMElectrically programmedUV light, whole chipDevelopment
EEPROMElectrically prog/eraseElectrically, byte levelBIOS, config data
FlashElectrically prog/eraseBlock levelSSDs, 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

Programmable logic device families distinguished by which array is fixed and which is programmable.
DeviceAND arrayOR arrayOutputs
ROMFixed (decoder)Programmable\(\sum m_i\) for each output
PALProgrammableFixedLimited product terms/output
PLAProgrammableProgrammableMost 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.

Programmable logic array showing inputs with their complements feeding a programmable AND plane that generates product terms P1, P2, P3, which connect through a programmable OR plane to outputs F1 and F2.
PLA architecture realising \(F_1=AB+\bar{A}C\) and \(F_2=AB+BC\). Each horizontal line is a product term formed in the programmable AND plane; programmable connections in the OR plane select which products reach each output.

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.

14

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:

\[ V_{out} = V_{ref}\cdot \frac{\sum_{i=0}^{n-1} b_i\cdot 2^{i}}{2^{n}} \]

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

ADC architectures arranged by the speed–resolution trade-off.
TypeSpeedResolution
Flash (parallel)Very high (GHz)Low (4–10 bits)
Successive approximation (SAR)Medium (MHz)Medium (8–16 bits)
Dual-slope integratingVery low (Hz–kHz)High (12–22 bits)
Sigma-delta (\(\Sigma\Delta\))Low to mediumVery high (16–24 bits)
Counter / rampLowMedium
Three-bit flash ADC with a resistor ladder generating seven reference levels, seven comparators each comparing the input against a tap, and a priority encoder producing the three-bit output.
Three-bit flash ADC: a resistor ladder sets seven thresholds, seven parallel comparators evaluate the input simultaneously, and a priority encoder converts the thermometer code to a binary output \(D_2 D_1 D_0\).

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

\[ f_s \geq 2 f_m \]

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:

\[ \text{SNR}_{dB} = 6.02\,n + 1.76\ \text{dB} \]

The dynamic range is approximately \(6.02\,n\) dB.

Ideal signal-to-noise ratio for common ADC resolutions.
ResolutionSNR
8-bit\(\approx 49.9\) dB
12-bit\(\approx 74.0\) dB
16-bit\(\approx 98.1\) dB
24-bit\(\approx 146\) dB
15

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.

16

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

Conversion equations between the four standard flip-flop types.
FromToFormula
SRJK\(S = J\bar{Q}\), \(R = KQ\)
SRD\(S = D\), \(R = \bar{D}\)
SRT\(S = T\bar{Q}\), \(R = TQ\)
JKD\(J = D\), \(K = \bar{D}\)
JKT\(J = T\), \(K = T\)
JKSR\(J = S\), \(K = R\) (with \(SR=0\))
DJK\(D = J\bar{Q} + \bar{K}Q\)
DT\(D = T \oplus Q\)
TD\(T = D \oplus Q\)
TJK\(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)

The standard Boolean laws and identities used in simplification.
LawIdentity
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

Conversion methods between common number systems.
From → ToMethodNotes
Any → DecimalPositional expansion\(\sum d_i r^{i}\)
Decimal → BinaryDivide by 2, take remaindersBottom-up
Decimal fraction → BinaryMultiply by 2, take integersTop-down
Binary → OctalGroup 3 bitsFrom binary point
Binary → HexGroup 4 bitsFrom binary point
Octal → BinaryEach digit → 3 bits
Hex → BinaryEach digit → 4 bits
Hex ↔ OctalVia binaryTwo-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

Distinguishing features of Mealy and Moore finite-state machines.
Mealy MachineMoore Machine
Output \(= f(\text{state, input})\)Output \(= f(\text{state})\)
Output changes asynchronously with inputOutput changes synchronously with clock
Generally fewer statesGenerally more states
Responds faster (same clock cycle)Responds one cycle later
Output may have glitchesGlitch-free output
Output labelled on arrows: input/outputOutput 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

  1. Convert \((ABC.D)_{16}\) to binary, octal, and decimal.
  2. Express \(-45\) in 8-bit sign-magnitude, 1's complement, and 2's complement.
  3. Simplify \(F = \sum m(0,1,3,5,7,8,9,11,15) + \sum d(6,14)\).
  4. Design a MOD-12 synchronous counter using T flip-flops.
  5. Implement \(F = \bar{A}BC + AB\bar{C} + ABC\) using only NAND gates.
  6. Design an overlapping "1011" sequence detector using both Moore and Mealy machines.
  7. Convert an SR flip-flop to a JK flip-flop.
  8. For a 16-bit ripple adder with \(t_{pd}=3\) ns per full adder, find the maximum operating frequency.
  9. Design a 4-to-1 MUX using 2-to-1 MUXes.
  10. 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.

17

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\):

\[ \begin{array}{r} 1101 \\ \times\ 1011 \\ \hline 1101 \\ 11010 \\ 000000 \\ 1101000 \\ \hline 10001111 \end{array} \]

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})\):

Booth recoding actions for each adjacent multiplier bit pair (ASR = arithmetic shift right of \(\{A,Q,Q_{-1}\}\)).
\(Q_i\)\(Q_{i-1}\)Action
00ASR
01\(A \leftarrow A+M\), then ASR
10\(A \leftarrow A-M\), then ASR
11ASR
Flowchart of Booth's multiplication algorithm: initialise accumulator and counter, test the two low-order bits, add or subtract the multiplicand, arithmetic shift right, decrement the counter, and loop until the counter reaches zero.
Booth's algorithm flowchart: the low-order bit pair \(Q_0 Q_{-1}\) selects add, subtract, or shift-only; the accumulator triple is arithmetic-shifted each cycle until the bit counter reaches zero.

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-by-step Booth multiplication of \(+4\) by \(-3\), tracking \(A\), \(Q\), and the appended bit \(Q_{-1}\).
Step\(A\)\(Q\)\(Q_{-1}\)Operation
Init000011010
1 (10)110011010\(A \leftarrow A - M\)
111001101ASR
2 (01)001001101\(A \leftarrow A + M\)
000100110ASR
3 (10)110100110\(A \leftarrow A - M\)
111010011ASR
4 (11)111010011ASR only
111101001ASR

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

\[ C = K + Z_3 Z_2 + Z_3 Z_1 \]

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

\[ N = (-1)^{S} \times 1.M \times 2^{\,E - \text{bias}} \]
Single- and double-precision IEEE 754 field widths and exponent bias.
FormatTotalSignExponentMantissa
Single precision32 bits18 (bias 127)23
Double precision64 bits111 (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

\[ A - B = A + [B]_{1\text{'c}} + \text{end-around carry} \]

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\).

18

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.

Choosing a combinational implementation method by design situation.
MethodWhen to use
MUXSingle output, minimal hardware
Decoder + ORMultiple outputs, shared variables
K-map minimisationStandard gate-level design
PLA/PALMany 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\).

Karnaugh map of F equals AB plus A-bar C showing two adjacent groups with the transition that causes a static-1 hazard, alongside a timing waveform where the output F dips briefly as A switches.
Static-1 hazard in \(F = AB + \bar{A}C\): the K-map shows the gap between the two prime-implicant groups, and the waveform shows the momentary glitch on \(F\) as \(A\) switches with \(B=C=1\).

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.

19

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.

Master-slave JK flip-flop: a master JK latch driving a slave JK latch, with the clock applied directly to the master and inverted to the slave, and the slave outputs fed back to the master inputs.
Master-slave JK flip-flop. The master latch follows the inputs while the clock is HIGH; the slave copies the master while the clock is LOW, making the overall device effectively negative-edge triggered.

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

Behavioural contrast between level-triggered latches and edge-triggered flip-flops.
Level-Triggered (Latch)Edge-Triggered (Flip-Flop)
Transparent when enable activeOpaque except at clock edge
Output follows input continuouslyOutput samples input at the edge only
Can cause feedback problemsSafe in feedback circuits
Smaller area, fasterLarger (\(\approx 2\times\) transistors)
Uses: pipeline stages, time borrowingUses: 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.

Timing comparison of non-pipelined and pipelined execution of four operations across four stages, showing that in steady state the pipeline completes one operation per clock cycle.
Non-pipelined versus pipelined execution: by overlapping the four stages of successive operations, the pipeline delivers one completed operation per clock cycle in steady state.

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.

20

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.

Inverting op-amp Schmitt trigger with feedback resistors R1 and R2, its hysteresis transfer loop between the lower and upper thresholds, and an illustration of a noisy input being cleaned into a sharp digital output.
Inverting op-amp Schmitt trigger, its hysteresis loop between \(V_{LT}\) and \(V_{UT}\), and the cleaning of a noisy input into a glitch-free digital output.

Threshold Voltages

\[ V_{UT} = V_{OH}\cdot\frac{R_2}{R_1+R_2},\quad V_{LT} = V_{OL}\cdot\frac{R_2}{R_1+R_2},\quad V_{H} = V_{UT}-V_{LT} \]

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.

Internal block diagram of the 555 timer: a three-resistor divider sets the two-thirds and one-third reference levels, two comparators drive an SR latch, an output buffer drives pin 3, and a discharge transistor connects to pin 7.
Internal architecture of the 555 timer: the resistive divider sets the comparator references at \(\tfrac{2}{3}V_{CC}\) and \(\tfrac{1}{3}V_{CC}\), the comparators set and reset the SR latch, and the latch drives both the output buffer and the discharge transistor.

Monostable

\[ T = 1.1\,R\,C \]

Astable

\[ T_{H} = 0.693(R_1+R_2)C,\quad T_{L} = 0.693\,R_2 C,\quad f = \frac{1.44}{(R_1+2R_2)C},\quad \text{DC} = \frac{R_1+R_2}{R_1+2R_2} \]

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.

Sample-and-hold circuit with an input buffer, a sampling switch, a hold capacitor, and an output buffer, alongside timing waveforms showing the output tracking the input during sample and freezing during hold.
Sample-and-hold circuit: an input buffer drives a switch and hold capacitor feeding an output buffer; during sample the output tracks the input, and during hold it freezes the captured voltage.

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.

Four-bit R-2R ladder DAC with rungs of resistance R, shunt resistors of 2R at each bit node, bit switches selecting between the reference voltage and ground, and a summing op-amp producing the analog output.
Four-bit R-2R ladder DAC: each bit switch connects its \(2R\) leg to \(V_{ref}\) (for a 1) or ground (for a 0); the summing op-amp converts the ladder current into the analog output voltage.

Total Output

\[ V_{out} = -V_{ref}\cdot\frac{R_f}{R}\cdot\frac{1}{2^{n}}\sum_{i=0}^{n-1} b_i\cdot 2^{i} \]

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.

Successive-approximation ADC: a sample-and-hold feeds one input of a comparator, the SAR and control logic drive an internal DAC whose output forms the other comparator input, and the SAR produces the digital output bit by bit.
SAR ADC architecture: the comparator tests the held input against the internal DAC output, and the SAR control logic sets or clears each bit from MSB to LSB over \(n\) clock cycles.

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

SAR binary search converging on the code 1010 for a 5 V input with an 8 V reference.
StepTry\(V_{DAC}\)Action
110004.0\(\lt V_{in}\): keep
211006.0\(\gt V_{in}\): clear
310105.0\(= V_{in}\): keep
410115.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.

Dual-slope ADC integrator waveform showing a fixed-time upward ramp proportional to the input followed by a fixed-slope downward ramp, alongside a first-order sigma-delta modulator with a summing node, integrator, one-bit comparator, feedback DAC, and decimation filter.
Dual-slope integrator waveform (run-up time \(T_1\) fixed, run-down time \(T_2 \propto V_{in}\)) and a first-order sigma-delta modulator with its integrator, one-bit quantiser, feedback DAC, and decimating low-pass filter.

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.

21

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

Voltage transfer characteristic of a CMOS inverter showing the logic-0 input region, forbidden transition zone, and logic-1 input region, with the switching threshold VM on the unity-gain line and the high and low noise margins marked beside the axis.
CMOS inverter voltage transfer characteristic: the unity-gain points define \(V_{IL}\) and \(V_{IH}\), the switching threshold \(V_M\) lies on the \(V_{out}=V_{in}\) line, and the high and low noise margins separate the valid logic regions from the forbidden zone.

Noise Margin Definitions

\[ \begin{aligned} NM_H &= V_{OH(min)} - V_{IH(min)} \quad \text{(HIGH noise margin)} \\ NM_L &= V_{IL(max)} - V_{OL(max)} \quad \text{(LOW noise margin)} \end{aligned} \]

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

\[ t_{pd} \approx \frac{C_L\cdot V_{DD}}{2\cdot I_{D,sat}} = \frac{C_L\cdot V_{DD}}{\mu C_{ox}(W/L)(V_{DD}-V_T)^{2}} \]

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:

\[ t_{pd,loaded} = t_{pd,intrinsic} + N_{load}\cdot C_{gate}\cdot R_{driver} \]

where \(N_{load}\) is the number of loads driven.

High fan-out solutions: buffer chains, clock trees, and wire-sizing.

22

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.

Chip-select decoding for a 16K×8 memory built from four 4K×8 chips.
\(A_{13}\)\(A_{12}\)Chip selectedAddress range
00Chip 00000–0FFF
01Chip 11000–1FFF
10Chip 22000–2FFF
11Chip 33000–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

\[ h = \frac{\text{Hits}}{\text{Total accesses}},\qquad T_{avg} = h\cdot T_{cache} + (1-h)\cdot T_{main} \]

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

Side-by-side comparison of direct mapping, two-way set-associative, and fully associative cache organisations, showing how main-memory blocks map onto cache lines in each scheme.
The three cache organisations: in direct mapping block \(i\) maps to line \(i \bmod 4\); in two-way set-associative mapping block \(i\) maps to set \(i \bmod 2\) and either way within it; in fully associative mapping any block may occupy any line.
Trade-offs between the three cache mapping schemes.
AspectDirectSet assoc.Fully assoc.
Hardware complexityLowestMediumHighest
Comparators1\(w\) (per set)\(n\) (all)
Hit ratioLowestMediumHighest
Conflict missesManyFewNone

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

\[ FC = \frac{\text{Number of faults detected}}{\text{Total faults}}\times 100\% \]

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).

Common primitive-polynomial tap positions for maximal-length LFSRs.
\(n\)Taps (XOR positions)
33, 2
44, 3
55, 3
88, 6, 5, 4
1616, 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.

23

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)

  1. Multiply \((-5)\times(+3)\) using the 4-bit Booth algorithm; show each iteration.
  2. Represent \(-0.15625\) in IEEE 754 single-precision format.
  3. Design a 555 astable for 1 kHz with 60% duty cycle; find \(R_1\), \(R_2\), \(C\).
  4. 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\).
  5. A 12-bit SAR ADC with a 10 MHz clock: find the conversion time.
  6. A 4-stage pipeline with \(t_s=10\) ns, \(t_{reg}=1\) ns: find throughput and speedup.
  7. Design a \(32\text{K}\times 16\) memory using \(8\text{K}\times 8\) chips. How many chips?
  8. Cache hit ratio \(h=0.95\), \(T_c=2\) ns, \(T_m=50\) ns: find \(T_{avg}\).
  9. 3-bit LFSR (taps 3, 2): list the full sequence starting from 001.
  10. Implement \(F=\bar{A}B+AC\) using (a) a 4:1 MUX, (b) a 3-to-8 decoder + OR gate.
  11. Show that a transmission gate passes a full \(V_{DD}\) and full ground, unlike a single NMOS switch.
  12. Derive the condition for hazard-free SOP via adjacent-1 analysis.
  13. CMOS NAND with \(C_L=50\) fF, \(V_{DD}=1.8\) V, \(I_D=100\,\mu\)A: estimate \(t_{pd}\).
  14. Find the oversampling ratio of a \(\Sigma\Delta\) ADC for 24 dB gain (first-order).
  15. 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\).

24

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

  1. Morris Mano & Michael Ciletti — Digital Design, 5th/6th edition, Pearson.
  2. R. P. Jain — Modern Digital Electronics, Tata McGraw-Hill.
  3. Thomas L. Floyd — Digital Fundamentals, Pearson.
  4. Ronald J. Tocci — Digital Systems: Principles and Applications, Pearson.
  5. A. Anand Kumar — Fundamentals of Digital Circuits, PHI.
  6. A. Anand Kumar — Switching Theory and Logic Design, PHI.
  7. Malvino & Leach — Digital Principles and Applications, McGraw-Hill.
  8. Stephen Brown & Zvonko Vranesic — Fundamentals of Digital Logic with Verilog Design.
  9. Jan Rabaey — Digital Integrated Circuits: A Design Perspective, Pearson.
  10. 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.