0% found this document useful (0 votes)
11 views36 pages

Unit I (Ids)

The document provides an introduction to digital electronics, focusing on number systems and Boolean algebra. It explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. Additionally, it includes examples and procedures for converting decimal numbers to binary, octal, and hexadecimal, as well as conversions in the reverse direction.

Uploaded by

subhash.chandra
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)
11 views36 pages

Unit I (Ids)

The document provides an introduction to digital electronics, focusing on number systems and Boolean algebra. It explains various number systems including decimal, binary, octal, and hexadecimal, along with methods for converting between these systems. Additionally, it includes examples and procedures for converting decimal numbers to binary, octal, and hexadecimal, as well as conversions in the reverse direction.

Uploaded by

subhash.chandra
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
You are on page 1/ 36

Introduction to digital electronics

Dr. Surendra Singh


Assistant Professor, Galgotias University

UNIT - I
NUMBER SYSTEM AND BOOLEAN ALGEBRA
NUMBER SYSTEMS AND BINARY CODES
Number systems
Number systems other than the familiar decimal (base 10) number system are used in the
computer field and digital systems. Digital computers internally use the binary (base 2)
number system to represent data and perform arithmetic calculations. The hexadecimal
(base 16) number system is a shorthand method of working with binary numbers. The octal
(base 8) number system is also less commonly used in digital computers.

The different number systems are:


1. Decimal number system
2. Binary number system
3. Octal number system and
4. Hexadecimal number system

Decimal number system


We use the decimal number system in our day-to-day life for representing numbers. It is a
positionalnumber system. It has ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The base (or radix,
or weight) of the decimal number system is 10. The place value of each position is given
below:

103 102 101 100 . 10-1 10-2 10-3


1000 100 10 1 . 0.1 0.01 0.001

Example:

3472.65 = 3 x 103 + 4 x 102 + 7 x 101 + 2 x 100 + 6 x 10-1 + 5 x 10-2


= 3 x 1000 + 4 x 100 + 7 x 10 + 2 x 1 + 6 x 0.1 + 5 x 0.01

Symbols used: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.


Base (or radix, or weight): 10
Place value: ….. 103, 102, 101, 100 . 10-1, 10-2, 10-3 …..

Binary number system


Binary number system is used in computers and digital circuits for representing numbers. It
has only two symbols: 0 and 1. The base (or radix, or weight) of the binary number system is
2. The place value of each position is given below:

23 22 21 20 . 2-1 2-2 2-3


8 4 2 1 . 0.5 0.25 0.125

1
Example:
1011.01 = 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 + 0 x 2-1 + 1 x 2-2
= 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 + 0 x 0.5 + 1 x 0.25
= 11.25 (in decimal)

Symbols used: 0 and 1


Base (or radix, or weight): 2
Place value: ….. 23, 22, 21, 20 . 2-1, 2-2, 2-3 …..

Octal number system

Octal numbers are used to represent binary numbers. It has eight symbols: 0, 1, 2, 3, 4, 5, 6
and 7. The base (or radix, or weight) of the octal number system is 8. The place value of each
position is given below:

83 82 81 80 . 8-1 8-2 8-3


512 64 8 1 . 0.125 0.015625 0.001953125

Example:

72.2 = 7 x 81 + 2 x 80 + 2 x 8-1
= 7 x 8 + 2 x 1 + 2 x 0.125
= 58.25 (in decimal)

Symbols used: 0, 1, 2, 3, 4, 5, 6 and 7


Base (or radix, or weight): 8
Place value: ….. 83, 82, 81, 80 . 8-1, 8-2, 8-3 …..

Hexadecimal number system

Hexadecimal numbers are used to represent binary numbers. It has sixteen symbols: 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, A, B, C, E and F. The base (or radix, or weight) of the hexadecimal number
system is 16. Here the decimal number for „A‟ is 10, „B‟ is 11, „C‟ is 12, „D‟ is 13, „E‟ is 14
and „F‟ is 15. The place value of each position is given below:

163 162 161 160 . 16-1 16-2 16-3


4096 256 16 1 . 0.0625 0.00390625 0.000244140625

Example:
3C.A = 3 x 161 + 12 x 160 + 10 x 16-1
= 3 x 16 + 12 x 1 + 10 x 0.0625
= 60.625 (in decimal)

Symbols used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F


Base (or radix, or weight): 16
Place value: ….. 163, 162, 161, 160 . 16-1, 16-2, 16-3 …..

2
Conversion

Decimal to binary conversion

i) Integer numbers

The “double dabble” method is used to convert decimal number to binary number. In
this method, the decimal number is divided by 2 repeatedly and the remainders are noted after
each division. We have to continue until we get zero in the quotient. The remainders are
taken from bottom to top to get the binary number.

Example: To convert the decimal number 27 to binary number

27 † 2 = 13 → Remainder 1
13 † 2 = 6 → Remainder 1
6 † 2 = 3 → Remainder 0
3 † 2 = 1 → Remainder 1
1 † 2 = 0 → Remainder 1

Therefore, 2710 = 110112

ii) Fractional numbers

The decimal number is multiplied by 2 repeatedly and the carries integer part (whole
numbers) is noted after each multiplication. We have to continue until we get zero in the
fraction. The process may be stopped after six places. The carries are taken from top to
bottom to get the binary number.

Example: To convert the decimal number 0.85 to binary number.

0.85 x 2 = 1.7 = 0.7 with carry → 1


0.7 x 2 = 1.4 = 0.4 with carry → 1
0.4 x 2 = 0.8 = 0.8 with carry → 0
0.8 x 2 = 1.6 = 0.6 with carry → 1
0.6 x 2 = 1.2 = 0.2 with carry → 1
0.2 x 2 = 0.4 = 0.4 with carry → 0

Therefore, 0.8510 = 0.1101102

Decimal to octal conversion

i) Integer numbers

The “octal dabble” method is used to convert decimal number to octal number. In this
method, the decimal number is divided by 8 repeatedly and the remainders are noted after
each division. We have to continue until we get zero in the quotient. The remainders are
taken from bottom to top to get the octal number.

3
Example: To convert the decimal number 175 to octal number

175 † 8 = 21 → Remainder 7
21 † 8 = 2 → Remainder 5
2 † 8 = 0 → Remainder 2

Therefore, 17510 = 2578

ii) Fractional numbers

The decimal number is multiplied by 8 repeatedly and the carries (ie.) integer part
(whole numbers) is noted after each multiplication. We have to continue until we get zero in
the fraction. The process may be stopped after three places. The carries are taken from top to
bottom to get the octal number.

Example: To convert the decimal number 0.23 to octal number.

0.23 x 8 = 1.84 = 0.84 with carry → 1


0.84 x 8 = 6.72 = 0.72 with carry → 6
0.72 x 8 = 5.76 = 0.76 with carry → 5

Therefore, 0.2310 = 0.1658

Decimal to hexadecimal conversion

i) Integer numbers

The “hex dabble” method is used to convert decimal number to hexadecimal number.
In this method, the decimal number is divided by 16 repeatedly and the remainders are noted
after each division. We have to continue until we get zero in the quotient. The remainders are
taken from bottom to top to get the hexadecimal number.

Example: To convert the decimal number 2479 to hexadecimal number

2479 † 16 = 154 → Remainder 15 → F


154 † 16 = 9 → Remainder 10 → A
9 † 16 = 0 → Remainder 9 → 9

Therefore, 247910 = 9AF16

ii) Fractional numbers

The decimal number is multiplied by 16 repeatedly and the carries (ie.) integer part
(whole numbers) is noted after each multiplication. We have to continue until we get zero in
the fraction. The process may be stopped after three places. The carries are taken from top to
bottom to get the hexadecimal number.

4
Example: To convert the decimal number 0.23 to hexadecimal number.
0.23 x 16 = 3.68 = 0.68 with carry → 3 → 3
0.68 x 16 = 10.88 = 0.88 with carry → 10 → A
0.88 x 16 = 14.08 = 0.08 with carry → 14 → E
Therefore, 0.2310 = 0.3AE16

Binary to decimal conversion


i) Integer numbers
The given binary number can be converted to decimal number by using the following
procedure:

Step 1 : Write the binary number


Step 2 : Write the place value (weight) directly under the binary number
Step 3 : If the binary digit is zero, cross out the decimal weight
Step 4 : Add the remaining weights to get the decimal number.
Example: To convert the binary number 1011 to decimal number
Step 1 : 1 0 1 1 (Binary number)
Step 2 : 8 4 2 1 (Place value)
Step 3 : 8 4 2 1 (Cross out)
Step 4 : 11 (Add, to get the decimal number)
Therefore, 10112 = 1110
ii) Fractional numbers
The same procedure used for the integer numbers can be used for fractional numbers also.
Example: To convert the binary number 0.101 to decimal number
Step 1 : 1 0 1 (Binary number)
Step 2 : 0.5 0.25 0.125 (Place value)
Step 3 : 0.5 0.25 0.125 (Cross out)
Step 4 : 0.625 (Add, to get the Decimal number)
Therefore, 0.1012 = 0.62510
Binary to octal conversion
The binary numbers for the octal numbers from 0 to7 are given in the following table:

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

5
The following procedure can be used for converting the binary number to octal number:

Step 1 : Group the binary digits in threes, starting at the binary point.
Step 2 : Convert each group of three to its octal equivalent

Example: To convert the binary number 1101110.101011 to octal number

Step 1 : 001 101 110 . 101 011 (Group)


Step 2 : 1 5 6 . 5 3 (Octal equivalent)

Therefore, 1101110.1010112 = 156.538

Binary to hexadecimal conversion

The binary numbers for the hexadecimal numbers from 0 to F are given in the following
table:

Binary Hexadecimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

The following procedure can be used for converting the binary number to octal number:

Step 1 : Group the binary digits in fours, starting at the binary point.
Step 2 : Convert each group of four to its hexadecimal equivalent

Example: To convert the binary number 1101110.101011 to hexadecimal number

Step 1 : 0110 1110 . 1010 1100 (Group)


Step 2 : 6 E . A C (Hexadecimal equivalent)

Therefore, 1101110.1010112 = 6E.AC16

6
Octal to decimal conversion

i) Integer numbers

The given octal number can be converted to decimal number by using the following
procedure:

Step 1 : Write the octal number


Step 2 : Write the place value (weight) directly under the octal number
Step 3 : Multiply the octal number by the place value
Step 4 : Add the values to get the decimal number.

Example: To convert the octal number 257 to decimal number

Step 1 : 2 5 7 (Octal number)


Step 2 : 64 8 1 (Place value)
Step 3 : 128 40 7 (Multiply)
Step 4 : 175 (Add, to get the Decimal number)

Therefore, 2578 = 17510

ii) Fractional numbers

The same procedure used for the integer numbers can be used for fractional numbers also.

Example: To convert the octal number 0.41 to decimal number

Step 1 : 4 1 (Octal number)


Step 2 : 0.125 0.015625 (Place value)
Step 3 : 0.5 0.015625 (Multiply)
Step 4 : 0.515625175 (Add, to get the Decimal number)

Therefore, 0.418 = 0.51562517510

Octal to binary conversion

The following procedure can be used for converting the octal number to binary number:

Step 1 : Write the octal number


Step 2 : Write the three digit equivalent binary number

Example: To convert the octal number 34.56 to binary number

Step 1 : 3 4 . 5 6 (Octal number)


Step 2 : 011 100 . 101 110 (Binary equivalent)

Therefore, 34.568 = 11100.101112

7
Octal to hexadecimal conversion
The following procedure can be used for converting the octal number to binary number:

Step 1 : First convert the octal number to binary number


Step 2 : Then, convert the binary number to hexadecimal number (procedure already given)

Example: To convert the octal number 34.56 to binary number


Step 1 : 3 4 . 5 6 (Octal number)
Step 2 : 011 100 . 101 110 (Binary equivalent)
Step 3 : 0001 1100 . 1011 1000 (Group of 4-bits)
Step 4 : 1 C . B 8 (Hexadecimal number)

Therefore, 34.568 = 1C.B816

Hexadecimal to decimal conversion

i) Integer numbers

The given hexadecimal number can be converted to decimal number by using the following
procedure:

Step 1 : Write the hexadecimal number


Step 2 : Write the place value (weight) directly under the hexadecimal number
Step 3 : Multiply the hexadecimal number by the place value
Step 4 : Add the values to get the decimal number.

Example: To convert the hexadecimal number 8E6 to decimal number

Step 1 : 8 E 6 (Hexadecimal number)


Step 2 : 256 16 1 (Place value)
Step 3 : 2048 224 6 (Multiply)
Step 4 : 2278 (Add, to get the Decimal number)

Therefore, 8E616 = 227810

ii) Fractional numbers

The same procedure used for the integer numbers can be used for fractional numbers also.

Example: To convert the hexadecimal number 0.39 to decimal number

Step 1 : 3 9 (Hexadecimal number)


Step 2 : 0.0625 0.00390625 (Place value)
tep 3 : 0.18755 0.03515625 (Multiply)
Step 4 : 0.22270625 (Add, to get the Decimal number)

Therefore, 0.3916 = 0. 0.2227062510

8
Hexadecimal to binary conversion
The following procedure can be used for converting the hexadecimal to binary number:
Step 1 : Write the Hexadecimal number
Step 2 : Write the four digit equivalent binary number
Example: To convert the hexadecimal number 7A.2D to binary number
Step 1 : 7 A . 2 D (Hexadecimal number)
Step 2 : 0111 1010 . 0011 1101 (Binary equivalent)

Therefore, 7A.2D16 = 1111010.001111012

Hexadecimal to Octal conversion


The following procedure can be used for converting the hexadecimal number to octal
number:
Step 1 : First convert the hexadecimal number to binary number
Step 2 : Then, convert the binary number to octal number (procedure already given)
Example: To convert the hexadecimal number 7A.2D to octal number
Step 1 : 7 A . 2 D (Hexadecimal number)
Step 2 : 0111 1010 . 0011 1101 (Binary equivalent)
Step 3 : 001 111 010 . 001 111 010 (Group of 3-bits)
Step 4 : 1 7 2 . 1 7 2 (Octal number)

Therefore, 7A.2D16 = 172.1728

Binary codes
We use the decimal code to represent numbers. Digital electronic circuits in computers and
calculators use mostly the binary code to represent numbers. Many other special codes are
used in digital electronics to represent numbers, letters, and punctuation marks and control
characters. These special codes are generally called binary codes. Some of the special binary
codes are BCD code, Gray code, and Excess 3 code.

BCD Code (Natural BCD code)


BCD is an abbreviation for Binary-Coded Decimal. In this code, decimal digits 0 through 9
are represented by their binary equivalents using 4 bits (binary digits) individually. For
example, the decimal number 429 is expressed in BCD as follows:
Decimal number : 4 2 9
BCD number : 0100 0010 1001
The lowest BCD digit is 0000 and the highest BCD digit is 1001. In general, BCD codes are
also called 8421 code. The main advantage of 8421 code is that converting to and from
decimal numbers is very easy.

Excess-3 Code
This is another form of BCD code. The code for each decimal digit is obtained by adding
decimal number 3 to the natural BCD code. For example, decimal number 2 is coded as 0010
+ 0011 = 0101 in Excess-3 code. It is a self-complementing code which is very much useful
in performing subtraction operation in digital systems. The Excess-3 codes for the decimal
numbers from 0 to 9 are given in the following table.
9
Decimal Natural BCD Excess-3
number code code
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100

Gray Code

It is a special binary code used in optical encoders. In this code, only one bit will change each
time the decimal number is incremented. The BCD codes and Gray codes for the decimal
numbers from 0 to 15 are given in the following table.

Natural BCD
Decimal number Gray code
code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 0001 0000 1111
11 0001 0001 1110
12 0001 0010 1010
13 0001 0011 1011
14 0001 0100 1001
15 0001 0101 1000

BOOLEAN ALGEBRA AND DE-MORGAN’S THEOREMS

Boolean Algebra

In the middle of the 19th century, an English mathematician George Boole developed rules for
manipulations of binary variables, known as Boolean algebra. This is the basis for all digital
systems like computers, calculators, etc. Binary variables can be represented by a letter
symbol such as A, B, X, Y, etc. The variable can have only one of the two possible values at
any time either 0 or 1. The following are the operators used in Boolean algebra.

Operator Operation
= Equal (Assignment)
+ OR (Logic addition)
. AND (Logic multiplication)
(Bar) NOT (Complement)
10
Boolean postulates and laws

Theorems

S.No Theorem
1. 𝐴=A
2. A (𝐴 + B) = A B
3. A+AB=A
4. (A + B) (A + 𝐵) = A
5. AB+𝐴𝐵=A
6. A (A + B) = A
7. A+A𝐵=A+B
8. A + B C = (A + B) (A + C)

Laws of complementation (NOT Laws)

S.No Law
1. 0=1
2. 1=0
3. If A = 0, 𝐴 = 1
4. If A = 1, 𝐴 = 0
5. 𝐴=A

AND Laws

S.No Law
1. A.0=0
2. A.1=A
3. A.A=A
4. A .𝐴 = 0

OR Laws

S.No Law
1. A+0=A
2. A+1=1
3. A+A=A
4. A +𝐴 = 1
Commutative Laws
The commutative laws allow the change in position of an AND or OR variable.

S.No Law
1. A+B=B+A
2. A.B=B.A

Associative Laws
The associative laws allow the grouping of variables.

S.No Law
1. A + (B + C) = (A + B) + C
2. A . (B . C) = (A .B) . C

11
Distributive Laws

The distributive laws allow the factoring or multiplying out of expressions.

S.No Law
1. A . (B + C) = (A . B) + (A . C)
2. A + (B . C) = (A + B) . (A + C)

DeMorgan’s theorems
De Morgan contributed a lot for the Boolean algebra. Out of them, the following two
theorems are very important. It allows transformation from a sum-of-products form to a
products-of-sums form. De Morgan‟s theorems are also useful in simplifying Boolean
equations.

First theorem

Statement:
The complement of a sum of variables is equal to the product of their complements.

Equation:

𝐴 + 𝐵 = 𝐴 . 𝐵

Logic diagram :

Proof:

We have to show the left side equals the right side for all possible values of A and B. The
following table proves the De Morgan‟s first theorem.

A B A+B 𝐴 + 𝐵 𝐴.𝐵
(LHS) 𝐴 𝐵 (RHS)
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0

In the above table, LHS = RHS. Hence, the De Morgan‟s first theorem is proved.

Second theorem
Statement:
The complement of a product of variables is equal to the sum of their complements.

Equation:

𝐴 . 𝐵 = 𝐴+𝐵
12
Logic diagram :

Proof:

We have to show the left side equals the right side for all possible values of A and B. The
following table proves the De Morgan‟s second theorem.

A B A.B 𝐴 .𝐵 𝐴+
(LHS) 𝐴 𝐵 𝐵(RHS)
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0

In the above table, LHS = RHS. Hence, the De Morgan‟s second theorem is proved.

Logic gates

A gate is a logic circuit with one output and one or more inputs. The output signal occurs
only for certain input combinations. The input and output signals are digital in nature ie.
either 0 (low) or 1 (high). All the possible input combinations and their corresponding output
conditions are noted in a table, called truth table.

In digital systems, two different voltage levels (0v and 5v) are used to represent the logic
levels „0‟ and „1‟. If the high voltage level (5v) represents logic „1‟ and low voltage level (0v)
represents logic „0‟, then the system is called positive logic. But some systems use the low
voltage level (0v) for logic „1‟ and the high voltage level (5v) for logic „0‟. This is called
negative logic. This is shown in the following figure.

OR gate

OR gate has two or more inputs and only one output. It works according to the OR boolean
function. It follows the addition (+) law. It gives output when any one of the input is at logic
„1‟. The symbol, logic equation and truth table for OR gate are shown in the following figure.

Inputs Output
A B Y
0 0 0
Y=A+ 0 1 1
B 1 0 1
1 1 1

For a two input OR gate, there are four cases of input combinations, 00, 01, 10 and 11.
13
Case 1 : A = 0 and B = 0
In this case, the output (A + B) = (0 + 0) = 0

Case 2 : A = 0 and B = 1
In this case, the output (A + B) = (0 + 1) = 1

Case 3 : A = 1 and B = 0
In this case, the output (A + B) = (1 + 0) = 1

Case 4 : A = 1 and B = 1
In this case, the output (A + B) = (1 + 1) = 1

For a three input OR gate, there are eight input combinations, 000, 001, 010, 011, 100, 101,
110 and 111. The generalized formula for the number of input combinations is 2n, where „n‟
is the number of inputs in the gate.

AND gate

AND gate has two or more inputs and only one output. It works according to the AND
boolean function. It follows the multiplication (.) law. It gives output only when all the inputs
are at logic „1‟. The symbol, logic equation and truth table for AND gate are shown in the
following figure.

Inputs Output
A B Y
Y=A. 0 0 0
0 1 0
B
1 0 0
1 1 1

For a two input AND gate, there are four cases of input combinations, 00, 01, 10 and 11.

Case 1 : A = 0 and B = 0
In this case, the output (A . B) = (0 . 0) = 0

Case 2 : A = 0 and B = 1
In this case, the output (A . B) = (0 . 1) = 0

Case 3 : A = 1 and B = 0
In this case, the output (A . B) = (1 . 0) = 0

Case 4 : A = 1 and B = 1
In this case, the output (A . B) = (1 . 1) = 1

NOT gate

NOT gate has only one input and only one output. It works according to the complementation
law of boolean algebra. Its output is the complement of the input ie. the output is „1‟ when the
input is „0‟ and the output is „0‟ when the input is „1‟. The symbol, logic equation and truth
table for NOT gate are shown in the following figure.

14
Input Output
Y=A A Y
0 1
1 0

There are two cases of input combinations, 0 and 1.


Case 1 : A = 0
In this case, the output (𝐴) = (0) = 1

Case 2 : A = 1
In this case, the output (𝐴) = (1) = 0

The other names of NOT gate are Inverter gate and Complement gate.

NOR gate

NOR gate is a combination of OR gate and NOT gate. An OR gate followed by a NOT gate is
a NOR gate. NOR gate has two or more inputs and only one output. It gives output only when
all the inputs are at logic „0‟. The symbol, logic equation and truth table for NOR gate are
shown in the following figure.

Inputs Output
A B Y
Y= 0 0 1
𝐴+ 𝐵 0 1 0
1 0 0
1 1 0
For a two input NOR gate, there are four cases of input combinations, 00, 01, 10 and 11.

Case 1 : A = 0 and B = 0
In this case, the output (𝐴 + 𝐵) = (0 + 0) = 0 = 1

Case 2 : A = 0 and B = 1
In this case, the output (𝐴 + 𝐵) = (0 + 1) = 1 = 0

Case 3 : A = 1 and B = 0
In this case, the output (𝐴 + 𝐵) = (1 + 0) = 1 = 0

Case 4 : A = 1 and B = 1
In this case, the output (𝐴 + 𝐵) = (1 + 1) = 1 = 0

NAND gate

15
NAND gate is a combination of AND gate and NOT gate. An AND gate followed by a NOT
gate is a NAND gate. NAND gate has two or more inputs and only one output. It gives output
only when any one of the input is at logic „0‟. The symbol, logic equation and truth table for
NAND gate are shown in the following figure.

Inputs Output
A B Y
0 0 1
Y = 𝐴 .𝐵 0 1 1
1 0 1
1 1 0

For a two input NAND gate, there are four cases of input combinations, 00, 01, 10 and 11.

Case 1 : A = 0 and B = 0
In this case, the output (𝐴 . 𝐵) = (0 . 0) = 0 = 1

Case 2 : A = 0 and B = 1
In this case, the output (𝐴 . 𝐵) = (0 . 1) = 0 = 1

Case 3 : A = 1 and B = 0
In this case, the output (𝐴 . 𝐵) = (1 . 0) = 0 = 1

Case 4 : A = 1 and B = 1
In this case, the output (𝐴 . 𝐵) = (1 . 1) = 1 = 0

Exclusive OR (EX-OR) gate

EX-OR gate has two or more inputs and only one output. It gives output only when the inputs
are at different logic levels ie. when one input is „0‟ the other input must be „1‟. This gate can
be constructed using AND, OR and NOT gates. The symbol, logic circuit, logic equation and
truth table for EX-OR gate are shown in the following figure.

Y=𝐴B+A
𝐵

Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0

For a two input EX-OR gate, there are four cases of input combinations, 00, 01, 10 and 11.
16
Case 1 : A = 0 and B = 0
In this case, the output (𝐴 . B + A .𝐵) = (1 . 0 + 0 . 1) = (0 + 0) = 0

Case 2 : A = 0 and B = 1
In this case, the output (𝐴 . B + A .𝐵) = (1 . 1) + 0 . 0) = (1 + 0) = 1

Case 3 : A = 1 and B = 0
In this case, the output (𝐴 . B + A .𝐵) = (0 . 0 + 1 . 1) = (0 + 1) = 1

Case 4 : A = 1 and B = 1
In this case, the output (𝐴 . B + A .𝐵) = (0 .1 + 1 . 0) = (0 + 0) = 0

Exclusive NOR (EX-NOR) gate

It is a combination of EX-OR gate and NOT gate. An EX-OR gate followed by a NOT gate is
EX-NOR gate. It has two or more inputs and only one output. It gives output only when the
inputs are at same logic levels ie. „00‟ and „11‟. This gate can be constructed using AND, OR
and NOT gates. The symbol, logic circuit, logic equation and truth table for EX-NOR gate
are shown in the following figure.

Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
For a two input EX-NOR gate, there are four cases of input combinations, 00, 01, 10 and 11.

Case 1 : A = 0 and B = 0
In this case, the output (𝐴 . 𝐵 + 𝐴 . 𝐵) =0 . 0 + 0 . 0 = (1 . 0 + 0 . 1) = (0 + 0) = 0 = 1

Case 2 : A = 0 and B = 1
In this case, the output (𝐴 . 𝐵 + 𝐴 . 𝐵) =0 . 1 + 0 . 1 = (1 . 1 + 0 . 0) = (1 + 0) = 1 = 0

Case 3 : A = 1 and B = 0
In this case, the output (𝐴 . 𝐵 + 𝐴 . 𝐵) =1 . 0 + 1 . 0 = (0 . 0 + 1 . 1) = (0 + 1) = 1 = 0

Case 4 : A = 1 and B = 1
In this case, the output (𝐴 . 𝐵 + 𝐴 . 𝐵) =1 . 1 + 1 . 1 = (0 . 1 + 1 . 0) = (0 + 0) = 0 = 1

17
Implementation of logic functions using gates

The following table shows the various logic equations and their equivalent gates.

Logic equation Name of the gate Symbol

𝐴 NOT

A+B OR

A.B AND

𝐴+ 𝐵 NOR

𝐴 .𝐵 NAND

𝐴 . B + A .𝐵 EX-OR

𝐴 .𝐵 + 𝐴 . 𝐵 EX-NOR

The given logic function can be realized using gates as per the above table.

Different forms of logic functions:

There are two different forms of logic functions. They are,

1. Sum-of-products form (or) Minterm form - SOP


2. Product-of-sums form (or) Maxterm form - POS

Consider the following two logic functions.

Y = (𝐴 . B) + (A .𝐵) + (𝐵 . C) ............................1
Y = (A + B + C) . (𝐴+ 𝐵) ....................................2

The first equation has three terms. Each term is a product term. The logic function is the sum
of the product terms. This function is said to be in Sum-of-products form (or) Min term form.
Similarly, the second equation has two terms. Each term is a sum term. The logic function is
the product for the sum terms. Hence, this function is said to be in Product-of-sums form (or)
Max term form.

18
Implementation of logic functions using gates

Follow the steps given below to draw the logic diagram for the given logic function.

1. For a function in Sum-of-products form, the final output gate is an OR gate. For a
function in Product-of-sums form, the final output gate is an AND gate.
2. Realize the (.) function using AND gate.
3. Realize the (+) function using OR gate.
4. Realize the complement ( ) function using NOT gate.

Example

1. Draw the logic diagram for the following logic function.


Y = (𝐴 . B) + (A .𝐵) + (𝐵 . C)

2. Draw the logic diagram for the following logic function.


Y = (A + B + C) . (𝐴 + 𝐵)

3. Draw the logic diagram for the following logic function.

𝑌 =𝐴+ 𝐵𝐶

𝑌 =𝐴+ 𝐵𝐶

19
Realization of gates using universal gates
We can use only NAND gates for constructing all the other gates (ie. NOT, OR, AND, NOR,
EX-OR and EX-NOR). Similarly, we can useonly NOR gates for constructing all the other
gates. Hence, NAND and NOR gates are called universal gates.

Realization of gates using NAND gates only

1) NOT gate using only NAND gates

Y=𝐴
= (𝐴 . 𝐴) ……. Because A . A = A

Hence, when we tie the two inputs of an NAND gate together we get a NOT gate.

2) OR gate using only NAND gates

Y=A+B
= 𝐴+𝐵 ……. Double complementation will give the same function
=𝐴. 𝐵 ….. Using De-Morgan‟s first theorem, 𝐴 + 𝐵 = 𝐴 . 𝐵

Two NAND gates are used for the two NOT functions. A third NAND gate is used for the (.)
and complement functions.

3) AND gate using only NAND gates

Y=A.B
= 𝐴 .𝐵 ……. Double complementation will give the same function

One NAND gate is used for the 𝐴 . 𝐵 function. Another NAND gate is used for the
complement function.

20
4) NOR gate using only NAND gates

Y=𝐴+ 𝐵
=𝐴.𝐵 ….. Using Using De-Morgan‟s first theorem, 𝐴 + 𝐵 = 𝐴 . 𝐵
=

Two NAND gates are used for the two NOT functions. Another two NAND gates are
required for implementing the (.) ie. AND function. Hence, totally four NAND gates are
required for realizing a NOR gate using only NAND gates.

5) EX-OR gate using only NAND gates

Y = 𝐴 . B + A .𝐵

= 𝐴 . 𝐵 + 𝐴 . 𝐵 ….Double complementation will give the same function


= 𝐴 . 𝐵 . 𝐴 . 𝐵 ….. Using De-Morgan‟s first theorem, 𝐴 + 𝐵 = 𝐴 . 𝐵

Two NAND gates are used for the two NOT functions 𝐴and 𝐵. Another two NAND gates are
required for 𝐴 . 𝐵 and 𝐴 . 𝐵. A final NAND gate is required for the (.) and complement
function. Totally five NAND gates are required for realizing an EX-OR gate using only
NAND gates.

6) EX-NOR gate using only NAND gates

Y = 𝐴.𝐵 +𝐴. 𝐵

When the output of an EX-OR gate is connected to a NOT gate, we get an EX-NOR gate.
Hence, EX-OR gate is realized first using five NAND gates. Sixth NAND gate is used to
realize the NOT gate. Totally six NAND gates are required for realizing an EX-NOR gate
using only NAND gates.

21
Realization of gates using NAND gates only

1) NOT gate using only NOR gates

Y=𝐴
= (𝐴 + 𝐴) ……. Because A + A = A

Hence, when we tie the two inputs of a NOR gate together we get a NOT gate.

2) OR gate using only NOR gates

Y=A+B
= 𝐴+𝐵 ……. Double complementation will give the same function

When the output of a NOR gate is connected to a NOT gate, we get an OR gate. One NOR
gate is used for 𝐴 + 𝐵. Another NOR gate is used to implement the NOT function.

3) AND gate using only NOR gates

Y=A.B
= 𝐴 . 𝐵 ……. Double complementation will give the same function
=𝐴+ 𝐵 ……. Using De-Morgan‟s second theorem, 𝐴 . 𝐵 = 𝐴+𝐵

Two NOR gates are used for 𝐴and 𝐵. Another NOR gate is used for (+) and complement
functions.

22
4) NAND gate using only NOR gates

Y=𝐴. 𝐵
=𝐴+𝐵 ….. Using De-Morgan‟s second theorem, 𝐴 . 𝐵 = 𝐴+𝐵

Two NOR gates are used for the two NOT functions. Another two NOR gates are required
for implementing the (+) ie. OR function. Hence, totally four NOR gates are required for
realizing a NAND gate using only NOR gates.

5) EX-OR gate using only NOR gates

Y = 𝐴 . B + A .𝐵

= 𝐴 .𝐵 + 𝐴 . 𝐵 ….. Double complementation will give the same function

= 𝐴. 𝐵 . 𝐴. 𝐵 ….. Using De-Morgan‟s first theorem, 𝐴 + 𝐵 = 𝐴 . 𝐵


= 𝐴 + 𝐵 + 𝐴 + 𝐵 ….. Using De-Morgan‟s second theorem, 𝐴 . 𝐵 = 𝐴+𝐵

Two NOR gates are used for the two NOT functions 𝐴and 𝐵. Another two NOR gates are
required for (+) and complement functions. Two more NOR gates are required for the final
(+) operation. Totally six NOR gates are required for realizing an EX-OR gate using only
NOR gates.

6) EX-NOR gate using only NOR gates

Y = 𝐴.𝐵 +𝐴. 𝐵

When the output of an EX-OR gate is connected to a NOT gate, we get an EX-NOR gate.
Hence, EX-OR gate is realized first using five NOR gates. Another NOR gate is used to
realize the NOT gate. The last two NOR gates implemented for the NOT operation can be
removed because double complementation give the same function. Totally five NOR gates
are required for realizing an EX-NOR gate using only NOR gates.

23
Simplification of expression using Boolean techniques
We can simplify logic expressions using Boolean techniques (ie.)Boolean laws and theorems.
Example 1 : Simplify the expression Y = A 𝐵 + A B
Y = A𝐵+AB
= A ( 𝐵 + B) …. By factoring
= A (1) ….. 𝐵 + B = 1
= A ….. A . 1 = A

Example 2 : Simplify the expression Y = 𝐴B𝐶 + AB𝐶 + ABC


Y = 𝐴B𝐶 + AB𝐶 + ABC
= 𝐴B𝐶 + AB𝐶 + AB𝐶 + ABC … AB𝐶 + AB𝐶 = AB𝐶
= B𝐶(𝐴+A) + AB(𝐶+C) …. By factoring
= B𝐶 + AB …. 𝐴+A = 1

Example 3 : Simplify the expression Y = AB + 𝐴𝐶 + A𝐵C(AB+C)


Y = AB + 𝐴𝐶 + A𝐵C(AB+C)
= AB + 𝐴𝐶 + AA𝐵BC + A𝐵CC …. Multiply
= AB + 𝐴𝐶 + 0 + A𝐵C …. 𝐵B = 0, CC = C
= AB + 𝐴 + 𝐶 + A𝐵C …. DeMorgan‟s theorem 𝐴𝐶 = 𝐴 + 𝐶
= AB + 𝐶 + 𝐴 + A𝐵C …. Rearrange
= AB + 𝐶 + 𝐴 + 𝐵C …. Distributive law
= 𝐴 + AB + 𝐶 + 𝐵C …. Rearrange
= 𝐴+ B + 𝐶 + 𝐵 …. Distributive law
= 𝐴+ 𝐶 + B + 𝐵 …. Rearrange
= 𝐴+𝐶+1 …. B + B’ = 1
= 1 ….. Reduce

Boolean expression for outputs


The following steps are involved to find out the boolean expression for the output of the
given logic circuit.
Step 1 : Label all the inputs ie. A, B, C, D, etc.
Step 2 : Label all the gates in the circuit ie. A1, A2, A3, A4, etc.
Step 3 : Start with the input signals, write down the logic equation for the output of each
gate until the output is reached.

24
Example :

Find out the Boolean expression for the circuit given below:

Step 1 : Label all the inputs ie. A, B, C, D, E, F and G.


Step 2 : Label all the gates in the circuit ie. A1, A2, A3, A4, A5, A6 and A7.
Step 3 : The output of A1 is A + B
The output of A2 is 𝐴 + 𝐵
The output of A3 is E + F
The output of A4 is 𝐺
The output of A5 is CD𝐺 (E+F)
The output of A6 is C D 𝐺 ( E + F)
The output is A7 is 𝐴 + 𝐵+C D 𝐺 ( E + F)

25
COMBINATIONAL CIRCUITS

Combinational circuits

26
In digital systems, there are two types of circuits, 1) Combinational logic circuits and 2)
Sequential logic circuits. In combinational circuits, the output depends only on the present
input conditions. But, in sequential circuits, the output depends not only on the present input
conditions but also on the previous output conditions.

Binary Arithmetic
Arithmetic
circuits

Arithmetic circuits are the combinational logic circuits used to perform arithmetic operations
such as addition, subtraction, multiplication and division on binary numbers.

Binary addition

In addition, the first number is called augend and the second number is called is addend. The
result is called the sum. Sometimes, we may get carry also.

Augend
+ Addend
Carry Sum

The following rules are used in binary addition.

0 0 1 1
+0 +1 +0 +1
0 1 1 10 Sum = 0 and Carry = 1

1
1
+1
11
Sum = 1 and Carry = 1
In a binary number, the left most bit is called Most Significant Bit (MSB) and the rightmost
bit is called Least Significant Bit (LSB). Addition must be carried out bit by bit starting from
the LSB.
Examples :

1) Add the binary number 101 and 10. (Apply basic rules)

Answer :(111)2

2) Add (10)10 and (3)10 in binary.

First convert the decimal numbers to binary.

Answer :(1101)2 = (13)10

Add the binary numbers 11010 and 1100.

27
Answer :(100110)2

3) Add (3)10 and (3)10 in binary.

First convert the decimal numbers to binary.

Answer :(110)2 = (6)10

Binary subtraction

In subtraction, the first number is called minuend and the second number is called is
subtrahend. The result is called the difference. Sometimes, we may get borrow also.

Minuend
- Subtrahend
Borrow Difference

The following rules are used in binary subtraction.

0 1 1 0
-0 -0 -1 -1
0 1 0 11 Difference =1, Borrow = 1

Subtraction must be carried out bit by bit starting from the LSB.
When we borrow a 1 from the next bit, we will get 10 (ie. 2 in decimal).

Examples :

1) Subtract : 1011 – 1001

1011
-1001
Answer : (10)2 0010

2) Subtract 1010 from 100101

Answer :(11011)2

Representation of negative numbers

In decimal systems, we use (+) sign for positive numbers and (–) sign for negative numbers.
But in binary numbers, complement method is used for representing negative numbers. Two
types of complement methods are available.

1) 1‟s complement method


2) 2‟s complement method

28
Either 1‟s complement or 2‟s complement method is adopted in a particular digital system.

1’s complement

1‟s complement is used to represent negative numbers. Each bit is subtracted from 1 (borrow
is ignored) to get the 1‟s complement. A shortcut method is also used. Each bit in the given
number is complemented (0 to 1, 1 to 0) to get its 1‟s complement.
Examples :
1) Find the 1‟s complement of 101011.
010100 ---- 0 to 1, 1 to 0
Answer :10100

2) Find the 1‟s complement of 11110.


00001 ---- 0 to 1, 1 to 0

Answer : 1

2’s complement

2‟s complement is used to represent negative numbers. When we add 1 to 1‟s complement,
we will get the 2‟s complement of the given number.
Examples:
1) Find the 2‟s complement of 101011.

1‟s complement 010100 ---- 0 to 1, 1 to 0


Add 1 + 000001
2‟s complement 010101

Answer : (010101)2

2) Find the 2‟s complement of 11110.


1‟s complement 00001 ---- 0 to 1, 1 to 0
Add 1 + 00001
2‟s complement 00010

Answer :(00010)2

Subtraction using complement methods

The number to be subtracted (subtrahend) is converted into 1‟s complement form or 2‟s
complement form to represent it as a negative number. Then it will be added to the first
number (minuend).

Minuend
+ Complement of
Subtrahend

Difference

29
Binary subtraction using 1’s complement method

The following steps are used to subtract a number using 1‟s complement method

1) Find the 1‟s complement of the subtrahend.


2) Add the 1‟s complement with the minuend.
3) If there is any carry:
a. Add the carry (ie. add 1) to the result
b. The result is a positive number.
4) If there is no carry:
a. Find the 1‟s complement of the result.
b. The result is a negative number.

Example 1 : Subtract 100101 from 101100

Here, the minuend is 101100


And the subtrahend is 100101

101100
- 100101
Difference

The 1‟s complement of subtrahend 100101 is 011010. This should be added to the minuend.

Minuend 101100
Add 1‟s complement of + 011010
Subtrahend
1 000110 There is a carry 1.
Add Carry + 1
+ 000111 Result is positive.

Answer : + (111)2

Example 2 : (54)10 - (62)10

Binary of 54 (Minuend) = 110110


Binary of 62 (Subtrahend) = 111110

1‟s complement of 111110 = 000001

Minuend 110110
Add 1‟s complement of Subtrahend + 000001
110111 There is no carry.
Find 1‟s complement
001000
- 001000 Result is negative.
Convert to Decimal - 8

Answer : - 8

Binary subtraction using 2’s complement method

30
The following steps are used to subtract a number using 2‟s complement method.

1) Find the 2‟s complement of the subtrahend.


2) Add the 2‟s complement with the minuend.
3) If there is any carry:
a. Ignore the carry
b. The result is a positive number.
4) If there is no carry:
a. Ignore the carry
b. Find the 2‟s complement of the result.
c. The result is a negative number.

Example 1 : Subtract 100101 from 101100


Here, the minuend is 101100
And the subtrahend is 100101

101100
- 100101
Difference

The 2‟s complement of subtrahend 100101 is 011011. This should be added to the minuend.
Minuend 101100
Add 2‟s complement of Subtrahend + 011011
1 000111 There is a carry 1.
Ignore it.
+ 000111 Result is positive.

Answer : + (111)2

Example 2 : (54)10 - (62)10


Binary of 54 (Minuend) = 110110
Binary of 62 (Subtrahend) = 111110
2‟s complement of 111110 = 000010

Minuend 110110
Add 2‟s complement of Subtrahend + 000010
111000 There is no carry.
Find 2‟s complement 000111
(1‟s complement Plus 1) + 1
- 001000 Result is negative.
Convert to Decimal - 8

Answer : - 8

Signed binary numbers


In decimal systems, we use (+) sign for positive numbers and (–) sign for negative numbers.
In binary number system, an additional bit is used as the sign bit. A „0‟ is used to represent a
positive number and a „1‟ is used to represent a negative number.

Sign

31
bit Magnitude bits

For example, an 8-bit signed number 01000100 represents a positive number, because the
sign bit is „0‟. Its magnitude is 1000100. Hence, the equivalent decimal number is +68.
Similarly, the signed number 11000100 represents a negative number, because the sign bit is
„1‟. Its magnitude is 1000100. Hence, the equivalent decimal number is -68.

ie. 01000100 = +68


11000100 = -68

This type of representation for signed numbers is called „sign-and-magnitude representation‟.

Half adder

Half adder adds two binary digits at a time. It has two inputs A and B, and two outputs SUM
and CARRY.

Figure : Block diagram

Figure : Logic diagram

𝑆𝑈𝑀 = 𝐴𝐵 + 𝐴𝐵 = A ⊕ B
CARRY = A B

Inputs Outputs

A B CARRY SUM

0 0 0 0

0 1 0 1

1 0 0 1

32
1 1 1 0

As per the laws of binary addition, we get,

When A= 0 and B = 0
0 + 0 ===> Carry = 0, Sum = 0

When A= 0 and B = 1
0 + 1 ===> Carry = 0, Sum = 1

When A= 1 and B = 0
1 + 0 ===> Carry = 0, Sum = 1

When A= 1 and B = 1
1 + 1 ===> Carry = 1, Sum = 0

The logic diagram, truth table and logic equations for SUM and CARRY are given in figure.

From the truth table (A, B and SUM), we find that an EX-OR can be used to produce the
SUM. From the truth table (A, B and CARRY), we find that an AND gate can be used to
produce the CARRY.

Full adder

When we add two bits, we may get a carry bit. Hence, an adder circuit needs to add three bits
(ie. two input bits A and B and one carry bit C). The logic circuit which adds three bits is
called Full adder. The truth table of full adder is given in table.

Inputs Outputs
A B C CARRY SUM
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1

A full adder can be implemented using two half adders and an OR gate as shown in the
figure.

Figure : Block diagram

33
Figure : Block diagram of full adder using two half adders

The logic diagram and logic equations for SUM and CARRY are given in figure.

Figure : Logic diagram

SUM = A ⊕ B ⊕ C
CARRY = A B + (A ⊕ B) C

The first Half adder HA1 is used to add A and B. Its SUM output and C are added by the
second Half adder HA2. The SUM output of HA2 is the final SUM. The carry outputs of
HA1 and HA2 are ORed to get the final CARRY output.

Half subtractor

Half subtractor subtracts one binary bit from another binary bit at a time. It has two inputs A
and B, and two outputs DIFFERENCE and BORROW.

Figure : Block diagram of half subtractor

As per the laws of binary subtraction, we get,

When A= 0 and B = 0
0 - 0 ===> Borrow = 0, Difference = 0

When A= 0 and B = 1
0 - 1 ===> Borrow = 1, Difference = 1

When A= 1 and B = 0
1 - 0 ===> Borrow = 0, Difference = 1

When A= 1 and B = 1
1 - 1 ===> Borrow = 0, Difference = 0
34
The logic diagram, truth table and logic equations for DIFFERENCE and BORROW are
given in figure.

Borrow = 𝐴 . B

Figure : Logic diagram of half subtractor

Inputs Outputs
A B BORROW DIFFERENCE
0 0 0 0
0 1 1 1
1 0 0 1
1 1 0 0

DIFFERENCE = 𝐴𝐵 + 𝐴𝐵 = A ⊕ B
BORROW = 𝐴 B

From the truth table (A, B and DIFFERENCE), we find that an EX-OR gate can be used to
produce the DIFFERENCE. From the truth table (A, B and BORROW), we find that A‟.B
will give the BORROW. Hence, a NOT gate and an AND gate are used to produce the
BORROW.

Full subtractor

When we subtract two bits, we may get a borrow bit. Hence, a subtractor circuit needs to
subtract three bits (ie. two input bits A and B and one borrow bit C). The logic circuit which
subtracts three bits is called Full subtractor. The truth table of full subtractor is given in table.

Figure : Block diagram of full subtractor

Inputs Outputs
A B C BORROW DIFFERENCE
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 1 0
1 0 0 0 1
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
35
A full subtractor can be implemented using two half subtractors and an OR gate as shown in
the figure.

Borrow

Figure : Block diagram of full subtractor using two half subtractors

The logic diagram and logic equations for DIFFERENCE and BORROW are given in figure.

Figure : Logic diagram of full subtractor

DIFFERENCE = A ⊕ B ⊕ C
BORROW = 𝐴 B + (𝐴 ⊕ 𝐵) C

The first Halfsubtractor HS1 is used for (A - B). Then C is subtracted from (A-B) using the
second Half subtractor HS 2. The DIFFERENCE output of HA2 is the final DIFFERENCE.
The BORROW outputs of HS1 and HS2 are ORed to get the final BORROW output.

36

You might also like