Original BCA Nepal study material. Units and topic order follow the approved 2025 BCA103 outline. All explanations, truth tables, worked examples, and diagrams are original BCA Nepal material; they are not reproduced TU text. Official syllabus facts (unit titles, topic titles, teaching hours, credits, objectives, references) come from the course outline.

Course overview

BCA103 covers the logical and mathematical foundations of all digital hardware: number systems and codes, Boolean algebra and minimization, combinational circuits (outputs depend only on current inputs), and sequential circuits (outputs depend on current inputs and stored state). Class load is 6 hours per week (3 lecture, 3 practical), 3 credits. Course objectives: provide concepts for designing and analyzing digital systems, enable design of combinational logic circuits, and enable design of sequential logic circuits and programmable memory.

Mastering this course is essential for understanding computer architecture, embedded systems, and hardware description languages. Exam questions fall into predictable categories: number-system conversion, binary arithmetic and complements, truth tables and gate realization, Boolean simplification, Karnaugh maps, adder/subtractor/mux/decoder design, flip-flop truth tables and excitation tables, and counter/register design.

Learning outcomes

Derived from the approved 2025 TOC only. After completing this course, you can:

  • Convert between binary, octal, decimal, and hexadecimal (integer and fractional parts); perform binary arithmetic.
  • Compute r's and (r−1)'s complements; subtract using 2's complement; identify BCD, ASCII, Excess-3, Gray, and parity codes.
  • Construct truth tables for AND, OR, NOT, NAND, NOR, EXOR, EXNOR gates.
  • Apply Boolean postulates and theorems; derive SOP and POS canonical forms; simplify with Boolean laws.
  • Minimize functions with Karnaugh maps and describe the Quine-McCluskey tabular method.
  • Design combinational circuits: half/full adders and subtractors, encoders, decoders, multiplexers, demultiplexers, comparators, code converters, parity circuits.
  • Describe ROM, PAL, and PLA programmable logic devices.
  • Draw state diagrams; distinguish Moore and Mealy machines; explain triggering types.
  • Draw truth tables and characteristic equations for SR, D, T, JK, and master-slave JK flip-flops.
  • Design asynchronous and synchronous counters (ripple, ring, mod-10, mod-5/7/11); compare shift register modes SIPO, SISO, PIPO, PISO, bidirectional.

Unit 1: Digital Design Fundamentals and Number System

Teaching hours: 8

1.1 Analog and digital signal

An analog signal varies continuously in time and amplitude and can take any value within a range (for example, the voltage from a microphone). A digital signal is discrete in time and amplitude; in binary digital systems it takes only two levels, logic 0 (low) and logic 1 (high).

Property Analog signal Digital signal
Values Infinite, continuous Finite, discrete (usually two levels)
Noise Accumulates and degrades quality Noise immunity — wide margins between 0 and 1
Regeneration Not possible without distortion Can be regenerated cleanly
Typical storage Tape, vinyl, film RAM, flash, magnetic disk
Examples Analog thermometer, ECG trace Calculator, computer, smartphone

Why digital dominates: digital signals can be regenerated without accumulating noise, circuits are easier to make reliable, and VLSI integration of billions of transistors is practical.

Self-check: Name one advantage of a digital signal over an analog signal. Answer: Noise immunity — logic levels can be regenerated without noise accumulation.

Exam pointers: Define analog vs digital signal; give one example of each; state one advantage of digital.

1.2 Analog and digital system

A digital system processes information in discrete (binary) form — all modern computers are digital systems. An analog system processes continuously varying quantities. Real systems often combine both: an ADC (Analog-to-Digital Converter) converts sensor analog data into digital form for processing, and a DAC (Digital-to-Analog Converter) converts digital results back to analog (for example, audio output).

Self-check: What does ADC stand for and what does it do? Answer: Analog-to-Digital Converter; converts continuous analog signals into discrete digital values.

Exam pointers: Define analog and digital systems; explain where ADC and DAC fit in a mixed system.

1.3 Number system representation

In positional notation with base (radix) r, each digit position represents a power of r. The rightmost integer digit is position 0; fractional digits use negative powers.

General formula: Value = Σ (dᵢ × rⁱ), where dᵢ is the digit at position i.

Example: 237₁₀ = 2×10² + 3×10¹ + 7×10⁰ = 200 + 30 + 7.

Positions left of the point have increasing positive powers; positions right of the point have powers r⁻¹, r⁻², ...

Self-check: In 543.25₁₀, what is the weight of the digit 5? Answer: 10² = 100.

Exam pointers: State the positional-value formula; compute a decimal number by expansion.

1.4 Number systems and their conversion

Four bases matter in this course: binary (2), octal (8), decimal (10), and hexadecimal (16). Conversions use repeated division (integer part) and repeated multiplication (fractional part).

Self-check: Which conversion method uses repeated division by the base? Answer: Decimal-to-other-base integer conversion: divide by the base and collect remainders bottom-up.

Exam pointers: Name the four bases and their digit sets; state the division/multiplication conversion methods.

1.4.1 Binary number system

Base 2 with digits 0 and 1. Each position is a power of 2.

Binary to decimal: multiply each bit by 2ⁿ and add.

Example: 1011₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8 + 0 + 2 + 1 = 11₁₀.

Binary fraction: 0.101₂ = 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 0.5 + 0 + 0.125 = 0.625₁₀.

Self-check: Convert 1101₂ to decimal. Answer: 8 + 4 + 0 + 1 = 13₁₀.

Exam pointers: Convert binary (integer and fraction) to decimal with positional expansion.

1.4.2 Octal number system

Base 8 with digits 0–7. Octal is convenient because each octal digit maps to exactly 3 binary bits.

Binary to octal: group bits in threes from the binary point (right for integers), convert each group.

Example: 101011₂ → 101 011 → 5 3 → 53₈.

Octal to decimal: 53₈ = 5×8¹ + 3×8⁰ = 40 + 3 = 43₁₀.

Decimal to octal: divide by 8 repeatedly, remainders bottom-up. 43 ÷ 8 = 5 R 3; 5 ÷ 8 = 0 R 5 → 53₈.

Self-check: Convert 101011₂ to octal. Answer: Group 101|011 → 5|3 → 53₈.

Exam pointers: Convert between binary and octal using 3-bit grouping; convert octal to decimal.

1.4.3 Decimal number system

Base 10 with digits 0–9 — the system humans normally use, with positional powers of 10. All decimal numbers convert to/from other bases by the division (integer) and multiplication (fraction) methods.

Decimal to binary example: 43₁₀:

43 ÷ 2 = 21 R 1   (LSB)
21 ÷ 2 = 10 R 1
10 ÷ 2 =  5 R 0
 5 ÷ 2 =  2 R 1
 2 ÷ 2 =  1 R 0
 1 ÷ 2 =  0 R 1   (MSB)
Read bottom-up: 101011₂
Verify: 32+8+2+1 = 43 ✓

Self-check: What is the MSB of the binary result for decimal 43? Answer: 1 (from the last division, 1 ÷ 2 = 0 R 1).

Exam pointers: Convert decimal to binary by repeated division; verify by reconverting.

1.4.4 Hexadecimal number system

Base 16 with digits 0–9 and A–F (A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit maps to exactly 4 binary bits.

Binary to hex: group bits in fours from the point.

Example: 10101111₂ → 1010 1111 → A F → AF₁₆ = 10×16 + 15 = 175₁₀.

Hex to decimal: AF₁₆ = A×16¹ + F×16⁰ = 160 + 15 = 175₁₀.

Self-check: Convert AF₁₆ to decimal. Answer: 10×16 + 15×1 = 175₁₀.

Exam pointers: Convert binary to hex via 4-bit groups; convert hex to decimal; list hex digit values A–F.

1.5 Representation of signed numbers, floating point numbers

Sign-magnitude: the most significant bit is the sign (0 = positive, 1 = negative); the rest is magnitude. For n bits, range is −(2ⁿ⁻¹−1) to +(2ⁿ⁻¹−1), and zero has two representations (+0 and −0). Arithmetic hardware must examine the sign separately — a drawback.

Floating point: IEEE 754 single precision uses 32 bits: 1 sign, 8 exponent, 23 mantissa. Value = (−1)ˢ × 1.mantissa × 2^(exponent − 127). It represents very large or very small numbers, but not all decimal fractions are exactly representable (for example, 0.1).

Self-check: What is a drawback of sign-magnitude representation? Answer: Two representations of zero, and sign must be handled separately in arithmetic.

Exam pointers: Describe sign-magnitude range and its zero problem; state the IEEE 754 single-precision layout and formula.

1.6 Complement of number systems

Complements simplify subtraction as addition. For base r with n digits:

  • (r−1)'s complement (diminished radix): subtract each digit from r−1.
  • r's complement: (r−1)'s complement plus 1.

Self-check: State the formula for r's complement in words. Answer: r's complement = (r−1)'s complement + 1.

Exam pointers: Define (r−1)'s and r's complement for an arbitrary base r.

1.6.1 r's complement

For binary, r = 2: 2's complement = invert all bits (1's complement), then add 1. It is the standard way modern hardware represents negative integers.

Example: 2's complement of 00101101 (45₁₀):

1's complement: 11010010
Add 1:          11010011   → represents −45 in 8-bit 2's complement
Verify: unsigned value 211; 211 − 256 = −45 ✓

For decimal, r = 10: 10's complement = 9's complement + 1, used in BCD arithmetic.

Self-check: Find the 2's complement of 45₁₀ in 8 bits. Answer: 45 = 00101101; invert → 11010010; +1 → 11010011.

Exam pointers: Compute 2's complement of an 8-bit number; show verification.

1.6.2 (r-1)'s complement (with r as 2 or 10)

For binary (r = 2), (r−1)'s = 1's complement: invert every bit (0→1, 1→0).

Example: 1's complement of 10110010₂ = 01001101₂.

For decimal (r = 10), 9's complement: subtract each digit from 9. Example: 9's complement of 429 = 570 (9−4=5, 9−2=7, 9−9=0).

Self-check: What is the 1's complement of 11001100₂? Answer: 00110011₂.

Exam pointers: Compute 1's complement (binary) and 9's complement (decimal) with examples.

1.7 Binary arithmetic

Addition rules: 0+0=0; 0+1=1; 1+0=1; 1+1=0 carry 1; 1+1+1=1 carry 1.

Example: 1101 + 1011 = 11000.

Subtraction: perform A − B by adding A to the 2's complement of B. If a carry comes out of the most significant bit, discard it and the result is positive; if no carry, the result is negative and its magnitude is the 2's complement of the result.

Example: 7 − 3 in 4 bits: 0111 + 2's complement of 0011 (1101) = 10100; discard carry → 0100 = 4 ✓.

Multiplication: shift-and-add (like decimal long multiplication). Division: shift-and-subtract.

Self-check: In 2's complement subtraction, what do you do if a carry is generated out of the MSB? Answer: Discard the carry; the result is positive.

Exam pointers: Show binary addition with carries; perform subtraction via 2's complement with carry handling.

1.8 Representation of BCD, ASCII, Excess-3, Gray code, error detection codes

BCD (Binary Coded Decimal): each decimal digit is encoded separately as 4 bits. Example: 429₁₀ = 0100 0010 1001 (not the same as binary 429 = 110101101). Used where decimal accuracy matters, such as calculators.

ASCII: 7-bit code for characters and control characters. 'A' = 65 (1000001), 'a' = 97, '0' = 48, space = 32.

Excess-3 (XS-3): BCD + 3 per digit; self-complementing, useful for BCD subtraction. Example: 429 → (4+3)=7=0111, (2+3)=5=0101, (9+3)=12=1100 → 0111 0101 1100.

Gray code: adjacent values differ by exactly one bit; used in shaft encoders to avoid multi-bit transition errors.

Decimal: 0 1 2 3 4 5 6 7
Binary:  000 001 010 011 100 101 110 111
Gray:    000 001 011 010 110 111 101 100

Binary→Gray: MSB stays the same; each next Gray bit = XOR of two adjacent binary bits. Gray→Binary: MSB stays the same; each next binary bit = XOR of previous binary bit and current Gray bit.

Error detection codes: a parity bit is appended so the total number of 1s is even (even parity) or odd (odd parity). It detects a single-bit error but cannot correct it and misses two-bit errors. Hamming codes detect and correct single-bit errors; CRC detects multi-bit errors in storage and communication.

Worked example — Binary to Gray: 1101₂ → Gray: MSB 1; 1⊕1=0; 1⊕0=1; 0⊕1=1 → 1011. Check Gray→Binary: 1; 1⊕0=1; 1⊕1=0; 0⊕1=1 → 1101 ✓.

Self-check: Convert binary 1101 to Gray code. Answer: 1011 (MSB 1; 1⊕1=0; 1⊕0=1; 0⊕1=1).

Exam pointers: Encode a decimal in BCD, Excess-3, and Gray; convert binary↔Gray; state parity-bit capability and limits.

Key terms — Unit 1

Radix · positional notation · MSB/LSB · ADC/DAC · 1's complement · 2's complement · BCD · Gray code · parity bit · sign-magnitude · IEEE 754

Unit 1 summary

This unit established the analog/digital distinction, positional number representation, and conversions among binary, octal, decimal, and hexadecimal (including fractions), signed-number representation, complements for subtraction, binary arithmetic, and codes (BCD, ASCII, Excess-3, Gray, parity/Hamming). Each conversion method includes a worked example you can reproduce by hand.

Expanded chapter notes

The physical world operates on continuous quantities. Variables like temperature, pressure, sound waves, and light intensity change smoothly over time. Early computing and communication systems attempted to model these continuous physical changes directly. However, continuous variables are highly susceptible to degradation. A slight drop in voltage across a long wire changes the exact value of the signal, which permanently alters the information it carries. Digital logic abandons this continuous approach. Instead of measuring exact physical quantities, digital systems map ranges of physical values into distinct, separated states. Information is broken down into discrete symbols, usually represented as numbers. This abstraction allows engineers to design systems that process information with perfect mathematical reliability. A small drop in voltage does not change a digital signal, because the system only cares whether the voltage is above or below a specific threshold. This fundamental shift from continuous measurement to discrete counting forms the basis of all modern computing. To understand digital logic, one must first understand how physical signals are categorized. From there, one must learn how numbers can represent any piece of discrete information. This unit establishes the mathematical foundation required to design circuits that process binary data.

1.1 Analog and digital Signal

The Nature of Analog Signals

An analog signal is a continuous physical quantity that varies smoothly over time. It can take on an infinite number of values within any given range. If you measure the temperature of a room over an hour, the temperature does not jump instantly from 20 degrees to 21 degrees. It passes through 20.1, 20.15, and every other fractional value in between. An analog electrical signal represents this physical reality by varying its voltage or current in direct proportion to the physical quantity. Because analog signals have infinite resolution, they theoretically carry an infinite amount of information. The exact shape of the waveform holds the data. However, this infinite resolution is also the primary weakness of analog signals. Any electrical system experiences random fluctuations called noise. When noise mixes with an analog signal, the original waveform is permanently distorted. The receiving equipment has no way to separate the intended original voltage from the added noise voltage. Furthermore, analog signals degrade over distance. As a signal travels through a copper wire, the resistance of the wire reduces the signal's amplitude. Engineers use amplifiers to boost the signal back to its original strength. Unfortunately, an amplifier boosts the accumulated noise just as much as it boosts the intended signal. Over long distances or multiple stages of amplification, the signal-to-noise ratio drops until the original information becomes completely unreadable.

Unit 2: Boolean Algebra and its Simplification

Teaching hours: 8

2.1 Basic logic gates: AND, OR and NOT

Logic gates process binary inputs to produce one binary output.

Gate Symbol Boolean expression 2-input truth table
AND A · B 1 only if all inputs are 1 0·0=0, 0·1=0, 1·0=0, 1·1=1
OR A + B 1 if any input is 1 0+0=0, 0+1=1, 1+0=1, 1+1=1
NOT Ā inverse of input 0→1, 1→0

Swipe to see all columns

Use case: an AND gate can enable a signal only when all conditions are true; an OR gate triggers if any condition is true.

Self-check: What is 1 AND 0? Answer: 0.

Exam pointers: Draw symbols and truth tables for AND, OR, NOT; state the Boolean expression of each.

2.2 Universal logic gates: NAND and NOR

A universal gate can implement any Boolean function by itself.

NAND: output = NOT(A·B). NOR: output = NOT(A+B).

Proof of universality: NOT = NAND with both inputs tied together; AND = NAND followed by a NAND-NOT; OR = (A NAND B) then invert using De Morgan equivalents. NAND is preferred in CMOS VLSI because it needs fewer transistors per gate than AND or OR.

Self-check: How do you make a NOT gate from a single NAND gate? Answer: Tie both NAND inputs together.

Exam pointers: Define NAND/NOR; show how NOT, AND, OR are built from NAND; state why NAND is common in CMOS.

2.3 Extended/derived logic gates: Ex-OR and Ex-NOR

EXOR (Exclusive OR): output is 1 when inputs differ. F = A ⊕ B = A·B̄ + Ā·B.

EXNOR: output is 1 when inputs are equal. F = A ⊙ B = A·B + Ā·B̄ = (A ⊕ B)̄.

A B EXOR EXNOR
0 0 0 1
0 1 1 0
1 0 1 0
1 1 0 1

Swipe to see all columns

EXOR gives the sum bit in adders and is used in comparators and parity generators; EXNOR is used in equality comparators.

Self-check: What is 1 EXOR 1? Answer: 0 (inputs are equal, so EXOR output is 0).

Exam pointers: Give truth tables and Boolean expressions for EXOR and EXNOR; name one application of each.

2.4 Boolean algebra

Boolean algebra manipulates binary variables with operators + (OR), · (AND), and̄ (NOT).

2.4.1 Postulates and theorems

Huntington's postulates:

  1. Closure: A+B and A·B are in {0,1}.
  2. Identity: A+0 = A; A·1 = A.
  3. Commutative: A+B = B+A; A·B = B·A.
  4. Distributive: A·(B+C) = A·B + A·C; A+(B·C) = (A+B)·(A+C).
  5. Complement: A+Ā = 1; A·Ā = 0.
  6. 0 ≠ 1 (two distinct elements).

Derived theorems:

  • Idempotent: A+A = A; A·A = A.
  • Null: A+1 = 1; A·0 = 0.
  • Involution: (Ā)̄ = A.
  • Absorption: A+(A·B) = A; A·(A+B) = A.
  • De Morgan's theorems: (A·B)̄ = Ā+B̄; (A+B)̄ = Ā·B̄. Mnemonic: "break the bar, change the operator."

Self-check: Simplify A + A·B using a theorem. Answer: A (absorption law).

Exam pointers: List Huntington's postulates; apply De Morgan's to complement an expression.

2.4.2 Canonical forms (SOP, POS)

Every Boolean function can be written uniquely as a sum of minterms (SOP) or product of maxterms (POS).

SOP (Sum of Products): each minterm includes every variable exactly once (complemented if the variable is 0 in that row). For F(A,B,C) = 1 at rows 1, 3, 5, 7: F = Σm(1,3,5,7) = Ā·B̄·C + Ā·B·C + A·B̄·C + A·B·C.

POS (Product of Sums): each maxterm covers a 0-output row. For the same function, 0s at rows 0, 2, 4, 6: F = ΠM(0,2,4,6) = (A+B+C)·(A+B̄+C)·(Ā+B+C)·(Ā+B̄+C).

Self-check: In minterm m₃ of F(A,B,C) (row 011), how is A written? Answer: Uncomplemented A (because A = 1 in row 3).

Exam pointers: Write SOP and POS canonical forms from a truth table; define minterm and maxterm.

2.4.3 Simplification of Boolean functions using laws

Apply theorems step by step, naming each law:

F = A·B·C + A·B·C̄ + Ā·B·C
  = A·B·(C + C̄) + Ā·B·C     [Distributive]
  = A·B·1 + Ā·B·C            [Complement: C+C̄=1]
  = A·B + Ā·B·C              [Identity]
  = B·(A + Ā·C)              [Distributive]
  = B·(A + C)                [Absorption: A + Ā·C = A + C]

Final minimal form: F = B·(A + C).

Self-check: Name the law used to go from C + C̄ to 1. Answer: Complement law.

Exam pointers: Simplify a 3-term expression, naming the postulate or theorem at each step.

2.5 Simplification of logic function using Karnaugh Map

A K-map is a grid of cells (one per minterm) arranged in Gray-code order so that adjacent cells differ in exactly one variable. Group adjacent 1s (for SOP); each group's size must be a power of 2 (1, 2, 4, 8, ...). Larger groups eliminate more variables.

Grouping rules: rectangles only; wrap-around allowed; every 1 covered at least once; overlap permitted; group of 2 eliminates 1 variable, group of 4 eliminates 2, group of 8 eliminates 3.

Layouts (minterm numbering):

  • 2 variables: cells m0..m3 in a 2×2 grid.
  • 3 variables: columns B̄C̄, B̄C, BC, BC̄; rows Ā, A.
  • 4 variables: columns C̄D̄, C̄D, CD, CD̄; rows ĀB̄, ĀB, AB, AB̄ — 16 cells.

Worked example — 4-variable K-map: F(A,B,C,D) = Σm(0,1,2,3,8,9,10,11).

        C̄D̄   C̄D   CD   CD̄
ĀB̄     [ 1 |  1 |  1 |  1 ]   row ĀB̄: group of 4 → ĀB̄
ĀB     [ 0 |  0 |  0 |  0 ]
AB     [ 0 |  0 |  0 |  0 ]
AB̄     [ 1 |  1 |  1 |  1 ]   row AB̄: group of 4 → AB̄

Both rows share B̄, so together they form a group of 8: F = B̄.

Self-check: In a group of 4 cells, how many variables are eliminated from the term? Answer: 2 variables.

Exam pointers: Draw a 4-variable K-map, group 1s, and write the minimal SOP; state grouping rules.

2.5.1 Analysis of SOP and POS expressions

For POS minimization, group the 0s instead of the 1s; each group yields a sum term (a maxterm combination), and the product of these sums is the minimal POS. Don't-care cells (d) may be included in a group if it helps make a larger group, but do not need to be covered.

Self-check: When minimizing for POS, which cell values do you group? Answer: The 0s.

Exam pointers: Group 0s for POS; explain don't-care usage.

2.6 Simplification of up to 5 variable Boolean expression using Quine-McCluskey minimization technique (tabular method)

Quine-McCluskey is a tabular, algorithmic method that works for any number of variables (unlike K-maps, which are practical only up to about 4–5 variables) and suits computer implementation.

Steps:

  1. List minterms in binary, grouped by count of 1s.
  2. Compare adjacent groups; terms differing in exactly one bit combine, replacing that bit with a dash (–); mark combined terms.
  3. Repeat until no more combinations. Uncombined terms are prime implicants.
  4. Build a prime implicant chart (rows = prime implicants, columns = minterms).
  5. Select essential prime implicants (cover minterms covered by only one row), then cover remaining minterms with the minimum extra rows (Petrick's method or greedy choice).

Example: F(A,B,C,D) = Σm(0,1,2,3,8,9,10,11) — combining yields prime implicants covering the two groups of 4; essential cover gives F = B̄ (matching the K-map result). QM generalizes to 5 variables identically, just with more columns.

Self-check: What is the output of step 3 in Quine-McCluskey called? Answer: Prime implicants.

Exam pointers: List the QM steps in order; state its advantage over K-maps (handles more variables, algorithmic).

Key terms — Unit 2

Minterm · maxterm · SOP · POS · prime implicant · essential prime implicant · K-map adjacency · don't-care · Quine-McCluskey · De Morgan's theorem · universal gate

Unit 2 summary

This unit covered basic and universal gates (AND/OR/NOT, NAND/NOR universality), EXOR/EXNOR, Huntington's postulates and derived theorems, De Morgan's laws, SOP/POS canonical forms, algebraic simplification with named laws, K-map grouping and a worked 4-variable example, POS analysis, don't-cares, and the Quine-McCluskey tabular method with its five steps. Every simplification method is illustrated with a concrete example.

Expanded chapter notes

Unit 1 established how digital systems represent information using binary numbers. However, numbers alone are abstract mathematical concepts. To build a functioning computer, engineers must design physical hardware that can manipulate these binary values. This requires a system of logic that translates mathematical operations into electrical signals. In the mid-nineteenth century, mathematician George Boole developed a formal algebraic system for logic. Boolean algebra does not deal with continuous quantities. It only evaluates statements that are strictly true or strictly false. Decades later, Claude Shannon realized that Boole's two-state algebra mapped perfectly to electrical circuits. A closed switch represents a true state, and an open switch represents a false state. This connection gave birth to the logic gate. A logic gate is a physical electronic device that performs a basic Boolean operation. It receives one or more binary input voltages, applies a logical rule, and produces a single binary output voltage. By wiring thousands of these simple gates together, engineers can construct processors capable of executing complex software. This unit explores the fundamental gates and the algebraic rules used to simplify them.

2.1 Basic Logic Gates: AND, OR and NOT

The Architecture of Logic Gates

A logic gate acts as a decision-making element within a digital circuit. It continuously monitors its input terminals. When the voltage levels on the inputs change, the gate evaluates the new combination according to its specific logical rule. It then updates its output terminal almost instantly. The output remains stable as long as the inputs remain stable. Engineers describe the exact behavior of any logic gate using a truth table. A truth table is a mathematical grid that maps every possible combination of input states to the resulting output state. Because digital logic uses base-2 mathematics, a gate with nnn distinct inputs will always have exactly 2n2^n2n possible input combinations. This predictable scaling allows designers to map out the behavior of massive circuits before building them. The operations performed by these gates form the core of Boolean algebra. Instead of standard arithmetic operations like addition and subtraction, Boolean algebra uses logical operations. We represent these operations with specific mathematical symbols. This notation allows us to write complex circuit behaviors as simple algebraic equations, which we can then simplify using formal theorems.

Unit 3: Combinational Logic Design

Teaching hours: 10

A combinational circuit has outputs that depend only on the current inputs — no memory. Design procedure: (1) derive the truth table from the specification, (2) write the Boolean expression, (3) minimize it, (4) implement with gates.

3.1 Implementation of combinational logic function

Combinational logic functions are built from the basic gates: a truth table defines the required input/output behavior, Boolean algebra derives the expression, minimization (laws, K-map, or Quine-McCluskey) reduces the gate count, and the result is implemented with AND/OR/NOT or universal gates. This unit covers arithmetic circuits (adders/subtractors), data-routing circuits (MUX/DEMUX, encoders/decoders), comparators, code converters, parity circuits, and programmable logic.

3.1.1 Half adder and full adder

Half adder adds two 1-bit inputs A and B, with no carry input:

A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

Swipe to see all columns

Sum = A⊕B; Carry = A·B. Implemented with one EXOR gate and one AND gate.

Full adder adds three 1-bit inputs A, B, Cin:

A B Cin Sum Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Swipe to see all columns

Sum = A⊕B⊕Cin; Cout = A·B + Cin·(A⊕B). A full adder equals two half adders plus one OR gate.

Ripple-carry adder: n full adders chained, Cout of stage i feeds Cin of stage i+1. Carry delay grows linearly with n; a carry-lookahead adder pre-computes carries in parallel to remove this delay.

Self-check: What is the sum expression of a full adder? Answer: Sum = A ⊕ B ⊕ Cin.

Exam pointers: Draw half/full adder truth tables; give Sum and Carry expressions; state how a full adder is built from half adders.

3.1.2 Half subtractor and full subtractor

Half subtractor computes A − B with no borrow-in: Difference = A⊕B; Borrow = Ā·B.

A B Difference Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

Swipe to see all columns

Full subtractor computes A − B − Bin: Difference = A⊕B⊕Bin; Bout = Ā·B + Ā·Bin + B·Bin.

Self-check: What is the borrow expression of a half subtractor? Answer: Borrow = Ā · B.

Exam pointers: Write truth tables and expressions for half and full subtractor.

3.1.3 Encoders and decoders

Decoder: n inputs → 2ⁿ outputs; exactly one output is active for each input combination. A 2-to-4 decoder: Y0=Ā·B̄, Y1=Ā·B, Y2=A·B̄, Y3=A·B. Uses: memory chip select, seven-segment display drivers, binary-to-BCD conversion.

Encoder: 2ⁿ inputs → n outputs; the inverse of a decoder, assuming only one input is active at a time. A priority encoder resolves multiple active inputs by priority (highest input wins).

Self-check: How many outputs does a 3-to-8 decoder have? Answer: 8 (2³).

Exam pointers: Give the 2-to-4 decoder output equations; state one application; contrast encoder vs decoder.

3.2 Implementation of data processing circuits

3.2.1 Multiplexers and demultiplexers

Multiplexer (MUX, data selector): 2ⁿ data inputs, n select lines, 1 output; selects connect one data input to the output.

4-to-1 MUX: Y = S̄1·S̄0·D0 + S̄1·S0·D1 + S1·S̄0·D2 + S1·S0·D3.

A 2ⁿ-to-1 MUX can implement any n-variable Boolean function by hardwiring data inputs to 0/1 according to the function's minterms.

Demultiplexer (DEMUX, data distributor): 1 data input, n select lines, 2ⁿ outputs; routes the input to the selected output.

Self-check: How many select lines does a 16-to-1 MUX need? Answer: 4 (2⁴ = 16 data inputs).

Exam pointers: Write the 4-to-1 MUX expression; explain how a MUX implements any Boolean function; contrast MUX vs DEMUX.

3.2.2 Parallel binary adder

An n-bit parallel binary adder chains n full adders with carry propagation (ripple-carry). A 4-bit adder adds two 4-bit numbers; delay ≈ n × t_FA where t_FA is one full-adder delay.

Self-check: What limits the speed of a ripple-carry adder? Answer: Carry propagation delay through all stages.

Exam pointers: Describe a 4-bit parallel adder structure and its delay limitation.

3.2.3 Magnitude comparator

Compares two n-bit numbers A and B and produces three outputs: A>B, A=B, A<B.

1-bit comparator: A>B = A·B̄; A=B = A·B + Ā·B̄ = A⊙B (EXNOR); A<B = Ā·B.

2-bit comparator: compare the MSBs first; if equal, compare the LSBs. A 4-bit IC (7485) gives A>B, A=B, A<B and can be cascaded for wider comparison using cascade inputs.

Self-check: For a 1-bit comparator, when is A=B true? Answer: When A and B are equal (00 or 11); expression A⊙B.

Exam pointers: Give 1-bit comparator outputs; describe cascading 4-bit comparators.

3.2.4 Code converters

BCD to Excess-3: add 3 (0011₂) to each BCD digit, built with adders.

Binary to Gray: Gₙ = Bₙ (MSB); Gᵢ = Bᵢ ⊕ Bᵢ₊₁ for each lower bit.

Gray to Binary: Bₙ = Gₙ; Bᵢ = Bᵢ₊₁ ⊕ Gᵢ.

Self-check: Convert binary 1010 to Gray. Answer: G₃=1; G₂=1⊕0=1; G₁=0⊕1=1; G₀=1⊕0=1 → 1111.

Exam pointers: State binary→Gray and Gray→binary conversion formulas; convert an example.

3.2.5 Parity generator and checker

Parity generator: takes n data bits and produces one parity bit so the total number of 1s is even (even parity) or odd (odd parity), built from a tree of EXOR gates. For 3-bit even parity: P = D₂ ⊕ D₁ ⊕ D₀.

Parity checker: the receiver recomputes parity over data plus parity bit; a nonzero result (for even parity) signals an error. Detects single-bit errors only; no correction.

Self-check: What is the even-parity bit for data 1011? Answer: three 1s already (odd), so P = 1 to make the total four (even) → P = 1? Wait: data 1011 has three 1s; even parity requires total even, so P = 1 → total four 1s. P = 1.

Exam pointers: Compute a parity bit; describe checker operation; state detection limits.

3.3 Basic concepts of programmable logic

3.3.1 ROM

A ROM implements a fixed truth table: n address lines and m data lines produce m different n-variable functions at once. The AND plane (decoder generating all 2ⁿ minterms) is fixed at manufacture; the OR plane (selecting minterms per output) is programmed. Uses: lookup tables, character generators, firmware.

3.3.2 PAL

PAL has a programmable AND plane (custom product terms) and a fixed OR plane (each output sums a fixed set of product terms). Faster and cheaper than PLA, less flexible. Used for medium-complexity glue logic (e.g., 74PAL16L8).

3.3.3 PLA

PLA has both AND and OR planes programmable, so any product term can feed any output — most flexible of the three. Modern FPGAs/CPLDs generalize these ideas using LUT (look-up table) cells and routing matrices.

Comparison:

Device AND plane OR plane Flexibility
ROM Fixed (all minterms) Programmable High, slower for logic
PAL Programmable Fixed Moderate
PLA Programmable Programmable High
FPGA/CPLD LUT-based Routing matrix Very high

Swipe to see all columns

Self-check: Which PLD has both planes programmable? Answer: PLA.

Exam pointers: Contrast ROM, PAL, PLA on AND/OR plane programmability; name one use of each.

Key terms — Unit 3

Combinational circuit · half/full adder · ripple-carry delay · MUX/DEMUX · encoder/decoder · magnitude comparator · parity bit · ROM/PAL/PLA · don't-care

Unit 3 summary

This unit covered combinational design procedure and circuits: half and full adders (truth tables and expressions), half and full subtractors, encoders and decoders (2-to-4 equations), multiplexers and demultiplexers (4-to-1 expression and function implementation), parallel binary adder delay, magnitude comparator (1-bit and cascaded 4-bit), code converters (BCD↔Excess-3, binary↔Gray), parity generator/checker, and ROM/PAL/PLA with a comparison table. Each circuit includes expressions you can implement directly with gates.

Expanded chapter notes

Digital systems process information using two broad categories of logic circuits: combinational logic and sequential logic. This unit focuses entirely on combinational logic. A combinational circuit has no memory. Its output depends entirely and instantly on the current state of its inputs. If you change the input binary values, the output binary values change immediately to reflect the new state. Because they lack memory, combinational circuits cannot store data or track a sequence of events. Instead, they perform immediate mathematical and routing operations. When a computer adds two numbers, compares two passwords, or routes a signal to a specific memory chip, it uses combinational logic. We build these circuits by wiring basic logic gates together according to strict Boolean equations. The previous units established the mathematical rules of binary arithmetic and Boolean algebra. We will now apply those abstract rules to design physical hardware. We will design the actual circuits that perform binary addition and subtraction. We will also design the routing circuits that translate and direct data across a computer's motherboard.

The Combinational Design Procedure

Designing a combinational circuit follows a strict, repeatable engineering procedure. Engineers never guess the gate arrangement. They build the circuit mathematically from the ground up. The first step is to define the problem clearly. The designer must identify the exact number of input variables and the exact number of output variables required. Each variable receives a unique letter symbol. The second step is to construct a complete truth table. The truth table maps every possible binary combination of the inputs to the desired output states. If a circuit has three inputs, the truth table must contain exactly eight rows. The designer fills in the output columns based on the specific mathematical or routing task the circuit must perform. This table serves as the absolute blueprint for the hardware. The third step is to extract the simplified Boolean equations. The designer takes the 111s from the output columns and writes the canonical Sum of Products expression. They then use Karnaugh maps or Boolean algebra to reduce this expression to its minimal form. This minimization step is strictly required. A minimized equation uses fewer logic gates, which reduces the manufacturing cost and the physical size of the final microchip. The final step is to draw the logic diagram. The designer translates the minimal Boolean equations into a schematic using AND, OR, NOT, or universal gates. They map the input variables to physical wires and route them through the gates to produce the final output signals. Every circuit in this unit will be derived using this exact four-step procedure.

Half Adder and Full Adder

Arithmetic circuits form the core of any processor's Arithmetic Logic Unit (ALU). The most basic arithmetic operation is binary addition. When we add two single-bit numbers, we generate a sum and a possible carry. A circuit that performs this exact operation is called a Half Adder. It has two input wires and two output wires. The Half Adder has a severe structural limitation. It cannot accept a carry bit from a previous lower column. This makes it useless for adding multi-bit numbers like 8-bit or 16-bit integers. If you add the second column of a binary number, you must account for any carry generated by the first column. The Half Adder simply has no physical input pin to receive that incoming carry. To solve this limitation, engineers designed the Full Adder. The Full Adder accepts three inputs: two significant bits and one carry-in bit from a previous stage. It produces two outputs: a sum and a carry-out. By chaining multiple Full Adders together in a row, a computer can add binary numbers of any length. The carry-out of one Full Adder connects directly to the carry-in of the next Full Adder. Worked Example 1: Derive the logic equations for a Half Adder. Step 1: Define variables. Let inputs be AAA and BBB. Let outputs be Sum (SSS) and Carry (CCC). Step 2: Construct the truth table based on binary addition rules (1+1=01+1 = 01+1=0 with carry 111). ABSC0000011010101101\begin{array}{|c|c|c|c|} \hline A & B & S & C \\ \hline 0 & 0 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 0 \\ 1 & 1 & 0 & 1 \\ \hline \end{array}A0011​B0101​S0110​C0001​​ Step 3: Extract the equations. The Sum (SSS) is 111 when the inputs are different. This perfectly matches the XOR gate. S=A‾⋅B+A⋅B‾S = \overline{A} \cdot B + A \cdot \overline{B}S=A⋅B+A⋅BS=A⊕BS = A \oplus BS=A⊕B The Carry (CCC) is 111 only when both inputs are 111. This perfectly matches the AND gate. C=A⋅BC = A \cdot BC=A⋅B Step 4: The final circuit requires exactly one XOR gate and one AND gate. Worked Example 2: Derive the logic equations for a Full Adder. Step 1: Define variables. Let inputs be AAA, BBB, and Carry-In (CinC_{in}Cin​). Let outputs be Sum (SSS) and Carry-Out (CoutC_{out}Cout​). Step 2: Construct the truth table. We add all three bits together. ABCinSCout0000000110010100110110010101011100111111\begin{array}{|c|c|c|c|c|} \hline A & B & C_{in} & S & C_{out} \\ \hline 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ 0 & 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 0 & 1 \\ 1 & 0 & 0 & 1 & 0 \\ 1 & 0 & 1 & 0 & 1 \\ 1 & 1 & 0 & 0 & 1 \\ 1 & 1 & 1 & 1 & 1 \\ \hline \end{array}A00001111​B00110011​Cin​01010101​S01101001​Cout​00010111​​ Step 3: Extract and simplify the equations algebraically. First, extract the canonical SOP for the Sum (SSS): S=A‾⋅B‾⋅Cin+A‾⋅B⋅Cin‾+A⋅B‾⋅Cin‾+A⋅B⋅CinS = \overline{A} \cdot \overline{B} \cdot C_{in} + \overline{A} \cdot B \cdot \overline{C_{in}} + A \cdot \overline{B} \cdot \overline{C_{in}} + A \cdot B \cdot C_{in}S=A⋅B⋅Cin​+A⋅B⋅Cin​​+A⋅B⋅Cin​​+A⋅B⋅Cin​ Factor out A‾\overline{A}A from the first two terms, and AAA from the last two terms: S=A‾⋅(B‾⋅Cin+B⋅Cin‾)+A⋅(B‾⋅Cin‾+B⋅Cin)S = \overline{A} \cdot (\overline{B} \cdot C_{in} + B \cdot \overline{C_{in}}) + A \cdot (\overline{B} \cdot \overline{C_{in}} + B \cdot C_{in})S=A⋅(B⋅Cin​+B⋅Cin​​)+A⋅(B⋅Cin​​+B⋅Cin​) Recognize the XOR and XNOR patterns inside the parentheses: S=A‾⋅(B⊕Cin)+A⋅(B⊕Cin‾)S = \overline{A} \cdot (B \oplus C_{in}) + A \cdot (\overline{B \oplus C_{in}})S=A⋅(B⊕Cin​)+A⋅(B⊕Cin​​) Let X=(B⊕Cin)X = (B \oplus C_{in})X=(B⊕Cin​). The equation becomes A‾⋅X+A⋅X‾\overline{A} \cdot X + A \cdot \overline{X}A⋅X+A⋅X, which is another XOR operation: S=A⊕B⊕CinS = A \oplus B \oplus C_{in}S=A⊕B⊕Cin​ Next, extract the canonical SOP for Carry-Out (CoutC_{out}Cout​): Cout=A‾⋅B⋅Cin+A⋅B‾⋅Cin+A⋅B⋅Cin‾+A⋅B⋅CinC_{out} = \overline{A} \cdot B \cdot C_{in} + A \cdot \overline{B} \cdot C_{in} + A \cdot B \cdot \overline{C_{in}} + A \cdot B \cdot C_{in}Cout​=A⋅B⋅Cin​+A⋅B⋅Cin​+A⋅B⋅Cin​​+A⋅B⋅Cin​ Factor out CinC_{in}Cin​ from the first two terms, and A⋅BA \cdot BA⋅B from the last two terms: Cout=Cin⋅(A‾⋅B+A⋅B‾)+A⋅B⋅(Cin‾+Cin)C_{out} = C_{in} \cdot (\overline{A} \cdot B + A \cdot \overline{B}) + A \cdot B \cdot (\overline{C_{in}} + C_{in})Cout​=Cin​⋅(A⋅B+A⋅B)+A⋅B⋅(Cin​​+Cin​) Apply the XOR pattern to the first bracket, and the Inverse Law to the second bracket: Cout=Cin⋅(A⊕B)+A⋅B⋅(1)C_{out} = C_{in} \cdot (A \oplus B) + A \cdot B \cdot (1)Cout​=Cin​⋅(A⊕B)+A⋅B⋅(1)Cout=A⋅B+Cin⋅(A⊕B)C_{out} = A \cdot B + C_{in} \cdot (A \oplus B)Cout​=A⋅B+Cin​⋅(A⊕B) Step 4: The final circuit requires two XOR gates for the Sum, and two AND gates plus one OR gate for the Carry-Out.

Unit 4: Sequential Logic Design

Teaching hours: 10

A sequential circuit's outputs depend on current inputs and on previously stored state. Memory elements (latches, flip-flops) hold the state.

4.1 Concept of state and state diagram

The state is a snapshot of all memory elements. A state diagram draws states as circles and transitions as directed arrows labeled with input/output.

stateDiagram-v2
    [*] --> GREEN
    GREEN --> RED : timer_expired / stop
    RED --> GREEN : timer_expired / go

Moore machine: outputs depend only on the current state (written inside state circles). Mealy machine: outputs depend on current state and inputs (written on transition arcs). Mealy machines often need fewer states; Moore machines are simpler to implement.

Self-check: In a Moore machine, where do outputs depend on? Answer: Only on the current state.

Exam pointers: Draw a state diagram; contrast Moore vs Mealy outputs.

4.2 State reduction technique

Equivalent states produce identical outputs for all inputs and transition to the same or equivalent next states. Merging equivalent states reduces the number of flip-flops needed.

Method (implication table): list all state pairs; mark pairs with different outputs as non-equivalent; propagate implications until no new marks appear; merge unmarked pairs.

Self-check: What is the benefit of state reduction? Answer: Fewer states mean fewer flip-flops and simpler logic.

Exam pointers: Describe the implication-table method; state the benefit of merging equivalent states.

4.3 Triggering and its types

A flip-flop changes state only at a controlled instant:

  • Level triggering: output responds while the clock enable is at the active level. Problem: transparency — output follows input for the whole active level.
  • Edge triggering: change occurs only at a clock transition — positive edge (0→1, PET) or negative edge (1→0, NET).
  • Pulse triggering (master-slave): master captures input on one edge, slave transfers output on the other edge, preventing race conditions.

Edge triggering is the standard in synchronous design.

Self-check: What is the main problem with level triggering? Answer: Transparency — output follows input while the enable level is active.

Exam pointers: Define level, positive-edge, negative-edge, and master-slave triggering; state why edge triggering is preferred.

4.4 Latches and flip-flops (RS, D, T, JK, master-slave)

SR latch (NOR gates):

S R Q(next) Meaning
0 0 Q (hold) no change
0 1 0 reset
1 0 1 set
1 1 Invalid avoid

Swipe to see all columns

S=R=1 is forbidden: both outputs go low and the subsequent state at 00 is unpredictable.

Clocked SR flip-flop: same behavior but changes only on the active clock edge; S=R=1 at the edge remains undefined.

D flip-flop: connects D to S and D̄ to R, eliminating the undefined input.

D Q(t+1)
0 0
1 1

Q(t+1) = D — output tracks D at the clock edge; used in registers and data storage.

T flip-flop:

T Q(t+1)
0 Q(t) — hold
1 Q̄(t) — toggle

Q(t+1) = T ⊕ Q(t); derived from JK with J=K=T; used in counters.

JK flip-flop: eliminates the undefined state — J=K=1 toggles.

J K Q(t+1)
0 0 Q(t) — hold
0 1 0 — reset
1 0 1 — set
1 1 Q̄(t) — toggle

Q(t+1) = J·Q̄ + K̄·Q. The JK can be configured as SR (avoid J=K=1), as D (K=D̄), or as T (J=K).

Master-slave JK flip-flop: two JK flip-flops in series with opposite clocks. The master samples input while the slave is disabled; the slave transfers while the master is disabled — this prevents the output from feeding back to the input while the clock is active (the race condition).

Comparison:

FF type Characteristic equation Problem input Typical use
SR Q⁺ = S + R̄·Q S=R=1 forbidden —
D Q⁺ = D none Registers, storage
T Q⁺ = T ⊕ Q none Counters
JK Q⁺ = J·Q̄ + K̄·Q none General purpose, counters

Swipe to see all columns

Self-check: What does J=K=1 do in a JK flip-flop? Answer: It toggles the output (Q⁺ = Q̄).

Exam pointers: Give truth tables and characteristic equations for D, T, JK; explain master-slave race prevention.

Key terms — Unit 4

Moore vs Mealy · state diagram · level vs edge triggering · characteristic equation · excitation table · race condition · master-slave · toggle

Unit 4 summary

This unit covered state and state diagrams, Moore vs Mealy machines, state reduction via implication tables, triggering types (level, edge, master-slave), and latches/flip-flops: SR (with forbidden 11), clocked SR, D, T, JK (with characteristic equations and truth tables), and master-slave JK with race prevention. A comparison table summarizes all flip-flop types.

Expanded chapter notes

Combinational logic circuits possess a fatal structural flaw. They cannot remember anything. If you remove the input voltages from a combinational circuit, the output vanishes instantly. The circuit retains no record of what it just calculated. A functional computer cannot operate this way. It must store data, track its current place in a software program, and execute instructions step by step. This requires a completely different approach to hardware design. Sequential logic solves the memory problem by introducing feedback loops. In a sequential circuit, the output of the logic gates does not just travel forward to the next component. A physical wire routes the output back into the input terminals of the exact same circuit. This loop traps the electrical signal. The circuit continuously feeds itself, maintaining a stable electrical state even after the original external input disappears. This feedback mechanism forms the basis of all computer memory, from simple data registers to massive hard drives. However, feedback loops introduce complex timing issues. The circuit must know exactly when to accept new data and when to ignore it. This unit explores how engineers design these feedback loops, how they control the timing of the signals, and how they build the fundamental memory elements called flip-flops.

4.1 Concept of State and State Diagram

The Concept of Sequential State

In digital logic, a state is a snapshot of a circuit's memory at one specific moment in time. It represents the exact binary condition of every feedback loop in the system. A combinational circuit only cares about present inputs. A sequential circuit cares about both the present inputs and the present state. Together, these two factors determine what the circuit will do next. We divide the behavior of a sequential circuit into two distinct phases. The present state is the data currently held in the memory elements. The next state is the data the circuit is preparing to store. When the circuit receives a trigger signal, the next state overwrites the present state. The circuit then holds this new present state until the next trigger arrives. This reliance on past history allows sequential circuits to recognize sequences of events. For example, a digital combination lock must receive the numbers 4, then 2, then 7 in that exact order. A combinational circuit cannot do this, because it evaluates every number in isolation. A sequential circuit changes its internal state with each correct number. It only unlocks if its present state proves that the previous two numbers were entered correctly.

Unit 5: Counters and Registers

Teaching hours: 12

5.1 Asynchronous and synchronous counter

A counter cycles through a predefined sequence of states; used for counting events, frequency division, timing, and sequence control.

Asynchronous (ripple) counter: each flip-flop is clocked by the previous flip-flop's output, not the common clock; the change ripples from LSB to MSB, causing propagation delay and brief invalid states during transitions.

Synchronous counter: all flip-flops share one clock; combinational logic decides which flip-flops toggle; states change together with no ripple delay — preferred for high-speed designs.

Self-check: In a ripple counter, what clocks the second flip-flop? Answer: The Q output of the first flip-flop.

Exam pointers: Contrast asynchronous vs synchronous counters on clocking and delay.

5.1.1 Ripple counter

A 4-bit ripple up-counter uses T flip-flops with T = 1 permanently: FF0 toggles on every clock edge; FF1 toggles on the falling edge of Q0; FF2 on falling edge of Q1; FF3 on falling edge of Q2.

Clock → FF0(T=1) → Q0 → FF1(T=1) → Q1 → FF2(T=1) → Q2 → FF3(T=1) → Q3
Count: 0000 → 0001 → 0010 → 0011 → ... → 1111 → 0000

Delay for n stages ≈ n × t_FF, limiting high-frequency use.

Self-check: What is the count sequence after 0011 in a 4-bit ripple up-counter? Answer: 0100.

Exam pointers: Draw/describe a 4-bit ripple up-counter; give the state sequence; state the delay formula.

5.1.2 Ring counter

An n-bit ring counter feeds the Q output of the last flip-flop back to the input of the first; only one flip-flop is set (1) at a time and the 1 circulates.

4-bit sequence: 1000 → 0100 → 0010 → 0001 → 1000 → ... Only 4 of 16 states are valid; self-correcting versions exist.

Use case: generating timed pulses (one output per stage per cycle), simple sequencers.

Self-check: How many valid states does a 4-bit ring counter have? Answer: 4 (out of 16 possible).

Exam pointers: Draw the 4-bit ring counter state sequence; state an application.

5.1.3 Modulus 10 counter

Counts 0000 → ... → 1001 (decimal 0–9), then resets to 0000 — a decade (BCD) counter.

Method: run a 4-bit asynchronous counter; detect state 1010 with a NAND gate (inputs Q3 and Q1, since 1010 has Q3=1 and Q1=1) and use its output to asynchronously clear all flip-flops.

Self-check: Which state does a mod-10 counter detect to force a reset? Answer: 1010 (decimal 10), detected as Q3·Q1.

Exam pointers: Design a mod-10 counter with a 4-bit ripple counter and NAND reset logic.

5.1.4 Modulus counter (5, 7, 11)

For modulus N, use an appropriately sized counter and add a feedback NAND gate detecting state N to force reset.

  • Mod-5: count 0–4; detect 0101 (Q2·Q0) → reset.
  • Mod-7: count 0–6; detect 0111 (Q2·Q1·Q0) → reset.
  • Mod-11: 4-bit counter; detect 1011 → reset.

Self-check: Which state is detected for a mod-7 counter reset? Answer: 0111 (decimal 7).

Exam pointers: Design mod-5, mod-7, mod-11 counters with detection states and reset gates.

5.1.5 Synchronous design of above counters

For a synchronous mod-N counter, build the next-state table and derive J/K (or D) input logic from K-maps.

Example — synchronous mod-3 counter with T flip-flops:

Present Q1 Q0 Next Q1⁺ Q0⁺ T1 = Q1⊕Q1⁺ T0 = Q0⊕Q0⁺
00 01 0 1
01 10 1 1
10 00 1 0
11 XX X X (don't care)

Swipe to see all columns

T0 = 1 (toggles every cycle); T1 = Q0 (from K-map). Implement T1 with one AND/buffer on Q0.

Self-check: For the mod-3 counter, what is T0? Answer: 1 (Q0 toggles every clock cycle).

Exam pointers: Build a next-state/excitation table; derive T/J/K inputs via K-map; show the mod-3 example.

5.2 Registers

A register is a group of flip-flops storing a multi-bit value; data can be loaded or shifted serially or in parallel.

5.2.1 Serial in parallel out register

Data enters one bit at a time through the serial input; after n clock pulses, all n bits appear at parallel outputs.

Input 1011 (4-bit SIPO):

Clock 1: D=1 → Q0=1, Q1=0, Q2=0, Q3=0
Clock 2: D=0 → Q0=0, Q1=1, Q2=0, Q3=0
Clock 3: D=1 → Q0=1, Q1=0, Q2=1, Q3=0
Clock 4: D=1 → Q0=1, Q1=1, Q2=0, Q3=1
Parallel output Q3Q2Q1Q0 = 1011

Use case: serial-to-parallel conversion (e.g., UART reception).

Self-check: After loading 1011 into a 4-bit SIPO, what is the parallel output order Q3Q2Q1Q0? Answer: 1011.

Exam pointers: Trace SIPO loading cycle by cycle; state the application.

5.2.2 Serial in serial out register

Data enters serially and leaves serially from the last stage after n clock pulses; acts as an n-cycle delay element.

Use case: data delay lines, synchronization buffers.

Self-check: How many clock cycles does a 4-bit SISO delay a bit by? Answer: 4 cycles.

Exam pointers: Describe SISO operation; state its use as a delay element.

5.2.3 Parallel in parallel out register

All bits load simultaneously on one clock edge and are read simultaneously; standard CPU register-file storage.

Self-check: How many clock pulses to load a PIPO register? Answer: 1.

Exam pointers: Contrast PIPO loading with serial modes.

5.2.4 Parallel in serial out register

All bits load in parallel, then shift out serially one bit per clock.

Use case: parallel-to-serial conversion (e.g., SPI transmission).

Self-check: A 4-bit PISO loads 4 bits in parallel; how many clocks to shift all of them out? Answer: 4 clocks (after 1 load clock).

Exam pointers: Describe PISO operation and its use.

5.2.5 Bidirectional shift register

Shifts left or right under a direction-control input; a universal shift register (e.g., 74LS194) supports all four modes plus both directions via a 2-bit mode control.

Shift arithmetic: logical left shift by 1 = multiply by 2 (fill 0); logical right shift = divide by 2 (fill 0); arithmetic right shift preserves the sign bit (fill with MSB); rotate moves bits circularly with no loss.

Comparison:

Type Input Output Clocks to load Application
SIPO Serial Parallel n Serial-to-parallel
SISO Serial Serial n Delay line
PIPO Parallel Parallel 1 CPU registers
PISO Parallel Serial 1 load + n shift Parallel-to-serial
Bidirectional Both Both Depends on mode Shift/rotate arithmetic

Swipe to see all columns

Self-check: What does an arithmetic right shift preserve that a logical right shift does not? Answer: The sign bit (fills with MSB instead of 0).

Exam pointers: Compare all register modes in a table; explain left/right shift arithmetic effects.

Key terms — Unit 5

Modulus · ripple delay · synchronous enable · decade counter · ring counter · SIPO/SISO/PIPO/PISO · bidirectional · universal shift register · arithmetic vs logical shift

Unit 5 summary

This unit covered asynchronous vs synchronous counters, the 4-bit ripple up-counter sequence and delay, ring counter, mod-10 (decade) counter with NAND reset detection, mod-5/7/11 counters, synchronous counter design with excitation tables (worked mod-3 T-FF example), and all five register modes (SIPO, SISO, PIPO, PISO, bidirectional) with a comparison table and shift-arithmetic rules. Every counter design includes the detection-state method; every register mode includes a use case.

Expanded chapter notes

A single flip-flop stores exactly one bit of data. While this is mathematically useful, it is physically limited. Modern digital systems process data in large blocks. They must track time, count events, and step through memory addresses sequentially. To perform these tasks, engineers connect multiple flip-flops together into arrays. When we wire an array of flip-flops to store and move data, we create a register. When we wire an array of flip-flops to cycle through a specific sequence of binary numbers, we create a counter. Counters and registers form the immediate working memory of every computer processor. This unit explores how to design these multi-bit sequential systems. We will apply the flip-flop excitation tables derived in the previous unit to build circuits that count predictably and reliably.

5.1 Asynchronous and Synchronous Counter

Counters are classified entirely by how they receive their clock signals. In a synchronous counter, a single global clock wire connects directly to the clock pin of every single flip-flop in the array. When the clock pulses, every flip-flop evaluates its inputs and updates its state at the exact same microsecond. This global synchronization makes the circuit fast and highly stable. In an asynchronous counter, the global clock only connects to the very first flip-flop. The subsequent flip-flops do not look at the main clock. Instead, they use the data output of the previous flip-flop as their clock signal. The signal must physically travel through the first flip-flop to trigger the second flip-flop. It must then travel through the second to trigger the third. We call these asynchronous circuits "ripple" counters, because the clock signal ripples through the hardware like a wave.

5.1.1 Ripple counter

We build a basic ripple counter using T flip-flops, or JK flip-flops wired to act like T flip-flops. We tie both the JJJ and KKK inputs permanently to logic 111. This forces every flip-flop into its toggle state. Whenever a flip-flop receives a valid clock edge, it will automatically invert its current output. For standard ripple counters, we use negative edge-triggered flip-flops. These flip-flops only toggle their state when their clock input falls from 111 to 000. They ignore the clock input when it rises from 000 to 111. Worked Example 1: Trace a 3-bit Asynchronous Up Counter. We use three negative edge-triggered flip-flops: FF0,FF1,FF_0, FF_1,FF0​,FF1​, and FF2FF_2FF2​. The external clock drives FF0FF_0FF0​. The output Q0Q_0Q0​ drives the clock of FF1FF_1FF1​. The output Q1Q_1Q1​ drives the clock of FF2FF_2FF2​. Assume the counter starts at 0002000_20002​. We trace the outputs Q2,Q1,Q_2, Q_1,Q2​,Q1​, and Q0Q_0Q0​ after each external clock pulse.

Clock Pulse Q2Q_2Q2​ (MSB) Q1Q_1Q1​ Q0Q_0Q0​ (LSB) Mechanism
Initial 0 0 0 Starting state.
1 0 0 1 Q0Q_0Q0​ toggles on external clock.
2 0 1 0 Q0Q_0Q0​ falls to 000, triggering Q1Q_1Q1​ to toggle.
3 0 1 1 Q0Q_0Q0​ toggles to 111. Q1Q_1Q1​ ignores the rise.
4 1 0 0 Q0Q_0Q0​ falls, triggering Q1Q_1Q1​ to fall. Q1Q_1Q1​ falling triggers Q2Q_2Q2​ to toggle.
5 1 0 1 Q0Q_0Q0​ toggles on external clock.
6 1 1 0 Q0Q_0Q0​ falls to 000, triggering Q1Q_1Q1​ to toggle.
7 1 1 1 Q0Q_0Q0​ toggles to 111. Q1Q_1Q1​ ignores the rise.
8 0 0 0 Q0Q_0Q0​ falls, triggering Q1Q_1Q1​ to fall. Q1Q_1Q1​ falling triggers Q2Q_2Q2​ to fall.
The circuit correctly counts upward from 000 to 777 in standard binary. On the eighth pulse, it overflows and resets to 000.
Worked Example 2: Trace a 3-bit Asynchronous Down Counter.
To count backward, we change the wiring slightly. We keep the JJJ and KKK inputs tied to 111. We still use negative edge-triggered flip-flops. However, we connect the inverted output (Q‾\overline{Q}Q​) of the previous stage to the clock input of the next stage.
The external clock drives FF0FF_0FF0​.
The inverted output Q0‾\overline{Q_0}Q0​​ drives the clock of FF1FF_1FF1​.
The inverted output Q1‾\overline{Q_1}Q1​​ drives the clock of FF2FF_2FF2​.
Assume the counter starts at 1112111_21112​.
Clock Pulse Q2Q_2Q2​ Q1Q_1Q1​ Q0Q_0Q0​ Mechanism
--- --- --- --- ---
Initial 1 1 1 Starting state. Q0‾=0,Q1‾=0\overline{Q_0}=0, \overline{Q_1}=0Q0​​=0,Q1​​=0.
1 1 1 0 Q0Q_0Q0​ falls to 000. Q0‾\overline{Q_0}Q0​​ rises to 111. FF1FF_1FF1​ ignores the rise.
2 1 0 1 Q0Q_0Q0​ rises to 111. Q0‾\overline{Q_0}Q0​​ falls to 000, triggering Q1Q_1Q1​ to toggle.
3 1 0 0 Q0Q_0Q0​ falls to 000. Q0‾\overline{Q_0}Q0​​ rises to 111. FF1FF_1FF1​ ignores the rise.
4 0 1 1 Q0Q_0Q0​ rises, Q0‾\overline{Q_0}Q0​​ falls. Q1Q_1Q1​ toggles to 111, so Q1‾\overline{Q_1}Q1​​ falls, triggering Q2Q_2Q2​ to toggle.
5 0 1 0 Q0Q_0Q0​ falls to 000. Q0‾\overline{Q_0}Q0​​ rises to 111. FF1FF_1FF1​ ignores the rise.
6 0 0 1 Q0Q_0Q0​ rises to 111. Q0‾\overline{Q_0}Q0​​ falls to 000, triggering Q1Q_1Q1​ to toggle.
7 0 0 0 Q0Q_0Q0​ falls to 000. Q0‾\overline{Q_0}Q0​​ rises to 111. FF1FF_1FF1​ ignores the rise.
8 1 1 1 Q0Q_0Q0​ rises, Q0‾\overline{Q_0}Q0​​ falls. Q1Q_1Q1​ toggles, Q1‾\overline{Q_1}Q1​​ falls. Q2Q_2Q2​ toggles.
The circuit correctly counts downward from 777 to 000. By using the inverted output to drive the clock, we reversed the counting direction without changing the flip-flop type.

Swipe to see all columns

Detailed practice questions and answer keys

Unit 1

  1. Convert 173.625₁₀ to binary, octal, and hexadecimal.
    • Answer: 173 = 10101101; 0.625 = 0.101 → 10101101.101₂; octal 255.5₈; hex AD.A₁₆.
  2. Subtract 29₁₀ from 46₁₀ using 8-bit 2's complement.
    • Answer: 46 = 00101110; 29 = 00011101 → 2's comp = 11100011; 00101110 + 11100011 = 1 00010001 → discard carry → 00010001 = 17 ✓.
  3. Represent 2025₁₀ in BCD and Excess-3.
    • Answer: BCD: 0010 0000 0010 0101; XS-3: 0101 0011 0101 1000.
  4. Convert 1101₂ to Gray; convert Gray 0110 back to binary.
    • Answer: 1101 → 1011; Gray 0110 → binary 0100.
  5. State the parity-bit rule and one error it cannot detect.
    • Answer: total 1s made even/odd; cannot detect two simultaneous bit errors or correct errors.

Unit 2 6. Simplify F = AB + A(B+C) + B(B+C), naming each law.

  • Answer: AB + AB + AC + BB + BC = AB + AC + B + BC = B + AC (absorption/idempotent).
  1. For F(A,B,C,D) = Σm(0,1,4,5,10,11,14,15), draw the 4-variable K-map and give minimal SOP.
    • Answer: groups → F = ĀC̄ + AC (m0,1,4,5 → ĀC̄; m10,11,14,15 → AC).
  2. Implement EXOR using only NAND gates.
    • Answer: EXOR = (A NAND (A NAND B)) NAND (B NAND (A NAND B)) — 4 NAND gates.
  3. Write canonical SOP and POS for output 1 at rows 1, 2, 5, 6 of a 3-input truth table.
    • Answer: SOP = Σm(1,2,5,6); POS = ΠM(0,3,4,7).
  4. State two advantages of Quine-McCluskey over K-maps.
    • Answer: handles any number of variables; algorithmic, suitable for computer implementation.

Unit 3 11. Design a full adder from two half adders and one OR gate; show truth table. - Answer: first HA adds A,B → sum₁, carry₁; second HA adds sum₁,Cin → final Sum; Cout = carry₁ OR carry₂. 12. Show how a 4-to-1 MUX implements any 2-variable function. - Answer: connect data inputs D0..D3 to 0/1 per minterm values; select lines = the two variables. 13. Design a 3-to-8 decoder; use it to implement EXOR. - Answer: 3 inputs, 8 outputs Y0..Y7 = minterms; OR the minterms where EXOR = 1 (m1, m2, m4, m7). 14. Design an even-parity generator for 4 bits. - Answer: P = D3 ⊕ D2 ⊕ D1 ⊕ D0 with a tree of EXOR gates. 15. Contrast ROM, PAL, PLA. - Answer: ROM fixed AND/programmable OR; PAL programmable AND/fixed OR; PLA both programmable.

Unit 4 16. Draw the state diagram for a 1011 sequence detector. - Answer: states S0..S3 tracking matched prefix; transitions on 0/1 with output 1 on completing 1011. 17. Derive the JK characteristic equation and verify against its truth table. - Answer: Q⁺ = J·Q̄ + K̄·Q; check rows: J=K=0 → Q; 0,1 → 0; 1,0 → 1; 1,1 → Q̄. 18. Explain the SR race problem and how master-slave fixes it. - Answer: S=R=1 is undefined; master-slave separates sampling and transfer on opposite clock edges so output cannot feedback while clock is active. 19. Convert a D flip-flop into a T flip-flop with external logic. - Answer: T = 1 → connect D = Q̄ (toggle each clock); or D = T ⊕ Q. 20. Distinguish Moore and Mealy with an example. - Answer: Moore output on state only (e.g., traffic light state shows color); Mealy output on state+input (fewer states).

Unit 5 21. Design a 4-bit synchronous binary up-counter with JK flip-flops; give excitation table and K-map results. - Answer: J0=K0=1; J1=K1=Q0; J2=K2=Q0·Q1; J3=K3=Q0·Q1·Q2. 22. Draw the state table of a mod-5 asynchronous counter with NAND reset logic. - Answer: counts 0000..0100; detect 0101 (Q2·Q0) → NAND → async clear. 23. Trace a 4-bit SIPO loading serial input 1101, clock by clock. - Answer: clk1: 1000; clk2: 1100; clk3: 1110; clk4: 1111 (depending on shift direction convention) — state Q3Q2Q1Q0 after each clock. 24. Draw the state diagram of a 3-bit ring counter; give one application. - Answer: 100→010→001→100; application: timing pulse generation/sequencing. 25. Contrast arithmetic right shift and logical right shift. - Answer: arithmetic preserves sign bit (fill MSB); logical fills 0.


References

  • Floyd, T. L. Digital Fundamentals. Pearson, 2011.
  • Mano, M. M. Digital Design. Pearson, 2018.
  • Tocci, R. J. Digital Systems — Principles and Applications. Pearson, 2001.

Source evidence