0% found this document useful (0 votes)
9 views25 pages

Chapter 4

Uploaded by

Isanka
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)
9 views25 pages

Chapter 4

Uploaded by

Isanka
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/ 25

LOGIC GATES AND USE OF BOOLEAN ALGEBRA

After studying this lesson, you will have a clear understanding on,
Boolean Algebra
basic Laws in Boolean Algebra
Logic Gates
designing circuits by using Combinational Logic Gates

Algebraic expressions, algebraic equations and operators are used in general algebra. The number system
used here is the Decimal number system. Before we start discussing about Boolean Algebra, let us
consider the algebraic expressions and algebraic equations we come across in general algebra.

Algebraic Expressions

When numbers, letters, digits, signs (mathematical operators), variables and plus or minus signs are
arranged to get a mathematical or logical idea we call it an algebraic expression. They should not contain
an equal sign.

Example :-
• 2x+y
• –3ax + 11xy
Is this an algebraic expression? 2x+y=4y
Since the equal sign is used in this expression it is not an algebraic expression.

Algebraic Equations
Two algebraic expressions connected by an equal sign is called as algebraic equation.

Example :- • v = u+ft
• P = ma
• Profit = Income - Expenditure

Mathematical Operations
In mathematics we use the operations: Addition ^+&, Subtraction ^-&, Multiplication ^Í& and Division ^$&

Values
Let's consider the equation Y=2X+1 used in general algebra

X Y
10001 20001
100 199
10 21
1000 2001
10000 20001

We can get any value from minus infinity to plus infinity for X and can obtain similar values for Y
relevant to it.
Accordingly in normal algebra we use the numerals from minus infinity in the decimal number system to
represent values..

1
4.1 Boolean Algebra
As we are going to discuss Boolean Algebra here, we should have an understanding of Boolean
expressions, 'Boolean values' and Boolean operations.

Boolean Values
To express Boolean Values 'True' or 'False' or '1' or '0' are used in general.

Boolean Expressions
If we can set only logical values such as 'True' or 'False' for a certain expression, it is defined as a
Boolean expression.

Example :- • The parrot is a carnivorous bird.


• The sun is a cold object.

Boolean Variables
If a variable can take only logical values it can be called a Boolean variable. These two values can be
expressed as '0' or '1' or 'True' or 'False'.

Boolean Operations
Boolean operations are as follows :

OR - Boolean Addition
AND - Boolean Multiplication
NOT - Boolean Complementation

OR - Boolean Addition
"+" sign is used for the addition operation in Boolean Algebra. This is known as "OR". The same sign is
used for addition in General Algebra and it is given a different meaning in Boolean algebra.

If A and B are Boolean variables, let us consider the expression 'A+B ' or A OR B'. Here we have to
consider four situations. The table shows how the value of a Boolean expression changes according to the
values of Boolean variables. This is called a Truth Table

A B A+B (A OR B) Note :
0 0 0 When A and B are Boolean variables, we read 'A + B'
0 1 1 as 'A OR B' , and not
1 0 1 as A plus B.
1 1 1

If and only if the values of both variables


A and B are 0, A + B is 0. A B C A+B+C (A OR B OR C)
0 0 0 0
In all other situations A + B = 1 0 0 1 1
0 1 0 1
If A, B and C are three Boolean variables, 0 1 1 1
let us consider the expression 'A+B+C' or 1 0 0 1
'A OR B OR C'. Here to show the various 1 0 1 1
values taken by the expression A, B and C, 1 1 0 1
we have to construct a truth table with 8 1 1 1 1
rows
2
AND - Boolean Multiplication
We use the "." sign for Boolean multiplication and it can also be written as 'AND' operation.

If A and B are two Boolean variables, the various values the expression 'A . B' or 'A AND B' can take are
shown in Table

A B A.B (A AND B) Note :


0 0 0 'A'B' is read as 'A AND B'.
0 1 0
1 0 0
1 1 1
If and only if values of both variables A and B are 1, A . B = 1,
In all other situations A . B = 0

If A" B and C are three Boolean variables, let us consider the expression 'A.B.C' or 'A AND B AND C'.
For this we have to consider 8 situations.

A B C A.B.C (A AND B AND C) If and only if the values of all three


0 0 0 0 variables A" B and C are 1,
0 0 1 0 A.B.C=1
0 1 0 0
0 1 1 0 In all the other situations, A . B . C = 0.
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1

NOT - Logical Complementation


For 'NOT', operation we use " " (bar) or " ' " symbol.

If A is the Boolean variable, let us consider the expression NOT A . Here we have to consider 2
situations.

A NOT A (A’) When A = 1, NOT A = 0 and when A = 0, NOT A = 1.


0 1 For the operation NOT only one variable is used.
1 0

Simplification of Boolean Expressions


Let us consider the simplification of a simple algebraic expression before simplifying Boolean
expressions.

Simplify Y = 2+6 Ï 4 / 3 Ï 2-5. We cannot obtain several solutions for this expression. Therefore we
should know the priority order of the operators.

Starting from the left and going towards the right you will notice the operations '+' , ' / ' 'Ï' and '_'. Among
these operators 'Ï' and ' / ' gain precedence (than '+' and '-'). Therefore, first you have to do multiplication
or division. Since you get multiplication first, you should do that operation first.
3
Y = 2+6 Ï 4 / 3 Ï 2-5
Y = 2+24 / 3 Ï 2-5
Secondly you should do division
Y = 2+8 Ï 2-5
Then multiplication should be done
Y = 2+16-5 Then addition and subtraction should be done.
Y = 13

The following conditions should be observed when simplifying boolean expressions or equations.
• Start from the left and move towards the right'
• First simplify operation within brackets.
• After that do all 'NOT' operation ( - ) from left to right.
• Then do 'AND' operation ( . ) from left to right.
• Finally, do 'OR' operation (+) from left to right.

Example :- When simplifying the Boolean expression A+B.C , we come across both 'OR' and 'AND'
operations from left to right. The first operation here should be 'AND', that is B.C and then finally the
'OR' operation.

Let us construct a Truth Table for this.


A B C B.C A+B.C
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

Activities 4.1
Find the values of following Boolean Expressions.
1. 1.1+1.0 2. 0.1+1.0
3. 1.1.1+0.1+1 4. 0+1+1.1.1
5. 1.1+1.0 6. 1.1.0 +1.1.1+0.1+1
7. 1.0.1 +(1.1.1+1.1).1 8. (1 + 1+ 1) (1+ 1. 0)
9. 1 .1 .1 +(1.1.1+1.1).1 10. (1 + 1+ 1) (1. 1. 0)

If A and B are two Boolean variables, construct Truth Tables for the following Boolean expressions.
1' A.B+A 2' A.B+A.B

4.2 Basic laws of Boolean Algebra


Let X, Y and Z be Boolean variables.
a) X = 0 , if and only if X 1
b) X =1 , if and only if X 0

A) X+0=X B) X .0 = 0 C) X+ 1 = 1 D) X.1=X

4
Commutative Law
A) X+Y=Y+X B) X.Y=Y.X

Associative Law
A) X+(Y+Z) = (X+Y)+Z B) X.(Y.Z) = (X.Y). Z

Distributive Law
A) X.(Y+Z) = (X.Y)+(X.Z) B) X + (Y.Z) = (X + Y) . (X + Z)

Idempotent Law
A) X + X = X B) X.X=X

These laws can be proven by Truth Tables.

Idempotent Law
A) X + X = X B) X.X = X

X X X+X X X X.X
0 0 0 0 0 0
1 1 1 1 1 1

A) X + 1 = 1 B) X.0 = 0

X 1 X+1 X 0 X.0

0 1 1 0 0 0
1 1 1 1 0 0

De Morgan's Law

A) X + Y = X . Y B) X . Y = X + Y

X Y X+Y X+Y X Y X.Y


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

Activity 4.2
If X, Y and Z are Boolean variables, simplify the following Boolean expressions.
1. X. (X + Y) 2. X Y + XYZ + XY
3. X.(X+Y) 4. X.Y.Z+X.Y
5. X.Y .Z+X.Y.Z+X.Y+1 6. (X+Y) . (X+Y)

5
4.3 Logic Gates
Here we discuss the three main gates and other gates made from them. These gates are used in electronic
circuites.
• AND Gate
• OR Gate Main three gates
• NOT Gate
• NAND Gate
• NOR Gate The other gates produced by them
• XOR Gate

AND Gate
The 'AND' gate physically represents an 'AND' operation. The symbol for it is given in Figure

Let's consider the circuit shown in Figure 4.2 to get an idea about the function of this. Here 'A' and 'B'
switches are connected serially and when only both switches are closed (On) current passes through the
circuit. In any other situation current is not passing through the circuit. This circuit can take two values
for switch 'A' and 'B'(On or Off). Therefore 'A' and 'B' can be considered as two Boolean variables.

The Truth Table for this is as given in Table


The Figure 4.1 represents a two-input AND gate while
A B A.B (A AND B)
Figure 4.3 represents a three- input AND gate.
0 0 0
0 1 0
1 0 0
1 1 1

OR Gate
Logical addition can be physically represented by an 'OR' gate. This is represented by the figure 4.4

The symbol of an OR gate is shown in Figure 4.4 The output is 1 if at least one if the two inputs is zero.

'A' and 'B' switches are connected parallel in the above circuit. When only both of them are open (Off)
current does not pass through the circuit and in all other situations it does.
6
Activity 4.3
Construct the Truth Table for the above gate.

NOT Gate
Logical 'NOT' operation is physically represents by the 'NOT' gate. The symbol for this is given in Figure
4.5.
Table relevant to the above figure is as given in Table 4.14.
A NOT A (A’)
0 1
1 0

4.4 Combined Logic Gates

Combined logic gates are made by combining several basic logic gates. NAND, NOR and XOR can be
cited as examples.

NAND Gate (Not AND)


The NAND gate is obtained by combining AND gate and NOT gate in serially.

A NAND B= A . B = A + B

The Truth Table for this is as follows;

A B A.B A NAND B
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
The NAND gate is depicted in the following diagram. When A and B swiches are on current flows in the
first circuit. When A and B switches are off, the current flows in the second circuit lighting the bulb

When only A and B switches are in ON position the bulb does not burn.

The NAND gate is used for electric circuits and ICs. NAND gate is available in the market to be bought.
Low resistance prevents short circuiting.

• Forming an AND gate using NAND gates

7
• Forming an OR gate using NAND gates

NOR gate (Not OR)

The result obtained by a combination of the OR gate and NOT gate is the NOR gate.

A NOR B = A + B = A . B
The Truth Table relevant to this is given below.

A B A+B A NOR B A simple circuit relevant to the NOR gate is given below
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0

The bulb burns only when both the keys A and B are in OFF position. In all the other situations the bulb
does not burn.

• XOR (pronounced as "exor" gate

The name XOR is obtained through the meaning ' exclusive OR'; that is only one of the inputs should be
1 for the output to be 1. The symbol for XOR is depicted in Figure

A XOR B also written as A + B and its output is (A . B) + (A . B).

The Truth Table relevant to it is given below.

A B A+B
0 0 0
0 1 1
1 0 1
1 1 0
Activity4.5
Represent OR and NOT gates using NOR gate.

• XNOR gate
XNOR gate is shown in the
following figure

8
The truth table of XNOR is as follows

A B A+B
0 0 1
0 1 0
1 0 0
1 1 1
Designing Logical Circuits Related to Boolean Expressions

Let us design a circuit with logic gates to get Boolean expression Q=A.(A+B)+B.
There are two inputs in this circuit. These are A and B. The logical circuit for the above Boolean
expression is given below.

Activity
1). Write the Boolean expressions relevant to the following circuits

2). Draw truth tables for the above Boolean expressions.

3). Draw circuits for the Boolean expressions given below and construct the related truth tables.
(a) A+A.B
(b) A.(A+B)
(c) (A+B).(A.C)

9
4). Write Boolean expressions for the circuits given below and construct Truth Tables.

10
Integrated Circuits
Integrated Circuits (ICs) are used to construct electronic circuits. A complex electronic circuit consists of
various circuits. For instance, a modern television circuit and a mobile phone consist of many circuits. An
integrated circuit is a type of circuit designed for a certain function with devices such as transistors,
resistors, capacitors and diodes. Now there are methods to produce circuits in small sizes so that one
circuit can be packed in one. Circuits produced in this way are called integrated circuits.

As per Figure 4.23, a microprocessor is made of a large number of integrated circuits which use logic
gates. In these integrated circuits, there are logic gates. For instance, Figure 4.22 is a logic circuit which
uses an AND gate. Thus, there are integrated circuits designed with the logic gates.

In this integrated circuit (Figure 4.22), 1, 2, 4, 5, 9, 10, 12 and 13 pins are inputs. 3, 6, 8 and 11 pins are
outputs. Figure 4.23 is the external appearance of an integrated circuit which consists of 16 pins.

Activity
1. Consider the Integrated Circuit given below. (Figure 4.24)

Consider the pins 1, 2 and 3 in the above circuit.


If 2 = 0 and 3 = 0, what is the value of pin 1?

11
2. In the Integrated Circuit given below (Figure 4.34), if pins 1 = 1 and 2 = 1, what
is the value of 3?

Practical Usage of Logic Gates


Example 1
Home Alarm System
The circuit given below is an alarm system which informs the house owner of a theft at home. This is
designed using OR gates. This circuit protects two windows, the front and back door of the house. When
any window or door is opened, an alarm system will be on. The logic gates which is connected to
windows and doors are connected to sensors. Input is "1" when windows or doors are open; input is 0
when windows or door are closed. As shown in Figure 4.27, when all the inputs are 0, there will be no
alarm.

This means all the window are


closed at this moment. However,
there will be an alarm when one
input value is 1 or several input
values are 1 or all input values are
1. This means when a thief opens
one window or door or several of
these, there will be an alarm. For
instance, Figure 4.28 shows the
alarm which warns the house owner
when the first window is opened by
somebody. The moments the alarm
is on like this are shown in Table
4.11.

12
Example 2
Circuits designed to control street lights.

Following Figure 4.29 is a circuit designed using logic gates to control street lights. This is designed
using a dark / light sensor, timer and a manual switch.

There are several occasions when the lights are on. These are,
• When only the manuals switch is closed
• When the input of the timer is 1 and when the environment is dark
• When only the manuals Switch is closed

When the manual switch is closed, its input is 1. Hence, the light is on.

When the input of the timer is 1 and when the environment is dark

If the time is in the range of two pre-arranged ranges the input is 1 and otherwise 0. This means, the input
is 1 when time is from 6 pm and 6 am, and the input is 0 when from 6 am to 6 pm. Further, the light
sensor will be 1 when there is light above pre-arranged value and it will be 0 when it is dark. Here, the
street light will be on when the timer’s input is 1 and light sensor’s value is 0. When the environment is
gloomy with a rain cloud, the street light will not be on though the light sensor’s value is 0 if the time is
not between 6 am and 6 pm.

13
Activity
A motor car manufacturing company has manufactured a motor car protecting circuit to warn if there is a
movement in the car when the engine is not on or when there is damage to a shutter. This has three
sensors to detect whether the engine is on and another sensor to detect whether there is a damage to a
shutter. Another sensor is there to detect whether the car is moving.

This circuit is designed with three basic circuits. One of these is a NOT gate and the other two gates
should be included in the empty boxes. What are the logic gates suitable for these?

Draw the circuit.

Activity

14
Postulates / Axioms

In Boolean algebra postulates / axioms means starting of the logic situation. This is accepted all without
any obligations.

1a. 0.0 = 0 1b. 1+1 = 1

2a. 1.1 = 1 2b. 0+0 = 0

3a. 0.1 = 1.0 = 0 3b. 0+1 = 1+0 = 1

4a. if x=0, then x’=1 4b. if x=1, then x’=0

Laws / Theorems

5a. x.0 = 0 5b. x+1 = 1

6a. x.1 = x 6b. x+0 = x

7a. x.x = x 7b. x+x = x

8a. x.x’ = 0 8b. x+x’ = 1

9. x’’= x

Variable Properties

Below laws are used different types of variables to build a standard in logic that use to the Boolean
algebra.All of these laws can be assured using a truth table.

Commutative Law

10a. x . y = y . x 10b. x + y = y + x

Associative Law

11a. x . ( y . z ) = ( x . y ) . z 11b. x + ( y + z ) = ( x + y ) + z

Distributive Law

12a. x . ( y + z ) = x . y + x .z 12b. x + y . z = ( x + y ) . ( x + z )

Absorption Law

13a. x + x . y = x 13b. x . ( x + y ) = x

Idempotent Law

14a. x + x = x 14b. x . x = x
15
Combining Law

15a. x . y + x . y’ = x 15b. ( x + y ) . ( x + y’ ) = x

De Morgan’s Law

16a. ( x . y )’ = x’ + y’ 16b. ( x + y )’ = x’ . y’

17a. x + x’ . y = x + y 17b. x . ( x’ + y ) = x . y

Consensus Law

18a. x . y + y . z + x’ . z = x . y + x’ . z 18b. ( x + y ) . ( y + z ) . ( x’ + z) = ( x + y ) . ( x . z )

Standard logical expressions

Boolean expressions can be changed two major parts without changing their content.

1. Sum of Products (SOP) – If AND gates are connected with OR gate SOP can be produced.
2. Product of Sum (POS) – If OR gates are connected with AND gate POS can be produced.

By using above methods evaluation, simplification and implementation processes can be done as easily
and standard way.

Sum of Products – SOP

Sum of products expression mean addition (OR gate) of two or more boolean algebra products (AND
gates).

Eg: In this example circled products (AND gates), the result of


this added products are 1.

When consider the example of AND gate with truth table, which is having 3 inputs.

A B C A.B.C
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
16
According to above picture output becomes 1 when all inputs are 1 only. But some situation output
should be changed according to below table.

In this situation output has to be taken as sum of


products.

To getting the output step by step expressions can be built.

Step 01

To getting the output is 1 of number 1 row, output of A and B need to take as 1. To do this A’B’C
products need to be built.

Step 02

To getting the output is 1 of number 2 row, output of A needs to take as 1. To do this A’BC products
need to be built.

Step 03

To getting the output is 1 of number 3 row, output of C needs to take as 1. To do this ABC’ products
need to be built.

Step 04

All these product need to be added and get the result

ABC = A’B’C + A’BC + ABC’

This expression is called as sum of product.

Example 01

Here, sum of product expression is XY =X’Y + XY’ + XY.

17
Product of Sum - POS

In boolean algebra two or more OR values can be multiplied and produced product of sum value.

Eg: Here circled additions are multiplied and get the result as 0.

Eg: Consider OR gate with 3 inputs.

According to the above picture output becomes 0 when all 3 inputs have 0. If any situation output can be
changed as below table,

When writing as sum of product (SOP) expression that is very large because six of the outputs become 1.
In this situation short method is to use product of sum (POS).

Step 01

First select outputs having 0.

Step 02

Build the additions of outputs become 0. According to above table,

Number 1 is: A + B’ + C and Number 2 is : A’ + B’ + C’

Step 03

These additions (sums) need to multiply (AND) and get the final result.

D = (A+B’+C) (A’+B’+C’) this expression has known as Product of sum (POS).

18
Eg 01: Here the product of sum (POS) expression is:

Z = ( X + Y ) ( X’ + Y’ )

Sum of Product (SOP) convert into Product of Sum (POS) and Invert.

There are two ways to convert Sum of Product (SOP) expressions into Product of Sum (POS)
expressions. They are;

1. Using Karnaugh Maps


2. Using Boolean algebra laws.

Here using Boolean algebra laws conversion can be done.

1st Method

F = xy’ +yz’ is sum of product expression. To convert this into Product of Sum need to use Distributive
Law.

F = (xy’) + y.z’

F = (xy’ +y) . (xy’ +z’)

Sum of Product Product of Sum


F = xy’ + yz’ F = ( xy’ + y).( xy’ + z’ )

2nd Method

In this method is used De Morgan’s law.

= xy’ +yz’ (to convert product of sum (POS) used (xy’+yz’)’ )

= (xy’)’.(yz’)’

=(x’+y)(y’+z) (De Morgans law (a+b)’ = (a’.b’) )

Sum of Product Product of Sum


= xy’ + yz’ = ( x’+ y ).( y’ + z )

Simplify Logical Expressions

Simplifying complex Boolean expressions give simple and clear output. There are two methods to
simplify. They are;

1. Using Boolean Theorem


2. Using Karnaugh Maps.
19
Boolean Theorem

When simplify Boolean expressions using Boolean theorem we must know Postulates / Axioms and
Laws / Theorems well. All simplifications are depend on above all.

Eg: 01 Logical Expression

Simplification (A + 1 = 1

Simplification (1A = 1

Eg: 02 Logical Expression


Expand A ( A + AB = A )

From AB + A’B expression B getting out


expression

Simplification (A + A’ = 1)

Simplification (1A= A)

Eg: 03 Logical Expression


Expand according to the Distributive law

Simplification (AA = A)

Except A + AC, Apply A + AB =A law

Except A + AB, Apply A + AB =A law

20
Karnaugh Maps

In 1953 Telecommunication Engineer Morris Karnaugh introduced to simplify karnaugh crcuits using
graph. When comparing wth Boolean algebra simplification, the karnaugh map simplification is very
easy.

Karnaugh map for the OR gate.

Before making karnaugh map, need to build the truth table.

Then need to arrange karnaugh map squares according to the inputs.

After, all the 1 values from truth table need to add into the karnaugh map.

Now, need to get groups 1, 2, 4, 8, etc from the karnaugh map combining very closed squares those
values has been 1 (minimum groups need to create).

Inputs of the Logic circuit

Finally, above groups need to be written as Boolean expressions. This expression is gained by simplified
the logic circuit. According to the inputs of the circuit, karnaugh map variables can vary.

1. 2 inputs – 4 variables
2. 3 inputs – 8 variables
3. 4 inputs – 16 variables
4. 5 inputs – 32 variables

And for easy simplification these variables can be numbered.

When noticing inputs always need to change one variable in two inputs that are closed together. This
method is different than truth table variable input method.

In truth tables normal way is 0 0 , 0 1 , 1 0 , 1 1 and for the karnaugh maps 0 0 , 0 1 , 1 1 , 1 0 . Ths
method is very important rule for the karnaugh maps.

The facts that we need to consider when making groups of the karnaugh maps.

1. Groups must contain 1s. 0s cannot be inserted.


21
2. In an one group can contain 1s, 2s, 4s , 8s ,etc… like powers of two.
3. Need to have minimum groups
4. Under the above conditions, In an one group can have maximum values.
5. Groups can be overlapping. (see below picture)
6. Left and right corners and top and bottom values can be taken as a groups.

1st picture

2nd picture

According to the truth table, variables can be numbered.

Grouped values simplification using karnaugh maps, the Boolean expression can be written as a common
input/inputs.

(output is taken as single single Boolean values)

(output is simplified into one


common Boolean value)

22
Entering variables into karnaugh map and grouping of them.

Using karnaugh maps, value 1 variables get from the truth table and simplify as Sum Of Product. The
value 0 variables get and simplify as Product of Sum.

23
Exercises:

01 Complete below karnaugh map using truth table.

02. Draw a karnaugh map to simplify the below truth table.

03. Simplify below expressions using karnaugh maps

04. Study following logic gate and the simplification of Boolean expression, simplify using karnaugh
maps. Truth table is taken as Sum of Product.

24
05. Draw karnaugh map for following logic gate

06. Simplify following logic gate using karnaugh map

25

You might also like