N
N
N
Unit III
I)
Logic gates:
Apart from the arithmetic operations, there are logical operations involved in the processing.
The logical operations involve some elements. These elements are NOT, OR and AND. NOT
is the opposite of negation or inversion. Negation of True is False. OR is another logical
element which represents either or. AND is another logical element which represents two
together.
So following are the basic logical elements: AND , OR, NOT
In 1854 George Boole invented symbolic logic. This is known today as Boolean algebra. Each
variable in Boolean algebra has either of two values. - True or False. The purpose of this twostate algebra was to solve logic problems. As we saw before the computers think in terms of
binary (high or low) it is appropriate to say logic is the core of computers. To implement this
logic circuits are used. In the logic circuits Gates are used. A Gate is a small circuit with one
or more input signals but only one output signal. Gates are digital circuits (two-state).
There are several gates such as OR, AND, Inverter, etc. Each has symbol to represent them.
Let us see them one by one.
AND Gates
The AND Gate has two or more input signals but only one output signal. All the inputs must
be high to get a high output. If we have two inputs to this AND gate and both the inputs are
high then the output will be high otherwise the output will be low. All the possible inputs and
outputs are shown in the following table.
Truth Table
A
0
0
1
1
B
0
1
0
1
Y
0
A
0
0
B
1
Y=A.B
Y
AND Gate symbol
AND function
OR Gates
The OR gates has two or more input signals but only one output signal. If any input signal is
high, the output signal is high. If we have two inputs to this OR gate and any of the two inputs
is high then the output will be high. This can be shown in a table below with all the possible
inputs and corresponding outputs.
Truth Table
A
0
0
1
OR function
B
0
1
0
1
Y
0
1
1
1
Y=A+B A
B
b
b
OR Gate symbol
NOT or Inverter:
A Low input produces a high output, and a high input produces low output. In binary format if
the input is 0 the output will be 1 and if the input is 1 then the output will be 0. The table
shows the input and output possibilities.
Input
Output
0
1
0
Unit III Digital 1
Logic
Page 1
Y=A
NOT Gate symbol
NOT function
NAND Gate
NAND Gate is a combination of an AND gate with an inverter. An AND Gate followed by an
inverter.
A
Y
Whatever the output of the AND gate, it will be inverted by the inverter. This is the formation
of NAND gate. The sign and the table is shown below. The NAND operation is called Universal
Operation or gate.
Y = AB
A
0
0
1
1
NAND Sign
B
0
1
0
1
Y
1
1
1
0
NOR Gate
NOR Gate is a combination of an OR gate with an inverter. An NOR Gate followed by an
inverter.
The NOR operation is also a Universal Operation or Gate.
B
Y = A+B
A
0
0
1
1
NOR Sign
B
0
1
0
1
Y
1
0
0
0
Exclusive OR Gate
An OR Gate recognizes with one or more 1s as inputs and gives output as 1. The Exclusive-OR
is different; it recognizes only that have odd number of 1s. The following table shows different
inputs and outputs.
Y= A XOR B
Y= A
B
Ex-OR sign
A
0
0
1
1
B
0
1
0
1
Y
0
1
1
0
Page 2
Y=A B+A B
A
Y
B
Y= A ENOR B
Y= A
B
Ex-NOR sign
A
0
0
1
1
B
0
1
0
1
B
Y
1
0
0
1
CMOS
TTL
ECL
They are CMOS (Complementary Metal Oxide Semiconductor), TTL (Transistor Transistor
Logic) and ECL (Emitter Coupled Logic).
II)
Flip flops:
The flip flop is a bistable device. It exists in one of two states and, in the absence of input,
remains in that state. Thus, the flip flop can function as a 1 bit memory.
The flip flop has two outputs, which are always the complementary of each other, these are
generally labelled Q and Q
Unit III Digital Logic
Page 3
characteristic Table
Q
Qn+1
Qn
--
So, at this point in time, the inputs to the upper NOR gate become R=0 , Q = 0. After another
gate delay of t, the output Q becomes 1. This is again a stable state. The inputs to the lower gate
are now S = 1, Q =1, which maintain the output Q=0. As long as S =1 and R =0, the outputs will
remain Q =1, Q = 0. Furthermore, if S returns to 0, the outputs will remain unchanged.
Observe that the inputs S = 1, R =1 are not allowed, because these would produce an inconsistent
output ( both Q and Q equal 0).
Clocked S-R Flip-Flop:
The output of the S-R latch changes, after a brief time delay, in response to a change in the input.
This is referred to as asynchronous operation. More typically, events in the digital computer are
synchronized to a clock pulse, so that changes occur only when a clock pulse occurs. This type of
device is referred to as a clocked S-R flip-flop. Note that the R and S inputs are passed to the NOR
gates only during the clock pulse.
R
Q
Clock
Q
S
D Flip Flop:
One problem with S-R flip flop is that the condition R = 1, S = 1 must be avoided. One way to do
this is to allow just a single input. The D flip flop accomplishes this. By using an inverter, the two
AND gates are guaranteed to be the opposite of each other.
Unit III Digital Logic
Page 4
The D flip flop is sometimes referred to as the data flip flop because it is, in effect, storage for
one bit of data. the output of the D flip flop is always equal to the most recent value applied to
the input. Hence, it remembers and produces the last input. It is also referred to as the delay flip
flop, because it delays a 0 or 1 applied to its input for a single clock pulse.
Q
D
0
1
Qn+1
0
1
clk
Q
D
J-K Flip-Flop:
Like the S-R flip flop, it has 2 inputs. However, in this case all possible combinations of input
values are valid. In its characteristic table, we can note that the first three combinations are the
same as for the S-R flip-flop. With no input, the output is stable. The J input alone performs a set
function, causing the output to be 1; the K input alone performs a reset function, causing the
output to be 0. When both J and K are 1, the function performed is referred to as the toggle
function: the output is reversed.
Characteristic Table:
K
Q
Clock
Q
J
iii)
Qn+1
Qn
Qn
Latches
A flip flop in its simplest form is called a latch. A latch stores a binary bit 1 or 0. The unclocked
simple flip-flops and D flip flops fall under the category of latches. An n-bit latch consists of nnumber single bit latches. It stores a binary word of n bits. The n-bits of the binary word are
transferred to the latch simultaneously in parallel. In a latch there is no facility to read its
contents. The latches are temporary storage devices. They are ideally suited for storing
information between processing units and I/O units or indicator units. The examples of latch ICs
are:
74100 8 bit bistable latches
74259 8 bit addressable latches
7477 4 bit bistable latches
iv)
Registers
A register is a digital circuit used within the CPU to store one or more bits of data. Two basic types
of registers are commonly used: Parallel registers and shift registers.
Parallel Registers:
A parallel register consists of a set of 1-bit memories that can be read or written simultaneously.
It is used to store data.
The 8 bit register of figure illustrates the operation of a parallel register using D flip flops. A
control signal, labelled load, controls writing into the register from signal lines, D11 through D18.
These lines might be the output of multiplexers, so that data from a variety of sources can be
loaded into the register.
Unit III Digital Logic
Page 5
Data Lines
D18
CLk ---Load---
D17
D16
D15
D14
D13
D12
D11
D
Q
D
Q
D
Q
D
Q
D
Q
D
Q
D
Q
D
Q
CLK
CLK
CLK
CLK
CLK
CLK
CLK
CLK
D08
D01
D07
D06
D05
D04
D03
D02
Output Lines
--8-bit Parallel Register-Shift Registers:
A Shift register accepts and / or transfers information serially. Consider, for example, the figure,
which shows a 5-bit shift register constructed from clocked D flip-flops. Data are input only to the
leftmost flip-flop. With each clock pulse, data are shifted to the right one position, and the
rightmost bit is transferred out.
Serial In
D
Q
D
Q
D
Q
D
Q
D
Q
CLK
CLK
CLK
CLK
CLK
Serial Out
Clock
--5-bit Shift Register-Shift registers can be used to interface to serial I/O devices. In addition, they can be used
within the ALU to perform logical shift and rotate functions.
v)
The function of a buffer/driver is to increase the output current/voltage ratings. When the output
current of a digital device is insufficient to drive another device which is to be connected to the
output terminal of the device, a buffer is employed to amplify the current. A buffer is a current
amplifier. For an inverting buffer a bubble is placed at the output point of triangle. Sometimes,
an increased voltage is required to drive relays, lamps etc., the device is said to be a buffer only
when the manufacturers optimize the design for high current output.
For example, IC 7426 is a quad 2-input NAND buffer. Its NAND gates are optimized for high
current output.
INPUT
-buffer-
OUTPUT
INPUT
OUTPUT
- Inverter buffer -
Counters:
A counter is a register whose value is easily incremented by 1 modulo the capacity of the
register. Thus, a register made up of n flip flops can count up to 2 n-1. When the counter is
incremented beyond its maximum value, it is set to 0. An example of a counter in the CPU is the
program counter.
Counters can be designated as asynchronous or synchronous, depending on the way in which
they operate.
Asynchronous counters are relatively slow because the output of one flip flop triggers a change
in the status of the next flip flop.
Unit III Digital Logic
Page 6
In synchronous counter, all of the flip flops change state at the same time. This type is much
faster, it is the kind used in CPUs.
Ripple Counter:
An asynchronous counter is also referred to as a ripple counter, because the change that occurs
to increment the counter starts at one end and ripples through to the other end.
High
J
Q
Clock
CLK
K
Q
Q0
J Q
J Q
J Q
CLK
CLK
CLK
K
Q
Q1
K
Q
Q2
K
Q
Q3
---Sequential Circuit----
In the illustrated implementation, the counter is incremented with each clock pulse. The J and K
inputs to each flip flop are held at a constant 1. This means that, when there is a clock pulse, the
output at Q will be inverted ( 1 to 0; 0 to 1).
Note that the change in state is shown as occurring with the falling edge of the clock pulse; this
is known as an edge-triggered flip flop. If one looks at patterns of output for this counter, it can
be seen that it cycles through 0000, 0001, ......1110,1111,0000 and so on.
Synchronous counters: the ripple counter has the disadvantage of the delay involved in changing
value. To overcome this disadvantage, CPUs make use of synchronous counters, in which all of
the flip-flops of the counter change at the same time.
High
Clock
J
C
J
B
J
A
CLK
CLK
CLK
--Design
of a Synchronous counter-K
K
K
C
For a 3 bit counter, three flip flops will be needed. Let us use JK flipflops. Label the
uncomplemented output of the three flip flops A, B,C respectively, with C representing the lease
significant bit.
vi)
A digital multiplexer has N inputs and only one output. By applying control signals anyone input
can be made available at the output terminal. It is also called data selector. The control signals
are applied to the select lines to select the desired input.
Examples :
IC 74150 1 of 16 Data selectors /Multiplexers
IC 74152 1 of 8 Data selectors/Multiplexers
D0
D1
INPUT D2
SIGNALS
.
.
DIGITAL
MULTIPLEXE
R
OUTPUT SIGNAL
Page 7
DN
SELECT LINES
FIG: DIGITAL MULTIPLEXER
vii)
Digital Demultiplexers/Decoders
A digital demultiplexer has 1 input and N outputs. The meaning of demultiplexer is one into
many. By applying control signals the input signal can be made available at anyone of output
terminals. It performs reverse operation of a multiplexer.
Example : IC 74154 is a 1 to 16 demultiplexer/4 to 16 decoder.
D0
D1
DIGITAL
INPUT
SIGNALS
DEMULTIPLEX
ER
D 2 OUTPUT SIGNAL
.
.
DN
SELECT LINES
FIG: DIGITAL DEMULTIPLEXER
viii)
Boolean Algebra
Boolean Algebra is mathematical system for formulating logical statements with symbols so that
problems can be solved in a manner to ordinary algebra.
Boolean algebra is the mathematics of digital systems
A basic knowledge in the Boolean algebra required to study and analysis of logic circuits.
It is a convenient and systematic way of expressing and analyzing the operations of logic circuits.
Rule
Number
1
2
3
4
5
6
7
8
9
10
11
12
Boolean Expression
A+0=A
A+1=1
A.0=0
A.1 =A
A+A=A
A+=1
A .A = A
A . =0
=A
A + AB =A
A +AB = A + B
(A + B) (A + C) = A + BC
Commutative Law : A + B = B + A
Associative Law :
A+(B+C) = (A+B)+C
Distributive law:
A(B+C) = AB + AC
De morgans Theorems :
A+B=A.B
Unit III Digital Logic
AB = BA
A(BC) = (AB)C
A +(BC) = (A+B). (A+C)
A.B = A + B
Page 8
ix)
The Karnaugh map method is a graphical technique for simplifying Boolean functions. It is a twodimensional of a Truth Table. It provides a simpler method for minimizing logic expressions. The
map method is ideally suited for four or less variables.
A Karnaugh map for n variables is made up of 2 n squares. Each square designates a product term
of a Boolean expression. For product terms which are present in the expression, 1s are written in
the corresponding squares; 0s are written in those squares which correspond to product terms
not present in the expression.
B
BA A
B
AB
A
B B
Y=
+ AB
1
1
Example : simplify
Y= A
B
A+
B
0
0
1
1
B
1
B
B
B
(
A
+ A)
Page 9
So the variable which is common to adjacent squares is selected, and the variable which is not
common is discarded.
Example: simplify
Y= A
B
+ ABA
0
B
0
1
1
+
1
A
1 B
Simplification result Y= A
+ ABA +
=B+A
B
B
The result obtained by map method can also be verified algebraically as follows:
Y= A
+ ABA +
B
B
=A
+ AB + AB
A +
B
B
= B
(
+ A) + A ( B + B )
= B + AA
Karnaugh Map for Three variables:
A B
A B
A B
A B
C
A B C
A B C
A B C
AB C
A B C
A B C
ABC
A BC
10
A B C
A B C
A B C
AB C
A B C
A B C
ABC
A BC
00
0
1
01
11
10
AB
1
1
The simplified
function will be Y = AB
Example: simplifying the function Y = A B C + A B C
+ A B C
Page 10
AB
C
00
01
1
11
10
AC
A B
The simplified
function will be Y = A B + A C
x)
There are two types of logic circuits combinational and sequential. A combinational circuit is one
in which the state of the output at any instant is entirely determined by the states of the inputs at
that time.
Combinational circuits are those logic circuits whose operations can be completely described by a
truth table / Boolean expression. A combinational circuit is realized using AND, OR, NOT gates (or
NAND OR NOR gates).
Examples of combinational circuits are: adder, subtractors, code converters, decoders, encoders,
digital multiplexers, demultiplexers, programmable logic arrays, ROMs etc.,
A sequential circuit consists of a combinational logic and storage elements. The output of a
sequential circuit is not only a function of a present inputs but also of past inputs. The state of the
storage elements depends upon the preceding inputs and the preceding states of the elements.
Therefore, the output of a sequential circuit becomes a function of both the present inputs and the
present internal states of the sequential circuit. To realize sequential circuits in addition to AND,
OR and NOT gates, flip-flops are also required.
Examples of sequential circuits are: registers, shift registers, counters, etc.,
The two major uses of sequential circuits in digital systems are:
1) As memories to store information while processing
2) As control circuits to generate control signals which are essential to select and enable a
sequence of data transfer or data processing steps in the execution of multistep tasks.
The sequential circuits which employ clock are called synchronous sequential circuits. In a
synchronous sequential circuit all memory elements are clocked latches or clocked flip flops. The
design and operation of sequential circuits is greatly simplified by the use of clock signals.
The sequential circuits which do not employ clock are known as unclocked or asynchronous
sequential circuits. Unclocked sequential circuits are difficult to design and therefore, they are
relatively uncommon.
xi)
Arithmetic Circuits
Arithmetic operations, such as addition, subtraction, multiplication, division etc., are performed by
a digital computer, calculator or other digital system. Logic circuits for some important arithmetic
operations are half-adder and full adder.
HALF ADDER:
A logic circuit which performs addition of two binary bits is called a half-adder.
Truth table for the addition of two binary bits.
A
0
0
1
Inputs
B
0
1
0
Sum
0
1
1
Outputs
Carry
0
0
0
Page 11
It is concluded that the sum is equal to A XOR B. It means that the outputs of an EXCLUSIVE-OR
gate will give the sum. The carry is equal to A AND B. The output of an AND gate will give the
carry.
S= A B + A B
=A
C=AB
Sum
S
Sum
S
HALF
ADDER
Carry
C
B
Carry
C
Full Adder
A logic circuit which performs addition of three binary bits is called a Full-adder.
A full adder can be built using two half adders and an OR gate.
Inputs
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
HALF
ADDER
Sum
0
1
1
0
1
0
0
1
Outputs
Carry
0
0
0
1
0
1
1
1
Carry
Carry
Sum
HALF
ADDER
A
Carry
Y
Sum
--Full Adder
---------
Page 12