BCA Paper-VII Block-1 Unit-2
BCA Paper-VII Block-1 Unit-2
Lesson Structure
2.0 Objective
2.1 Introduction
2.6.1 Adders
2.6.2 Decoders
2.6.3 Multiplexer
2.6.4 Encoder
2.7 Summary
2.8 Questions
2.0 Objective
Aftergoing through this unit we will be able to :
Define logic gates;
Describe the significance of Boolean algebra in digital circuit design;
Describe the Karnaugh map and necessity of minimizing the number of gates
in design;
Describe how basic mathematical operations like addition and subtraction, are
performed by computer; and
Define and describe some of the useful circuits of a computer system such as
Adders, multiplexers, ROM etc.
2.1 Introduction
In the previous unit we have discussed the basic configuration of computer
system, von Neumann architecture, data representations and simple instruction
execution paradigm. In this unit, we will be exposed to some of the basic
components that form the most essential parts of a computer such as logic gates,
binary adders, logic circuits combinational circuits etc. These circuits are the
backbone of any computer system and knowing them is quite essential. The
characteristics of integrated digital circuits are also discussed in this unit.
A F A F
NOT F=A
0 1
1 0
A A B F
AND F F = A .B = AB
0 0 0
B 0 1 0
1 0 0
1 1 1
A A B F
OR F F=A+B
0 0 0
B 0 1 1
1 0 1
1 1 1
NAND A F A B F
{AND + F = A .B = A + B
0 0 1
NOT} B 0 1 1
1 0 1
1 1 0
A F A B F F = A + B = A .B
NOR
(OR + NOT) 0 0 1
B 0 1 0
1 0 0
1 1 0
A F A B F F = AB + AB
EXOR
(Exclusive OR) 0 0 0 =A+B
B 0 1 1
1 0 1
1 1 0
A F A B F F=A+ B
XNOR
(Exclusive 0 0 1 =A.B
B 0 1 0
NOR)
1 0 0
1 1 1
Input Output
A B C F
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
Figure : 3 Truth Table
Universal Gates : NAND and NOR logic can be used for the realization of all
the basic gates. Therefore NAND and NOR gates are known as universal gates.
NAND gate as universal gate.
NOT using NAND
A
F = A. B = A
[ 32 ]
Principles of Logic Circuits
OR using NAND
A
A
F = A .B = A+B = A+B
B
B
Similarly NOR logic can also be used to construct the above siren fundamental
gates.
Boolean rules and laws
The three basic rules of Boolean alzebra are :
(i) Commutative rule
(ii) Associative rule
(iii) Distributive rule
Commutative rule
(i) A+B=B+A
(ii) A B = B A
Associative rule
(i) A + (B + C) = (A + B) + C
(ii) A (B C) = (A B) C
Distributive rule
(i) A (B C) = A B A C
(ii) A (B C) = (A B) (A C)
Demorgan’s Law
(i) A B = A B
(ii) A B = A B
Other Rules
(i) A+A=A
(ii) A+1=A
(iii) A+O=A
(iv) AA =A
(v) AO = O
(vi) A 1 = A
(vii) AA = A
[ 33 ]
Principles of Logic Circuits
(viii) AA = O
(ix) A= A
(x) A+AB = A
(xi) A (A + B) = A
(xii) A + AB = A + B
(xiii) AB + BC + B C = AB + C
Logic Gates
A
(A.B) Boolean Expression
B
F = (A. B).(A+B)
(A+B)
[ 34 ]
Principles of Logic Circuits
A B F
0 0 0
0 1 0
1 0 0
1 1 0
(b) Truth table
Figure 4 : (a) Circuit diagram (b) Truth table
The basic design issue related to combinational circuits is Minimization of
number of gates. The normal circuit constants for combinational circuits are :
The depth of the circuit should not exceed a specific level. (figure 4 has the
depth 2.)
The number of input lines to a gates (fan in) and how many gates its output
can be fed (fan out ) are constraints by the circuit power/ constraints.
A B C F
0 0 0 0
0 0 1 0
0 1 0 1 m2
0 1 1 0
1 0 0 1 m4
1 0 1 1 m5
1 1 0 0
1 1 1 1 m7
= A B C A B C A BC ABC
= (A B C ) (A B C ) (A B C ) (A B C )
= M o M1 M 3 M 6
= (0,1, 3, 6)
The symbol stands for ANDing maxterm. Thus SOP’s and POS are inter-
convertible, that is if one form is known then other form can directly be formed.
The Boolean function expressed as a sum of minterms or product of maxterms
has the property that each and every literal of the function should be present in each
and every term in either normal or complemented form.
Example of SOP
F = AC + B C A B C
A
C
B F
C
A
B
C Level 2
(OR Gates)
Level 1
(AND Gates)
[ 37 ]
Principles of Logic Circuits
Example of POS
A
C
B
F
C
A
B Level 2
C
(AND Gates)
Level 1
(OR Gates)
2.4.2 Minimization of Gates
The simplification of Boolean expression is very useful for combinational circuit
design. The following three methods are used for this :
(i) Alzebric simplification
(ii) Karnaogh Maps
(iii) Quine Mc cluskey Method. (Beyond the scope of study).
Alzebric Simplification
We have already discussed alzebric simplification. An alzebric expression can
exist in POS or SOP form The expression must be minimized before implementation.
The simplification is essential to minimize the cost of the logic network. The drawback
of this technique is that there are no specific rules for preceding step by step to
manipulate the process of simplification. For minimization of Boolean function having
more than three variable the alzebric method becomes inconvenient. For this
karnaugh map provider a better technique of simplification the alzebric function can
appear in many different form. But simplification of expression is sometimes difficult
as one may not know what rule to apply next. The karnaugh map is a simple and
direct approach of simplification of logic expression.
Karnaugh Map
The karnaugh map (K-Map) is a graphical technique for simplifying Boolean
function. The karnaugh map is a two-dimensional representation of a truth table. The
map is simply suited for simplifying Boolean function of 2 to 6 variables.
A Karnaugh map is diagram consisting of squares. Each square of the map
represents a minterm. Any logic can be written as a sum of products, that is sum of
minterms. A map of 2 variables contains 4 element (or squares), while for 3 variable it
contain 8 elements that is for n variable it contain 2n elements (or squares).
Example : Simplify F = AB C A B C A BC A B C
[ 38 ]
Principles of Logic Circuits
Solv : A B C A B C A B C A B C
= B C (A A ) A B C A B C ( ( A A ) 1)
= B (C A C ) A BC
= B (C A ) A BC
F= B C AB ABC
B BC
C
A AB F
( B C A B A B C)
ABC
The Logic diagram for the simplified Boolean expression is given is figure 7.
Thus if the expression is reduced then the number of gates required to build the
circuit is also reduced, which results in a more simplified circuit.
The step wise procedure for Karnaugh map is :
Step 1 : Create a simple map depending on the number of variables in the
function. Special case is taken to represent variable in the map. The
value of only one variable change in two adjacent columns or rows. The
advantage of having change in one variable is that two adjacent columns
or rows represent a true or complement form of a single variable.
For example in figure 8 the columns which have positive A are adjacent and so
are the columns for A .
Decimal A B B
A 0 1
0 0 0 0 0 1
1 0 1
2 1 0
1 2 3
3 1 1
(i)
[ 39 ]
Principles of Logic Circuits
Decimal A B C BC 00 01 11 10
A
0 0 0 0
0 0 1 3 2
1 0 0 1
2 0 1 0
3 0 1 1 1 4 5 7 6
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1 (ii)
Decimal A B C D
0 0 0 0 0
1 0 0 0 1 CD
AB 00 01 11 10
2 0 0 1 0
3 0 0 1 1
00 0 1 3 2
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0 01 4 5 7 6
7 0 1 1 1
8 1 0 0 0
11 12 13 15 14
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1 10 8 9 11 10
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
(iii)
Figure 8 (i) Two variables (ii) Three variables (iii) Four variables
Note : (i) The decimal equivalent are given to help and understand where the
position of the respective set lies. Each square can contain the value 0 or
1 or nothing.
(ii) The values 00, 01, 11 or 10 written on the top implies the value of the
respective variable.
(iii) Whenever the value of the variable is 0 it is said to represent its
compliment form.
(iv) The value of only one variable changes when we move form one row to
the next row or one column to the next column.
[ 40 ]
Principles of Logic Circuits
Step 2 : Next the Karnaugh map maps the truth table. The value 1 is put in the
respective square belonging to the 1 value in the truth table. Rest of the
square are filled with 0.
Example :
Decimal A B C O BC 00 01 11 10
A
0 0 0 0 0 0 1 3 2
1 0 0 1 1 0 0 1 1 1
2 0 1 0 1
3 0 1 1 1 4 5 7 6
1
4 1 0 0 0
0 0 1 1
5 1 0 1 0
6 1 1 0 1
7 1 1 1 1
(i) (ii)
BC
A 00 01 11 10
0 0 1 1 1
1 0 0 1 1
= A B (C C ) AB (C C )
= A B AB = B ( A A ) = B.
The second pair of two 1’s can be represented as :
A B C A BC
= A C (B B ) = A C .
Thus the Boolean expression desired from this K-map is :
F = B AC
Note : This expression can directly be obtained from K-map ofter making doublet and
quadrets.
The expression so obtained is in SOP form. This expression can be expressed in
POS form also (already discussed in last section).
Don’t Care Condition
Boolean expression describe the behaviour of the logic networks. Each square
of a karnaugh map represents the response (i.e. output) of the network corresponding
of logic value of the input variables. Sometimes certain input combination never occur.
In such situation the output of the logic network are not specified on the K-map.
These situation are referred to as DON’T CARE CONDITIONS. These condition imply
that it does not matter whether the output produced is 0 or 1 for the specific input.
Example :
In calculation of BCD where 4-bits are used to represent decimal digits imply
we can represent 24 = 16 digits. But since we have only 10 decimal digits therefore 6
of those input combination values do not matter. These are called Don’t care
condition.
As the number of variable increase in K-map, it becomes difficult to keep track
on the input combination and corresponding outputs respectively. K-map is suited for
upto 6 variables. A tabular method was suggested to deal with the increasing number
of variables known as Quine Mcklusky they method.
[ 42 ]
Principles of Logic Circuits
s s s c s
There addition can be implemented using truth tables as :
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
The K-map for S and C are :
K-map for S K-map for C
B 0 1 B 0 1
A A
0 0 1 0 0 0
1 1 0 1 0 1
[ 43 ]
Principles of Logic Circuits
A AB
B S = AB + AB = A + B
AB
A
C = AB
B
Or
A S=A+ B
B
C = AB
S
A
Haff
Adder C
B
A B C Sum Carry
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
[ 44 ]
Principles of Logic Circuits
1 1 1 1 1 1 1
y z
Boolean expression for sum and carry can be siren as :
(i) Sum = A B C A B C A B C ABC
(ii) Carry x = ABC ABC = BC (A A) = BC
y = A B C ABC = AC ( B B) = AC
z = ABC ABC = AB (C C) = AB
Cary = x + y + z = BC + AC + AB
Logic Diagram for full Adder
A A B B C C
ABC
ABC
Sum
ABC
ABC
BC
AC Carry
AB
2.6.2 Decoders
A decoder is a combinational circuit that converts binary information from n
input lines to the maximum of 2n output lines. A binary code of n bits is capable of
representing upto 2n distinct elements of coded information. There can be 2 × 4, 3
× 8, 4 × 16, etc. type of decoders. Let us take an example of 3 × 8 decoder, which
decoders 3 bit information. Only one output line will be selected at one time to get
the value 1. Thus depending on the selected output line the information of the 3 bits
can be recognised or decoded.
I0 I1 I2 O0 O1 O2 O3 O4 O5 O6 O7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Enable (E)
(b)
[ 46 ]
Principles of Logic Circuits
I0 I1 I2
000 = O0
a
001
b O1
010
c O2
011
d O3
100
e O4
101
f O5
110
g O6
111
h O7
(c)
Figure 13 : 3 × 8 decoder
There are 8 AND gates named from ‘a’ to ‘h’, from which we are getting the
output numbered from O0 to O7. The output line selected is named 000 or 111 etc.
The output value of only one of the live will be 1 (given in the truth table). [The
enable line given in the block diagram is a good resource for combining two 3 × 8
decoders to make 4 × 16 decoder].
2.6.3 Multiplexers
Multiplexer or Data selector is also known as MUX. It is a device that allows
digits information from several sources to be routed into a single output line for
transmission over a common destination. It connects multiple input lines to a single
output line. At a specific time one of the input lines is selected and the selected
input passed on the output line.
[ 47 ]
Principles of Logic Circuits
In general if there are n data select lines then there are 2 n input lines to the
single output line. The multiplexing scheme thus defined is known as N × 1
multiplexer. An example of 4 × 1 MUX is given below in the figure 14.
S0 S1 O I0
O
I0 I1 4 ×1
0 0
I2 Multiplexer
0 1 I1
1 0 I3
I2
1 1 I3
S0 S1
(a) Truth Table
(b) Block diagram 4 × 1 MUX
I0 00
a
I1 01
b
O
I2 10
c
I3 11
d
For 4 × 1 mux, 4 AND gates are used named from ‘a’ to ‘d’ . Each AND gate is
connected to input line through I0 to I3 and two select line So and S1. For So = 0 and
S1 = 0 the input line becomes I0 for So = 0 and S1 = 1 the input line is I1 and so on.
[ 48 ]
Principles of Logic Circuits
Therefore by having two control lines we can have 4 × 1 mux. To have 8 × 1 Mux
we must have 3 control line. Similarly for n × 1 MUX we need to have n control lines.
The multiplexers are often used in replacement of logic gates and make the
design easier. It is also used in digital circuits for data and controlled signal routing.
The reverse circuit of multiplexing is called demultiplexing, where we have one
input line and data is transmitted to one of the possible 2n lines where ‘n’ represents
the number of selection lines.
2.6.4 Encoders
An encoder is a combinational circuit that perform a reverse function of the
decoder. An encoder has 2n input lines and ‘n’ output lines. Like 3 × 8 decoder, we
have 8 × 3 encoder, which encodes 8 bit information and produces 3 outputs
corresponding to binary numbers. This encoder is also called octal to binary encoder.
The truth table, Block diagram and circuit diagram of 8 × 3 encoder is given below :
I0 I1 I2 I3 I4 I5 I6 I7 O2 O1 O0
1 0 0 0 0 0 0 0 D0 0 0 0
0 1 0 0 0 0 0 0 D1 0 0 1
0 0 1 0 0 0 0 0 D2 0 1 0
0 0 0 1 0 0 0 0 D3 0 1 1
0 0 0 0 1 0 0 0 D4 1 0 0
0 0 0 0 0 1 0 0 D5 1 0 1
0 0 0 0 0 0 1 0 D6 1 1 0
0 0 0 0 0 0 0 1 D7 1 1 1
O0
I0 – I7 8 ×3
Encoder O1
O2
[ 49 ]
Principles of Logic Circuits
D1 D2 D3 D4 D5 D6 D7
O0
O1
O2
[ 50 ]
Principles of Logic Circuits
The drawback faced by VLSI chips is that for each logic function the layout of
gate and inter connection needs to be designed. The cost involved in making custom
designs is quite high. Thus, came the concept of programmable Logic Array, a
general purpose chip which can readily be adopted for any specific purpose at any
time.
The PLA are designed for SOP form of Boolean function and consist of regular
arrangements of NOT, AND and OR gates on a chip. Each input to the chip is passed
through a NOT gate, thus the input and its complement are available to each AND
gate. The output of each AND gate is made available for each OR gate and the
output of each OR gate is treated as chip output. By making appropriate connections
any logic function can be implemented in these Programmable Logic Array. An
example of PLA with 3 NOT gates, 3 AND and 3 OR gates is given below :
I0 I1 I2
I0 I1 I 2
a
I0 I1 I 2
b
I0 I1 I 2
c
O1 O1 O2
Figure 16 : Programmable Logic Array
[ 51 ]
Principles of Logic Circuits
n input
2n × m
ROM
m output
(a) Rom block diagram
[ 52 ]
Principles of Logic Circuits
Minterm
Adders
Input
A0 0
1
2
A1 3
.
A2 5×32 .
decoder .
A3
A4
31
F1 F2 F3 F4
(b) Logic diagram
Figure 17 : 32 × 4 ROM
Internally, the ROM is a combinational circuit with AND gates connected as a
decoder and a number of OR gates equal to the number of outputs in the unit.
The number of adders words in a ROM is determined from the fact than n
input lines are needed to specify 2n word. A ROM is some times specified by the total
number of bits it contains which is 2n × m.
For example, 128 bit ROM may be organized as 32 word of 4 bits each. This
means that the unit has 4 output lines and 5 input lines to specify 25 = 32 words.
The total number of bits stored in the unit is 32 × 4 = 128.
2.7 Summary
This unit provides the information regarding a basis of a computer system.
The basic components of circuits design are discussed such as AND, OR and NOT
gates. The key elements for the design of a combinational circuit like adders,
multiplexers, Encoder, etc. are discussed in this unit. With the advent of
Programmable Logic Array the designing of circuit is changing and now the scenario
is moving towards micro processors. You can refer to latest trends of design and
development including a hardware design language in the suggested readings.
[ 53 ]
Principles of Logic Circuits
2.8 Questions
1. What are Logic gates and which gates are called as universal gates.
2. Simplify the Boolean function F (A, B, C, D) = (0, 2, 4, 6, 7, 8, 14,
15) and
F (A, B, C, D) = (1, 3, 4, 5, 10, 12, 13)
3. Draw the logic diagrams for the above question.
4. Show the implementation of AND, OR and NOT gates using universal
gates.
5. Prepare the truth table for the following Boolean expressions :
(i) AB A B ABC
(ii) (A B) (A B)
6. Simplify the following Boolean function in SOP and POS form by means
of Karnaugh-Maps.
F (A, B, C, D) = (0, 1, 3, 6, 8, 9, 12)
7. Find the optimal logic expression for the above function. Draw the
resultant logic diagram.
8. Describ Adders, Multiplexer and encoders.
9. What is PLA ? What are its advantages ?
[ 54 ]