Introduction to Digital Logic

Digital logic is one of the basic subjects behind computer science and digital electronics. Computers do not process information in the same way humans normally do. At the hardware level, information is represented using electrical signals that are interpreted as two logical states, commonly represented by 0 and 1.

Digital logic helps us understand how these two states can be combined to perform operations, store information and make decisions. Concepts such as logic gates, Boolean algebra, combinational circuits, flip-flops, registers and counters are all built on this basic idea.

This topic is particularly useful for students preparing for Computer Science examinations because questions from digital logic often involve both concepts and small calculations. Understanding why a circuit behaves in a particular way is usually more useful than simply memorizing the definitions.

Digital Signals and Binary Values

A digital system works with discrete values rather than a continuously varying signal. The simplest digital system has two states: 0 and 1. These values are often associated with LOW and HIGH voltage levels in an electronic circuit, although the actual voltage ranges depend on the technology being used.

Digital Logic vs Analog Electronics

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
Generally easier to store and process digitally Can be affected more directly by signal noise
Used extensively in computers and digital devices Common in applications such as traditional audio and measurement systems

Why Digital Logic Matters

The processor, memory, calculator, digital clock and many other electronic devices depend on combinations of digital logic circuits. Learning the basic circuits makes it easier to understand how a computer performs calculations and stores information.

Number Systems Used in Digital Logic

Number systems are important in digital logic because computers represent and manipulate information in binary form. Humans normally use decimal numbers, while computer hardware works primarily with binary values. Octal and hexadecimal notation are useful because they provide shorter ways of writing binary numbers.

Common Number Systems

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 and other compact representations

Binary to Decimal Conversion

To convert a binary number into decimal, each bit is multiplied by the corresponding power of 2. The results are then added together.

For example, consider the binary number 1011.

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

Therefore, 1011 in binary is equal to 11 in decimal.

Binary and Hexadecimal

Conversion between binary and hexadecimal is relatively simple because one hexadecimal digit represents exactly four binary bits. For example, the binary value 1010 corresponds to hexadecimal A.

Study Tip: Practice binary, decimal, octal and hexadecimal conversions separately before attempting mixed conversion questions. This reduces mistakes during examinations.

Logic Gates

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

For example, an AND gate produces an output of 1 only when all of its inputs are 1. An OR gate produces 1 when at least one input is 1. These simple operations can be combined to create much larger circuits.

Common Logic Gates

Gate Boolean Expression Basic Operation
AND Y = A · B Output is 1 only when all inputs are 1
OR Y = A + B Output is 1 when at least one input is 1
NOT Y = A' Produces the complement of the input
NAND Y = (A · B)' Complement of AND output
NOR Y = (A + B)' Complement of OR output
XOR Y = A ⊕ B Output is 1 when the inputs are different
XNOR Y = (A ⊕ B)' Output is 1 when the inputs are the same

Understanding AND, OR and NOT

A simple way to remember the three basic gates is to think about their conditions. AND requires all conditions to be true, OR requires at least one condition to be true, and NOT reverses the input.

For example, if A = 1 and B = 0, then A AND B produces 0, while A OR B produces 1. A NOT gate connected to A would produce 0.

Universal Gates

NAND and NOR are known as universal gates. A complete digital circuit can be constructed using only NAND gates or only NOR gates. This property makes these gates especially important in digital circuit design.

Remember: NAND is the complement of AND, while NOR is the complement of OR.

Boolean Algebra

Boolean algebra provides a mathematical way to describe and simplify digital logic. Instead of working with ordinary numerical values, Boolean algebra generally uses binary variables and logical operations such as AND, OR and NOT.

Boolean expressions can be simplified before implementing them as circuits. A simpler expression can reduce the number of gates required, which may make a circuit smaller and easier to implement.

Important Boolean Laws

Law Expression
Identity Law A + 0 = A, A · 1 = A
Null Law A + 1 = 1, A · 0 = 0
Idempotent Law A + A = A, A · A = A
Complement Law A + A' = 1, A · A' = 0
Commutative Law A + B = B + A, A · B = B · A
Associative Law (A + B) + C = A + (B + C)
Distributive Law A · (B + C) = A·B + A·C
De Morgan's Theorem (A + B)' = A' · B', (A · B)' = A' + B'

Sum of Products and Product of Sums

A Boolean expression can be represented in different standard forms. In a Sum of Products (SOP) expression, AND operations are performed first and the resulting terms are combined using OR. In a Product of Sums (POS) expression, OR operations form individual terms and those terms are combined using AND.

Study Tip: De Morgan's theorems are frequently used when simplifying Boolean expressions. Practice applying the complement to both individual variables and operators rather than memorizing the result alone.

Karnaugh Maps (K-Maps)

A Karnaugh Map, commonly called a K-Map, is a graphical technique for simplifying Boolean expressions. Instead of repeatedly applying algebraic laws, the values of a Boolean function are placed into cells and related cells are grouped together.

Common K-Map Sizes

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

Basic Simplification Rules

When simplifying an SOP expression, cells containing 1 are grouped together. The number of cells in a group should normally be a power of two, such as 1, 2, 4 or 8. Larger groups generally result in simpler expressions.

  • Try to create the largest valid groups possible.
  • Groups may overlap when this helps simplify the expression.
  • The edges of a K-Map can be adjacent to the opposite edges.
  • Groups normally contain 1, 2, 4, 8 or another power of two cells.
  • Don't include unnecessary cells merely to make a group larger.
Important: K-Maps are useful because they provide a visual method for reducing Boolean expressions and can help produce circuits with fewer logic gates.

Combinational Circuits

A combinational circuit produces its output from the inputs that are currently applied to it. Unlike a sequential circuit, it does not use stored previous states as part of its operation.

Common examples include adders, subtractors, multiplexers, demultiplexers, encoders and decoders. These circuits are widely used as building blocks inside larger digital systems.

Common Combinational Circuits

  • Half Adder: Adds two binary bits and produces a Sum and Carry.
  • Full Adder: Adds two input bits along with a carry input.
  • Half Subtractor: Performs subtraction between two binary bits.
  • Full Subtractor: Performs binary subtraction while considering a borrow input.
  • Multiplexer (MUX): Selects one input from several available inputs.
  • Demultiplexer (DEMUX): Routes one input to one of several outputs.
  • Encoder: Converts one of several input lines into a coded output.
  • Decoder: Converts a coded input into one of several output lines.

Where Multiplexers Are Used

A multiplexer can be thought of as a digital selector. Selection lines determine which input is passed to the output. This makes multiplexers useful for data routing and for implementing certain Boolean functions.

Sequential Circuits

Sequential circuits differ from combinational circuits because their output can depend on both the current input and the previous state of the circuit. In other words, sequential circuits have a form of memory.

Flip-flops are commonly used as memory elements in sequential circuits. Depending on the design, a clock signal may be used to control when the stored state changes.

Combinational vs Sequential Circuits

Feature Combinational Circuit Sequential Circuit
Memory Does not store previous state Uses memory elements
Output depends on Current inputs Current inputs and previous state
Feedback Normally not required Commonly used
Clock Not normally required Often used in synchronous circuits
Examples Adders, multiplexers, decoders Flip-flops, registers and counters

Synchronous and Asynchronous Circuits

In a synchronous sequential circuit, changes are controlled by a common clock signal. Asynchronous circuits do not depend on a common clock in the same way and may respond directly to changes in their inputs.

Flip-Flops

A flip-flop is a basic sequential circuit capable of storing one bit of information. Flip-flops are important because larger storage structures such as registers and counters can be constructed using them.

Types of Flip-Flops

Flip-Flop Main Purpose Typical Characteristic
SR Flip-Flop Set and reset operations Basic storage element
D Flip-Flop Stores the value present at the data input Commonly used for data storage
JK Flip-Flop Set, reset and toggle operations Flexible general-purpose flip-flop
T Flip-Flop Toggle operation Useful in counter circuits

Important Timing Terms

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

Registers

A register is a group of storage elements used to hold multiple bits. Registers are found inside processors and other digital systems where temporary storage or movement of data is required.

Shift Registers

A shift register moves stored bits from one position to another, usually in response to clock pulses. Depending on how data enters and leaves the register, different types are available.

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

Applications of Registers

Registers are used for temporary data storage, data transfer and serial-to-parallel or parallel-to-serial conversion. Processor registers are also essential for holding operands, addresses and intermediate results while instructions are being executed.

Counters

A counter is a sequential circuit that moves through a predefined sequence of states. Counters are commonly used when a digital system needs to count events, generate timing sequences or divide a clock frequency.

Types of Counters

Classification Examples
Counting sequence Binary, BCD, Up/Down
Clocking method Synchronous, Asynchronous
Modulus Mod-N, Decade and Ring counters

Common Counter Types

  • Asynchronous Counter: The clock does not reach all flip-flops simultaneously, which can result in cumulative propagation delays.
  • Synchronous Counter: Flip-flops receive the clock in a coordinated manner, allowing faster operation.
  • Ring Counter: A circulating bit pattern moves through the register.
  • Johnson Counter: A variation of the ring counter that feeds the complemented output back into the input.
Study Tip: When comparing synchronous and asynchronous counters, remember to consider both clocking arrangement and propagation delay.

Digital Logic Families

A logic family refers to a group of digital circuits designed using a particular electronic technology. Different logic families have different characteristics, including speed, power consumption, noise tolerance and the number of gates that can be connected together.

Common Logic Families

Family Full Name General Characteristics
TTL Transistor-Transistor Logic Good speed with 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 Logic-Circuit Parameters

  • Propagation Delay: The time between a change at the input and the corresponding change at the output.
  • Power Dissipation: The amount of electrical power consumed by the circuit.
  • Fan-out: The number of similar logic inputs that one output can reliably drive.
  • Noise Margin: The ability of a digital circuit to tolerate unwanted electrical noise without incorrectly changing its logical state.
Key Point: CMOS technology is widely used in modern digital electronics because it can provide high integration density with low power consumption, making it suitable for processors, memory and many other digital devices.

Digital Logic: Quick Revision

Before an examination, it helps to connect the individual topics instead of studying each one in isolation. Logic gates are used to build Boolean functions. Boolean expressions can be simplified using Boolean algebra or K-Maps. Combinational circuits perform operations based on current inputs, while sequential circuits also retain information about previous states.

  • Logic gates are the basic building blocks of digital circuits.
  • Boolean algebra is used to represent and simplify logic expressions.
  • K-Maps provide a graphical method for Boolean simplification.
  • Combinational circuits depend 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.

For objective questions, focus on truth tables, Boolean laws, gate characteristics, flip-flop behaviour and differences between circuit types. For numerical questions, spend additional time practising number-system conversions and Boolean simplification.