Unit 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Chapter-1 Logic Gates

a. Logic Gates
Logic gates are the basic building blocks of any digital system. Logic gates are
electronic circuits having one or more than one input and only one output. The
relationship between the input and the output is based on certain logic. Based on this,
logic gates are named as:

1. AND gate
2. OR gate
3. NOT gate
4. NAND gate
5. NOR gate
6. Ex-OR gate
7. Ex-NOR gate

1. AND gate: The AND gate is an electronic circuit that gives a high output (1) only
if all its inputs are high. A dot (.) is used to show the AND operation i.e. A.B or
can be written as AB

Y= A.B

Figure-1: Logic Symbol of AND Gate Figure-2: Truth Table of AND Gate

2. OR gate: The OR gate is an electronic circuit that gives a high output (1) if one or
more of its inputs are high. A plus (+) is used to show the OR operation.

Y= A+B

Figure-2: Logic Symbol of OR Gate Figure-4: Truth Table of OR Gate


3. NOT gate: The NOT gate is an electronic circuit that produces an inverted
version of the input at its output. It is also known as an inverter. If the input
variable is A, the inverted output is known as NOT A. This is also shown as A' or
A with a bar over the top, as shown at the outputs.

Y= A'

Figure-3: Logic Symbol of NOT Gate Figure-6: Truth Table of NOT Gate

4. NAND gate: This is a NOT-AND gate which is equal to an AND gate followed
by a NOT gate. The outputs of all NAND gates are high if any of the inputs are
low. The symbol is an AND gate with a small circle on the output. The small
circle represents inversion.

Y= AB

Figure-7: Logic Symbol of NAND Gate Figure-8: Truth Table of NAND Gate

5. NOR gate: This is a NOT-OR gate which is equal to an OR gate followed by a


NOT gate. The outputs of all NOR gates are low if any of the inputs are high. The
symbol is an OR gate with a small circle on the output. The small circle represents
inversion.

Y=A+B

Figure-9: Logic Symbol of NOR gate Figure-10: Truth Table of NOR gate
6. Ex-OR gate: The 'Exclusive-OR' gate is a circuit which will give a high output if
either, but not both of its two inputs are high. An encircled plus sign (⊕) is used to
show the Ex-OR operation.

Y=A⊕B

Figure-11: Logic Symbol of Ex-OR gate Figure-12: Truth Table of Ex-OR gate

7. Ex-NOR gate: The 'Exclusive-NOR' gate circuit does the opposite to the EX-OR
gate. It will give a low output if either, but not both of its two inputs are high. The
symbol is an EX-OR gate with a small circle on the output. The small circle
represents inversion.

Y= A⊕B

Fig.-13: Logic Symbol of Ex-NOR gate Fig.-14: Truth Table of Ex-NOR gate

Ex-NOR gate is created from AND, NOT and OR gates. The output is high only
when both the inputs are same.

b. Applications of Logic Gates


a. AND Gate: The AND gate is used for data transmission control in digital
electronics. AND gate allows or disallows the transmission of data through a
channel. AND Gates are used in digital measuring instruments. AND gates are
also used in alarm circuits.
b. OR Gate: OR gates are used in automatic digital control circuits. There are many
sensors are used to detect faults in an industry. The sensor creates a signal if any
fault occurs. Then OR gates give command signals to the main processor for the
shutdown. OR gates are used in Door Bell Switches.
c. NAND Gate: There are many applications of NAND gate available. NAND gates
are used in Alarm circuit using LDR, Freezer warning buzzer circuits, automatic
temperature control circuits.
d. NOT Gate: The NOT gate is also called inverter it inverts the input signal and
gives the opposite signal in the output. NOT gates are used in CMOS inverter for
generating waveforms. NOT gates are also used in temperature detector circuits.
e. Use of Logic gates in Microprocessor and Microcontroller: The basic fundamental
component of any processor, microprocessor, and microcontroller is the logic
gate. ALU, Registers, memories in a processor are made of logic gates. We also
know Flip flops are designed using logic gates which are used in any processor.
f. Use of Logic gates in IC: Most of the digital ICs are uses logic gates as
fundamental components. Logic gates use in analog ICs also. IC 555 has RS flip
flop inside it. The RS flip flop inside the IC555 is made of logic gates. Most of the
digital driver ICs, controller ICs has used logic gates inside them. Logic gates are
used in disk read-write IC, Printer IC, etc.
g. Use of Logic Gates in our Daily Life: In the modern day, we cannot live without
smartphones and also we use lots of digital devices, gadgets in our daily life such
as smartphones, digital watch, computer, digital stopwatches, calculator, etc. All
of those devices use logic gates for their operation.
h. Use of Logic Gates in Control Circuit: Nowadays, Digital Control circuits come in
the industry. Nowadays, all machines are controlled digitally. In digital control
circuits, logic gates are used for creating commands. Basically, AND, OR, and
NOT gates are mostly used in controlled circuits.

Digital Control circuits give the facilities to ON, OFF, and speed control of a
machine by computer from the control rooms. This is possible for the logic gates.
Chapter-2 Boolean Algebra

a. Introduction to Boolean Algebra


Boolean algebra is used to analyze and simplify the digital (logic) circuits. It uses only the
binary numbers i.e. 0 and 1. It is also called as Binary Algebra or logical Algebra. Boolean
algebra was invented by George Boole in 1854.

 Rule in Boolean algebra:

 Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
 Complement of a variable is represented by an overbar (-). Thus, complement of
variable B is represented as . Thus if B = 0 then = 1 and B = 1 then = 0.
 ORing of the variables is represented by a plus (+) sign between them. For example
ORing of A, B, C is represented as A + B + C.
 Logical ANDing of the two or more variable is represented by writing a dot between
them such as A.B.C. Sometime the dot may be omitted like ABC.

 Boolean Laws: There are six types of Boolean Laws.

 Commutative law: Any binary operation which satisfies the following expression is
referred to as commutative operation.

Commutative law states that changing the sequence of the variables does not have any
effect on the output of a logic circuit.

 Associative law: This law states that the order in which the logic operations are
performed is irrelevant as their effect is the same.

 Distributive law: Distributive law states the following condition.

 AND law: These laws use the AND operation. Therefore they are called
as AND laws.

 OR law: These laws use the OR operation. Therefore they are called as OR laws.
 INVERSION law: This law uses the NOT operation. The inversion law states that
double inversion of a variable results in the original variable itself.

Important Boolean Theorems

Following are few important Boolean Theorems.

Boolean function/theorems Description

Boolean Functions and Expressions, K-Map and NAND


Boolean Functions
Gates realization

De Morgan's Theorem 1 and Theorem 2


De Morgan's Theorems

b. Boolean Algebraic Theorems


Boolean algebraic theorems are the theorems that are used to change the form of a boolean
expression. Sometimes these theorems are used to minimize the terms of the expression, and
sometimes they are used just to transfer the expression from one form to another.
There are Boolean algebraic theorems in digital logic:
a. De Morgan’s Theorem : DE Morgan’s Theorem represents two of the most important
rules of boolean algebra.
i. (A . B)' = A' + B'
Thus, the complement of the product of variables is equal to the sum of their
individual complements.
ii. (A + B)' = A' . B'
Thus, the complement of the sum of variables is equal to the product of their
individual complements.
The above two laws can be extended for n variables as
(A1 . A2 . A3 ... An)' = A1' + A2' + ... + An')
And
(A1 + A2 + ... + An)' = A1' . A2' . A3' ... An' )

b. Transposition Theorem : It states that:


AB + A'C = (A + C) (A' + B)
Proof:
RHS
= (A + C) (A' + B)
= AA' + A'C + AB + CB
= 0 + A'C + AB + BC
= A'C + AB + BC(A + A')
= AB + ABC + A'C + A'BC
= AB + A'C
= LHS

c. Redundancy Theorem : This theorem is used to eliminate the redundant terms. A


variable is associated with some variable and its complement is associated with some
other variable and the next term is formed by the left over variables, then the term
becomes redundant.

Example:
AB + BC' + AC = AC + BC'

Proof:
LHS
= AB + BC' + AC
= AB(C + C') + BC'(A + A') + AC(B + B')
= ABC + ABC' + ABC' + A'BC' + ABC + AB'c
= ABC + ABC' + A'BC' + AB'C
= AC(B + B') + BC'(A + A')
= AC + BC'
= RHS

d. Duality Theorem:
Dual expression is equivalent to write a negative logic of the given boolean relation. For
this,
 Change each OR sign by and AND sign and vice-versa.
 Complement any 0 or 1 appearing in the expression.
 Keep literals as it is.

Example:
Dual of A(B+C) = A+(B.C) = (A+B)(A+C)
e. Complementary Theorem: For obtaining complement expression,
 Change each OR sign by AND sign and vice-versa.
 Complement any 0 or 1 appearing in the expression.
 Complement the individual literals.

Example:
Complement of A(B+C) = A'+(B'.C') = (A'+B')(A'+C')
3. Simplification using boolean algebra
A simplified Boolean expression uses the fewest gates possible to implement a given
expression.

 Simplify: C + BC:
Expression Rule(s) Used

C + BC Original Expression

C + (B + C) DeMorgan's Law.

(C + C) + B Commutative, Associative Laws.

T+B Complement Law.

T Identity Law.

 Simplify: AB(A + B)(B + B):

Expression Rule(s) Used

AB(A + B)(B + B) Original Expression

AB(A + B) Complement law, Identity law.

(A + B)(A + B) DeMorgan's Law

Distributive law. This step uses the fact that or distributes


over and. It can look a bit strange since addition does not
A + BB distribute over multiplication.

A Complement, Identity.

 Simplify: (A + C)(AD + AD) + AC + C:

Expression Rule(s) Used

(A + C)(AD + AD) + AC + C Original Expression

(A + C)A(D + D) + AC + C Distributive.

(A + C)A + AC + C Complement, Identity.

A((A + C) + C) + C Commutative, Distributive.


A(A + C) + C Associative, Idempotent.

AA + AC + C Distributive.

A + (A + T)C Idempotent, Identity, Distributive.

A+C Identity, twice.

You can also use distribution of or over and starting from A(A+C)+C to
reach the same result by another route.

 Simplify: A(A + B) + (B + AA)(A + B):

Expression Rule(s) Used

A(A + B) + (B + AA)(A + B) Original Expression

Idempotent (AA to A), then Distributive,


AA + AB + (B + A)A + (B + A)B used twice.

Complement, then Identity. (Strictly


speaking, we also used the Commutative Law
AB + (B + A)A + (B + A)B for each of these applications.)

AB + BA + AA + BB + AB Distributive, two places.

Idempotent (for the A's), then Complement


AB + BA + A + AB and Identity to remove BB.

Commutative, Identity; setting up for the next


AB + AB + AT + AB step.

AB + A(B + T + B) Distributive.

AB + A Identity, twice (depending how you count it).

A + AB Commutative.

(A + A)(A + B) Distributive.

A+B Complement, Identity.


4. Difference between SOP and POS in Digital Logic
In digital logic, the inputs and output of a function are in the form of
binary numbers (boolean values) i.e., the values are either zero (0)
or one (1). Therefore, digital logic is also known as ‘Boolean logic’.
These inputs and output can be termed as ‘Boolean Variables’. The
output boolean variable of a digital signal can be expressed in terms
of input boolean variables which forms the ‘Boolean Expression’.
Representation of Boolean expression can be primarily done in two
ways. They are as follows:
1. Sum of Products (SOP) form
2. Product of Sums (POS) form

Note:
If the number of input variables are n, then the total number of
combinations in Boolean algebra is 2n.
If the input variable (let A) value is :
 Zero (0) – a is LOW -It should be represented as A’ (Complement
of A)
 One (1) – a is HIGH -It should be represented as A

In boolean logic,
AND is represented as '.'
A AND B is written as 'A.B'

OR is represented as '+'
A OR B is written as 'A+B'
For example, Considering number of input variables =3, Say A, B
and C.
Total number of combinations are: 23=8.

A B C

0 0 0

0 0 1

0 1 0
A B C

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

 Sum of Products (SOP):


It is one of the ways of writing a boolean expression. As the
name suggests, it is formed by adding (OR operation) the
product terms. These product terms are also called as ‘min-
terms’. Min-terms are represented with ‘m’, they are the
product(AND operation) of boolean variables either in normal
form or complemented form.
Therefore, SOP is sum of minterms and is represented as:
F in SOP = m(0, 3)
Here, F is sum of minterm0 and minterm3.
For Example:
A=0, B=0, C=0 Minterm is A'.B'.C'
A=1, B=0, C=1 Minterm is A.B'.C
Consider a function X, whose truth table is as follows:

A B C X

0 0 0 0

0 0 1 1
A B C X

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 0

1 1 0 1

1 1 1 0

The function X can be written in SOP form by adding all the min-
terms when X is HIGH(1).
While writing SOP, the following convention is to be followed:

If variable A is Low(0) - A'


A is High(1) - A
X (SOP) = m(1, 3, 6)
= A’.B’.C + A’.B.C + A.B.C’

 Product of Sums (POS):


As the name suggests, it is formed by multiplying(AND operation)
the sum terms. These sum terms are also called as ‘max-terms’.
Max-terms are represented with ‘M’, they are the sum (OR
operation) of Boolean variables either in normal form or
complemented form.

Therefore, POS is product of maxterms and is represented as:


F in POS = M(1, 2) Here, F is product of maxterm1 and
maxterm2.
For Example:
A=0, B=1, C=0 Maxterm is A+B'+C
A=1, B=1, C=1 Maxterm is A'+B'+C'
Consider a function X, whose truth table is as follows:
A B C X

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 0

The function X can be written in POS form by multiplying all the


max-terms when X is LOW(0).
While writing POS, the following convention is to be followed:
If variable A is Low(0) - A
A is High(1) - A'

X (POS) = M (0, 2, 4, 5, 7)

= (A+B+C).(A+B'+C).(A'+B+C).(A'+B+C').(A'+B'+C')

5. Realization of Boolean expressions using Basic Logic Gates


The main idea of making a Boolean Expression is to transform it into a logical circuit with
the help of hardware devices. These logic circuits are made using logic gates. We need to
choose that logical expression which is minimal and can be implemented easily and cheaply.

 Converting Boolean Expression to Logic Circuit


The simplest way to convert a Boolean expression into a logical circuit is to follow the
reverse approach in which we start from the output of the Boolean expression and reach
towards the input.

Example1: Realize the Boolean Expression BC + A + (A + C) using AOI logic.

Solution:

To realize this using the AOI logic gates, we will use the reverse approach.

Step 1:

Our expression BC + A + (A+C) is the summation of three terms BC, A and, (A+C), thus
a 3-input OR Gate must have been used to obtain the expression as given :0

Step 2:

Now, BC and (A + C) both are inverted in nature, so they must have been inverted using a
NOT Gate earlier. BC must have been obtained by inverting the input BC and (A +
C) must have been obtained by inverting the input (A + C) both using the NOT Gate.

Step 3:

Moving further, in the reverse direction we see, BC must have been an output of 2-input
AND Gate with inputs as B and C. Likewise, (A + C) must have been obtained as the
output of 2-input OR gate with A and C as the inputs.

So, Final Logic Diagram for above given Boolean expression can be drawn as,
Converting Logic Diagrams into Boolean Expressions

The easiest way to obtain the Boolean Expression from any logic circuit is to follow the
forward propagation approach. In this, we start from the input side and move ahead until
the output is reached. While moving from the input side to the output side, we continue
evaluating the output of intermediate logic gates.

Example 1: Find out the Boolean Expression for Logic Diagram given below and
simplify the output in the minimal expression, also implement the simplified
expression using the AOI logic.

Solution:

Following the forward propagation approach, we see that gate G1 is a 2-input AND Gate
having inputs A and B. So, output of G1 will be AB. Similarly, G2 is an OR Gate, so
output of G2 will be (B+C). Also, G3 is an AND Gate and its output will be AB.

Now, gate G4 is a 2-input OR Gate which has one of its inputs as A and the other one is
the output of gate G1, thus the output of gate G4 will be (A + AB). Similarly, output for
gate G5 and G6 will be (B + BC) and (C + AB) respectively. Now, gate G7 is a 3-input
AND Gate, therefore output (Y) of G7 will be equal to (A+AB). (B+BC). (C+AB)
Since, we have Y = (A+AB). (B+BC). (C+AB), now we have to minimize it.

Therefore, (A+AB). (B+BC). (C+AB)


= A (1 + B). B (1 +C). (C+AB)
= A. B. (C+AB) [Since, 1+B =1 and 1+C =1]
= AB (1 + C)
= AB

Therefore, Y=AB is the minimal expression. This can be implemented using a 2-input
AND Gate having inputs A and B as:

6. Introduction of K-Map (Karnaugh Map)

The K-map is a systematic way of simplifying Boolean expressions. With the help of the K-
map method, we can find the simplest POS and SOP expression, which is known as the
minimum expression. The K-map provides a cookbook for simplification.

Just like the truth table, a K-map contains all the possible values of input variables and their
corresponding output values. However, in K-map, the values are stored in cells of the array.
In each cell, a binary value of each input variable is stored.
The K-map method is used for expressions containing 2, 3, 4, and 5 variables. For a higher
number of variables, there is another method used for simplification called the Quine-
McClusky method. In K-map, the number of cells is similar to the total number of variable
input combinations. For example, if the number of variables is three, the number of cells is
23=8, and if the number of variables is four, the number of cells is 2 4. The K-map takes the
SOP and POS forms. The K-map grid is filled using 0's and 1's. The K-map is solved by
making groups. There are the following steps used to solve the expressions using K-map:

1. First, we find the K-map as per the number of variables.


2. Find the maxterm and minterm in the given expression.
3. Fill cells of K-map for SOP with 1 respective to the minterms.
4. Fill cells of the block for POS with 0 respective to the maxterm.
5. Next, we create rectangular groups that contain total terms in the power of two like 2,
4, 8, … and try to cover as many elements as we can in one group.
6. With the help of these groups, we find the product terms and sum them up for the
SOP form.

2 Variable K-map

There is a total of 4 variables in a 2-variable K-map. There are two variables in the 2-variable
K-map. The following figure shows the structure of the 2-variable K-map:

o In the above figure, there is only one possibility of grouping four adjacent minterms.
o The possible combinations of grouping 2 adjacent minterms are {(m 0, m1), (m2, m3),
(m0, m2) and (m1, m3)}.

3-variable K-map

The 3-variable K-map is represented as an array of eight cells. In this case, we used A, B, and
C for the variable. We can use any letter for the names of the variables. The binary values of
variables A and B are along the left side, and the values of C are across the top. The value of
the given cell is the binary values of A and B at left side in the same row combined with the
value of C at the top in the same column. For example, the cell in the upper left corner has a
binary value of 000, and the cell in the lower right corner has a binary value of 101.
The 4-Variable Karnaugh Map

The 4-variable K-map is represented as an array of 16 cells. Binary values of A and B are
along the left side, and the values of C and D are across the top. The value of the given cell is
the binary values of A and B at left side in the same row combined with the binary values of
C and D at the top in the same column. For example, the cell in the upper right corner has a
binary value of 0010, and the cell in the lower right corner has a binary value of 1010

5-variable K-map

With the help of the 32- cell K-map, the boolean expression with 5 variables can be
simplified. For constructing a 5-variable K-map, we use two 4-variable K-maps. The cell
adjacencies within each of the 4- variable maps for the 5-variable map are similar to the 4-
variable map.

A K-map for five variables (PQRST) can be constructed using two 4-variable maps. Each
map contains 16 cells with all combinations of variables Q, R, S, and T. One map is for P = 0,
and the other is for P = 1).
7. Simplification of boolean expressions using Karnaugh Map

As we know that K-map takes both SOP and POS forms. So, there are two possible solutions
for K-map, i.e., minterm and maxterm solution. Let's start and learn about how we can find
the minterm and maxterm solution of K-map.

 Minterm Solution of K Map

There are the following steps to find the minterm solution or K-map:

Step 1: Firstly, we define the given expression in its canonical form.

Step 2: Next, we create the K-map by entering 1 to each product-term into the K-map
cell and fill the remaining cells with zeros.

Step 3: Next, we form the groups by considering each one in the K-map.

Notice that each group should have the largest number of 'ones'. A group cannot contain
an empty cell or cell that contains 0.

In a group, there is a total of 2n number of ones. Here, n=0, 1, 2, …n.

Example: 20=1, 21=2, 22=4, 23=8, or 24=16.


We group the number of ones in the decreasing order. First, we have to try to make the
group of eight, then for four, after that two and lastly for 1.

In horizontally or vertically manner, the groups of ones are formed in shape of rectangle
and square. We cannot perform the diagonal grouping in K-map.

The elements in one group can also be used in different groups only when the size of
the group is increased.

The elements located at the edges of the table are considered to be adjacent. So, we can
group these elements.

We can consider the 'don't care condition' only when they aid in increasing the group-
size. Otherwise, 'don't care' elements are discarded.
Step 4: In the next step, we find the boolean expression for each group. By looking at
the common variables in cell-labeling, we define the groups in terms of input variables.
In the below example, there is a total of two groups, i.e., group 1 and group 2, with two
and one number of 'ones'.

In the first group, the ones are present in the row for which the value of A is 0. Thus,
they contain the complement of variable A. Remaining two 'ones' are present in
adjacent columns. In these columns, only B term in common is the product term
corresponding to the group as A'B. Just like group 1, in group 2, the one's are present in
a row for which the value of A is 1. So, the corresponding variables of this column are
B'C'. The overall product term of this group is AB'C'.

Step 5: Lastly, we find the boolean expression for the Output. To find the simplified
boolean expression in the SOP form, we combine the product-terms of all individual
groups. So the simplified expression of the above k-map is as follows:

A'+AB'C'

Let's take some examples of 2-variable, 3-variable, 4-variable, and 5-variable


K-map examples.

Example 1: Y=A'B' + A'B+AB


Simplified expression: Y=A'+B

Example 2: Y=A'B'C'+A' BC'+AB' C'+AB' C+ABC'+ABC

Simplified expression: Y=A+C'

Example 3: Y=A'B'C' D'+A' B' CD'+A' BCD'+A' BCD+AB' C' D'+ABCD'+ABCD

Simplified expression: Y=BD+B'D'

 Maxterm Solution of K-Map

To find the simplified maxterm solution using K-map is the same as to find for the
minterm solution. There are some minor changes in the maxterm solution, which are as
follows:

i. We will populate the K-map by entering the value of 0 to each sum-term into the K-
map cell and fill the remaining cells with one's.
ii. We will make the groups of 'zeros' not for 'ones'.
iii. Now, we will define the boolean expressions for each group as sum-terms.
iv. At last, to find the simplified boolean expression in the POS form, we will combine
the sum-terms of all individual groups.

Let's take some example of 2-variable, 3-variable, 4-variable and 5-variable K-map
examples

Example 1: Y=(A'+B')+(A'+B)+(A+B)

Simplified expression: A'B

Example 2: Y=(A + B + C') + (A + B' + C') + (A' + B' + C) + (A' + B' + C')

Simplified expression: Y=(A + C') .(A' + B')

Example 3: F(A,B,C,D)=π(3,5,7,8,10,11,12,13)

Simplified expression: Y=(A + C') .(A' + B')

You might also like