Digital Practical
Digital Practical
2 ADDER 6-9
3 SUBTRACTOR 9-11
4 DECODER 12-15
6 ENCODER 15-19
7 MULTIPLEXER 19-22
8 DEMULTIPLEXER 22-25
10 REGISTERS 31-32
Page | 1
Logic Gates
o The logic gates are the main structural part of a digital system.
o Each gate has a distinct graphic symbol, and its operation can be described
by means of algebraic expressions.
o The seven basic logic gates includes: AND, OR, XOR, NOT, NAND, NOR, and
XNOR.
o The relationship between the input-output binary variables for each gate
can be represented in tabular form by a truth table.
o Each gate has one or two binary input variables designated by A and B and
one binary output variable designated by x.
1. AND
2. OR
3. NOT
4. NAND
5. NOR
6. XOR
7. XNOR
AND Gate
The AND gate produces the AND logic function, that is, the output is 1 if input A
and input B are both equal to 1; otherwise the output is 0.
Page | 2
The algebraic symbol of the AND function is the same as
the multiplication symbol of ordinary arithmetic.
We can either use a dot between the variables or concatenate the variables
without an operation symbol between them. AND gates may have more than two
inputs, and by definition, the output is 1 if and only if all inputs are 1.
OR Gate
The OR gate produces the inclusive-OR function; that is, the output is 1 if input A
or input B or both inputs are 1; otherwise, the output is 0.
OR gates may have more than two inputs, and by definition, the output is 1 if any
input is 1.
Page | 3
Inverter(NOT) Gate
The inverter circuit inverts the logic sense of a binary signal. It produces the NOT,
or complement, function.
The algebraic symbol used for the logic complement is either a prime or a bar
over the variable symbol.
NAND Gate
The NAND function is the complement of the AND function, as indicated by the
graphic symbol, which consists of an AND graphic symbol followed by a small
circle.
Page | 4
NOR Gate
The NOR gate is the complement of the OR gate and uses an OR graphic symbol
followed by a small circle.
Exclusive-OR Gate
The exclusive-OR gate has a graphic symbol similar to the OR gate except for the
additional curved line on the input side.
The output of the gate is 1 if any input is 1 but excludes the combination when
both inputs are 1. It is similar to an odd function; that is, its output is 1 if an odd
number of inputs are 1.
Exclusive-NOR Gate
Page | 5
The output of this gate is 1 only if both the inputs are equal to 1 or both inputs
are equal to 0.
Half Adder
Full Adder
Half Adder:
A combinational circuit that performs the addition of two bits is called a Half
Adder. It receives two inputs and produces two outputs Sum and Carry. The block
diagram for a half adder is as follows.
Page | 6
Designing of Half Adder:
3. The input and output variables are assigned letter symbols. Let’s represent
the inputs by A AND B, and the outputs SUM and Carry by S and C
respectively.
4. Truth Table
The Sum and Carry are in simplified form and further it cannot be simplified.
Page | 7
Full Adder:
A combinational circuit that performs the addition of three bits is called a Full
Adder. It receives
eives three inputs and produces two outputs Sum and Carry. The
Block diagram for the Full Adder is shown below.
The input and output variables are assigned letter symbols. Let we
represent the inputs by A, B, and C; and the outputs by S and C i.e. S for
Sum and C for Carry.
Truth Table
Page | 8
Subtractor:
A combinational circuit that performs the subtractions of bits is called a
Subtractor. There are two types of Subtractors.
1. Half Subtractor
2. Full Subtractor
1. Half Subtractor:
A combinational circuit that performs the subtraction of two bits is called Half
Subtractor.
tractor. It receives two inputs and produces two outputs Difference and
Borrow. The block diagram of the Half Subtractor is given as
Page | 9
Half Subtractor Block diagram:
The input and output variables are assigned letter symbols. Let we
represent the inputs by A and B, and the outputs Difference and Borrow by
D and B.
Page | 10
Full Subtractor:
A combinational circuit that performs the subtraction of three bits is called a Full
Subtractor. It receives three inputs and produces two outputs Difference and
Borrow. The Block Diagram of the Full Subtractor is as follows.
Full Subtractor
btractor Block Diagram:
The input and output variables are assigned letter symbols. Let we
represent the inputs by A, B, and C; and the outputs Difference and Borrow
by D and B.
Page | 11
Decoder
The combinational circuit that change the binary information into 2 N output lines
is known as Decoders. The binary information is passed in the form of N input
lines. The output lines define the 2 N-bit
bit code for the binary information. In simple
words, the Decoder performs the reverse operation of the Encoder.. At a time,
only one input line is activated for simplicity. The produced 2 N-bit
bit output code is
equivalent
valent to the binary information.
2 to 4 line decoder:
In the 2 to 4 line decoder, there is a total of three inputs, i.e., A 0, and A1 and E and
four outputs, i.e., Y0, Y1, Y2, and Y3. For each combination
bination of inputs, when the
enable 'E' is set to 1, one of these four outputs will be 1. The block diagram and
the truth table of the 2 to 4 line decoder are given below.
Block Diagram:
Page | 12
Truth Table:
The logical expression of the term Y0, Y0, Y2, and Y3 is as follows:
Play Videox
Y3=E.A1.A0
Y2=E.A1.A0'
Y1=E.A1'.A0
Y0=E.A1'.A0'
Page | 13
3 to 8 line decoder:
Block Diagram:
Truth Table:
Page | 14
The logical expression of the term Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7 is as follows:
Y0=A0'.A1'.A2'
Y1=A0.A1'.A2'
Y2=A0'.A1.A2'
Y3=A0.A1.A2'
Y4=A0'.A1'.A2
Y5=A0.A1'.A2
Y6=A0'.A1.A2
Y7=A0.A1.A2
Encoders
The combinational circuits that change the binary information into N output lines
are known as Encoders.. The binary information is passed in the form of 2N input
lines. The output lines define the N
N-bit
bit code for the binary information. In simple
Page | 15
words, the Encoder performs the reverse operation of the Decoder. At a time,
only one input line is activated for simplicity. The produced N-bit output code is
equivalent to the binary information.
4 to 2 line Encoder:
In 4 to 2 line encoder, there are total of four inputs, i.e., Y 0, Y1, Y2, and Y3, and two
outputs, i.e., A0 and A1. In 4-input lines, one input-line is set to true at a time to
get the respective binary code in the output side. Below are the block diagram
and the truth table of the 4 to 2 line encoder.
Block Diagram:
Page | 16
Truth Table:
A1=Y3+Y2
A0=Y3+Y1
8 to 3 line Encoder:
Page | 17
time to get the respective binary code in the output side. Below are the block
diagram and the truth table of the 8 to 3 line encoder.
Block Diagram:
Truth Table:
The logical expression of the term A0, A1, and A2 are as follows:
A2=Y4+Y5+Y6+Y7
A1=Y2+Y3+Y6+Y7
A0=Y7+Y5+Y3+Y1
Page | 18
Multiplexer
A multiplexer is a combinational circuit that has 2n input lines and a single output
line. Simply, the multiplexer is a multi-input and single-output combinational
circuit. The binary information is received from the input lines and directed to the
output line. On the basis of the values of the selection lines, one of these data
inputs will be connected to the output.
Unlike encoder and decoder, there are n selection lines and 2 n input lines. So,
there is a total of 2N possible combinations of inputs. A multiplexer is also treated
as Mux.
2×1 Multiplexer:
In 2×1 multiplexer, there are only two inputs, i.e., A0 and A1, 1 selection line, i.e.,
S0 and single outputs, i.e., Y. On the basis of the combination of inputs which are
present at the selection line S0, one of these 2 inputs will be connected to the
output. The block diagram and the truth table of the 2×1 multiplexer are given
below.
Page | 19
Block Diagram:
Truth Table:
Y=S0'.A0+S0.A1
Logical
gical circuit of the above expression is given below:
Page | 20
4×1 Multiplexer:
In the 4×1 multiplexer, there is a total of four inputs, i.e., A 0, A1, A2, and A3, 2
selection lines, i.e., S0 and S1 and single output, i.e., Y. On the basis of the
puts that are present at the selection lines S 0 and S1, one of
combination of inputs
these 4 inputs are connected to the output. The block diagram and the truth table
of the 4×11 multiplexer are given below.
Block Diagram:
Truth Table:
De-multiplexer
multiplexer is a combinational circuit that has only 1 input line and 2 N output
A De-multiplexer
lines. Simply, the multiplexer is a single-input and multi-output
output combinational
circuit. The information is received from the single input lines and directed to the
output line. On the basis of the values of the selection lines, the input will be
connected to one of these outputs. De De-multiplexer
exer is opposite to the multiplexer.
Unlike encoder and decoder, there are n selection lines and 2 n outputs. So, there
is a total of 2n possible combinations of inputs. De
De-multiplexer
multiplexer is also treated
as De-mux.
1×2 De-multiplexer:
In the 1 to 2 De-multiplexer,
multiplexer, there are only two outputs, i.e., Y 0, and Y1, 1
selection lines, i.e., S0, and single input, i.e., A. On the basis of the selection value,
Page | 22
the input will be connected to one of the output
outputs.
s. The block diagram and the
truth table of the 1×22 multiplexer are given below.
Block Diagram:
Truth Table:
Y0=S0'.A
Y1=S0.A
Page | 23
1×4 De-multiplexer:
In 1 to 4 De-multiplexer,
multiplexer, there are total of four outputs, i.e., Y 0, Y1, Y2, and Y3, 2
selection lines, i.e., S0 and S1 and single input, i.e., A. On the basis of the
combination of inputs which are present at the selection lines S 0 and S1, the input
be connected to one of the outputs. The block diagram and the truth table of the
1×44 multiplexer are given below.
Block Diagram:
Page | 24
Truth Table:
Y0=S1' S0' A
y1=S1' S0 A
y2=S1 S0' A
y3=S1 S0 A
Page | 25
flip-flop
A flip-flop is a sequential digital electronic circuit having two stable states that can
be used to store one bit of binary data. Flip-flops are the fundamental building
blocks of all memory devices.
Types of Flip–Flops
S-R flip-flop
J-K flip-flop
D flip-flop
T flip-flop
S-R Flip-flop
This is the simplest flip-flop circuit. It has a set input (S) and a reset input
(R). When in this circuit when S is set as active, the output Q would be high
and the Q’ will be low. If R is set to active then the output Q is low and the
Q’ is high. Once the outputs are established, the results of the circuit are
maintained until S or R get changed, or the power is turned off.
Page | 26
S R Q State
0 0 0 No Change
0 1 0 Reset
1 0 1 Set
1 1 X
S R Q(t) Q(t+1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 X
1 1 1 X
Page | 27
Q(t+1)=S+R‘Q(t)Q(t+1)=S+R‘Q(t)
J-K Flip-flop
J K Q State
0 0 0 No Change
0 1 0 Reset
1 0 1 Set
1 1 Toggles Toggle
Page | 28
Characteristics table of JK flip-flop
J K Q(t) Q(t+1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
Q(t+1)=jkQ(t)‘+K‘Q(t)Q(t+1)=jkQ(t)‘+K‘Q(t)
D Flip-flop
Page | 29
Truth table of D flip-flop
D Q
0 0
1 1
Q(t+1)=DQ(t+1)=D
T Flip-flop
Page | 30
Truth Table of T flip-flop
T Q(t) Q(t+1)
0 0 0
0 1 1
1 0 1
1 1 0
Q(t+1)=T′Q(t)+TQ(t)′=T⊕Q(t)
Registers
A Register is a collection of flip flops. A flip flop is used to store single bit digital
data. For storing a large number of bits, the storage capacity is increased by
grouping more than one flip flops. If we want to store an n-bit word, we have to
use an n-bit register containing n number of flip flops.
The register is used to perform different types of operations. For performing the
operations, the CPU use these registers. The faded inputs to the system will store
into the registers. The result returned by the system will store in the registers.
There are the following operations which are performed by the registers:
Fetch:
It is used
Page | 31
Decode:
Execute:
The execution operation is used to store the result produced by the CPU
into the memory. After storing this result, it is displayed on the user screen.
Types of Registers
Page | 32