Skip to content

Digital Logic: Complete Notes for Students and Competitive Exams

Digital Logic explains how digital systems use binary values, logic gates, and electronic circuits to process information, make decisions, and store data.

These notes cover number systems, logic gates, Boolean algebra, Karnaugh maps, combinational circuits, sequential circuits, flip-flops, registers, counters, and logic families.

1. Introduction to Digital Logic

Digital Logic is a foundation of Computer Science and digital electronics. At the hardware level, computers represent information using electrical signals interpreted as two logical states: 0 and 1.

These two states are often associated with LOW and HIGH voltage levels, although the exact voltage values depend on the electronic technology being used.

Logic gates, Boolean algebra, combinational circuits, flip-flops, registers, and counters are all based on the idea of combining and storing binary values.

Digital Systems vs Analog Systems

Digital System Analog System
Works with discrete values. Works with continuously varying values.
Commonly represents information using 0 and 1. Represents information using a continuous range of values.
Uses defined voltage ranges and noise margins. Can be more directly affected by small changes in signal level.
Used extensively in computers, smartphones, calculators, and digital clocks. Common in traditional audio, measurement, and sensor systems.

2. Number Systems Used in Digital Logic

Number systems are important because computers store and process information in binary. Octal and hexadecimal are useful because they provide shorter ways to write binary values.

Number System Base Digits Common Use
Binary 2 0, 1 Internal representation in digital systems.
Octal 8 0 to 7 Compact representation of binary values.
Decimal 10 0 to 9 Everyday numerical representation.
Hexadecimal 16 0 to 9 and A to F Memory addresses, machine-level data, colours, and compact binary representation.

Binary to Decimal Conversion

To convert binary to decimal, multiply each bit by its corresponding power of 2 and add the results.

Example: Convert 10112 to decimal.

10112 = (1 × 23) + (0 × 22) + (1 × 21) + (1 × 20)

= 8 + 0 + 2 + 1 = 1110

Binary and Hexadecimal

One hexadecimal digit represents exactly four binary bits. For example, 10102 = A16.

Study tip: Practise binary, decimal, octal, and hexadecimal conversions separately before attempting mixed conversion questions.

3. Logic Gates

Logic gates are the basic building blocks of digital circuits. A gate receives one or more binary inputs and produces a binary output according to a logical rule.

Gate Boolean Expression Operation
ANDY = ABOutput is 1 only when all inputs are 1.
ORY = A + BOutput is 1 when at least one input is 1.
NOTY = A'Produces the complement of the input.
NANDY = (AB)'Complement of AND output.
NORY = (A + B)'Complement of OR output.
XORY = A ⊕ BOutput is 1 when the inputs are different.
XNORY = (A ⊕ B)'Output is 1 when the inputs are the same.

Two-Input Logic Gate Truth Table

A B AND OR NAND NOR XOR XNOR
00001101
01011010
10011010
11110001

Universal Gates

NAND and NOR are called universal gates because any Boolean function can be implemented using only NAND gates or only NOR gates.

4. Boolean Algebra

Boolean Algebra is a mathematical system used to represent and simplify digital logic. It uses binary variables and logical operations such as AND, OR, and NOT.

Simplifying a Boolean expression can reduce the number of gates required in a circuit, making the circuit simpler and potentially faster or less expensive.

Important Boolean Laws

Law Expression
Identity LawA + 0 = A; A · 1 = A
Null LawA + 1 = 1; A · 0 = 0
Idempotent LawA + A = A; A · A = A
Complement LawA + A' = 1; A · A' = 0
Commutative LawA + B = B + A; AB = BA
Associative Law(A + B) + C = A + (B + C); (AB)C = A(BC)
Distributive LawA(B + C) = AB + AC; A + BC = (A + B)(A + C)
Absorption LawA + AB = A; A(A + B) = A
De Morgan's Theorems(A + B)' = A'B'; (AB)' = A' + B'

Sum of Products and Product of Sums

  • Sum of Products (SOP): Product terms are combined using OR. Example: F = AB + A'C + BC.
  • Product of Sums (POS): Sum terms are combined using AND. Example: F = (A + B)(A' + C).
Remember: When applying De Morgan's Theorems, interchange AND and OR, then complement each variable.

5. Karnaugh Maps (K-Maps)

A Karnaugh Map, commonly called a K-Map, is a graphical method for simplifying Boolean expressions. It groups adjacent cells to produce simpler logic expressions.

Common K-Map Sizes

  • 2-variable K-Map: 4 cells
  • 3-variable K-Map: 8 cells
  • 4-variable K-Map: 16 cells

Basic K-Map Rules

  • For SOP simplification, group cells containing 1.
  • For POS simplification, group cells containing 0.
  • Each group must contain 1, 2, 4, 8, or another power-of-two number of cells.
  • Try to make groups as large as possible.
  • Groups may overlap when this produces a simpler result.
  • Cells at opposite edges of the map are adjacent.
  • K-Maps use Gray-code ordering so that adjacent cells differ by only one variable.

Example

Simplify: F(A, B) = A'B + AB' + AB

The function is 1 for input combinations 01, 10, and 11. Grouping the adjacent cells gives the simplified expression:

F(A, B) = A + B

6. Combinational Circuits

A combinational circuit produces output based only on the inputs currently applied to it. It does not store previous states.

Common Combinational Circuits

  • Half Adder: Adds two binary bits and produces Sum and Carry outputs.
  • Full Adder: Adds two input bits and a carry input.
  • Half Subtractor: Subtracts one binary bit from another and produces Difference and Borrow outputs.
  • Full Subtractor: Performs binary subtraction with a borrow input.
  • Multiplexer (MUX): Selects one input from several available inputs.
  • Demultiplexer (DEMUX): Routes one input to one of several outputs.
  • Encoder: Converts an active input line into a coded output.
  • Decoder: Converts a coded input into one active output line.

Half Adder

A half adder adds two one-bit values, A and B.

  • Sum: S = A ⊕ B
  • Carry: C = AB

Full Adder

A full adder adds A, B, and a carry input Cin.

  • Sum: S = A ⊕ B ⊕ Cin
  • Carry Output: Cout = AB + ACin + BCin

7. Sequential Circuits

Sequential circuits differ from combinational circuits because their output can depend on both current inputs and the circuit's previous state. Therefore, sequential circuits use memory elements.

Feature Combinational Circuit Sequential Circuit
MemoryDoes not store a previous state.Uses memory elements.
Output depends onCurrent inputs.Current inputs and previous state.
FeedbackNormally not required.Commonly used.
ClockNot normally required.Often used in synchronous circuits.
ExamplesAdders, multiplexers, decoders.Flip-flops, registers, and counters.

Synchronous and Asynchronous Circuits

  • Synchronous circuit: State changes are controlled by a common clock signal.
  • Asynchronous circuit: State may change directly in response to input changes without a common clock controlling every change.

8. Flip-Flops

A flip-flop is a basic sequential circuit that stores one bit of information. Registers, counters, and many memory-related circuits are built from flip-flops.

Flip-Flop Purpose Typical Behaviour
SR Flip-FlopSet and reset operations.Basic storage element; certain input combinations may be invalid depending on the implementation.
D Flip-FlopData storage.Stores the value at D on the active clock edge.
JK Flip-FlopSet, reset, and toggle operations.When J = K = 1, the output toggles.
T Flip-FlopToggle operation.Commonly used in counter circuits.

Timing Terms

  • Setup Time: The minimum time for which input data must remain stable before the active clock edge.
  • Hold Time: The minimum time for which input data must remain stable after the active clock edge.
  • Propagation Delay: The time taken for an input or clock change to produce the corresponding output change.
Remember: One flip-flop stores one bit. Therefore, an n-bit register generally requires n storage elements.

9. Registers

A register is a group of flip-flops used to store multiple bits. Registers are used inside processors and other digital systems for temporary storage, data transfer, and serial/parallel conversion.

Shift Registers

A shift register moves stored bits from one position to another, usually in response to clock pulses.

  • SISO: Serial-In Serial-Out
  • SIPO: Serial-In Parallel-Out
  • PISO: Parallel-In Serial-Out
  • PIPO: Parallel-In Parallel-Out

Applications of Registers

  • Temporary data storage
  • Data transfer between circuit stages
  • Serial-to-parallel conversion
  • Parallel-to-serial conversion
  • Holding processor operands, addresses, and intermediate results

10. Counters

A counter is a sequential circuit that moves through a predefined sequence of states. Counters are used to count events, generate timing sequences, and divide clock frequencies.

Types of Counters

  • Asynchronous Counter: The clock does not reach all flip-flops simultaneously, so propagation delays can accumulate.
  • Synchronous Counter: Flip-flops receive a common clock, allowing faster and more predictable operation.
  • Up Counter: Counts upward through a sequence of states.
  • Down Counter: Counts downward through a sequence of states.
  • Up/Down Counter: Can count in either direction.
  • BCD or Decade Counter: Counts from 0 to 9 before repeating.
  • Ring Counter: A circulating bit pattern moves through a shift register. An n-flip-flop ring counter has n valid states.
  • Johnson Counter: Feeds the complemented final output back to the input. An n-flip-flop Johnson counter has 2n valid states.
Exam point: A Mod-N counter has N distinct states before returning to its initial state.

11. Digital Logic Families

A logic family is a group of digital circuits built using a particular electronic technology. Logic families differ in speed, power consumption, voltage levels, noise tolerance, and fan-out.

Family Full Name General Characteristics
TTL Transistor-Transistor Logic Historically common, with good speed and comparatively higher power consumption.
CMOS Complementary Metal-Oxide-Semiconductor Low static power consumption and high integration density.
ECL Emitter-Coupled Logic Very high speed but relatively high power consumption.

Important Parameters

  • Propagation Delay: Time between an input change and the corresponding output change.
  • Power Dissipation: Electrical power consumed by the circuit.
  • Fan-Out: Number of similar logic inputs that one output can reliably drive.
  • Noise Margin: Ability to tolerate unwanted electrical noise without changing the logical state incorrectly.

12. Quick Revision

  • Digital systems use discrete logical values, commonly 0 and 1.
  • Logic gates are the building blocks of digital circuits.
  • Boolean Algebra represents and simplifies logic expressions.
  • K-Maps provide a graphical method for Boolean simplification.
  • Combinational circuits depend only on current inputs.
  • Sequential circuits depend on current inputs and stored state.
  • Flip-flops store individual bits.
  • Registers store groups of bits.
  • Counters move through a sequence of states.
  • NAND and NOR are universal gates.
  • CMOS is widely used in modern digital electronics because of low static power consumption and high integration density.

13. Practice Questions

  1. What is the difference between a digital signal and an analog signal?
  2. Convert 1011012 to decimal.
  3. What is the difference between XOR and XNOR gates?
  4. Why are NAND and NOR called universal gates?
  5. State De Morgan's Theorems.
  6. What is the difference between SOP and POS forms?
  7. How are K-Maps used to simplify Boolean expressions?
  8. What is the difference between a half adder and a full adder?
  9. Differentiate between combinational and sequential circuits.
  10. What is the purpose of a D flip-flop?
  11. What are setup time and hold time?
  12. Differentiate between synchronous and asynchronous counters.
  13. What is the difference between a ring counter and a Johnson counter?
  14. What is fan-out in a logic family?

Sources and further reading

These primary standards, official documentation, and established textbooks are useful for checking terminology and studying beyond this revision guide.