0% found this document useful (0 votes)
4 views49 pages

SF-8 Notes Module - 1

The document is a set of lecture notes for a Digital Electronics course, covering topics such as Boolean Algebra, logic gates, and digital signals. It explains the differences between analog and digital electronics, the basic operations of digital circuits, and the functions of various logic gates including AND, OR, NOT, NAND, and NOR. The notes emphasize the importance of digital systems in modern technology and their advantages over analog systems.

Uploaded by

jash60747
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views49 pages

SF-8 Notes Module - 1

The document is a set of lecture notes for a Digital Electronics course, covering topics such as Boolean Algebra, logic gates, and digital signals. It explains the differences between analog and digital electronics, the basic operations of digital circuits, and the functions of various logic gates including AND, OR, NOT, NAND, and NOR. The notes emphasize the importance of digital systems in modern technology and their advantages over analog systems.

Uploaded by

jash60747
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Department of Electronics and Communication

Engineering

Digital Electronics
(24ETECES204U/24EMECES204U)

Lecture Notes

B. Tech (I YEAR - II SEM)


(2024-25)
Department of Electronics and Communication
Engineering

Digital Electronics
(24ETECES204U/24EMECES204U)

BOOLEAN ALGEBRA AND LOGIC GATES


GA
TES
Module 1
DIGITAL ELECTRONICS

Syllabus: Module- 1: Boolean Algebra and Logic Gates (9 hrs)


Digital Systems, Binary Numbers, Octal and Hexadecimal Numbers, Number Base Conversions,
Signed Binary Numbers, Complements, One’s and Two’s complement arithmetic, binary codes
(BCD, Gray, and Xcess-3), Logic gates, Universal gates, Implementation of Boolean function using
universal gates.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |1
DIGITAL ELECTRONICS

1.1 INTRODUCTION
Digital electronics is a branch of electronics that deals with signals represented in discrete (binary)
form- 0s and 1s. Unlike analog electronics, which use continuous signals, digital systems process
information using binary logic, making them more reliable and efficient.
Digital electronics form the foundation of modern computing and communication systems. They are
used in devices such as computers, smartphones, calculators, and digital circuits in industrial
automation. The core components of digital electronics include logic gates, flip-flops, registers,
counters, and microprocessors, all of which work together to process and store digital data.
One of the main advantages of digital electronics is their resistance to noise and signal degradation,
allowing for precise and error-free data transmission. Additionally, digital circuits are easier to design,
modify, and integrate into complex systems compared to analog circuits.
Digital electronics deals with circuits that process and use digital signals, which have only two
discrete levels: 0 (LOW) and 1 (HIGH).

Difference Between Analog Electronics and Digital Electronics


Feature Analog Electronics Digital Electronics

Signal Type Continuous signals (vary smoothly) Digital signals (0 and 1)

Processing Works with real-world signals like Processes binary data using logic
sound, temperature, and voltage operations
Accuracy Less accurate due to signal distortion Highly accurate as noise has minimal
and noise effect
Complexity More complex due to varying signal Simpler as it operates with only two
levels levels (HIGH & LOW)
Design Requires components like resistors, Uses logic gates, flip-flops, and
capacitors, and transistors microprocessors
Memory & Difficult to store and retrieve signals Easy to store data using digital memory
Storage
Interference More prone to noise and distortionLess affected by noise, ensuring reliable
performance
Examples AM/FM radios, analog watches, old Computers, smartphones, digital TVs,
telephones microcontrollers

With the advent of semiconductor technologies, digital systems have become more powerful and
essential, revolutionizing our lives faster than any other technology.
Key Reasons for the Popularity of Digital Systems:
• Simple Operation – Digital systems work with just two states: HIGH (1) and LOW (0),
making them easy to design and use.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |2
DIGITAL ELECTRONICS

• High Reliability – Digital circuits are less affected by noise, temperature changes, and aging,
ensuring stable performance.
• Easy Design and Analysis – Digital circuits follow Boolean algebra and simple logic
operations, making them easier to learn and implement than analog circuits.
• Speed and Efficiency – Digital systems process data faster and with higher accuracy, making
them ideal for computing and automation.
• Miniaturization – Advances in IC technology allow the creation of compact, high-
performance digital devices.
• Interfacing and Compatibility – Digital systems use standardized logic families, making
integration with other components easier.
• Storage and Processing Power – Digital memory enables data storage, retrieval, and complex
processing, which is crucial for modern computing.
• Programmability – Many digital circuits are programmable, allowing flexibility in
applications like microcontrollers and computers.
• Cost-Effectiveness – Mass production of digital ICs has made them affordable and widely
available.
• Wide Applications – Used in computers, communication, automation, robotics, and AI, digital
technology is essential in almost every industry.

1.2 DIGITAL SIGNALS


A digital signal has two discrete levels: LOW and HIGH. In a positive logic system (Fig. 1.1a), the
lower voltage is LOW, and the higher voltage is HIGH. In a negative logic system (Fig. 1.1b), this is
reversed HIGH corresponds to the lower voltage, and LOW to the higher voltage.
The exact voltage for each level varies within a specified range. For example, in a positive logic
system, 3.5V to 5V is HIGH, while 0V to 1V is LOW.

(a) (b)
Figure 1.1: Digital Signal Representation (a) Positive Logic (b) Negative Logic

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |3
DIGITAL ELECTRONICS

The two discrete signal levels, HIGH and LOW, can be represented by the binary digits 1 and 0,
respectively. A binary digit (0 or 1) is called a bit. Since a digital signal has only two possible levels,
the binary number system is used for analyzing and designing digital systems. These levels can also
be referred to as ON and OFF or TRUE and FALSE.

1.3 BASIC DIGITAL CIRCUITS


Digital systems perform a few basic operations, regardless of their complexity. These operations are
repeatedly used in large systems like digital computers and control systems. The fundamental
operations include AND, OR, NOT, and FLIP-FLOP.

1.3.1 The AND Operation


An AND gate is a circuit that performs the AND operation. It has N inputs (N ≥ 2) and one output.
Digital signals are applied to the input terminals (A, B, …, N), and the output (Y) is also a digital
signal.
The AND operation is defined as: The output is 1 only if all inputs are 1; otherwise, the output is 0.

Figure 1.2: Symbol of N inputs AND Gate


Logical expression of AND gate can be expressed as:
Y = A AND B AND C … AND N or
Y=A· B · C · … · N or
Y = A.B.C…N
Here,
A, B, C,…, N are the input variables, and Y is the output variable.
These variables are binary, each can have only two possible values: 0 or 1. Binary variables are also
known as logical variables.
The term "gate" is used because a digital circuit functions like a gate. In an AND operation, the gate
opens (Y = 1) only when all inputs are at logic 1.
Since a logical variable can have only two values (0 and 1), any logical operation can be represented
in a table showing all possible input combinations and their corresponding outputs. This table is called
a truth table.
A truth table is a mathematical table used in logic and computer science to determine the output of a
logical expression based on all possible input values. The truth table fully defines the input-output
relationship of the digital circuit
For N inputs, there are 2ⁿ possible combinations, with each row representing one combination.
For a two-input AND gate, the truth table is shown in Table 1.1. The logical equation for the AND
gate is: Y = A.B

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |4
DIGITAL ELECTRONICS

This is read as "Y equals A AND B", meaning Y is 1 only when both A and B are 1; otherwise, Y is
0. Figure 1.3 represents the symbol of two input AND Gate

Figure 1.3: Symbol of two inputs AND Gate


Table 1.1 Truth Table of a 2-Input AND Gate

Input Output
A B Y
0 0 0
0 1 0
1 0 0
1 1 1

Since there are only two inputs (A and B), the total number of possible input combinations is four (2²
= 4).
The AND operation is also called logical multiplication because it follows the same rules as binary
multiplication.

Figure 1.4: Timing diagram of two input AND Gate Figure 1.5: Pin diagram of IC7408

IC 7408 (Quad 2-Input AND Gate): The 7408 is a quadruple 2-input AND gate IC, it contains four
independent AND gates, each with two inputs and one output. Figure 1.5 illustrates the input and
output pins of each individual 2-input AND gate.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |5
DIGITAL ELECTRONICS

1.3.2 The OR Operation


Figure 1.6 illustrates an OR gate with N inputs (N ≥ 2) and a single output. The OR operation states
that the output is HIGH (1) if at least one of the inputs is HIGH (1).
The logical equation for the OR gate is: Y=A+B+C+…+N
where A, B, C,…N are input variables and Y is the output. The OR operation is also known as logical
addition.

Figure 1.6: Symbol of N inputs OR Gate

The truth table of a 2-input OR gate is shown in Table 1.2. Its logical equation is: Y=A+B
which is read as "Y equals A OR B."

Figure 1.7: Symbol of two inputs OR Gate


Table 1.2: Truth Table for 2-Input OR Gate
Input Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 1

Figure 1.8: Timing diagram of two input OR Gate Figure 1.9: Pin diagram of IC7432
IC 74032 (Quad 2-Input OR Gate): The 7432 is a quadruple 2-input OR gate IC, it contains four
independent OR gates, each with two inputs and one output. Figure 1.9 illustrates the input and output
pins of each individual 2-input OR gate.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |6
DIGITAL ELECTRONICS

1.3.4 The NOT Operation


Figure 1.10 shows a NOT gate, which is also known as an inverter. It has one input (A) and one
output (Y). Its logic equation is written as
Y = NOT A
=A̅

Figure 1.10: Symbols of NOT Gate


and is read as “Y equals NOT A” or “Y equals complement of A”. The NOT operation is also referred
to as an inversion or complementation. The presence of a small circle, known as the bubble, always
denotes inversion in digital circuits.

Table 1.3: The truth table of a NOT gate


Input Output
A Y
0 1
1 0

Figure 1.11: Timing diagram of NOT Gate Figure 1.12: Pin diagram of IC7404

IC 7404 (Quad -Input AND Gate): The 7408 is a Hex 1-input NOT gate IC, it contains six
independents NOT gates, each with one input and one output. Figure 1.12 illustrates the input and
output pins of each individual NOT gate.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |7
DIGITAL ELECTRONICS

1.4 UNIVERSAL GATES (NAND AND NOR OPERATIONS)


NAND (NOT AND) and NOR (NOT OR) gates are known as universal gates because they can be
used to implement any Boolean function or logic circuit using only one type of gate.

1.4.1 The NAND Operation


The NAND (NOT–AND) operation is formed by passing the output of an AND gate through a NOT
gate. This means that the NAND operation first computes the logical AND of all inputs and then
complement the result.
The circuit consists of an N-input AND gate (where N≥2). The output of the AND gate is then inverted
using a NOT gate. The mathematical expression of N input NAND Gate is
Y = ̅̅̅̅̅̅̅̅̅̅̅
A. B … . N

Where A and B are the inputs, and Y is the output.

(a) (b)
Figure 1.13: (a) NAND Operation as NOT–AND Operation, (b) Standard Symbol for the NAND Gate

The standard symbol of the NAND gate is shown in Fig. 1.10b. Here, a bubble on the output side of
the NAND gate represents NOT operation, inversion or complementation.
Symbol of two input AND gate is shown in the figure 1.14

Figure 1.14. Symbol of two input NAND Gate

Its logic equation is Y = ̅̅̅̅̅


A. B
and, is read as “Y equals NOT (A AND B)”.
Table 1.4 represent the truth table of a 2-input NAND gate.

Table 1.4: Truth Table of a 2-Input NAND Gate


Input Output
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1
Page Page |8
DIGITAL ELECTRONICS

Figure 1.15: Timing diagram of two input NAND Gate Figure 1.16: Pin diagram of IC7404

The three basic logic operations, AND, OR and NOT can be performed by using only NAND gates.

Figure 1.17: Realisation of Basic Logic Operations Using NAND Gates


(a) NOT (b) AND (c) OR

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page Page |9
DIGITAL ELECTRONICS

1.4.2 The NOR Operation


NOR (NOT OR) operation is a fundamental logic operation in digital electronics. It is a combination
of the OR and NOT operations. The NOR gate produces a high (1) output only when all inputs are
low (0); otherwise, the output is low (0).
Boolean Expression of NOR gate: 𝑌 = ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
A + B + ⋯+ N

Figure 1.18 (b) represent standard symbol of N input (N ≥ 2) NOR Gate.


Similar to the NAND gate, a bubble on the output side of the NOR gate represents the NOT
operation.

Figure 1.18: (a) NOR Operation as NOT–OR Operation (b) Standard Symbol for the NOR Gate.

Figure 1.19: Symbol of two input NOR Gate

Figure 1.19 represent the Symbol of two input NOR Gate. Its logic equation is Y= ̅̅̅̅̅̅̅̅
𝐀+𝐁
and is read as “Y equals NOT (A OR B)”. Table 1.5 described the truth table of a 2-input NOR gate.

Table 1.5: Truth table of a 2-input NOR Gate


Input Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 0

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 10
DIGITAL ELECTRONICS

Figure 1.20: Timing diagram of two input NOR Gate Figure


1.21: Pin diagram of IC7402

The three basic logic operations, AND, OR, and NOT can be performed by using only the NOR
gates also as shown in the figure 1.22.

Figure 1.22: Realisation of Basic Logic Operations Using NOR Gates (a) NOT (b) OR (c) AND operations

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 11
DIGITAL ELECTRONICS

1.5 The EXCLUSIVE-OR Operation


The Exclusive OR (XOR) operation is a fundamental logic function used in digital electronics. The
XOR gate produces a high (1) output only when the inputs are different (i.e., one input is 1 and the
other is 0). If both inputs are the same (both 0 or both 1), the output is low (0).

Figure 1.23: Symbol of Exclusive OR Gate

The XOR operation is mathematically represented as:


Y = A EX-OR B or
Y = A⊕B or
Y = AB̅+ A̅B
The truth table of an EX-OR gate is given in Table 1.6.
Table 1.6: Truth Table of EX-OR Gate
Input Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0

Applications of XOR Gate


• Parity Checking & Error Detection – Used in error detection codes.
• Arithmetic Operations – Used in binary addition (Half Adder, Full Adder).
• Data Encryption – XOR is fundamental in cryptography (e.g., one-time pad encryption).
• Comparators – Used to compare two binary numbers.

1.6 The EXCLUSIVE-NOR (EX-NOR) Operation


The Exclusive-NOR (XNOR) operation is the complement of the XOR operation. The XNOR gate
produces a high (1) output when the inputs are the same (both 0 or both 1) and a low (0) output when
the inputs are different.
Its logic operation is specified as:
Y = A EX-NOR B or
Y = ̅̅̅̅̅̅̅̅̅̅̅̅̅
A EXOR B or
Y = ̅̅̅̅̅̅̅̅̅
A⊕B
Figure 1.24 shows the standard symbol of EX-NOR gate.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 12
DIGITAL ELECTRONICS

Figure 1.24: Symbol of Exclusive OR Gate

Table 1.6: Truth Table of EX-NOR Gate

Input Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 1

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 13
DIGITAL ELECTRONICS

Summary of Logic Gates

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 14
DIGITAL ELECTRONICS

1.7 BOOLEAN ALGEBRA


Digital signals have only two possible values: 0 and 1. This forms the binary number system. George
Boole created a set of rules, called Boolean algebra, to work with these binary values. These rules are
the foundation of digital systems like computers and calculators. The main Boolean algebra rules are
listed in Table 1.8.

Table 1.8: Boolean Algebra


Theorem No. Theorem
1.1 A+ 0 =A
1.2 A. 1 =A
1.3 A+1=1
1.4 A.0 = 0
1.5 A+A=A
1.6 A.A=A
1.7 A+A ̅=1
1.8 A . ̅A = 0
1.9 A (B+C) = AB + AC
1.10 A+BC = (A+B)(A+C)
1.11 A+AB = A
1.12 A(A+B) = A
1.13 A+A ̅B = (A+B)
1.14 A(A̅ + B) = AB
1.15 AB + A B ̅ =A
1.16 (A + B)(A + B ̅) = A
1.17 AB + A ̅C = (A + C)( A ̅ + B)
1.18 (A + B)( A ̅ + C) = AC + A ̅B
1.19 AB + A ̅ C + BC = AB + A ̅C
1.20 (A + B)( A ̅ + C)(B + C) = (A + B)(A ̅ + C)
1.21 ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
A. B. C … . N = A ̅+B ̅ + C̅ + ⋯+N ̅
1.22 ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
A +B + C + ⋯+ N = A ̅. B̅. C̅. …+N
̅

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 15
DIGITAL ELECTRONICS

1.7 NUMBER SYSTEMS


We commonly use a number system based on ten symbols 0 to 9 known as the decimal number
system. The base, or radix, of this system is 10, representing the total number of unique digits. Any
number is formed using these digits. For example, in 1982.365, the integer part is 1982, while the
fractional part is 0.365, separated by a decimal point.
Besides decimal, other number systems like binary, octal, and hexadecimal are also used, especially
in digital systems such as microprocessors, logic circuits, and computers.
In any number system, there is an ordered set of symbols called digits, along with defined rules for
arithmetic operations such as addition and multiplication. Numbers are formed using these digits and
typically consist of two parts: an integer and a fractional part, separated by a radix point (.).

(1.1)

Where,
N = a number
b = radix or base of the number system
n = number of digits in integer portion
m = number of digits in fractional portion
dn-1= most significant digit (msd)
dm-1 = least significant digit (lsd)
and 0 ≤ (di or d−f ) ≤ b − 1

The digits in a number are placed side by side and each position in the number is assigned a weight
or index of importance by some predesigned rule. Table 1.9 gives the details of commonly used
number systems.

Table 1.9: Characteristics of Commonly Used Number Systems

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 16
DIGITAL ELECTRONICS

1.7.1 Binary Number System


The number system with base (or radix) two is known as the binary number system. Only two
symbols are used to represent numbers in this system and these are 0 and 1. These are known as bits,
a group of four bits is known as a nibble, and a group of eight bits is known as a byte.
Table 1.10, illustrates counting in binary number system. The corresponding decimal numbers are
given in the right-hand column. Similar to decimal number system, the left-most bit is known as the
most significant bit (MSB) and the right-most bit is known as the least significant bit (LSB).

Table 1.10: 4-bit Binary Numbers and Their Corresponding Decimal Numbers

Binary-to-Decimal Conversion
Any binary number can be converted into its equivalent decimal number using the weights assigned
to each bit position as given in Table 1.9.

Example: Find the decimal equivalent of the binary number (1 1 1 1 1)2

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 17
DIGITAL ELECTRONICS

Example: Determine the decimal numbers represented by the following binary numbers:
(a) 110101 (b) 101101 (c) 11111111 (d) 00000000

Example: Determine the decimal numbers represented by the following binary numbers:
(a) 101101.10101 (b) 1100.1011 (c) 1001.0101 (d) 0.10101

Decimal-to-Binary Conversion
Decimal-to-binary conversion is performed through repeated division by 2, recording the remainders
at each step. The process continues until the quotient becomes zero, with the binary equivalent
obtained by reading the remainders in reverse order. The following examples illustrate this conversion
method.
Example: Convert (13)10 to an equivalent base-2 number.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 18
DIGITAL ELECTRONICS

Example: Express the following decimal numbers in the binary form:


(a) 25.5 (b) 10.625

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 19
DIGITAL ELECTRONICS

Example: Convert (0.65625)10 to an equivalent base-2 number.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 20
DIGITAL ELECTRONICS

1.8 SIGNED BINARY NUMBERS


1.8.1 Sign-Magnitude Representation
In the decimal number system, a plus (+) sign indicates a positive number, while a minus (-) sign
represents a negative number. By convention, the plus sign is usually omitted, meaning an unsigned
number is assumed to be positive. This method of representing numbers is known as signed notation.
Since digital systems operate using only 0s and 1s, the sign of a number must also be represented
using these symbols. Typically, an extra bit, called the sign bit, is added as the Most Significant Bit
(MSB). A sign bit of 0 represents a positive number, while 1 indicates a negative number.
For example, in an 8-bit signed representation:
• 01000100 represents +68, where the MSB (0) denotes a positive value.
• 11000100 represents -68, where the MSB (1) indicates a negative value, and the remaining
seven bits determine the magnitude.
This method of encoding signed numbers is called sign-magnitude representation.

Example: Find the decimal equivalent of the following binary numbers assuming sign-magnitude
representation of the binary numbers.
(a) 101100 (b) 001000 (c) 0111 (d) 1111

1.8.2 One’s Complement Representation


In a binary number, swapping each 1 with 0 and each 0 with 1 produces its one’s complement. Both
numbers are complements of each other. If one represents a positive value, the other represents the
negative.
For example:
• (0101)₂ represents (+5)₁₀
• (1010)₂ represents (-5)₁₀ in one’s complement form.
This method is commonly used for representing signed numbers. Similar to sign-magnitude
representation, the Most Significant Bit (MSB) is 0 for positive numbers and 1 for negative numbers.
Example: Find the one’s complement of the following binary numbers.
(a) 0100111001 (b) 11011010
Solution
(a) 1011000110 (b) 00100101
BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1
Page P a g e | 21
DIGITAL ELECTRONICS

Example: Represent the following numbers in one’s complement form.


(a) +7 and 7 (b) +8 and 8 (c) +15 and 15

1.8.3 Two’s Complement Representation


Adding 1 to the one’s complement of a binary number produces its two’s complement. For example,
the two’s complement of 0101 is 1011. Since 0101 represents (+5)₁₀, its two’s complement, 1011,
represents (-5)₁₀. Similar to other signed representations, the Most Significant Bit (MSB) indicates
the sign:
• 0 for positive numbers
• 1 for negative numbers
In an n-bit two’s complement system:
• The maximum positive number that can be represented is (2ⁿ⁻¹ - 1)
• The minimum (most negative) number is -2ⁿ⁻¹
For example, in a 4-bit system:
• The largest positive number is 0111 = +7
• The smallest negative number is 1000 = -8
An important property of two’s complement representation is that taking the two’s complement of a
number twice returns the original number. Table 1.11 provides a comparison of sign-magnitude, one’s
complement, and two’s complement representations for 4-bit binary numbers.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 22
DIGITAL ELECTRONICS

Table 1.11: Sign-Magnitude, 1’s and 2’s Complement Representation Using Four Bits

Example: Find the 2’s complement of the numbers:

From the above example, we observe the following:


1. If the LSB of the number is 1, its 2’s complement is obtained by changing each 0 to 1 and 1 to 0
except the least-significant bit.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 23
DIGITAL ELECTRONICS

2. If the LSB of the number is 0, its 2’s complement is obtained by scanning the number from the
LSB to MSB bit by bit and retaining the bits as they are up to and including the occurrence of the
first 1 and complement all other bits
Example:

Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 24
DIGITAL ELECTRONICS

1.9 BINARY ARITHMETIC


1.9.1 Binary Addition
Just like in the decimal system, arithmetic operations such as addition, subtraction, multiplication,
and division can also be performed on binary numbers. In fact, binary arithmetic is simpler than
decimal arithmetic because it uses only two digits: 0 and 1.

Table 1.12: Rules of Binary Addition

In the first three rows above, there is no carry, that is, carry = 0, whereas in the fourth row a carry is
produced (since the largest digit possible is 1), that is, carry = 1, and similar to decimal addition it is
added to the next higher binary position.

Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 25
DIGITAL ELECTRONICS

Example:

From the example above, we can derive the following observations:


1. If the number of 1’s in a column is even, the sum bit is 0. If the number of 1’s is odd, the sum
bit is 1.
2. Every pair of 1’s in a column generates a carry (1), which is added to the next higher bit
column.

1.9.2 Binary Subtraction


Table 1.13: Rules of Binary Subtraction

Except in the second row above, the borrow = 0. When the borrow = 1, as in the second row, this is
to be subtracted from the next higher binary bit as it is done in decimal subtraction.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 26
DIGITAL ELECTRONICS

Example:

1.9.3: Binary Multiplication


Binary multiplication is similar to decimal multiplication. In binary, each partial product is either zero
(multiplication by 0) or exactly same as the multiplicand (multiplication by 1). An example of binary
multiplication is given below:

Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 27
DIGITAL ELECTRONICS

1.9.4 Binary Division


Binary division is obtained using the same procedure as decimal division. An example of binary
division is given below:
Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 28
DIGITAL ELECTRONICS

1.10 2’S COMPLEMENT ARITHMETIC


Digital circuits are used for performing binary arithmetic operations. It is possible to use the circuits
designed for binary addition to perform the binary subtraction also if we can change the problem of
subtraction to that of an addition. This concept eliminates the need of additional circuits for
subtraction, rather the same adder circuits are used for both the operations. This makes design of
arithmetic circuits very convenient and cheaper.

1.10.1 Subtraction Using 2’s Complement


Binary subtraction can be performed by adding the 2’s complement of the subtrahend to the minuend.
If a final carry is generated, discard the carry and the answer is given by the remaining bits which is
positive (the minuend is greater than subtrahend). If the final carry 0, the answer is negative (the
minuend is smaller than the subtrahend) and is in 2’s complement form.
Example:

1.10.2 Addition/Subtraction in 2’s Complement Representation


The addition/subtraction of signed binary numbers can most conveniently be performed using 2’s
complement representation of both the operands. This is the method most commonly used when these
operations are performed using digital circuits and microprocessors.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 29
DIGITAL ELECTRONICS

Example:

From the above example, we observe the following:


(a) If the two operands are of the opposite sign, the result is to be obtained by the rule of subtraction
using 2’s complement
(b) If the two operands are of the same sign, the sign bit of the result (MSB) is to be compared with
the sign bit of the operands. In case the sign bits are same, the result is correct and is in 2’s
complement form. If the sign bits are not same there is a problem of overflow, i.e. the result can not
be accommodated using eight bits and the result is to be interpreted suitably. The result in this case
will consist of nine bits, i.e. carry and eight bits, and the carry bit will give the sign of the number.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 30
DIGITAL ELECTRONICS

1.11 OCTAL NUMBER SYSTEM


The number system with base (or radix) eight is known as the octal number system. In this system,
eight symbols, 0, 1, 2, 3, 4, 5, 6, and 7 are used to represent numbers. Similar to decimal and binary
number systems, it is also a positional system and has, in general, two parts: integer and fractional,
set apart by a radix (octal). Any number can be expressed in the form of b = 8 and 0 (di or d-f) ≤ 7.
The weights assigned to the various positions are given in Table 2.1. For example, (6327.4051)8 is
an octal number.

1.11.1 Octal-to-Decimal Conversion


Any octal number can be converted into its equivalent decimal number using the weights assigned to
each octal digit position as given in Table 1.9.
Example:

1.11.2 Decimal-to-Octal Conversion


The conversion from decimal to octal (base-10 to base-8) is similar to the conversion procedure for
base-10 to base-2 conversion. The only difference is that number 8 is used in place of 2 for division
in the case of integers and for multiplication in the case of fractional numbers.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 31
DIGITAL ELECTRONICS

Example:

From the above examples we observe that the conversion for fractional numbers may not be exact.
In general, an approximate equivalent can be determined by terminating the process of multiplication
by eight at the desired point

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 32
DIGITAL ELECTRONICS

1.11.3 Octal-to-Binary Conversion


Octal numbers can be converted into equivalent binary numbers by replacing each octal digit by its
3-bit equivalent binary. Table 2.6 gives octal numbers and their binary equivalents for decimal
numbers 0 to 15.

Table 1.14: Binary and Decimal Equivalents of Octal Numbers

Example:

1.11.4 Binary-to-Octal Conversion


Binary numbers can be converted into equivalent octal numbers by making groups of three bits
starting from LSB and moving towards MSB for integer part of the number and then replacing each
group of three bits by its octal representation. For fractional part, the groupings of three bits are made
starting from the binary point.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 33
DIGITAL ELECTRONICS

Example:

Example:

1.11.5 Octal Arithmetic


Octal arithmetic rules are similar to the decimal or binary arithmetic. Normally, we are not interested
in performing octal arithmetic operations using octal representation of numbers. This number system
is normally used to enter long strings of binary data into a digital system like a microcomputer. This
makes the task of entering binary data in a microcomputer easier. Arithmetic operations can be
performed by converting the octal numbers to binary numbers and then using the rules of binary
arithmetic.
Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 34
DIGITAL ELECTRONICS

Example:

Multiplication and division can also be performed using the binary representation of octal numbers
and then making use of multiplication and division rules of binary numbers.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 35
DIGITAL ELECTRONICS

1.12 HEXADECIMAL NUMBER SYSTEM


Hexadecimal number system is very popular in computer uses. The base for hexadecimal number
system is 16 which requires 16 distinct symbols to represent the numbers. These are numerals 0
through 9 and alphabets A through F. Since numeric digits and alphabets both are used to represent
the digits in the hexadecimal number system, therefore, this is an alphanumeric number system. Table
2.7 gives hexadecimal numbers with their binary equivalents for decimal numbers 0 through 15. From
the table, it is observed that there are 16 combinations of 4-bit binary numbers and sets of 4-bit binary
numbers can be entered in the
computer in the form of hexadecimal (hex.) digits. These numbers are required to be converted into
binary representation, using hexadecimal-to-binary converter circuits before these can be processed
by the digital circuits.

Table 1.15: Binary and Decimal Equivalents of Hexadecimal Numbers

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 36
DIGITAL ELECTRONICS

1.12.1 Hexadecimal-to-Decimal Conversion


Hexadecimal numbers can be converted to their equivalent decimal numbers by using equation 1.1.
Example:

The fractional part may not be an exact equivalent and therefore, may give a small error

1.12.2 Decimal-to-Hexadecimal Conversion


For conversion from decimal to hexadecimal, the procedure used in binary as well as octal systems
is applicable, using 16 as the dividing (for integer part) and multiplying (for fractional part) factor.
Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 37
DIGITAL ELECTRONICS

1.12.3 Hexadecimal-to-Binary Conversion


Hexadecimal numbers can be converted into equivalent binary numbers by replacing each hex digit
by its equivalent 4-bit binary number.
Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 38
DIGITAL ELECTRONICS

1.12.4 Binary-to-Hexadecimal Conversion


Binary numbers can be converted into the equivalent hexadecimal numbers by making groups of four
bits starting from LSB and moving towards MSB for integer part and then replacing each group of
four bits by its hexadecimal representation. For the fractional part, the above procedure is repeated
starting from the bit next to the binary point and moving towards the right.
Example:

Example:

From the above examples, we observe that in forming the 4-bit groupings 0’s may be required to
complete the first (most significant digit) group in the integer part and the last (least significant digit)
group in the fractional part.

1.12.5 Conversion from Hex-to-Octal and Vice-Versa


Hexadecimal numbers can be converted to equivalent octal numbers and octal numbers can be
converted to equivalent hex numbers by converting the hex/octal number to equivalent binary and
then to octal/hex, respectively.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 39
DIGITAL ELECTRONICS

Example:

Example:

1.12.6 Hexadecimal Arithmetic


The rules for arithmetic operations with hexadecimal numbers are similar to the rules for decimal,
octal, and binary systems. The information can be handled only in binary form in a digital circuit and
it is easier to enter the information using hexadecimal number system. Since arithmetic operations
are performed by the digital circuits on binary numbers, therefore hexadecimal numbers are to be fi
rst converted into binary numbers. Arithmetic operations will become clear from the following
examples.

Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 40
DIGITAL ELECTRONICS

Example:

Multiplication and division can also be performed using the binary representation of hexadecimal
numbers and then making use of multiplication and division rules of binary numbers.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 41
DIGITAL ELECTRONICS

1.13 CODES
Computers and other digital circuits process data in the binary format. Various binary codes are used
to represent data which may be numeric, alphabets or special characters. Although, in every code
used the information is represented in binary form, the interpretation of this binary information is
possible only if the code in which this information is available is known. For example, the binary
number 1000001 represents 65 (decimal) in straight binary, 41 (decimal) in BCD and alphabet A in
ASCII code. A user must be very careful about the code being used while interpreting information
available in the binary format. Codes are also used for error detection and error correction in digital
systems. Some of the commonly used codes are given below.

1.13.1 Straight Binary Code


This is used to represent numbers using natural (or straight) binary form as discussed in Section 2.3.
Various arithmetic operations can be performed in this form. Binary codes for decimal numbers 0 to
15 are given in Table 2.8. It is a weighted code since a weight is assigned to every position.

1.13.2 Natural BCD Code


In this code, decimal digits 0 through 9 are represented (coded) by their natural binary equivalents
using four bits and each decimal digit of a decimal number is represented by this four bit code
individually. For example, (23)10 is represented by 0010 0011 using BCD code, rather than (10111)2.
From this it is observed that it requires more number of bits to code a decimal number using BCD
code than using the straight binary code. However, inspite of this disadvantage it is very convenient
and useful code for input and output operations in digital systems. This code is also known as 8-4-2-
1 code or simply BCD code. 8, 4, 2, and 1 are the weights of the four bits of the binary code of each
decimal digit similar to straight binary number system. Therefore, this is a weighted code and
arithmetic operations can be performed using this code, which will be discussed in Chapter 6. BCD
codes for decimal digits 0 through 9 are given in Table 1.15.

1.13.3 Excess-3 Code


This is another form of BCD code, in which each decimal digit is coded into a 4-bit binary code. The
code for each decimal digit is obtained by adding decimal 3 to the natural BCD code of the digit. For
example, decimal 2 is coded as 0010 + 0011 = 0101 in Excess-3 code. It is not a weighted code. This
code is a self-complementing code, which means 1’s complement of the coded number yields 9’s
complement of the number itself. For example, Excess-3 code of decimal 2 is 0101, its 1’s
complement is 1010 which is Excess-3 code for decimal 7, which is 9’s complement of 2. The self
complementing property of this code helps considerably in performing subtraction operation in
digital systems. Excess-3 codes for decimal digits 0 through 9 are given in Table 2.8.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 42
DIGITAL ELECTRONICS

Table 1.15: Various Binary Codes

1.13.4 Gray Code


It is a very useful code in which a decimal number is represented in binary form in such a way so that
each Gray-code number differs from the preceding and the succeeding number by a single bit. For
example, the Gray code for decimal number 5 is 0111 and for 6 is 0101. These two codes differ by
only one bit position (third from the left). This code is used extensively for shaft encoders because of
this property. It is not a weighted code. The Gray code is a reflected code and can be constructed
using this property as given below.
• A 1-bit Gray code has two code words 0 and 1 representing decimal numbers 0 and 1
respectively
• An n-bit (n 2) Gray code will have first 2n-1 Gray codes of (n-1) bits written in order with a
leading 0 appended.
• The last 2n-1 Gray codes will be equal to the Gray code words of an (n-1) bit Gray code,
written in reverse order (assuming a mirror placed between first 2n-1 and last 2n-1 Gray codes)
with a leading 1 appended.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 43
DIGITAL ELECTRONICS

Example:

1.13.5 Octal Code


It is a 3-bit binary code, in which each of the octal digits 0 through 7 is coded into 3-bit straight binary
number. For example, code for octal digit 4 is 100. Using this code, octal numbers can be coded into
straight binary form or the binary numbers can be represented by octal numbers. This code is used
for binary inputs in digital computers, microprocessors, etc.

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 44
DIGITAL ELECTRONICS

1.13.6 Hexadecimal Code


It is a 4-bit binary code (Section 2.8) used for input/output in digital computers, microprocessors, etc.
Example:

Example:

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 45
DIGITAL ELECTRONICS

Problems
Question No. 1:

Question No. 2:

Question No. 3

Question No. 4

Question No. 5
For the circuit shown in the given figure, find out the logic function performed using
(a) Boolean algebraic theorems
(b) truth table

Question No. 6:
Determine the decimal numbers represented by the following binary numbers:
(a) 111001 (c) 11111110 (e) 1101.0011 (g) 0.11100
(b) 101001 (d) 1100100 (f) 1010.1010
Question No. 7:
Determine the binary numbers represented by the following decimal numbers:
(a) 37 (c) 15 (e) 11.75
(b) 255 (d) 26.25 (f) 0.1

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 46
DIGITAL ELECTRONICS

Question No. 8:
Convert the following binary numbers to octal and then to decimal. Compare the decimal numbers
obtained with the decimal numbers obtained directly from the binary numbers.
(a) 11011100.101010 (b) 01010011.010101 (c) 10110011
Question No. 9:
Encode the following decimal numbers in BCD code:
(b) (a) 46 (b) 327.89 (c) 20.305

BOOLEAN ALGEBRA AND LOGIC GATES MODULE 1


Page P a g e | 47

You might also like