Digital Electronics and Computer Organization SLM 93770
Digital Electronics and Computer Organization SLM 93770
and
Computer Architecture
Aditya Tandon has graduated with a B.Tech. CSE from the Apex Institute
of Engineering & Technology, Jaipur, Rajasthan, India. He secured a
Master of Technology in Computer Science and Engineering at Amity
University, Noida, Uttar Pradesh, India. He is pursuing a Ph.D. in
Computer Science Engineering at Quantum University, Roorkee,
Uttarakhand, India. He has been in the teaching profession for more than
10 years. He has presented 25 papers in National and International
Journals, conferences, and symposiums. His main areas of interest
include the Internet of Things and Data Science. He runs his own
YouTube channel, "C 4 Yourself,” with 130K+ subscribers.
Module 1: Logic Gates and Boolean Algebra
1. INTRODUCTION TO DIGITAL SYSTEMS AND COMPUTERS
Digital systems have revolutionized the way we live, work, and interact with the world. These
systems process and manipulate information using discrete values, most commonly represented
as binary digits (0 and 1). Digital systems offer advantages over traditional analog systems in
areas like accuracy, reliability, flexibility, and ease of design.
Input devices: These devices allow the user to feed data or instructions into the
digital system. Examples include keyboards, mice, touchscreens, sensors, and
microphones.
Central Processing unit (CPU): The CPU acts as the "brain" of the digital system. It
is responsible for interpreting and executing instructions, performing calculations, and
controlling the flow of data between the various components of the system.
Memory: Memory refers to the storage area within a digital system. There are two
main types of memory:
o RAM (Random Access Memory): This is volatile memory, meaning its
contents are lost when the device loses power. RAM serves as a temporary
workspace for the CPU, storing currently running programs and the data they
process.
o ROM (Read-Only Memory): ROM is non-volatile memory, meaning it
retains its contents even when the power is switched off. It houses crucial
system instructions and data needed to start the computer and load the
operating system.
Output devices: These devices present the results of the digital system's processing
to the user in a human-understandable form. Common examples include monitors,
speakers, and printers.
Figure 1: Core Components of a typical digital computer
Digital systems are ubiquitous in the modern world. Some of the most prevalent applications
include:
Digital logic forms the foundational basis of digital systems. It involves the use of discrete
values to represent logical and numeric values, which are processed by digital circuits. The
core of digital logic lies in binary, where two values, typically 0 and 1, represent different states
such as True/False, On/Off, or High/Low. These values are manipulated using various logic
gates and circuits to perform operations and make decisions.
2. BINARY NUMBERS
The binary number system is the foundation of how computers and other digital systems
represent and process information. Unlike our everyday decimal (base-10) system, the binary
system uses only two digits: 0 and 1. Understanding the binary number system is essential for
grasping fundamental concepts in digital electronics and computer science.
HISTORICAL CONTEXT
The binary system has been around for a while, dating back to ancient times in various forms.
However, it was the 17th century mathematician Gottfried Wilhelm Leibniz who really
championed the binary system to represent numbers and perform calculations efficiently.
Base-2: The binary system is a base-2 number system, meaning it uses two unique
symbols (0 and 1) to represent all values. Each digit in a binary number is called a bit
(short for "binary digit").
Place Value: Similar to the decimal system, each position in a binary number has a
corresponding place value. However, instead of being powers of 10, place values in
binary are powers of 2, increasing from right to left. For example:
o Rightmost position: 20 (value of 1)
o Second from the right: 21 (value of 2)
o Third from the right: 22 (value of 4) ...and so on.
1 * 23 1 * 8 8
0 * 22 0 * 4 0
1 * 21 1 * 2 2
1 * 20 1 * 1 1
Sum 11
Decimal Equivalent: 11
IMPORTANCE OF BINARY
Digital systems use binary numbers because they can be easily represented by physical states:
This allows construction of circuits using simple switches and transistors, which form the
building blocks of all modern digital electronics.
3. NUMBER BASE CONVERSION
In the world of digital systems, it's often necessary to switch between different number systems.
The most common are decimal (base-10), binary (base-2), octal (base-8), and hexadecimal
(base-16). Understanding how to convert between these number systems is a fundamental skill
in digital electronics.
KEY CONCEPTS
Number Bases: A number base (or radix) determines the number of unique digits
used to represent values within a number system.
METHODS OF CONVERSION
There are two primary methods for converting between number bases:
1. Division Method: This method is used to convert from a higher base to a lower base.
It involves repeated division by the target base, with the remainders forming the
converted number.
2. Positional Value Method: This method is used to convert from a lower base to a
higher base. It involves multiplying each digit by its corresponding place value and
summing the results.
Compatibility: Conversion ensures that data is represented in a form suitable for the
specific digital system or hardware being used.
Human Readability: Converting between hexadecimal and binary provides a more
compact and human-friendly way to represent large binary values.
Data Manipulation: Different number systems might be better suited for specific
mathematical operations or data representation tasks.
4. OCTAL NUMBERS
The octal number system is used in some digital systems and programming applications. It
utilizes base-8 and offers a convenient way to represent groups of binary values since each
octal digit corresponds to three binary digits.
KEY CONCEPTS
3. Octal to Decimal:
1. Identify the place value of each digit.
2. Multiply each digit by its place value.
3. Sum the results.
2 * 82 2 * 64 128
5 * 81 5*8 40
7 * 80 7*1 7
Sum 175
4. Decimal to Octal:
1. Repeatedly divide the decimal number by 8.
2. The remainders, read in reverse order, form the octal number.
5. HEXADECIMAL NUMBERS
The hexadecimal number system is widely used in computer systems and programming
because it provides a compact and human-readable way to represent large binary values. It
utilizes base-16 and understanding it is essential for working with memory addresses, color
codes, and other digital data..
KEY CONCEPTS
Base-16: The hexadecimal system uses sixteen symbols: 0-9 and A-F (where A
represents 10, B represents 11, and so on up to F, which represents 15).
Place Value: In the hexadecimal system, each position represents a power of 16,
increasing from right to left. For example:
o Rightmost position: 160 (value of 1)
o Second from the right: 161 (value of 16)
o Third from the right: 162 (value of 256) ...and so on
5. Hexadecimal to Decimal:
1. Identify the place value of each digit.
2. Multiply each digit by its place value. (use 10-15 for digits A-F).
3. Sum the results.
6. Decimal to Octal:
1. Repeatedly divide the decimal number by 8.
2. The remainders, read in reverse order, form the octal number.
KEY CONCEPTS
One's Complement: Obtained by inverting each bit of a binary number. To find the
one's complement, change every 1 to 0, and every 0 to 1.
Two's Complement: Obtained by adding 1 to the one's complement of a binary
number.
Two's complement is the most widely used method for representing negative numbers in
computer systems because:
Unique Representation of Zero: Zero has only one representation in the two's
complement system.
Simplified Arithmetic Operations: Adding and subtracting positive and negative
numbers is done with the same circuitry, making implementation more efficient.
Decimal Value -5
Binary Number 0101
One’s Complement 1010
Two’s Complement 1011
7. INTRODUCTION TO LOGIC GATES – AND GATE
Logic gates are the fundamental building blocks of digital circuits. They perform
basic logical operations on two or more binary inputs (0 or 1) to produce a single binary
output. These are the basic building blocks of digital circuits. Logic gates perform basic
logical functions on one or more binary inputs to produce a single binary output. The most
common logic gates include AND, OR, NOT, NAND, NOR, XOR, and XNOR. The AND
gate is one of the most basic and essential logic gates.
KEY CONCEPTS
The AND Gate: The AND gate produces a HIGH output (1) only if ALL of its inputs
are HIGH (1). If any input is LOW (0), the output is LOW.
Truth Table: A truth table lists all possible input combinations for a logic gate and
their corresponding outputs. Here's the truth table for a two-input AND gate:
Boolean Expression: Logic gates can be represented using Boolean expressions. The
AND operation is denoted by a dot (.) or sometimes by an asterisk (*).
Example: A . B or A * B
Logic Symbol: Each logic gate has a unique symbol. Here's the symbol for the AND
gate:
REAL LIFE EXAMPLE
Consider a simple circuit with two switches (A and B) connected in series to a light bulb. The
light bulb will only turn ON if both switches A and B are closed. The above circuit
demonstrates the functionality of an AND gate.
8. OR GATE
The OR gate is another fundamental logic gate in digital circuits. It produces a HIGH output
(1) if at least one of its inputs is HIGH (1).
KEY CONCEPTS
The OR Gate: The OR gate produces a HIGH output (1) only if any one of its inputs
are HIGH (1). If both inputs are LOW (0), the output is LOW.
Truth Table: The truth table for a two-input OR gate is given below:
9. NOT GATE
The NOT gate, also known as an inverter, is a fundamental logic gate that performs a simple
yet crucial function in digital circuits. It takes a single binary input and produces an output
that is the inverse of the input.
KEY CONCEPTS
The NOT Gate: The NOT gate performs the logical negation operation. If the input
is HIGH (1), the output is LOW (0), and if the input is LOW (0), the output is HIGH
(1).
Truth Table: The truth table for the NOT gate is straightforward:
̅)
Input (A) Output (𝑨
0 1
1 0
Boolean Expression: The NOT operation is denoted by a bar over the input variable
or by a prime symbol (').
o ̅ or A'
Example: If the input is A, the output is represented as 𝑨
Logic Symbol: The symbol for a NOT gate is a triangle with a small circle at its
output:
The NOT gate is unique among basic logic gates because it has only one input. It is often
used in combination with other logic gates to create more complex functions.
KEY CONCEPTS
The XOR Gate: The XOR gate produces a HIGH output (1) only if ONE of its inputs
is HIGH (1). If both inputs are the SAME (either both LOW or both HIGH), the
output is LOW (0).
Boolean Expression: The XOR operation is denoted by the symbol ⊕.
o Example: A ⊕ B
Truth Table: The truth table for a two-input XOR gate:
Logic Symbol:The XOR gate symbol is similar to the OR gate but with an additional
curved line at the input:
ADDITIONAL NOTES
Parity Bit Generation: XOR gates are used to generate parity bits, which are extra
bits added to data to detect errors during transmission.
Half Adder: The XOR gate is a key component in the design of half adders, which
are simple circuits used to add two single binary digits.
KEY CONCEPTS
The XNOR Gate: The XNOR gate outputs a HIGH (1) when both inputs are either
HIGH (1) or LOW (0). The output is LOW (0) only if one input is HIGH and the
other is LOW.
Boolean Expression: The XNOR operation is typically represented using the
equivalence symbol (≡) or sometimes with a bar over the XOR symbol (⊕).
o Example: A ≡ B or ̅̅̅̅̅̅̅̅
A ⊕ B.
Truth Table: The truth table for a two-input XNOR gate is given below:
̅̅̅̅̅̅̅̅
Input (A) Input (B) Output (A ⊕ B)
0 0 1
0 1 0
1 0 0
1 1 1
Logic Symbol: The XNOR gate symbol is similar to the XOR gate, but with an
additional circle at the output. The XNOR gate can be seen as an XOR gate followed
by a NOT gate. In other words, it inverts the output of an XOR gate.
The NAND gate is a versatile logic gate that plays a crucial role in digital electronics.
It is a combination of NOT and AND Gate. It's considered a universal gate because any other
logic function can be created using only NAND gates. This property makes NAND gates
fundamental in building complex digital circuits.
KEY CONCEPTS
The NAND Gate: The NAND gate is essentially an AND gate followed by a NOT
gate. It produces a LOW output (0) only if ALL of its inputs are HIGH (1). If any
input is LOW (0), the output is HIGH.
Boolean Expression: The NAND operation is denoted by an upward arrow (↑) or by
a bar over the AND operation (A.B)
o ̅̅̅̅)
Example: A ↑ B or (AB
Truth Table: Here's the truth table for a two-input NAND gate:
̅̅̅̅)
Input (A) Input (B) Output (𝐀𝐁
0 0 1
0 1 1
1 0 1
1 1 0
Logic Symbol: The NAND gate symbol is similar to the AND gate, but with a small
circle at the output:
The NAND gate's universality can be demonstrated by constructing other logic gates using
only NAND gates:
Simplicity: NAND gates are relatively easy to manufacture, making them cost-
effective.
Flexibility: Due to their universality, NAND gates can be used to build a wide range
of digital circuits, simplifying design and reducing component count.
The NOR gate, like the NAND gate, is another universal gate. It is a combination of NOT
and OR gates. Other logic gates can be created by using only NOR gates. This universality
makes NOR gates a powerful tool in designing digital circuits.
KEY CONCEPTS
The NOR Gate: The NOR gate essentially combines an OR gate with a NOT gate. It
produces a HIGH output (1) only if ALL of its inputs are LOW (0). If any input is
HIGH (1), the output is LOW.
Boolean Expression: The NOR operation is denoted by a down arrow (↓) or by a bar
̅̅̅̅̅̅̅
over the OR operation (A + B)
o ̅̅̅̅̅̅̅
Example: A ↓ B or (A + B)
Truth Table: Here's the truth table for a two-input NOR gate:
̅̅̅̅̅̅̅̅
Input (A) Input (B) Output (𝐀 + 𝐁)
0 0 1
0 1 0
1 0 0
1 1 0
Logic Symbol: The NOR gate symbol is similar to the OR gate, but with a small
circle at the output.
UNIVERSALITY OF THE NOR GATE
The NOR gate's universality can be demonstrated by constructing other logic gates using only
NOR gates:
Simplicity: Like NAND gates, NOR gates are relatively simple to manufacture.
Flexibility: Due to their universality, NOR gates offer flexibility in designing digital
circuits, often reducing the overall component count and simplifying the design
process.
KEY CONCEPTS
Boolean Variables: Variables that can have only two possible values: 0 (false) or 1
(true).
Boolean Operators: Symbols representing logical operations:
o AND (.)
o OR (+)
o NOT (¯ or ')
Boolean Expression: A combination of Boolean variables and operators that
represents a logical relationship.
The following are some of the most important Boolean algebra theorems:
A+0=A
Identity Laws
A.1=A
A+1=1
Null Laws
A.0=0
A +A = A
Idempotent Laws:
A.A=A
A + A̅ = 1
Inverse Laws
A . A̅ = 0
A+B=B+A
Commutative Laws:
A.B=B.A
A + (B + C) = (A + B) + C
Associative Laws
A . (B . C) = (A . B) . C
A . (B + C) = A . B + A . C
Distributive Laws
A + (B . C) = (A + B) . (A + C)
̅̅̅̅̅̅̅̅
(𝐴 + 𝐵) = 𝐴̅ . 𝐵̅
DeMorgan's Theorems:
̅̅̅̅ ) = 𝐴̅ + 𝐵̅
(𝐴𝐵
Each of the Boolean laws above are given with just a single or two variables, but the
number of variables defined by a single law is not limited to this as there can be an infinite
number of variables as inputs too the expression. These Boolean laws detailed above can be
used to prove any given Boolean expression as well as for simplifying complicated digital
circuits.
IMPORTANCE OF BOOLEAN ALGEBRA THEOREMS
Boolean algebra provides a powerful set of tools for manipulating and simplifying
logical expressions. Applying Boolean algebra theorems and properties can reduce complex
expressions to simpler, equivalent forms. This simplification process not only makes
expressions easier to understand but also leads to more efficient circuit implementations.
KEY CONCEPTS
1. Identify Theorems: Look for opportunities to apply Boolean algebra theorems such
as distributive, commutative, associative, DeMorgan's, and others.
2. Eliminate Redundancies: Look for terms that can be eliminated or combined using
idempotent and inverse laws.
3. Factorization: Factor out common terms to further simplify the expression.
4. Complementation: Apply DeMorgan's theorems to complement terms or the entire
expression.
Example:
Simplify the Boolean expression: A . (A + B) + A . B
A . (A + B) + A.B
A . A + A . B + A.B Distributive Law applied
A+A.B + A.B Idempotent Law applied
A+A.B Idempotent Law applied
A (1+B) Combining the terms
A.1 Null Law applied
A Identity Law applied
IMPORTANCE OF SIMPLIFICATION
KEY CONCEPTS
1. Truth Table: Create a truth table for the Boolean function, listing all possible input
combinations and their corresponding outputs.
2. Identify Minterms: Identify the rows in the truth table where the output is 1. These
rows represent the minterms of the function.
3. Form Product Terms: For each minterm, create a product term by including the
variables in their true form if they are 1 in the minterm and in their complemented
form if they are 0.
4. OR the Product Terms: Combine all the product terms using the OR (+) operator.
Example:
Consider the Boolean function F(A, B, C) with the following truth table:
A B C F(A,B,C)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
A̅B̅C
A̅BC
ABC̅
ABC
The SOP expression for F(A, B, C) is: A̅B̅C + A̅BC + ABC̅ + ABC
KEY CONCEPTS
1. Truth Table: Create a truth table for the Boolean function, listing all input
combinations and their corresponding outputs.
2. Identify Maxterms: Identify the rows in the truth table where the output is 0. These
rows represent the maxterms of the function.
3. Form Sum Terms: For each maxterm, create a sum term by including the variables
in their true form if they are 0 in the maxterm and in their complemented form if they
are 1.
4. AND the Sum Terms: Combine all the sum terms using the AND (.) operator.
Example:
Consider the Boolean function F(A, B, C) with the same truth table as in Topic 16.
A B C F(A,B,C)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
A+B+C
A + B̅ + C
A̅ + B + C
A̅ + B + C̅
KEY CONCEPTS
SOP IMPLEMENTATION
POS IMPLEMENTATION
Consider the POS expression: F(A+B+C) = (A+B+C) + (A+B̅+C) + (A̅+B+C) + (A̅ +B+ C̅)
Karnaugh Maps (K-Maps) offer a visual and intuitive method for simplifying Boolean
expressions. While Boolean algebra theorems can be used for simplification, K-Maps provide
a graphical approach that often leads to quicker and easier solutions, especially for expressions
with a moderate number of variables. It is a table consisting of cells which represents a Minterm
or Maxterm. Karnaugh map or K-map is named after Mayrice Karnough.
KEY CONCEPTS
Graphical Representation: K-Maps are grids where each cell represents a minterm
(for SOP simplification) or a maxterm (for POS simplification).
Cell Arrangement: The arrangement of cells follows a Gray code pattern, ensuring
that adjacent cells differ by only one variable.
Grouping: The simplification process involves grouping adjacent cells that contain 1s
(for SOP) or 0s (for POS).
Larger Groups: Larger groups of cells lead to simpler expressions.
Wrap-around: The edges of the K-Map are considered adjacent, allowing for wrap-
around grouping.
1. Create K-Map: Construct a K-Map with the appropriate number of variables. The
number of cells in the K-Map is 2^n, where n is the number of variables.
2. Suppose there are two variables, then there will be 22 = 4 cells in the K-map. Each
cell has a subscripted number at the bottom right corner. It is the value of the
minterm. Similarly, if we have three variables, then there will be 23 = 8 cells in the K-
map.
3. Fill the K-Map: Fill the K-Map with 1s for minterms (in SOP) or 0s for maxterms (in
POS) based on the truth table of the Boolean function.
4. Identify Groups: Group adjacent cells containing 1s (for SOP) or 0s (for POS) to
form rectangular or square groups.
5. Form Terms: For each group, write a product term (for SOP) or a sum term (for
POS) that includes only the variables that remain constant within the group.
6. Combine Terms: Combine all the terms using the OR operator (for SOP) or the AND
operator (for POS).
ADVANTAGES OF K-MAPS
Visual: K-Maps provide a visual aid for simplifying expressions, making the process
more intuitive.
Efficiency: K-Maps often lead to faster simplification than algebraic manipulation.
Minimization: K-Maps help identify the optimal grouping of terms to achieve the
simplest possible expression.
20. K-MAPS USING 2 VARIABLES
Let us consider an example for SOP. A 2-variable K-Map is a 2x2 grid, with each cell
representing a minterm (for SOP) or maxterm (for POS). Identify adjacent cells containing 1s
(for SOP) or 0s (for POS) and group them together to form rectangular or square groups of
sizes 1, 2, or 4. Larger groups lead to simpler expressions. The edges of the K-Map are
considered adjacent, allowing for wrap-around grouping.
Consider the Boolean function F(A, B) with the following truth table:
A B F(A,B)
0 0 0
0 1 1
1 0 1
1 1 0
B
0 1
A
0 0 1
1 1 0
Consider the Boolean function F(A, B) with the same truth table:
B
0 1
A
0 1 0
1 0 1
It can be seen that both the SOP and POS forms represent the same Boolean function,
but they do so in different ways. The choice between SOP and POS often depends on the
specific requirements of the circuit design or simplification process.
Karnaugh maps (K-Maps) can be extended to simplify Boolean expressions with three
variables. The process is similar to that used for two-variable K-Maps, but with a larger grid
and additional considerations for grouping cells. A 3-variable K-Map is a 2x4 grid (or 4x2,
depending on the arrangement of variables), where each cell represents one of the eight
possible minterms (for SOP simplification) or maxterms (for POS simplification).
Consider the Boolean function F(A, B,C) with the following truth table:
A B C F(A,B,C)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
BC 00 01 11 10
A
0 0 0 1 1
1 0 1 1 0
Consider the Boolean function F(A, B, C) with the same truth table for POS:
BC
00 01 11 10
A
0 1 1 0 0
1 1 0 0 1
K-Maps can be further extended to simplify Boolean expressions with four variables.
The principles remain the same as with two- and three-variable K-Maps, but the grid is larger
(4x4) to accommodate the increased number of possible combinations. A 4-variable K-Map
is a 4x4 grid, with each cell representing one of the sixteen possible minterms (for SOP) or
maxterms (for POS)
Consider the Boolean function F(A, B,C, D) with the following truth table:
A B C D F(A,B,C,D) A B C D F(A,B,C,D)
0 0 0 0 1 1 0 0 0 1
0 0 0 1 0 1 0 0 1 0
0 0 1 0 1 1 0 1 0 1
0 0 1 1 1 1 0 1 1 0
0 1 0 0 0 1 1 0 0 0
0 1 0 1 1 1 1 0 1 1
0 1 1 0 0 1 1 1 0 1
0 1 1 1 0 1 1 1 1 1
CD
00 01 11 10
AB
00 1 0 1 0
01 0 1 0 0
11 1 0 1 0
10 0 1 1 1
There are several possible groupings of 1s. Here's one optimal solution:
Consider the Boolean function F(A, B, C, D) with the same truth table for POS:
CD
00 01 11 10
AB
00 0 1 0 1
01 1 0 1 1
11 0 1 0 1
10 1 0 0 0
Write a sum term for each group, remembering to negate the variables:
Group 1: (B + D)
Group 2: (A + D')