Digital Circuits & Design E-Book
Digital Circuits & Design E-Book
and Design
s
es
y Pr
sit
er
S. Salivahanan
iv
Chennai
d
or
S. Arivazhagan
xf
Sivakasi
Published in India by
Oxford University Press
Ground Floor, 2/11, Ansari Road, Daryaganj, New Delhi 110002, India
ss
All rights reserved. No part of this publication may be reproduced, stored in
a retrieval system, or transmitted, in any form or by any means, without the
re
prior permission in writing of Oxford University Press, or as expressly permitted
by law, by licence, or under terms agreed with the appropriate reprographics
yP
rights organization. Enquiries concerning reproduction outside the scope of the
above should be sent to the Rights Department, Oxford University Press, at the
address above.
sit
You must not circulate this work in any other form
and you must impose this same condition on any acquirer.
er
ISBN-13: 978-0-19-948868-1
iv
ISBN-10: 0-19-948868-1
Un
Typeset in Times
by P.N. Computers, New Delhi
Printed in India by Magic International (P) Ltd., Greater Noida
d
Oxford University Press disclaims any responsibility for the material contained therein.
O
Digital electronic circuits are mainly based on digital design. Today, digital circuits form the workhorses
of the mobile phone, smart TV, digital camera, computer, GPS, and many other applications that demand
digital electronic circuitry. Ever since the invention of transistors in 1947, there has been a growing
dependency on digital electronic devices in our day-to-day life. The usage of system-based design tools
from the mid-1980s has revolutionized the electronic industry worldwide. The functionality of any
digital circuit can be written using a hardware description language (HDL) such as Verilog or VHDL
and it can be synthesized into hardware using FPGA or CMOS technology. Every digital device in
ss
future will be smart enough to automatically communicate with other devices and also do work without
re
human intervention. Moreover, any technological advancement in industry finds its way to engineering
curriculum. This book provides an exposition of the fundamental concepts for the design of digital
yP
circuits and furnishes suitable methods and procedures for a variety of digital design applications. The
enhanced usage of digital circuits in all disciplines of engineering has created an urge among students
sit
to have an in-depth knowledge about digital circuits and design.
er
A single textbook dealing with the basics of digital technology including the design aspects of digital
circuits is the need of the day. We present this fifth edition to fulfil the requirements of the students of
Un
various B.E./B.Tech. degree courses, including Electronics and Communication Engineering, Electrical and
Electronics Engineering, Information Technology, Computer Science and Engineering, and Electronics and
d
Instrumentation Engineering offered in all Indian universities. It will also serve as textbook for students
or
of B.Sc. and M.Sc. degree courses in Electronics, Information Technology, Computer Science, Applied
Physics and Computer Software, and MCA, AMIE, Grad. IETE, and Diploma courses, and as a reference
xf
book for competitive examinations. All the topics have been illustrated with clear diagrams. A variety of
examples is given to enable students to design digital circuits efficiently.
O
Key Features
• Provides simple and clear explanation of digital electronic concepts in a lucid language.
• Includes numerous examples—each solved step-by-step in chapters.
• Numerous review questions and additional problems are given at the end of each chapter to help
reader apply and practice the concepts learnt.
ss
Chapter 7 describes flip-flops and realization using flip-flops.
re
Chapter 8 discusses synchronous and asynchronous counters and the design of synchronous counters
in detail.
yP
Chapter 9 presents shift registers, shift counters, and ring counters and their design.
sit
Chapter 10 elaborates upon memory devices, which include ROM, RAM, PLA, PAL, and FPGA.
Chapters 11 and 12 are devoted to the design of synchronous and asynchronous sequential circuits,
er
respectively.
iv
Chapter 13 explains some of the most common types of digital to analog and analog to digital converters.
Un
Chapters 14 and 15 deal with clock generators and applications of digital circuits, respectively.
Chapter 16 describes hardware description language (HDL) for digital circuits.
d
Acknowledgements
xf
We sincerely thank the managements of SSN College of Engineering, Chennai and Mepco Schlenk
O
Engineering College, Sivakasi, for their constant encouragement and providing the necessary
facilities for completing this project. We express our deep gratitude to Prof. M. Salihu, Former Vice-
Chancellor, Madurai Kamaraj University, for writing Foreword to the first edition of this book. Many
of our colleagues have reviewed the additional material and we thank them for their useful comments,
which have improved the book considerably over the previous edition. Our thanks are due to Mr. R.
Gopalakrishnan, Mr. K. Rajan, and Mr. A. Chakkarapani for word processing the additional script.
We specially thank Oxford University Press for their initiation to bring out this revised edition in a
short span of time.
Dr Salivahanan is greatly thankful to his wife, Kalavathy and sons, Santhosh Kanna and Subadesh
Kanna. Dr Arivazhagan expresses his heartfelt thanks to his wife Rosilin Glory and children Sri Madhu
Mitha and Selva Yokesh.
We welcome suggestions for the improvement of the book.
S. Salivahanan
S. Arivazhagan
ss
1.2.5 Hexadecimal Numbers 5
re
1.2.6 Hexadecimal–Binary Conversion 6
1.2.7 Hexadecimal–Octal Conversion 7
yP
1.3 Floating Point Representation of Numbers 9
1.4 Arithmetic Operation 10
sit
1.4.1 Binary Arithmetic 10
1.5 l’s and 2’s Complements 13
er
Review Questions 36
Problems 36
ss
2.6.1 Minterm 54
2.6.2 Maxterm 56
re
2.6.3 Deriving Sum of Product (SOP) Expression from a Truth Table 59
yP
2.6.4 Deriving Product of Sum (POS) Expression from a Truth Table 59
2.7 Karnaugh Map 60
2.7.1 Five-variable K-map 68
sit
2.7.2 Six-variable K-map 72
er
2.8 Quine-McCluskey or Tabular Method of Minimization of Logic Functions 74
Review Questions 85
iv
Problems 86
Un
3. Logic Gates 90
3.1 Introduction 90
d
3.3.1 OR Gate 91
3.3.2 AND Gate 93
O
ss
4.3.5 Noise Immunity or Noise Margin 130
4.3.6 Operating Temperature 131
re
4.3.7 Power Supply Requirements 131
yP
4.3.8 Current and Voltage Parameters 131
4.4 Current–Sourcing and Current-Sinking Logic 131
4.5 Resistor–Transistor Logic (RTL) 131
sit
4.6 Resistor–Capacitor–Transistor Logic (RCTL) 133
4.7 Diode–Transistor Logic (DTL) 134
er
ss
5.4 Full-Adder 175
5.5 K-Map Simplification 177
re
5.6 Half-Subtractor 178
yP
5.7 Full-Subtractor 178
5.8 Parallel Binary Adder 180
5.8.1 IC 7483 — 4-bit Parallel Binary Adder 182
sit
5.8.2 4-bit Parallel Binary Subtractor 183
5.9 Controlled Inverter 183
er
ss
6.6 Liquid Crystal Displays 234
re
6.7 Encoders 235
6.7.1 Octal-to-Binary Encoder 236
yP
6.7.2 Decimal-to-BCD Encoder 237
6.7.3 Priority Encoder 238
sit
6.7.4 IC 74148 — 8-to-3 Priority Encoder 239
6.7.5 IC 74147—Decimal-to-BCD Priority Encoder 240
er
7. Flip-Flops 267
7.1 Introduction 267
7.2 Latches 268
7.2.1 Set–Reset (S-R) Latch 269
7.2.2 NOR-based S-R Latch 269
7.2.3 NAND-based S-R Latch 271
7.2.4 State Diagram and Characteristic Equation of S-R Latch 272
ss
7.9 Asynchronous Inputs in Flip-Flops 287
re
7.10 Master–Slave Flip-Flops 288
7.10.1 The Race-around Condition 288
yP
7.10.2 Master-Slave J-K Flip-Flop 289
7.11 Realisation of One Flip-Flop Using Other Flip-Flops 290
sit
7.11.1 Realisation of Delay Flip-Flop Using S-R Flip-Flop 291
7.11.2 Realisation of J-K Flip-Flop Using S-R Flip-Flop 292
er
Problems 303
8. Counters 307
8.1 Introduction 307
8.2 Asynchronous (Ripple or Serial) Counter 307
8.3 Ripple Counter with Decoded Outputs 309
8.4 Ripple Counters with Modulus < 2n 312
8.5 Counter ICs 313
8.5.1 IC 7493 — 4-bit Binary Ripple Counter 313
8.5.2 IC 7490 — Decade Counter 315
8.6 Asynchronous Down Counter 316
8.7 Up-Down Counter 317
8.8 Propagation Delay in Ripple Counter 319
8.9 Synchronous (Parallel) Counter 319
ss
8.16.2 Measurement of Period 351
re
8.16.3 Digital Clock 352
Review Questions 353
yP
Problems 354 sit
9. Registers 358
9.1 Introduction 358
er
ss
10.4 Read Only Memory (ROM) 401
re
10.4.1 Architecture of ROM 401
10.4.2 Types of ROM 403
yP
10.4.3 Programming Mechanisms 404
10.4.4 Organization of a Simple ROM 405
sit
10.4.5 ROM ICs 405
10.4.6 ROM Access Time 409
er
ss
11. Synchronous Sequential Circuits 473
re
11.1 Introduction 473
11.2 General Sequential Circuit Model 473
yP
11.3 Classification of Sequential Circuits 474
11.4 Design of Synchronous Sequential Circuits 476
sit
11.4.1 Design of Serial Binary Adder 477
11.4.2 State Reduction and Assignment 480
er
ss
13.4.2 R-2R Ladder Type D/A Converter 569
13.4.3 Voltage Mode R-2R Ladder 572
re
13.4.4 Inverted or Current-Mode R-2R Ladder D/A Converter 572
yP
13.5 Multiplying D/A Converters (MDACs) 574
13.6 Sampling Process 575
13.7 A/D Converters 577
sit
13.8 Specifications of A/D Converter 578
er
13.9 Classification of A/D Converters 581
13.9.1 Simultaneous Type (Flash Type) A/D Converter 582
iv
ss
15.4 Bar Graph Display System 627
15.5 Multiplexed Display System 627
re
15.5.1 4-Digit Multiplexed Display System 629
yP
15.5.2 Advantages of Multiplexed Display System 631
15.5.3 IC 74925 — 4-Digit Counter with Multiplexed
7-segment Display Decoder/Driver 631
sit
15.6 Dot Matrix Display System 632
15.7 Digital Voltmeter 632
er
ss
16.8.5 Variable Declaration 676
re
16.8.6 Levels of Abstraction 677
16.8.7 Verilog Operator Types 677
yP
16.9 Verilog HDL Programs for Combinational Logic Circuits 678
16.9.1 Verilog HDL Programs for Logic Gates 678
sit
16.9.2 Adders and Subtractors 680
16.9.3 Multiplexer and Demultiplexer 681
er
Appendices 694
Index 711
About the Authors 717
Chapter
Arithmetic Circuits
5.1 Introduction
ss
Digital computers and calculators consist of arithmetic and logic circuits, which contain logic gates
re
and flip-flops that add, subtract, multiply and divide binary numbers. The basic building blocks of
the arithmetic unit in a digital computer are adders. These circuits perform operations at speeds less
yP
than 1ms.
A digital system consists of two types of circuits, namely
sit
(i) Combinational logic circuit,
(ii) Sequential logic circuit.
er
In a combinational circuit, the output at any time depends only on the input values at that time.
iv
In a sequential circuit, the output at any time depends on the present input values as well as the past
output values. The basic building blocks of an arithmetic unit such as half-adder and full-adder are
Un
combinational circuits.
Any combinational circuit can be designed by following the design procedure given below:
1. From the word description of the problem, identify the inputs and outputs and draw a block
xf
diagram.
O
2. Draw a truth table such that it completely describes the operation of the circuit for different
combinations of inputs.
3. Write down the switching expression(s) for the output(s).
4. Simplify the switching expression using either algebraic or K-map method.
5. Implement the simplified expression using logic gates.
5.3 Half-adder
The simplest combinational circuit which performs the arithmetic addition of two binary digits is called
a half-adder. As shown in Fig. 5.1(a), the half-adder has two inputs and two outputs. The two inputs
are the two 1-bit numbers A and B, and the two outputs are the sum (S ) of A and B and the carry bit
denoted by C. From the truth table of the half-adder shown in Table 5.1, one can understand that
the Sum output is 1 when either of the inputs (A or B ) is 1, and the Carry output is 1 when both the
inputs (A and B ) are 1.
Inputs Outputs
Augend Addend Sum Carry
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
ss
B Carry (C)
re
(a) Logic symbol (b) Logic diagram
A
yP
A AB Sum
B
sit
S = AB + AB
er
Carry, C = AB
iv
From Table 5.1, the logic expression for the Sum output can be written as a Sum of Product
or
expression by summing up the input combinations for which the sum is equal to 1.
xf
In the truth table, the sum output is 1 when AB = 01 and AB = 10. Therefore, the expression for
sum is
O
__ __
S = AB + AB
Now, this expression can be simplified as
S=A≈B
Similarly, the logic expression for Carry output can be expressed as a Sum of Product expression
by summing up the input combinations for which the carry is equal to 1. In the truth table, the carry
is 1 when AB = 11. Therefore,
C = AB
This expression for C cannot be simplified. The sum output corresponds to a logic Ex-OR
function while the carry output corresponds to an AND function. So, the half-adder circuit can be
implemented using Ex-OR and AND gates as shown in Fig. 5.1(b). Fig. 5.1(c) gives the realisation of
the half-adder using minimum number of NAND gates. The implementation of the half-adder circuit
using basic gates AND, OR and NOT is shown in Fig. 5.2.
A B
AB
S = AB + AB
AB
C = AB
5.4 Full-adder
A half-adder has only two inputs and there is no provision to add a carry coming from the lower order
bits when multibit addition is performed. For this purpose, a full-adder is designed. A full-adder is a
ss
combinational circuit that performs the arithmetic sum of three input bits and produces a sum output
re
and a carry.
yP
Inputs Outputs
Cin
sit S
A Full-adder
B Cout
er
Inputs Outputs
Cin Sum
A2 2
HA2
d
or
A A1 1 B2 C2
xf
HA1 Cout
O
B B1 C1
A B Cin
BCin
ACin Carry
Sum
S=A B Cin
(c) Logic diagram
The logic symbol of the full adder is shown in Fig.5.3(a). It consists of three inputs and two
outputs. The two input variables denoted by A (Augend bit) and B (Addend bit) represent the two
significant bits to be added. The third input, Cin, represents the carry from the previous lower
significant position. The outputs are designated by the symbols S (for sum) and Cout (for carry). The
truth table for the full-adder circuit is shown in Table 5.2. The binary variable S gives the value of
the LSB of the sum, and the binary variable Cout, gives the output carry. A full-adder can be formed
using two half-adder circuits and an OR gate as shown in Fig. 5.3 (b).
Inputs Outputs
Augend bit Addend bit Carry input Sum Carry output
A B Cin S Cout
0 0 0 0 0
ss
0 0 1 1 0
0 1 0 1 0
re
0 1 1 0 1
yP
1 0 0 1 0
1 0 1 0 1
sit
1 1 0 0 1
1 1 1 1 1
er
iv
As shown in Table 5.2, there are eight possible input combinations for the three inputs and for
each case the S and Cout values are listed. From the truth table, the logic expression for S can be
Un
written by summing up the input combinations for which the sum output is 1 as:
__ __ __ __ __ __
S = A BCin + ABCin + AB Cin + ABCin
d
or
__ ______
= A(B ≈ Cin) + A(B ≈ Cin)
O
Let B ≈ Cin = X
__ __
Now, S = AX + AX = A ≈ X
Replacing X by B ≈ Cin in the above expression, we have
S = A ≈ B ≈ Cin
Similarly, the logic expression for Cout can be written by summing up the input combinations
for which Cout is 1, as given below:
__ __ __
Cout = ABCin + ABCin + ABCin + ABCin
__ __ __
= BCin(A + A) + ABCin + ABCin
__ __
= BCin + ABCin + ABCin
AB
AB
Cin 00 01 11 10
ss
Cin 00 01 11 10
0 0 0 1 0
re
0 0 1 0 1
yP
1 0 1 1 1
1 1 0 1 0
From the K-maps, the simplified expressions for S and Cout can be written as follows:
iv
____ __ __ ____
S = ABCin + ABCin + ABCin + ABCin
Un
Fig. 5.5.
or
A B Cin
xf
A B Cin
O
A B Cin
A B Cin
S=A B C
A B Cin
AB
CinA
5.6 Half-subtractor
The half-subtractor is a combinational circuit which is used to perform subtraction of two bits. It has
two inputs, X (minuend) and Y (subtrahend) and two outputs D (difference) and Bout (borrow out).
The logic symbol for a half-subtractor is shown in Fig. 5.6(a). The truth table for half-subtractor is
shown in Table 5.3. From the truth table, it is clear that the difference output is 0 if X = Y and 1 if
X π Y; the borrow output Bout is 1 whenever X < Y. If X is less than Y, then subtraction is done by
borrowing 1 from the next higher order bit.
X (X Y) D
X D
Y
HS
Y Bout (X Y) Bout
ss
re
Fig. 5.6 Half-subtractor
yP
Table 5.3 Truth table of half-subtractor
Inputs Outputs
sit
Minuend Subtrahend Difference Borrow
er
X Y D Bout
0 0 0 0
iv
0 1 1 1
Un
1 0 1 0
1 1 0 0
d
or
From Table 5.3, as discussed earlier, the Boolean expressions for difference (D) and Borrow out
(Bout) can be written as follows:
xf
__ __
D = XY + XY = X ≈ Y
__
O
Bout = XY
From the above equations, the half-subtractor can be implemented using an Ex-OR gate, a NOT
gate and an AND gate as shown in Fig. 5.6(b).
5.7 Full-subtractor
A full-subtractor is a combinational circuit that performs subtraction involving three bits, namely
minuend bit, subtrahend bit and the borrow from the previous stage. The logic symbol for
full-subtractor is shown in Fig. 5.7(a).
It has three inputs, X (minuend), Y (subtrahend) and Bin (borrow from previous stage), and
two outputs D (difference) and Bout (borrow out). The truth table for the full-subtractor is given in
Table 5.4. The full-subtractor can be implemented using two half-subtractors and an OR gate as
shown in Fig. 5.7(b).
X D
Y FS
Bin Bout
Bin X2 D2
HS2
X X1 D1 Y2 Bout 2
HS1
Y Y1 Bout 1 Bout
ss
Fig. 5.7 Full-subtractor
re
yP
Table 5.4 Truth table of full-subtractor
Inputs Outputs
sit
Minuend bit Subtrahend bit Borrow in Difference Borrow out
X Y Bin D
er
out
0 0 0 0 0
iv
0 0 1 1 1
Un
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
d
or
1 0 1 0 0
1 1 0 0 0
xf
1 1 1 1 1
O
From Table 5.4, the Sum of Product expression for the difference (D ) output can be written as:
__ __ __ ___ ____
D = X YBin + XYBin + XYBin + XYBin
Simplifying the above expression,
__ __ __ __ ___
D = (X Y + XY)Bin + (XY + XY)Bin
_____ ___
= (X ≈ Y)Bin + (X ≈ Y)Bin
D = X ≈ Y ≈ Bin
Similarly, the sum of product expression for Bout can be written from the truth table as:
__ __ __ ___ __
Bout = X YBin + XYBin + XYBin + XYBin
The equation for Bout can be simplified using Karnaugh map as shown in Fig. 5.8.
XY
Bin 00 01 11 10
0 0 1 0 0
1 1 1 1 0
ss
Y D
Bin
re
yP
sit
er
iv
Bout
Un
d
or
xf
One can notice that the equation for D is the same as the sum output for a full-adder, and
the borrow output Bout resembles the carry output for full-adder except that one of the inputs is
complemented. From these similarities, it is possible to convert a full-adder into a full-subtractor by
merely complementing that input prior to its application to the input of gates which form the borrow
output.
The addition operation is illustrated in the following example: Let the 4-bit words to be added be
represented by A3 A2 A1 A0 = 111 and B3 B2 B1 B0 = 0011.
Significant place 4 3 2 1
Input carry 1 1 1 0
Augend word A: 1 1 1 1
Addend word B: 0 0 1 1
1 0 0 1 0 Sum
Output carry
A3 B3 A2 B2 A1 B1 A0 B0
ss
re
Cin
C4 C3 C3 C2 C2 C1 C1 C0
0
yP
Cout
23 22 21 20
sit
S3 S2 S1 S0
er
In a 4-bit parallel binary adder circuit, the input to each full-adder will be Ai, Bi and Ci, and the
Un
outputs will be Si and Ci + 1, where ‘i ’ varies from 0 to 3. Also, the carry output of the lower order
stage is connected to the carry input of the next higher order stage. Hence, this type of adder is called
ripple-carry adder.
d
In the least significant stage, A0, B0 and C0 (which is 0) are added resulting in Sum S0 and
or
Carry C1. This carry C1 becomes the carry input to the second stage. Similarly, in the second stage,
A1, B1 and C1 are added resulting in S1 and C2; in the third stage, A2, B2 and C2 are added resulting
xf
in S2 and C3; in the fourth stage, A3, B3 and C3 are added resulting in S3 and C4 which is the output
O
carry. Thus, the circuit results in a sum (S3 S2 S1 S0) and a carry output (Cout).
Though the parallel binary adder is said to generate its output immediately after the inputs are
applied, its speed of operation is limited by the carry propagation delay through all stages. In each
full-adder, the carry input has to be generated from the previous full-adder which has an inherent
propagation delay. The propagation delay (tp) of a full-adder is the time difference between the
instant at which the inputs (Ai, Bi and Ci) are applied and the instant at which its outputs (Si and Ci + 1)
are generated. Therefore, in a 4-bit binary adder, the output in LSB stage is generated only after
tp seconds. Similarly, the output in the second stage will be generated only after tp seconds from the
time the outputs of the first stage are generated, i.e., after 2tp seconds from the time the inputs are
applied; the third stage will generate outputs only after 3tp seconds and the fourth stage will generate
outputs only after 4tp seconds. Thus, in a 4-bit binary adder, where each full adder has a propagation
delay of 50ns, the output in the fourth stage will be generated only after 4tp = 4 × 50 ns = 200 ns.
The magnitude of such delay is prohibitive for high-speed computers. However, there are several
methods to reduce this delay.
One of the methods of speeding up this process is look-ahead carry addition which eliminates
the ripple-carry delay. This method is based on the carry generate and the carry propagate functions
of the full-adder.
This scheme utilises logic gates to look at the lower order bits of the augend and addend if a
higher-order carry is to be generated. This requires extra circuitry for getting high speed adders. This
is not a significant consideration with the present day availability of integrated circuits.
ss
Y3 Y2 Y1 Y0 X3 X2 X1 X
0
re
yP
Cin
sit 7483
er
Cout S3 S2 S1 S0
iv
Y7 Y6 Y5 Y X7 X6 X5 X4 Y3 Y2 Y1 Y0 X3 X2 X1 X0
4
d
or
xf
Cout S7 S6 S5 S4 S3 S2 S1 S0
Fig. 5.11
Two or more parallel adder blocks can be connected in cascade to perform the addition operation
on larger binary numbers. Fig. 5.11(b) shows the cascading connection of two 7483 adders. The four
least significant bits of the numbers are added in the first adder. The carry output of this adder is
given as the carry input to the second adder, which adds four most significant bits of the numbers.
The output carry of the second adder is the final carry output.
X3 Y3 X2 Y2 X1 Y1 X0 Y0
B3 B2 B1
FS FS FS FS Bin
B0
ss
B3 B2 B1
re
yP
Bout D3 D2 D1 D0
sit
Fig. 5.12 4-bit parallel binary subtractor
er
The subtraction of two binary numbers may be accomplished by taking the 2’s complement of the
Un
subtrahend and adding to the minuend. By this procedure, the subtraction becomes an addition
operation. The 2’s complement of the subtrahend can be obtained by adding a 1 to the 1’s complement
of the subtrahend. From the Ex-OR gate truth table, we know that when one of the inputs is LOW
d
the output is the true value of the other input and when one of the inputs is HIGH the output is the
or
complement of the other input. Therefore, the complement of a binary digit can be obtained using
an Ex-OR gate as shown in Fig. 5.13.
xf
O
C
Y
X
In Fig. 5.13, X is the input, C is the control input and Y is the output. From the figure, it is clear
__
that if C = 0, then Y = X, i.e., input X is available at Y in uncomplemented form; if C = 1, then Y = X,
i.e., input X is available at Y in complemented form. Thus, if C = 1, the Ex-OR gate can function as
an inverter. Similarly, a group of Ex-OR gates can be used to invert a group of bits. Fig. 5.14 shows
the complementing process of a 4-bit binary number (Y3 Y2 Y1 Y0) using a controlled inverter.
When the control input is low, the output will be the__input, i.e. Y Y Y Y . When the control input
__ __ __ 3 2 1 0
is high, the output will be the complement of the input Y3 Y2 Y1 Y0.
Y3 Y2 Y1 Y0
Control
input (C)
ss
addition and subtraction. It has two 4-bit inputs X3 X2 X1 X0 and Y3 Y2 Y1 Y0. The ADD/SUB control
line, connected with Cin of the least significant bit of the full-adder, is used to perform the operations
re
of addition and subtraction. The Ex-OR gates are used as controlled inverters.
yP
X3 Y3 X2 Y2 X1 Y1 X0 Y0
sit
ADD/SUB
er
iv
Un
d
or
FA FA FA FA Cin
xf
C3 S3 C2 S2 C1 S1 C0 S0
O
Cout S3 S2 S1 S0
_____
To perform subtraction, the ADD/SUB __control input is kept high. Now, the controlled inverter
__ __ __
produces the 1’s complement of the addend (Y3 Y2 Y1 Y0). Since 1 is given to Cin of the least significant
bit of the adder, it is added to the complemented addend producing 2’s complement of the addend
before addition. Now, the data X3 X2 X1 X0 will be added to the 2’s complement of Y3 Y2 Y1 Y0 to
produce the Sum, i.e., the difference between the addend and the augend, and Cout, i.e., the borrow
output of 4-bit subtractor. Also, it has S3 S2 S1 S0 as sum output and Cout as carry output. When
B3 B2 B1 B0
ADD/SUB
A3 A2 A1 A0
1 2 45 9 10 12 13
7486
ss
3 6 8 11
1 3 8 10 16 4 7 11
re
yP
Cout Cin
14 IC 7483 sit 13
15 2 6 9
er
iv
S3 S2 S1 S0
Un
In the parallel binary adder discussed in section 5.7, the carry generated by the i th adder is fed as carry
O
input to the (i + 1)th adder. In this adder, the output (Cout S3 S2 S1 S0) is available only after the carry
is propagated through each of the adders i.e., from LSB to MSB adder through intermediate adders.
Hence, the addition process can be considered to be complete only after the above carry propagation
delay through adders, which is proportional to number of stages in it. One of the methods of making
this process faster is look ahead carry addition, which eliminates the ripple carry delay. This method
is based on the carry generating and the carry propagating functions of the full adder.
Table 5.5 Truth table of Full adder, emphasizing the conditions at which carry generation occurs
In rows 0 and 1, the carry output (Cout) is always ‘zero’ and independent of carry input
ss
(Cin), while in rows 6 and 7, the Cout is always ‘one’ and independent of Cin. These are known as
re
carry generate combinations. In rows 2, 3, 4 and 5 the carry output is equal to the carry input i.e.
Cout = 1 only when Cin = 1. These are carry propagate combinations. Let Gi represent the unity carry
yP
(i.e. Cout = 1) generate condition and Pi represent the carry propagate condition of the ith stage of
a parallel adder.
sit
From the Truth Table 5.5 Gi is obtained by summing up the combinations corresponding to 6th
and 7th rows as follows:
___
er
Gi = Ai Bi Cin + A Bi Cini
___
= Ai Bi (Cin + Cin)
iv
Gi = Ai Bi
Un
Similarly the carry propagation condition (Pi) occurs when either Ai = 1 and Bi = 0 or vice versa
as shown in Truth Table 5.5. Now Pi is given by
__
d
__
Pi = Ai Bi + Ai Bi = Ai ≈ Bi
or
Consider the addition of two 4-bit binary numbers A (A3 A2 A1 A0) and B (B3 B2 B1 B0). The unity
carry output of the ith stage can be expressed in terms of Gi, Pi and Ci – 1 which is the unity carry
xf
Ci (Cout) = Gi + Pi Ci – 1
where Ci – 1 for LSB stage is Cin which is assumed to be zero. In a 4-bit binary adder, four stages of
addition are required to add A0 B0, A1 B1, A2 B2 and A3 B3. Therefore, for i = 0, 1, 2 and 3, the Ci’s
are given by
C0 = G0 + P1 Cin ............................................. where G0 = A0 B0; P0 = A0 ≈ B0 and Cin = 0
C1 = G1 + P1 C0
= G1 + P1(G0 + P0 Cin)
= G1 + P1 G0 + P1 P0 Cin .................................. where G1 = A1 B1 and P1 = A1 ≈ B1
C2 = G2 + P2 C1
= G2 + P2 (G1 + P1 G0 + P1 P0 Cin)
= G2 + P2 G1 + P2 P1 G0 + P1 P0 Cin ...where G2 = A2 B2 and P2 = A2 ≈ B2
C3 = G3 + P3 C2
= G3 + P3 (G2 + P2 G1 + P2 P1 P0 Cin)
= G3 + P3 G2 + P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 Cin ...... where G3 = A3 B3 and
P3 = A3 ≈ B3
The sum of A and B is given by
S = C3 S3 S2 S1 S0
where Si = Ai ≈ Bi ≈ Ci – 1 for i = 0, 1, 2, 3
i.e., S0 = A0 ≈ B0 ≈ Cin
S1 = A1 ≈ B1 ≈ C0
S2 = A2 ≈ B2 ≈ C1
S3 = A3 ≈ B3 ≈ C2
Using the above equation, a 4-bit carry look ahead adder can be realized as shown in Fig. 5.16.
From the diagram, one can easily understand that the addition of two 4 bit numbers can be done by a
ss
carry look ahead adder in a four gate propagation time. Also, it is important to note that the addition
of n-bit binary numbers takes the same four gate propagation delay.
re
yP
A3 B3 A2 B2 A1 B1 A0 B0 Cin
sit
er
iv
Un
P3 G3 P2 G2 P1 G1 P0 G0
d
P3 P2 P1 P0
C3 S3 S2 S1 S0
A3 A2 A1 A0 Sum
A Reg A S S3 S2 S1 S0
Full- Reg
B Reg B3 B2 B1 B0 B adder
Cin Cout
Cout
ss
D
CLK CLR
re
Initial
yP
clear pulse
sit
Fig. 5.17 4-bit serial adder
er
The diagram of a 4-bit serial adder is shown in Fig. 5.17. The two shift registers A and B are
iv
used to store the numbers to be added serially. A single full-adder is used to add one pair of bits at
a time along with the carry. The D flip-flop, i.e. carry flip-flop, is used to store the carry output of
Un
the full-adder so that it can be added to the next significant position of the numbers in the registers.
The contents of the shift registers shift from left to right and their outputs starting from A0 and B0
are fed into a single full-adder along with the output of the carry flip-flop upon application of each
d
clock pulse.
or
The sum output of the full-adder is fed to the Most Significant Bit (S3) of the sum register. For
xf
each succeeding clock pulse, the contents of both the shift registers are shifted once to the right, and
new sum bit and new carry bit are transferred to sum register and carry flip-flop respectively. This
O
Third clock pulse The values of A0 and B0 are now 1 and 0 respectively, and Cin is 1. These
values produce S = 0 and Cout = 1 at the full-adder outputs. On the occurrence of the third clock pulse,
the A, B and sum registers shift right, sum = 0 goes to S3, and Cout = 1 goes to the carry flip-flop.
Fourth clock pulse Both A0 and B0 are now zero, and Cin = 1. Therefore, the full-adder produces
S = 1 and Cin = 0. The fourth clock pulse transfers S = 1 to S3 and initiates all the other transfers.
At the end of this fourth clock pulse, the sum value (1001) will be available in the sum register, and
Cout is 0.
ss
and initially setting the carry flip-flop to 1 instead of clearing it. The remaining circuitry is the same
re
as serial adder.
The circuit for 4-bit serial subtractor using full-adder is shown in Fig. 5.18.
yP
A3 A2 A1 A0
sit
A Reg A S D3 D2 D1 D0
B Reg B3 B2 B1 B0 B FA
er
Difference
Cin Cout Reg.
iv
Initial
Un
preset
pulse
d
Q PR D
or
CLK CLK
xf
O
A Reg A3 A2 A1 A0 A S S3 S2 S1 S0
B Reg B3 B2 B1 B0 FA
B Sum/Difference
Cin Cout Reg.
ADD/SUB
Initial
PR pulse
Q PR D
CLK CLK
CLR
Initial
CLR
pulse
ss
re
Table 5.5 Serial adder Vs parallel adder
yP
Serial adder Parallel adder
Serial adder is less fast Parallel adder is generally faster
sit
It requires fewer components It requires more components compared to serial
adder
er
Addition is performed bit by bit All the bits are added simultaneously
iv
also in BCD. A BCD adder must include the correction logic in its internal construction. A block
or
diagram for the BCD adder is shown in Fig. 5.20. This adder has two 4-bit BCD inputs X3 X2 X1 X0
Y3 Y2 Y1 Y0 and a carry input (Cin). It also has a 4-bit sum output (S3 S2 S1 S0 ) and a carry output
xf
Cin
X3
Augend X
2
digit Cout
X1
X0
Decimal
adder 3
Y3 2 Sum
Y2 1
digit
Addend
digit Y1 0
Y0
ss
1 0 0 0 1 0 0 0 1
re
2 0 0 1 0 0 0 1 0
3 0 0 1 1 0 0 1 1 No
yP
4 0 1 0 0 0 1 0 0 correction
5 0 1 0 1 0 1 0 1 required
6 0 1 1 0 0 1 1 0
sit
7 0 1 1 1 0 1 1 1
8 1 0 0 0 1 0 0 0
er
9 1 0 0 1 1 0 0 1
iv
10 1 0 1 0 1 0 0 0 0
Un
11 1 0 1 1 1 0 0 0 1
12 1 1 0 0 1 0 0 1 0
13 1 1 0 1 1 0 0 1 1
d
14 1 1 1 0 1 0 1 0 0 Correction
or
15 1 1 1 1 1 0 1 0 1 required
16 1 0 0 0 0 1 0 1 1 0
xf
17 1 0 0 0 1 1 0 1 1 1
18 1 0 0 1 0 1 1 0 0 0
O
19 1 0 0 1 1 1 1 0 0 1
S3S2
S1S0 00 01 11 10
00 12
01 13
11 15 11
10 14 10
Cn = S3S2 + S3S1 + C3
From the Table 5.6, it is clear that correction is required. When the sum output (S3 S2 S1 S0) is
greater than 9, i.e., when C3 = 1 (OR) S3 = 1 (AND) [S2 = 1 (OR) S1 = 1], add 0110 to get the BCD
result. Note that when C3 = 1, the result is 16 and above; when S3 = 1 (AND) S2 = 1, the result is 12
and above; when S3 = 1 (AND) S1 = 1, the result is 10 and above; when S3 = 1 (AND) [S2 = 1 (OR)
S1 = 1], the result is 14 and above. Therefore, the condition for correction can be written as an
expression as follows:
Cn = C3 + S3(S2 + S1)
Alternatively, the above condition for correction can also be obtained by K-map method as
shown in Fig. 5.21.
As discussed above, a BCD adder must be capable of adding two 4-bit BCD numbers, and the
result has to be corrected to BCD, if the above condition is satisfied, by adding 0110. The circuit
diagram for BCD adder using full-adders is shown in Fig. 5.22.
X3 Y3 X2 Y2 X1 Y1 X0 Y0
ss
re
yP
C3 C2 C1
(I stage) FA FA FA FA Cin
sit
C3 S3 C2 S2 C1 S1 C0 S0
er
iv
Un
2
d
1
or
3
xf
O
HA FA HA (II stage)
Cout 3 2 1 0
The operation of BCD adder shown in Fig. 5.22 is explained as follows: the first stage of
full-adders adds two 4-bit BCD numbers, and its sum (S3 S2 S1 S0) and carry (C3) are checked to
ascertain whether the result exceeds 9 by AND-OR gate combinations. If the output of OR gate (3)
is equal to 1, then correction is required and this is accomplished by adding 0110 in the second stage
of adders as shown in Fig. 5.22. Now, the BCD result is S3 S2 S1 S0 with carry output (Cout).
The BCD adder can also be implemented using two 7483 ICs as shown in Fig. 5.23. Here,
X3 X2 X1 X0 and Y3 Y2 Y1 Y0 are the BCD inputs. The outputs of adder 1 (S3 S2 S1 S0 and Cout) are checked
to ascertain whether the output is greater than 9 by AND-OR gate combinations. If correction is
required, then a 0110 is added with the output of adder 1. Now, the adder 2 output forms the BCD
result (S3 S2 S1 S0) with carry output (Cout).
X3 X2 X1 X0 Y3 Y2 Y1 Y0
ss
Cout 7483 (Adder 1) Cin
re
S3 S2 S1 S0
yP
sit
2
er
iv
3 1
Un
d
or
X3 Y3 X2 Y2 X1 Y1 X0 Y0
xf
3 2 1 0
Cout 3 2 1 0
1010 Æ Multiplicand
× 1011 Æ Multiplier
1010 Æ Partial product 1
1010 Æ Partial product 2
0000 Æ Partial product 3
1010 Æ Partial product 4
1101110
From the above multiplication process, one can easily understand that if the multiplier bit is 1,
ss
then the multiplicand is simply copied as a partial product; if the multiplier bit is 0, then the partial
product is 0. Whenever a partial product is obtained, it is shifted one bit to the left of the previous
re
partial product. This process is continued until all the multiplier bits are checked, and then the partial
products are added. This multiplication process, i.e. multiplication by partial product addition and
yP
shifting, can be implemented using the block diagram shown in Fig. 5.24.
In the diagram shown in Fig. 5.24, the 4-bit multiplier is stored in register Y(Y3 Y2 Y1 Y0); the
sit
4-bit multiplicand is stored in register M(M3 M2 M1 M0), and the X register (X4 X3 X2 X1 X0) is initially
cleared to 00000. Here, to perform multiplication, the least significant bit of the multiplier bit (Y0)
er
is checked whether it is 0 or 1. If Y0 = 1, the number in the multiplicand register (M) is added with
iv
the least significant 4-bits of X register (X3 X2 X1 X0; X4 is to store carry in addition process) and the
combined X and Y register is shifted to the right by 1 bit. If Y0 = 0, the combined X and Y register
Un
is shifted to the right by 1 bit without performing any addition. This process has to be repeated four
times to perform 4-bit multiplication. Now, the multiplication result (R7 R6 R5 R4 R3 R2 R1 R0) will be
available in X and Y registers (X3 X2 X1 X0 Y3 Y2 Y1 Y0).
d
or
4-bit parallel
adder
Multiplicand M3 M2 M1 M0
reg.
Y0
X3 X2 X1 X0
Y1
X3 X2 X1 X0
A3 B3 A2 B2 A1 B1 A0 B0
Cout (C3) 7483 - 1 Cin
ss
S3 S2 S1 S0
re
Y2
X3 X2 X1 X0
yP
sit
er
A7 B7 A6 B6 A5 B5 A4 B4
Cout (C7) 7483 - 2 Cin
iv
S7 S6 S5 S4
Un
Y3
X3 X2 X1 X0
d
or
xf
O
P7 P6 P5 P4 P3 P2 P1 P0
It requires three 4-bit parallel binary adders and 16 numbers of 2-input AND gates. Here, each
group of 4 AND gates is used to obtain partial products while 4-bit parallel adders are used to add
the partial products. Since the generation of partial products and their additions are performed
in parallel in the group of AND gates and 4-bit adders respectively, the multiplication result
(P7 P6 P5 P4 P3 P2 P1 P0) will be available at the output immediately after the propagation delay in
the multiplier circuit.
The operation of the parallel multiplier can be understood in a better manner from the symbolic
form of binary multiplication process shown in Fig. 5.26.
X3 X2 X1 X0 Multiplicand
Y3 Y2 Y1 Y0 Multiplier
X3Y0 X2Y0 X1Y0 X0Y0 Partial product 1 Added in
X3Y1 X2Y1 X1Y1 X0Y1 Partial product 2 IC7483-1
C2 C1 C0
C3 S3 S2 S1 S0 Partial sum 1 Added in
X3Y2 X2Y2 X1Y2 X0Y2 Partial product 3 IC7483-2
C6 C5 C4
ss
C7 S7 S6 S5 S4 Partial sum 2 Added in
re
X3Y3 X2Y3 X1Y3 X0Y3 Partial product 4 IC7483-3
C10 C9 C8
yP
C11 S11 S10 S9 S8 sit Partial sum 3
er
P7 P6 P5 P4 P3 P2 P1 P0 Final result
iv
Un
Division is the most difficult and time-consuming operation for a general purpose computer. A block
diagram of a binary divider unit using restoring technique for division is shown in Fig. 5.27.
xf
4-bit
adder/subtractor
Divisor D3 D2 D1 D0
reg.
Here, the dividend is stored in the dividend register Y(Y3 Y2 Y1 Y0), the divisor is stored in the
divisor register D(D3 D2 D1 D0) and initially the X register (X3 X2 X1 X0) is cleared.
The procedure for division operation using the circuit shown in Fig. 5.27 is explained as
follows:
1. Shift the combined content of X and Y registers to the left by one bit.
2. Perform trial subtraction by subtracting the content of D register from the content of X
register.
3. If there is no borrow in the previous subtraction, put 1 in the LSB of Y register, else restore
the original content of X register by adding the contents of D register with the contents of
X register.
4. Repeat steps 1 to 3 for n times, where n is the number of bits in the dividend. For a 4-bit
division, n = 4.
Now, the quotient will be available in the Y register and the remainder will be in the X register.
The above procedure can be understood in a better manner with the following example.
Consider the division of 1011(11) by 0011(3). The dividend and divisor are stored in Y and D
registers respectively, and the X register is initially cleared to 0. Therefore,
ss
Y3 Y2 Y1 Y0 = 1011
re
X3 X2 X1 X0 = 0000
yP
D3 D2 D1 D0 = 0011
Here, both divisor and dividend are 4-bit numbers. Therefore, steps 1–3 have to be repeated
sit
four times.
I cycle
er
Step 1 Shift the combined contents of X and Y to the left by one bit. Therefore,
iv
XY = 0001 0110
Un
XY = 0001 0110
xf
II cycle
O
Step 1 Shift the combined contents of X and Y to the left by one bit. Therefore,
XY = 0010 1100
Step 2 Subtract dividend 0011 from X register resulting in
X = 1111 with borrow = 1
Step 3 Since borrow = 1, restore the original content in X register by adding dividend 0011 with
the content of X register 1111. Now,
XY = 0010 1100
III cycle
Step 1 Shift the combined contents of X and Y to the left by one bit. Therefore,
XY = 0101 1000
Step 2 Subtract dividend 0011 from register X which results in
X = 0010 with borrow = 0
ss
Review QUESTIONS
REVIEW Questions
re
1. What is the need of arithmetic circuits?
2. What is a half-adder? Write its truth table.
yP
3. Design a half-adder using only NOR gates.
4. Describe the working of a half-adder.
5. What is a full-adder?
sit
6. Draw the full-adder circuit using NAND gates only. Explain the functioning of the circuit and show that
the output is that of a full-adder.
er
7. Design a full-adder circuit using only NOR gates. What relation has it to the half-adder circuit?
8. Design a full-subtractor using only NAND gates.
iv
15. Design the logic diagram of a circuit for addition/subtraction. Use a control variable w and a circuit that
functions as a full-adder when w = 0, as a full-subtractor when w = 1.
xf
16. Show how a full-adder can be converted to a full-subtractor with the addition of an inverter circuit.
O