DLD Lab Manual 2023-24
DLD Lab Manual 2023-24
Lab Manual
Academic Year-2023-24
Semester – III
Course Objectives:
This course introduces the fundamental concepts and techniques underlying the construction
of digital systems. It further provides insight into designing digital logic circuits using basic
building blocks and necessary techniques required in computer hardware design.
Course Outcomes:
After the successful completion of this course, the student will be able to
LIST OF EXPERIMENTS
Sr. Page
Name of the Experiments
No. No
a. To verify the behavior of all basic logic gates and universal gates using
truth table and familiarization with digital integrated circuits.
1 2
b. Realization of logic expression using basic logic gates and universal
gates.
To implement and verify NAND and NOR gate as Universal Gates.
2 10
a. Implement NOT, AND, OR and X-OR using NAND gate
b. Implement NOT, AND, OR and X-OR using NOR gate
To implement and verify following DeMorgan’s Theorems using Bread
Board and components-
3 15
1.
2.
Write a VHDL Code to implement Half and Full Adder using Vivado.
10 40
1
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 1
2
OR Gate: -
The OR gate is a digital logic gate that implements logical disjunction.
A HIGH output results if one or both the inputs to the gate are HIGH. If
neither input is HIGH, a LOW output results.
Symbol: - Truth Table: -
Input Input Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
NOT Gate: -
In digital logic, an inverter or NOT gate is a logic gate which
implements logical negation. A HIGH output results if input to the gate is
LOW. If input is HIGH output is LOW.
Symbol: - Truth Table: -
Input Output
A Y
0 1
1 0
NAND Gate: -
In digital electronics, a NAND gate (Negated AND or NOT AND) is
a logic gate which produces an output that is false only if all its inputs are
true. A LOW output results only if both the inputs to the gate are HIGH; if
one or both inputs are LOW, a HIGH output results.
Symbol: - Truth Table: -
3
NOR Gate: -
The NOR gate is a digital logic gate that implements the negation of
the OR operator. A HIGH output results if both the inputs to the gate are
LOW; if one or both input is HIGH, a LOW output results.
XOR Gate: -
The XOR gate (sometimes EOR gate or EXOR gate) is a digital logic
gate that implements an exclusive or; that is, a HIGH output results if one,
and only one, of the inputs to the gate is HIGH. If both inputs are LOW
and both are HIGH, a LOW output results.
4
Circuit
diagram: - AND GATE (IC 7408): -
Symbol: - Pin Configuration: -
Truth Table: -
Truth Table: -
Input A Input B Output Y
0 0 0
0 1 1
1 0 1
1 1 1
5
NOT GATE (IC 7404): -
Symbol: - Pin Configuration: -
Truth Table: -
Input A Output Y
0 1
0 0
Truth Table: -
6
NOR GATE (IC 7402): -
Symbol: - Pin Configuration: -
Truth Table: -
Truth Table: -
Input A Input B Output Y
0 0 0
0 1 1
1 0 1
1 1 0
7
Procedure: - 1. Draw the following Pin Diagram, Truth Table, Symbol of IC’S on the
blank sheet & attach with the main sheet
2. Place the IC- 74XX series in the socket of the breadboard in proper
position
3. Connect the circuit as shown in the figure
4. Switch on the Power Supply. (Set power supply to 5v Dc)
5. Verify the Truth Table of this IC by giving all the combinations of the
input and recording the corresponding output.
8
Conclusion: - All the logic gates were successfully implemented and their working
verified.
9
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 2
Theory: - A universal gate is a gate which can implement any Boolean function
without need to use any other gate type. The NAND and NOR gates are
universal gates.
In practice, this is advantageous since NAND and NOR gates are
economical and easier to fabricate and are the basic gates used in all IC
digital logic families.
An AND gate is typically implemented as a NAND gate followed by an
inverter. An OR gate is typically implemented as a NOR gate followed by
an inverter.
NAND Gate as Universal gate: -
Implement NOT gate using NAND gate: -
All NAND input pins connect to the input signal A gives an output A’.
10
Implement AND gate using NAND gate: -
An AND gate can be replaced by NAND gates as shown in the figure
The AND is replaced by a NAND gate with its output complemented by a
NAND gate inverter.
11
Implement OR gate using NOR gate: -
The OR is replaced by a NOR gate with its output complemented by a
NOR gate inverter.
Circuit
Diagram:- NAND Gate as Universal gate: -
Implement NOT gate using NAND gate: -
12
Implement OR gate using NOR gate: -
Procedure: - 1. Place the IC- 74XX series in the socket of the breadboard in proper
position
2. Connect the circuit as shown in the figure
3. Switch on the Power Supply. (Set power supply to 5v Dc)
4. Verify the Truth Table for all circuits by giving all the combinations of
the input and recording the corresponding output.
13
Result: - Input Input LED Input Input
LED
A(v) B(v) (v) A B
0 0 0 0 0 0
0 5 0 0 5 4.89
5 0 0 5 0 4.89
5 5 4.95 5 5 4.89
Input LED
A(v) (v)
0 4.92
5 0
NOT GATE
Conclusion: - Basic logic gates AND, OR and NOT were implemented using the
universal logic gates NAND and NOR and their output was verified.
14
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 3
Components:- Wires, Breadboard, LED, resistor, Gates IC’S: - 7408-AND Gate, IC7404-
NOT Gate, IC7432- OR Gate.
15
complement.”
A+B= A . B
L.H.S of this theorem consists of OR gate followed by NOT gate (or
NOR gate), while R.H.S is AND gate with its input Inverted.
16
Procedure: - 1. Place the IC- 74XX series in the socket of the breadboard in proper
position
2. Connect the circuit as shown in the figure
3. Switch on the Power Supply. (Set power supply to 5v Dc)
4. Verify the Truth Table for all circuits by giving all the combinations of
the input and recording the corresponding output.
17
Result: - De-Morgan’s First Theorem: -
LED LED
Input Input ̅̅̅̅̅̅
𝐴 .𝐵 𝐴̅ + 𝐵̅
A(v) B(v)
(v) (v)
0 0 4.98 4.98
0 5 4.98 4.98
5 0 4.98 4.98
5 5 0 0
De-Morgan’s Second Law: -
Conclusion: - De-Morgan’s laws were implemented using logic gates and verified the
two statement
“Complement of the product is equal to sum of the complement.”
“Complement of the sum is equal to product of the complement.”
18
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 4
Theory: - The reflected binary code, also known as Gray code, is a binary numeral
system where two successive values differ in only one bit. It is a non-
weighted code. Gray codes are widely used to facilitate error correction in
digital communications such as digital terrestrial television and some cable
TV systems.
Conversion from Binary to Gray code: -
1. The left most significant bit of a given binary code number is same as the
most left significant bit of the gray code number.
2. To obtain the successive gray bits to produce the equivalent gray number
for the given binary code number, add the first bit of binary number to the
second one and write down the result next to the first bit, add the second
binary number bit to third one and write down the result and so on next to
the second bit and repeat the same operation until the last bit.
Conversion from Gray to Binary code: -
1. The left most significant bit of a given grey code number is same as the
most left significant bit of the binary number.
2. To obtain the successive binary bits to produce the equivalent binary
19
number for the given grey code number, add the first bit of grey code to the
second one and write down the result next to the first bit, add the second
grey code bit to third one and write down the result and so on next to the
second bit and repeat the same operation until the last bit
20
2. Prepare K-maps for all the four bits.
3. Obtain the logical expression from K-maps.
4. List out the number and type of the gates required.
5. Design a combinational circuit using the expressions.
6. Implement the combinational circuit.
7. Verify the truth-table with all combinations of inputs.
Gray to Binary Code Conversion
1. Write truth –table for gray to binary code conversion.
2. Prepare K-maps for all the four bits.
3. Obtain the logical expression from K-maps.
4. List out the number and type of the gates required.
5. Design a combinational circuit using the expressions.
6. Implement the combinational circuit.
7. Verify the truth table with all the combinations of input.
21
Result: - BINARY TO GRAY CODE
BINARY CODE GRAY CODE
(v) (v)
0 0 0 0 0 0 0 0
0 0 0 5 0 0 0 5
0 0 5 0 0 0 5 5
0 0 5 5 0 0 5 0
0 5 0 0 0 5 5 0
0 5 0 5 0 5 5 5
0 5 5 0 0 5 0 5
0 5 5 5 0 5 0 0
5 0 0 0 5 5 0 0
5 0 0 5 5 5 0 5
5 0 5 0 5 5 5 5
5 0 5 5 5 5 5 0
5 5 0 0 5 0 5 0
5 5 0 5 5 0 5 5
5 5 5 0 5 0 0 5
5 5 5 5 5 0 0 0
Conclusion: - A digital logic circuit which converts gray code to binary and binary code to
gray code was implemented and the outputs verified.
22
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 5
Components:- Wires, Breadboard, LED, resistor, Gates IC’S: - 7486-EX-OR Gate, 7408-
AND Gate.
Theory: - In electronics, an adder or summer is a digital circuit that
performs addition of numbers. In many computers and other kinds of
processors, adders are used not only in the arithmetic logic unit, but also in
other parts of the processor, where they are used to calculate addresses,
table indices, and similar operations.
Half Adder: -
The half adder adds two single binary digits A and B. It has two outputs,
sum (S) and carry (C). The carry signal represents an overflow into the next
digit of a multi-digit addition. The value of the sum addition of bits. The
simplest half-adder design, incorporates an XOR gate for S and an AND
gate for C. With the addition of an OR gate to combine their carry outputs,
two half adders can be combined to make a full adder.
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
23
Full Adder: -
A full adder adds binary numbers and accounts for values carried in as
well as out. A one-bit full adder adds three one-bit numbers, often written
as A, B, and Cin; A and B are the operands, and Cin is a bit carried in from
the next less significant stage. The full-adder is usually a component in a
cascade of adders, which add 8, 16, 32, etc. bit wide binary numbers. The
circuit produces a two-bit output, output carry and sum typically
represented by the signals Cout and S
A B Cin 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
Full Adder: -
24
Procedure: - Half Adder:
1. Write the Truth Table for half Adder.
2. Prepare K maps.
3. Obtain the logical expression from K-maps.
4. List out the number and type of the gates required.
5. Design a combinational circuit using the expressions.
6. Implement the combinational circuit using bread-board, ICs.
7. Connect LED for output indication (sum, carry).
8. Verify the Truth Table for all the combinations of inputs.
Full Adder:
1. Write the Truth Table for Full Adder.
2. Prepare K maps.
3. Obtain the logical expression from K-maps.
4. List out the number and type of the gates required.
5. Design a combinational circuit using the expressions.
6. Implement the combinational circuit using bread-board, ICs.
7. Connect LED for output indication (sum, carry).
8. Verify the Truth Table for all the combinations of inputs.
25
FULL ADDER: -
A B Cin Sum Carry
(v) (v) (v) (v) (v)
0 0 0 0 0
0 0 5 4.98 0
0 5 0 4.98 0
0 5 5 0 4.97
5 0 0 4.98 0
5 0 5 0 4.97
5 5 0 0 4.98
5 5 5 4.98 4.98
Conclusion: - A half adder circuit was designed and implemented and verified.
A full adder circuit was designed and implemented and verified.
26
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 6
STUDY OF MULTIPLEXER
Components: Wires, Breadboard, LED, resistor, Gates IC’S: - 74151 – 8:1 Multiplexer
-
27
Design: - Sr. No. A B C D Y
0 0 0 0 0 0
𝑫𝟎 = 𝑫
1 0 0 0 1 1
2 0 0 1 0 1 ̅
𝑫𝟏 = 𝑫
3 0 0 1 1 0
4 0 1 0 0 0
𝑫𝟐 = 𝟎
5 0 1 0 1 0
6 0 1 1 0 1 ̅
𝑫𝟑 = 𝑫
7 0 1 1 1 0
8 1 0 0 0 1
𝑫𝟒 = 𝟏
9 1 0 0 1 1
10 1 0 1 0 0
𝑫𝟓 = 𝑫
11 1 0 1 1 1
12 1 1 0 0 1
𝑫𝟔 = 𝟏
13 1 1 0 1 1
14 1 1 1 0 0
𝑫𝟕 = 𝟎
15 1 1 1 1 0
Circuit
Diagram:- Y = ∑ m (1, 2, 6, 8, 9, 10, 11, 12, 13)
28
Procedure: - 1. Place the IC 74151 in the socket of the breadboard in proper position
and switch
2. Connect the wires as shown in the figure
3. Switch On the power supply.
4. Connect the pin16 and 8 to Vcc and ground respectively.
5. Connect the circuit output lines according to SOP equation.
6. Verify the Truth table of this IC by giving all the combinations of the
input and recording the corresponding output.
29
Result: - Sr. No. A B C D Y
0 0 0 0 0 0
1 0 0 0 5 4.98
2 0 0 5 0 4.98
3 0 0 5 5 0
4 0 5 0 0 0
5 0 5 0 5 0
6 0 5 5 0 4.98
7 0 5 5 5 0
8 5 0 0 0 4.98
9 5 0 0 5 4.98
10 5 0 5 0 0
11 5 0 5 5 4.98
12 5 5 0 0 4.98
13 5 5 0 5 4.98
14 5 5 5 0 0
15 5 5 5 5 0
Conclusion: - A multiplexer is a circuit which selects one input from many inputs. A
Boolean expression was implemented using a 8:1 Multiplexer.
30
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 7
Aim: - To design and implement OR /NOR / XOR GATE in VHDL using behavioral
modelling.
Appar
Computer, VHDL software, hardware board.
atus:
Theory: VHDL (VHSIC-HDL) (Very High Speed Integrated Circuit Hardware Description
- Language) is a hardware description language used in electronic design automation to
describe digital and mixed-signal systems such as field-programmable gate
arrays and integrated circuits. VHDL can also be used as a general purpose parallel
programming language. The key advantage of VHDL, when used for systems design, is
that it allows the behavior of the required system to be described (modeled) and verified
(simulated) before synthesis tools translate the design into real hardware. Another benefit
is that VHDL allows the description of a concurrent system. VHDL is a dataflow
language, unlike procedural computing languages such as BASIC, C, and assembly code,
which all run sequentially, one instruction at a time. A VHDL project is multipurpose.
Being created once, a calculation block can be used in many other projects. However,
many formational and functional block parameters can be tuned (capacity parameters,
memory size, element base, block composition and interconnection structure).
DESIGN CODE for OR gate:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
31
--use IEEE.NUMERIC_STD.ALL;
entity or_gate is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
y : out STD_LOGIC);
end or_gate;
begin
y <= a or b;
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity nor_gate is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
y : out STD_LOGIC);
end nor_gate;
begin
y <= a nor b;
32
end Behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity exor_gate is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
y : out STD_LOGIC);
end exor_gate;
begin
y <= a xor b;
end Behavioral;
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
entity or_gate_tb is
end;
component or_gate
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
33
y : out STD_LOGIC);
end component;
begin
stimulus1: process
begin
a <= not a;
wait for 10 ns;
end process;
stimulus2: process
begin
b <= not b;
wait for 20 ns;
end process;
end;
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
entity nor_gate_tb is
end;
component nor_gate
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
34
y : out STD_LOGIC);
end component;
begin
stimulus1: process
begin
a <= not a;
wait for 10 ns;
end process;
stimulus2: process
begin
b <= not b;
wait for 20 ns;
end process;
end;
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
entity exor_gate_tb is
end;
component exor_gate
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
y : out STD_LOGIC);
35
end component;
begin
stimulus1: process
begin
a <= not a;
wait for 10 ns ;
end process;
stimulus2: process
begin
b <= not b;
wait for 20 ns ;
end process;
end;
36
TIME GRAPH:
37
38
CONCLUSION:
Hence using VHDL codes, we can make different gates and simulate its properties before
performing practically.
39
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 8
Theory: VHDL (VHSIC-HDL) (Very High Speed Integrated Circuit Hardware Description
Language) is a hardware description language used in electronic design automation to
describe digital and mixed-signal systems such as field-programmable gate
arrays and integrated circuits. VHDL can also be used as a general purpose parallel
programming language. The key advantage of VHDL, when used for systems design, is that
it allows the behavior of the required system to be described (modeled) and verified
(simulated) before synthesis tools translate the design into real hardware. Another benefit is
that VHDL allows the description of a concurrent system. VHDL is a dataflow language,
unlike procedural computing languages such as BASIC, C, and assembly code, which all run
sequentially, one instruction at a time. A VHDL project is multipurpose. Being created once,
a calculation block can be used in many other projects. However, many formational and
functional block parameters can be tuned (capacity parameters, memory size, element base,
block composition and interconnection structure).
logic code:
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 09/03/2019 12:39:17 PM
-- Design Name:
-- Module Name: btg - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
40
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity btg is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
p : out STD_LOGIC;
q : out STD_LOGIC;
r : out STD_LOGIC);
end btg;
begin
p<=a;
q<=a xor b;
r<=b xor c;
end Behavioral;
Testbench:
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
41
entity btg_tb is
end;
component btg
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
p : out STD_LOGIC;
q : out STD_LOGIC;
r : out STD_LOGIC);
end component;
signal a: STD_LOGIC:='0';
signal b: STD_LOGIC:='0';
signal c: STD_LOGIC:='0';
signal p: STD_LOGIC;
signal q: STD_LOGIC;
signal r: STD_LOGIC;
begin
stimulus: process
begin
a<=not a;
wait for 40 ns;
b<=not b;
wait for 20 ns;
c<=not c;
wait for 10 ns;
end process;
end;
42
schematic diagram:
TIME GRAPH:
43
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 9
Apparatus
Computer, VHDL software, hardware.
:
LOGIC CODE:
library IEEE;
44
use IEEE.STD_LOGIC_1164.ALL;
--use IEEE.NUMERIC_STD.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity half_adder is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
s : out STD_LOGIC;
c : out STD_LOGIC);
end half_adder;
begin
s <= a xor b;
c <= a and b;
end Behavioral;
TEST BENCH CODE:
library IEEE;
use IEEE.Std_logic_1164.all;
use IEEE.Numeric_Std.all;
45
entity half_adder_tb is
end;
component half_adder
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
s : out STD_LOGIC;
c : out STD_LOGIC);
end component;
signal s: STD_LOGIC;
signal c: STD_LOGIC;
begin
uut: half_adder port map ( a => a,
b => b,
s => s,
c => c );
stimulus1: process
begin
a <= not a;
end process;
46
stimulus2: process
begin
b <= not b;
end process;
end;
TIME GRAPH:
47
CONCLUSION:
Hence we get the graph for half adder using VHDL.now we can connect a
hardware and burn the code to it so that it works as a half adder.
48
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 10
STUDY OF COUNTERS
Components:- Wires, Breadboard, LED, resistor, Gates IC’S: - 7476 – JK flip flop.
Theory: - In digital logic and computing, a counter is a device which stores (and
sometimes displays) the number of times a particular event or process has
occurred, often in relationship to a clock signal. In electronics, counters can
be implemented quite easily using register-type circuits such as the flip-flop.
Basically there are two types of counters.
Asynchronous counter (ripple counter).
Synchronous counter.
Asynchronous counter: - In the case of an Asynchronous Counter, all the
flip-flops are not clocked simultaneously. This counter is simple in
operation & requires a min. of hardware.
But its speed is low. Each FF is triggered by a previous FF o/p. Each FF
takes its own time to give o/p (due to propagation delay). So final settling
time is high. They have the problem of glitch.
Synchronous counter: - In synchronous counters all the FFs are clocked
simultaneously. It is complex in construction, but speed is more. In this case
since each FF is clocked simultaneously thus settling time is the delay time
of single FF. No problem of glitch.
49
Asynchronous counter IC (7490): - It is a BCD counter. It consists of four
FFs internally connected to provide a mod-2 counter and a mod-5 counter.
The mod-2 and mod-5 counters can be used independently or in
combination. FFA operates as a mod2 counter whereas the combination of
FFB, FFC and FFD form a mod-5 counter. There are two reset inputs R1 &
R2 both of which are to be connected to logic 1 level for clearing all the
FFs. The two set inputs S1 & S2 when connected to logic1 level are used
for setting the counter to 1001.
50
Procedure: - 1. Draw circuit diagram for MOD-8 Asynchronous counter using IC7476
2. Prepare Truth table for counter.
3. Implement counter Circuit using IC7476.
4. For output indicator connect LED’s at the outputs.
5. Verify truth table for all combinations of inputs
51
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 11
Aim: Design and verify the 4- Bit Synchronous/ Asynchronous Counter using JK flip flop.
https://de-iitr.vlabs.ac.in/exp/4bit-synchronous-asynchronous-counter/
Theory:
To verify the truth table and timing diagram of 4-bit synchronous parallel counter and 4-bit
asynchronous parallel counter by using JK flip flop ICs and analyse the circuit of 4-bit
synchronous parallel counter and 4-bit asynchronous parallel counter with the help of LEDs
display.
Introduction
A counter is a device which stores (and sometimes displays) the number of times a particular
event or process has occurred, often in relationship to a clock signal. Counters are used in
digital electronics for counting purpose, they can count specific event happening in the
circuit. For example, in UP counter a counter increases count for every rising edge of clock.
Classification of Counters
1. Asynchronous counter
2. Synchronous counter
1) Asynchronous Counter
In asynchronous counter we don’t use universal clock, only first flip flop is driven by main
clock and the clock input of rest of the following counters is driven by output of previous flip
flops. We can understand it by following diagram-
52
Figure-1: Asynchronous Counter Circuit and Timing Diagram
It is evident from timing diagram that Q0 is changing as soon as the rising edge of clock
pulse is encountered, Q1 is changing when rising edge of Q0 is encountered(because Q0 is
like clock pulse for second flip flop) and so on. In this way ripples are generated through
Q0,Q1,Q2,Q3 hence it is also called RIPPLE counter.
2) Synchronous Counter
Unlike the asynchronous counter, synchronous counter has one global clock which drives
each flip flop so output changes in parallel. The one advantage of synchronous counter over
asynchronous counter is, it can operate on higher frequency than asynchronous counter as it
does not have cumulative delay because of same clock is given to each flip flop.
53
Figure-2: Synchronous Counter Circuit and Timing Diagram
From circuit diagram we see that Q0 bit gives response to each falling edge of clock while
Q1 is dependent on Q0, Q2 is dependent on Q1 and Q0, Q3 is dependent on Q2, Q1 and Q0.
54
a: Counts the number of outputs
b: Stores the number of times a particular event or process has occurred
c: Stores the number of times a clock pulse rises and falls
d: Counts the number of inputs
What is the maximum possible range of bit-count specifically in n-bit binary counter
consisting of ‘n’ number of flip-flops?
a: 0 to 2^n
b: 0 to 2^n + 1
c: 0 to 2^n – 1
d: 0 to 2^n + 1/2
Procedure:
55
Synchronous Counter
Asynchronous Counter
Simulation:
Instructions
56
Instructions
57
Post-test
58
a: 3 b: 7 c: 8 d: 15
Which sequential circuits are applicable for counting pulses?
a: Counters b: Flip Flops c: Registers d: Latches
A decimal counter has ______ states.
a: 5 b: 10 c: 15 d: 20
Counter is a ____________ .
a: Combinational circuit b: Sequential circuit c: Both d: None
References:
59
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 12
Aim: Design and Verify the 4-Bit Serial In - Parallel Out Shift Registers.
To analyse the circuit and truth table of 4-bit SIPO (serial input parallel output) shift register
by using IC 7474 (D flip flop).
https://de-iitr.vlabs.ac.in/exp/4bit-sipo-shift-register/index.html
Theory:
In Serial In Parallel Out (SIPO) shift registers, the data is stored into the register serially
while it is retrieved from it in parallel-fashion. Figure 1 shows an n-bit synchronous SIPO
shift register sensitive to positive edge of the clock pulse. Here the data word which is to be
stored (Data in) is fed serially at the input of the first flip-flop (D1 of FF1). It is also seen that
the inputs of all other flip-flops (except the first flip-flop FF1) are driven by the outputs of the
preceding ones like the input of FF2 is driven by the output of FF1. In this kind of shift
register, the data stored within the register is obtained as a parallel-output data word (Data
out) at the individual output pins of the flip-flops (Q1 to Qn).
In general, the register contents are cleared by applying high on the clear pins of all the flip-
flops at the initial stage. After this, the first bit, B1 of the input data word is fed at the D1 pin
60
of FF1.This bit (B1) will enter into FF1, get stored and thereby appears at its output Q1 on
the appearance of first leading edge of the clock. Further at the second clock pulse, the bit B1
right-shifts and gets stored into FF2 while appearing at its output pin Q2 while a new bit, B2
enters into FF1. Similarly, at each clock pulse the data within the register moves towards
right by a single bit while a new bit of the input word enters into the register. Meanwhile one
can extract the bits stored within the register in parallel-fashion at the individual flip-flop
outputs.
Analyzing on the same grounds, one can note that the n-bit input data word is obtained as an
n-bit output data word from the shift register at the rising edge of the nth clock pulse. This
working of the shift-register can be summarized as in Table I and the corresponding
waveforms are given by figure 2.
In the right-shift SIPO shift-register, data bits shift from left to right for each clock pulse.
However, if the data bits are made to shift from right to left in the same design, one gets a
left-shift SIPO shift-register as shown by figure 3. Nevertheless the basic working principle
remains the same except the fact that now Bn down to B1 is stored in Qn down to Q1 i.e. Q1
61
= B1, Q2 = B2 … Qn = Bn at the nth clock pulse.
Pretest:
Procedure:
62
Step-7) Press clock pulse and observe that the data at LED Q3will shift to LED Q2 and the
new data applied will appear at Q3.
Step-8) Repeat steps 3 to 5 till all the 4 bits appear at the output of shift register.
Step-9) Press the "Print" button after completing your simulation to get your results.
Simulation:
63
Post Test
Based on how binary information is entered or shifted out, shift registers are classified
into _______ categories.
a: 2 b: 3 c: 4 d: 5
How can parallel data be taken out of a shift register simultaneously?
a: Use the Q output of the first FF b: Use the Q output of the last FF c: Tie all of
the Q outputs together d: Use the Q output of each FF
The group of bits 11001 is serially shifted (right-most bit first) into a 5-bit parallel
output shift register with an initial state 01110. After three clock pulses, the register
contains ________
a: 01110 b: 00001 c: 00101 d: 00101
The full form of SIPO is ___________
a: Serial-in Parallel-out b: Parallel-in Serial-out c: Serial-in Serial-out d:
Serial-In Peripheral-Out
A shift register that will accept a parallel input or a bidirectional serial load and
internal shift features is called as?
a: Tristate b: End around c: Universal d: Conversion
References:
64
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 13
Aim: Verify the truth table of RS, JK, T and D flip-flops using NAND & NOR gates
To verify the truth table and timing diagram of RS, JK, T and D flip-flops by using NAND &
NOR gates ICs and analyse the circuit of RS, JK, T and D flip-flops with the help of LEDs
display.
Reference Link:
A flip flop is an electronic circuit with two stable states that can be used to store binary data.
The stored data can be changed by applying varying inputs. Flip-flops and latches are
fundamental building blocks of digital electronics systems used in computers,
communications, and many other types of systems.
1) RS flip flop
The basic NAND gate RS flip flop circuit is used to store the data and thus provides feedback
from both of its outputs again back to its inputs. The RS flip flop actually has three inputs,
SET, RESET and clock pulse.
65
Figure-2:Characteristics table of R-S flip flop
2) D flip flop
A D flip flop has a single data input. This type of flip flop is obtained from the SR flip flop
by connecting the R input through an inverter, and the S input is connected directly to data
input. The modified clocked SR flip-flop is known as D-flip-flop and is shown below. From
the truth table of SR flip-flop we see that the output of the SR flip-flop is in unpredictable
state when the inputs are same and high. In many practical applications, these input
conditions are not required. These input conditions can be avoided by making them
complement of each other.
66
Figure-4: Characteristics table of D flip flop
In a RS flip-flop the input R=S=1 leads to an indeterminate output. The RS flip-flop circuit
may be re-joined if both inputs are 1 than also the outputs are complement of each other as
shown in characteristics table below.
67
Figure-6:Characteristics table of J-K flip flop
4) T flip flop
T flip-flop is known as toggle flip-flop. The T flip-flop is modification of the J-K flip-flop.
Both the JK inputs of the JK flip – flop are held at logic 1 and the clock signal continuous to
change as shown in table below.
68
Figure-8:Characteristics table of T flip flop
Pretest:
Procedure:
1) SR flip flop
69
Step-5) Repeat steps 3&4 for next state of inputs and their corresponding outputs.
Step-6) Press the "Print" button after completing your simulation to get your results.
2) D flip flop
4) T flip flop
Simulation:
70
71
72
73
Post Test:
74
a: AND or OR gates b: Ex-OR or Ex-NOR gates c: NOR or NAND gates d:
AND or NOR gate
The truth table for an S-R flip-flop has how many valid entries?
a: 1 b: 2 c: 3 d: 4
The flip-flops which has not any invalid states are _____________
a: S-R, J-K, D b: S-R, J-K, T c: J-K, D, S-R d: J-K, D, T
Both the J-K & the T flip-flop are derived from the basic _____________
a: S-R flip-flop b: S-R latch c: D latch d: D flip-flop
References:
1. William Gothmann H, Digital Electronics: An Introduction To Theory And Practice ,
Prentice Hall, 2nd ed. 1982
2. M. Morris Mano, Michael D Ciletti, "Digital Design", Pearson, 4th ed. 2008
3. Thomas L. Floyd, R. P. Jain, "Digital Fundamentals", Pearson, 11th ed. 2017
4. S Salivahanan, S Arivazhagan, "Digital Circuits and Design", Vikas Publishing House Pvt
Ltd., 3rd ed. 2009
5. Ronald J. Tocci, Neal S. Widmer, Gregory L. Moss, "Digital Systems", Pearson, 10th ed.
2009
6. Anil K. Maini, "Digital Electronics: Principles, Devices and Applications", Wiley-Blackwell,
2007
7. SR Flip-Flop with NAND Gates: https://circuitdigest.com/electronic-circuits/sr-flip-flop-
circuit-using-nand-gates
8. D latch: https://www.youtube.com/watch?v=peCh_859q7Q
9. JK Flip-Flop: https://www.youtube.com/watch?v=1mnowDsoAx0
10. D Type Flip-Flop: https://circuitdigest.com/electronic-circuits/d-flip-flops
11. T Flip-Flop: http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/Tflipflop.html
12. T Flip Flop Circuit: https://www.youtube.com/watch?v=wpoXdZmbIF0
75
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 14
Aim:
Verify the truth table of one bit and two-bit comparator using logic gates.
To analyse the truth table of 1-bit comparator by using NOT, AND and NOR logic gate ICs
and 2-bit comparator by using 1-input NOT, 3-input AND, 2-input AND, 3-input OR and 2-
input Ex-NOR logic gate ICs and to understand the working of 1-bit comparator and 2- bit
comparator with the help of LEDs display.
A magnitude digital comparator is a combinational circuit that compares two digital or binary
numbers in order to find out whether one binary number is equal, less than or greater than the
other binary number. We logically design a circuit for which we will have two inputs one for
A and other for B and have three output terminals, one for A > B condition, one for A = B
condition and one for A < B condition.
A comparator used to compare two bits is called a single bit comparator. It consists of two
inputs each for two single bit numbers and three outputs to generate less than, equal to and
greater than between two binary numbers. The truth table for a 1-bit comparator is given
below:
76
Figure-2: Truth Table of 1-Bit Comparator
From the above truth table logical expressions for each output can be expressed as follows:
A > B : AB'
A < B : A'B
A = B : A'B' + AB
By using these Boolean expressions, we can implement a logic circuit for this comparator as
given below :
A comparator used to compare two binary numbers each of two bits is called a 2-bit
magnitude comparator. It consists of four inputs and three outputs to generate less than, equal
to and greater than between two binary numbers.
77
Figure-4: Truth Table of 2-Bit Comparator
From the above truth table logical expressions for each output can be expressed as follows:
A > B : A1B1’ + A0B1’B0’ + A1A0B0’
A = B : A1’A0’B1’B0’ + A1’A0B1’B0 + A1A0B1B0 + A1A0’B1B0’
: A1’B1’ (A0’B0’ + A0B0) + A1B1 (A0B0 + A0’B0’)
: (A0B0 + A0’B0’) (A1B1 + A1’B1’)
: (A0 Ex-Nor B0) (A1 Ex-Nor B1)
A < B : A1’B1 + A0’B1B0 + A1’A0’B0
By using these Boolean expressions, we can implement a logic circuit for this comparator as
given below :
78
Figure-5: Logic Circuit of 2-Bit Comparator
Pretest:
Procedure:
79
1- Bit Comparator
Simulator 1:
Simulator 2:
2- Bit Comparator
Simulator 1:
80
Simulator 2:
Step-1) Enter the two bit Boolean input "A" and "B".
Step-2) Inputs should be written such that for 'A'="A1A0" and for 'B'="B1B0"
Step-3) Enter the Boolean output for your corresponding inputs.
Step-4) Click on "Check" Button to verify your output.
Step-5) Click "Print" if you want to get print out of Truth Table.
Simulation:
81
82
Post Test:
83
a: 1 b: 3 c: 2 d: 4
An identify comparator is defined as a digital comparator which has ____________ .
a: Only one output terminal b: Two output terminals c: Three output terminals
d: No output terminal
References:
84
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Electronics &Telecommunication Engineering
EXPERIMENT NO. 15
Aim:
Verify Binary to Gray and Gray to Binary conversion using NAND gates only.
To analyse the truth table of binary to gray and gray to binary converter using combination of
NAND gates and to understand the working of binary to gray and gray to binary converter
with the help of LEDs display.
https://de-iitr.vlabs.ac.in/exp/binary-conversion/
Theory:
Binary Numbers is default way to store numbers, but in many applications binary numbers
are difficult to use and a variation of binary numbers is needed. Gray code is an ordering of
the binary numeral system such that two successive values differ in only one bit (binary
digit). Gray codes are very useful in the normal sequence of binary numbers generated by the
hardware that may cause an error or ambiguity during the transition from one number to the
next. So, the Gray code can eliminate this problem easily since only one bit changes its value
during any transition between two numbers.
Gray code has property that two successive numbers differ in only one bit because of this
property gray code does the cycling through various states with minimal effort and used in K-
maps, error correction, communication etc.
In computer science many a times we need to convert binary code to gray code and vice
versa. This conversion can be done by applying following rules:
1. The Most Significant Bit (MSB) of the gray code is always equal to the MSB of the given
binary code.
2. Other bits of the output gray code can be obtained by Ex-ORing binary code bit at that index
and previous index.
There are four inputs and four outputs. The input variable are defined as B3, B2, B1, B0 and
the output variables are defined as G3, G2, G1, G0. From the truth table, combinational circuit
85
is designed. The logical expressions are defined as :
B3 = G3
B2 ⊕ B3 = G2
B1 ⊕ B2 = G1
B0 ⊕ B1 = G0
86
2) Gray to binary conversion:
1.The Most Significant Bit (MSB) of the binary code is always equal to the MSB of the given
binary number.
2.Other bits of the output binary code can be obtained by checking gray code bit at that index.
If current gray code bit is 0, then copy previous binary code bit, else copy invert of previous
binary code bit.
There are four inputs and four outputs. The input variable are defined as G3, G2, G1, G0 and
the output variables are defined as B3, B2, B1, B0. From the truth table, combinational circuit
is designed. The logical expressions are defined as :
G0 ⊕ G1 ⊕ G2 ⊕ G3 = B0
G1 ⊕ G2 ⊕ G3 = B1
G2 ⊕ G3 = B2
G3 = B3
87
Figure-4: Gray to Binary Code Converter Truth Table
Pre Test:
Procedure:
88
Gray to Binary Conversion
Step-5) Click "Print" to get the print out of the Truth Table.
Step-5) Click "Print" to get the print out of the Truth Table.
Simulation:
89
90
Post Test:
91
Reflected binary code is also known as ___________ .
a: BCD code b: Gray Code c: ASCII code d: Binary code
Code is a symbolic representation of __________ .
a: Discrete information b: Continuous information c: Decimal information into
binary d: Binary information into decimal
Convert gray code into binary code: 0101 .
a: 1001 b: 0110 c: 1101 d: 0111
References:
92