Manual For Digital Electronics Lab
Manual For Digital Electronics Lab
LABORATORY MANUAL
For
DIGITAL SYSTEM DESIGN LABORATORY (EC-392)
Department of
ELECTRONICS & COMMUNICATION ENGINEERING
1
Institute Vision:
Institute Mission:
Departmental Vision:
Departmental Mission:
M1. To offer the state-of-art infrastructure for teaching, learning, research activities and
innovative hands on engineering project.
M2. To deliver curricula to meet ever changing industry requirement and cope up with
the present trends in higher studies and research, through student centric learning
methodologies.
M3. To promote all round personality development of the students through interaction
with alumni and experts from academia and industry.
M4. To motivate and upgrade faculty members for departmental success, growth and
quality enhancement.
2
Department Program Educational Objectives (PEOs): Our Graduate will
PEO1 Utilize their domain knowledge to analyze data and technical concept for
application to higher studies, research and innovation in Electronics and
Communication engineering.
PEO2 Excel in multidisciplinary areas with modern engineering tools, techniques and
relevant software.
PEO3 Develop expressive confidence and presentation skills to bring forth celebrated
industry leaders, entrepreneurs, academicians and researchers.
PEO4 Inculcate lifelong learning, professional and ethical values for the development of
the society.
PO5. Modern tool usage: Create, select and apply appropriate techniques, resources,
and modern engineering and IT tools including prediction and modelling to complex
engineering activities with an understanding of the limitations.
3
PO6. The engineer and society: Apply reasoning informed by the contextual
knowledge to access societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
PO8. Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
PO12. Life-long learning: Recognize the need for, and have the preparation and ability
to engage in independent and lifelong learning in the broadest context of technological
change.
PSO-1. Solve real life industrial problems relevant to electronic circuits, VLSI and
nanotechnology, control system, microwave, embedded system, IoT and
communication engineering by applying current techniques, equipment, modern
engineering tools, hardware and software.
4
Course Outcome:
After this course student will be able to
CO5 Design of Multiplexer , Decoder and various logic Gates by using VHDL/Verilog
Prerequisites:
5
Syllabus
Proposed By
Maulana Abul Kalam Azad University of Technology (MAKAUT)
Digital System Design Laboratory Code: EC392
Contact: 2P
Credits: 1
Sl Name of the Experiment
No
1
6
List of Experiment Performed
Sl No Name of the Experiment
1 Introduction to Digital Electronics Lab- Nomenclature of Digital Ics, Specifications, Study of the
Data Sheet, Concept of Vcc and Ground, Verification of the Truth Tables of Logic Gates using
TTL ICs.
2 Realization the basic logic gates using universal logic gates (NAND & NOR).
3 Design and Implementation of adder and subtractor circuit using basic logic gates.
Verification of State Tables of Rs, J-k, T and D Flip-Flops using NAND & NOR
Gates
7 Design, and Verify the 4-Bit Asynchronous Counter.
8 Simulation of MOS and CMOS Inverter with different loads using PSPICE software
10 Design and Implementation of adder and subtractor circuit using Xilinx software
7
Rubrics for Hardware Experiment
Each week, students will be assessed on their participation and performance in lab. The points
each week will be totaled and combined with other assessments/report writing.
Objectives:
Outcomes:
A: Lab performance is excellent with the majority of assessments rated as proficient. The
student has attended all labs.
B: Lab performance is good with most assessments at the adequate level (with no more than
2 substandard) or above. At most, the student has one lab absence.
C: Lab performance is fair with most assessments at the Adequate and substandard levels.
The student may have been absent 2-3 times.
D: Lab performance is barely adequate with less than half of assessments at the Adequate
level or higher. The student may have been absent up 40% of total experiments.
E: Lab performance is not sufficient to pass since 50% of assignments were not completed
(or unacceptable) and/or the student missed more than 50%
8
Quality/Score Excellent (4) Good (3) Fair (2) Poor (1) Marks
Criteria
Lab Participation Student Student Student Student was
(Following Procedure demonstrates an arrives on unpreparedness absent from
+Lab Techniques+ accurate time to lab, makes it lab or did not
Subject Knowledge + understanding of but may be impossible to participate.
Contribution) the lab underprepar fully There was
objectives and ed. Answers participate. If no attempt to
concepts. They to questions able to make prior
can correctly are basic and participate, arrangements
answer questions superficial student has to make up
and if suggesting difficulty the lab.
appropriate, can that explaining key
explain concepts concepts are lab concepts.
to fellow not fully
classmates. grasped.
Lab Report Student Student has Student has Student turns
demonstrates an a basic problems with in lab report
accurate knowledge both the graphs late or the
understanding of of content, and the report is so
the lab but may lack answers. incomplete
objectives and some Student and/or so
concepts. understandin appears to have inaccurate
Questions are g of some not fully that it is
answered concepts. grasped the lab unacceptable
completely and Questions content and the
correctly. are graph(s)
Graphs are neat, answered possess
creative and fairly well multiple errors
include complete and/or
titles and graphs could
accurate units. have been
Errors, if any are done more
minimal neatly,
accurately or
with more
complete
information
9
Interaction with Very good Good Minimal No
Group (Team work) participation participation participation; participation;
with a good ; appears Shows little sits on the
leadership interested; interest; sidelines
quality; is enthusiastic doesn't pay with no
respectful of but talks attention to interaction;
others and theirover other group disinterested;
point of view; teammates; members; may No stake in
makes sure that try to help argue to get time
everyone gets a group point across; management
turn; conscious complete helps group
of time tasks; only when
somewhat asked; little
conscious of emphasis on
time time
Safety Proper safety Proper Proper safety Proper safety
precautions are safety precautions are precautions
consistently precautions often missed, are
followed. are generally consistently
followed missed;
Seldom
warned
Cleaning/Rearranging Placed all the Proper Needs to be Proper clean-
after experiment components as clean-up reminded more up
per instruction procedures than once procedures
after experiment; generally during the lab are seldom
Keep experiment followed. to use proper used.
station Station clean-up Requires
generally neat generally procedures. other’s help
and clean left clean. to complete
Consistently May need clean-up
uses proper reminding
clean-up occasionally
procedures; .
Reminds others
of their
responsibility.
Note: This document is a general guide line for a Particular Laboratory course (non
CSE/IT/MCA). It will be kept with the Laboratory manual. Teacher will complete the
Annexure after evaluation of each and every laboratory report and to be kept with student
Laboratory file.
10
Annexure
Lab Participation
Lab Report
Interaction with
Group
Safety
Cleaning/Rearrangi
ng after experiment
Total Marks with grade
20
+
Mark Evaluation Between 20-16 A (5)
Between 15-11 A (4)
Between 10-6 B+(3)
Between 5-0 B (2)
Comments:
11
EXPERIMENT -1
TITLE: - Introduction to digital electronics lab- nomenclature of digital ICs,
specifications, study of the data sheet, concept of Vcc and ground, verification of the
truth tables of logic gates using TTL ICs.
LIST OF EQUIPMENTS:
Power Supply, single strand wires, breadboard, Multi-meter, TTL IC’s
Gates IC NO.
AND 74LS08
OR 74LS32
NAND 74LS00
NOR 74LS02
NOT 74LS04
XOR 74LS86
THEORY:- Digital system are said to be constructed by using logic gates. Digital
electronics relies on the actions of just seven types of logic gates, called AND, OR,
NAND (Not AND), NOR (Not OR), XOR (Exclusive OR) XNOR (Exclusive NOR)
and NOT. Because, in binary logic there are only two states, 1 and 0 or ‘on and off,’
NOT in the world of binary logic therefore means ‘the opposite of’. If something is
not 1 it must be 0, if it is not on, it must be off. So NAND (not AND) simply means
that a NAND gate performs the opposite function to an AND gate.
12
A logic gate is a small transistor circuit. Each type of gate has one or more (most often
two) inputs and one output.
The principle of operation is that the circuit operates on just two voltage levels, called
logic 0 and logic 1. When either of these voltage levels is applied to the inputs, the
output of the gate responds by assuming a 1 or a 0 level, depending on the particular
logic of the gate. The logic rules for each type of gate can be described by a truth table.
The 7400 series is a popular set of logic ICs. 7400 chips are generally 14-pin or 16-
pin DIP packages, although other form factors are available as well.
The power supply required is +5V. For most of the 7400 chips, pin 7 is the ground
(GND) connection and pin 14 is the +5V power supply.
DATASHEET
13
Example of 7400
Series IC74LS00 Quad 2
input NAND gates
IC74LS02 Quad 2 input
NOR gates IC74LS04
Hex NOT gates
(Inverters)
14
IC74L08
OR gate: - Function of OR gate is to give output true when one of the either inputs
are true .In the remaining case output becomes false. Following table justify
the statement:
IC74LS32
15
NOT gate: -Function of NOR gate is to reverse the nature of the input .It converts
true input to false and vice versa. Following table justifies the statement :-
Input Output
(A) (B)
1 0
0 1
IC74LS04
16
Universal Gates
NAND gate: -Function of NAND gate is to give true output when one of the two
provided input are false. In the remaining output is true case .Following table
justifies the statement :-
IC 74LS00
17
NOR gate: - NOR gate gives the output true when both the two provided
input are false. In all the other cases output remains false. Following table
justifies the statement :-
IC 74LS02
18
Advanced Gates
1. XOR gate: - The function of XOR gate is to give output true only
when both the inputs are true. Following table explain this:-
IC 74LS86
19
OBSERVATION TABLE:-
Inputs NOT AND OR NAND NOR XOR XNOR
A B Y=A Y=A.B Y=A+B Y=(A.B)’ Y=(A+B)’ Y=A(+)B Y=A(.)B
(Volts) (Volts) (Volts) (Volts) (Volts) (Volts) (Volts) (Volts) (Volts)
0.00 0.00
0.00 5.00
5.00 0.00
5.00 5.00
VIVA QUESTIONS:
1. What is the full form of TTL?
2. What is the significant of 74LS and Why Each gate started from74?
3. Which gate is called Hex Inverter and why?
20
EXPERIMENT -2
TITLE: Realization of basic gates using universal gates.
OBJECTIVE: To realize the basic logic gates using universal logic gates (NAND & NOR).
LIST OF EQUIPMENT:-
THEORY::
NAND & NOR are called universal logic gates because they can be used to implement
any of the other gates (AND, OR, NOT, XOR, XNOR).
NAND GATE::
It is the complement of the AND of the inputs. It has two or more inputs and an output.
The output will be high if any or all of the inputs are low. Mathematically it can be defined as
Y=(A.B)’ .
21
NOR GATE::
It is the complement of OR of the inputs. It has two or more inputs and an output. The
output will be low if any or all of the inputs are high. Mathematically it can be defined as Y=
(A+B)’.
Implementation of various logic gates are shown below with corresponding TRUTH
TABLE.
CIRCUIT DIAGRAM:
NOT GATE:
TRUTH
TABLE
Logic symbol: Y=A’ A Y=A’
O 1
1 0
22
AND GATE:
TRUTH TABLE
A B Y=A.B
0 0 0
0 1 0
1 0 0
1 1 1
23
OR GATE::
TRUTH TABLE
A B Y=A+B
0 0 0
0 1 1
Logical symbol: 1 0 1
1 1 1
Y=A+B
24
NAND GATE:
Logical symbol
TRUTH TABLE
A B Y=(A.B)’
0 0 1
0 1 1
1 0 1
1 1 0
Y=(A.B)’
25
NOR GATE::
Logical symbol:
TRUTH TABLE
A B Y=(A+B)’
0 0 1
0 1 0
1 0 0
1 1 0
Y=(A+B)’
26
XOR GATE::
27
X-NOR GATE:
TRUTH TABLE
A B Y=A⊙B
Using NAND gate: 0 0 1
0 1 0
1 0 0
1 1 1
28
OBSERVATION TABLE::
In the table given below we shall see that the behavior of the gates tallies totally with the
experimental results.
L L H L L H H L H
L H L H H L H L
H L L L H H L H L
H H H H L L L H
VIVA QUESTIONS:
29
EXPERIMENT-3
TITLE: Implementation of half adder, full adder ,half substractor and full subtractor using logic
gates.
OBJECTIVE: To realize the operation of adder and subtractor circuit using basic logic gates.
THEORY:
A combinational circuit that performs the addition of 2 bits is called the half adder. One that
performs the addition of three bits is called a full adder.
A half adder has 2 inputs and 2 outputs. The output variables produce the sum and carry.
In full adder two input variables A and B represents the two significant bits to be added. The third
input C represents the carry from the previous lower significant position. It has two outputs sum and
carry.
A half sub tractor is a combinational circuit that subtracts two bits. It has two inputs and two outputs.
The output variables produce difference and borrow. A full subtractor is a combinational circuit that
performs subtraction between two bits taking into account one may have been borrowed by a lower
significant stage. It has three inputs and two outputs.
30
CIRCUIT DIAGRAM:
half adder
NOTE: give the Boolean expression for SUM and CARRY by yourself.
full adder
NOTE: give the Boolean expression for SUM and CARRY by yourself.
31
Half Sustractor
full subtractor
NOTE: give the Boolean expression for DIFFERENCE and BORROW by yourself.
32
Truth table for Half adder and Full Adder:
half adder
A B SUM CARRY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
33
Truth table for Half substractor
X Y Diff Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
34
Observation table for half adder and half subtractor:
A B SUM CARRY
L L L L
L H H L
H L H L
H H L H
X Y DIFF Borrow
L L L L
L H H H
H L H L
H H L L
35
Observation table for full adder and full subtractor:
Full adder
L L L L L
L L H H L
L H L H L
L H H L H
H L L H L
H L H L H
H H L L H
H H H H H
Full subtractor
36
K-Map for SUM: K-Map for CARRY:
37
K-Map for CARRY:
CARRY = AB + BC + AC
For Half Subtractor
BORROW = A’B
38
For full Subtractor
K-Map for Difference:
Difference = A’B’C + A’
39
CONCLUSION : Student will write conclusion in their own words.
VIVA QUESTIONS:
1. Can we construct a full adder and full subtractor circuit using universal gates?
2. What are the uses of full adder and full subtractor circuit?
40
EXPERIMENT NO.- 4
LIST OF EQUIPMENTS :
THEORY :-
A decoder is a combinational logic circuit that converts binary information from ‘n’ input lines
to a maximum of 2n unique output lines.
A 2 to 4 decoder is a combinational logic circuit that takes two input lines, typically labeled S0
and S1, and generates four output lines, usually labeled D0, D1, D2, and D3. The decoder
analyzes the input combination and activates the corresponding output.
41
CIRCUIT DIAGRAM:
2:4 Decoder
42
PROCEDURE:
1. Fix the required IC chips i.e.74LS32,74LS04 and 74LS08 on the bread board.
2. Connect pin no. 14 of each chip to +Vcc and pin no.7 of each chip to ground.
3. Make the other required connections as shown in the circuit diagram.
4. Verify the output and write it in the observation table.
Truth table :-
1:2 Decoder
Inputs Enable Outputs
A E Y0 Y1
X 0 0 0
0 1 1 0
1 1 0 1
2:4 Decoder
43
OBSERVATION TABLE :
1:2 Decoder
2:4 Decoder
VIVA QUESTION:
1. What are the use of DECODER circuit in practical?
2. What is an example of a decoder in real life?
3. How to implement 4 16 decoder using 3 8 decoder?
44
EXPERIMENT NO:-5(a)
OBJECT :- To construct multiplexer circuit using logic gates & to show its operation.
LIST OF EQUIPMENT’S :-
Sl No. Name Manufacturer Model No. Specification
THEORY :-
Multiplexing is the process of transmitting a large number of information over a single line. A
multiplexer is a combinational logic circuit which has 2n input line, n select and only one output
line. The selection of a particular input line is controlled by the set of select line. It determines
which inputs will go to the output.
45
CIRCUIT DIAGRAM:-
4:1 MUX
Truth table :
INPUT DATA LINES SELECT LINES OUTPUT
I0 I1 I2 I3 S0 S1 Y
1 0 0 0 0 0 1
0 1 0 0 0 1 1
0 0 1 0 1 0 1
0 0 0 1 1 1 1
46
CONCLUSION .: Student will write conclusion in their own words.
VIVA QUESTIONS:
1. What are the use of MULTIPLEXER circuit in practical?
2. Why Multiplexer is called Data selector?
47
EXPERIMENT:-(5b)
OBJECTIVE:
1) To implement a Boolean function using 8:1 MUX chip.
2) To implement full adder and full subtractor using 4:1 MUX chip.
3) To implement logic gates using 2:1 MUX chip.
THEORY:
Adigital multiplexer is a combinational circuit that selects binary information from one of the
many input lines and directs it to a single line.The selection of a particular input line is controlled
by a set of selection lines.Normally there are 2n input lines and n selection lines whose bit
combination determine which input is selected.
A B C D OUTPUT
0 0 0 0 1
0 0 0 1 1
0 0 1 0 0
0 0 1 1 1
0 1 0 0 1
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 1
Implementation Table:
I0 I1 I2 I3 I4 I5 I6 I7
Ᾱ 0 1 2 3 4 5 6 7
15
A 8 9 10 11 12 13 14
1 1 0 Ᾱ Ᾱ 0 0 A
49
Pin Configuration of 8:1 MUX.
CIRCUIT DIAGRAM:
PROCEDURE:
a) Fix the required chips i.e. 74LS151 and 74LS04 on the breadboard.
b) Connect pin np. 16 of both the chips to +Vcc and pin no. 8 to ground.
c) Make the other required connections as shown in the circuit diagram.
d) Verify the output and write the observation table.
50
OBSERVATION TABLE:
A B C D OUTPUT
A B C SUM CARRY
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Implementation Table:
Sum:
I0 I1 I2 I3
Ᾱ 0 1 2 3
A 4 5 6 7
A Ᾱ Ᾱ A
Carry:
I0 I1 I2 I3
Ᾱ 0 1 2 3
A 4 5 6 7
0 A A 1
51
Pin Configuration of Dual 4:1 MUX:
CIRCUIT DIAGRAM:
PROCEDURE:
a) Fix the required chips i.e. 74LS153 and 74LS04 on the breadboard.
b)Connect pin no. 16 of both the chips to +Vcc and pin no. 8 to ground.
c) Make the other required connections as shown in the circuit diagram.
d) Verify the output and write the observation table.
52
Observation Table:
A B C SUM CARRY
A B OUTPUT
0 0 1
0 1 1
1 0 1
1 1 0
Implementation Table:
I0 I1
Ᾱ 0 1
A 2 3
1 Ᾱ
53
Pin Configuration of Quad 2:1 MUX:
CIRCUIT DIAGRAM:
A B OUTPUT
0 0 0
0 1 1
1 0 1
1 1 1
54
Implementation Table:
I0 I1
Ᾱ 0 1
A 2 3
1 Ᾱ
CIRCUIT DIAGRAM:
PROCEDURE:
a) Fix the required chips i.e. 74LS157 and 74LS04 on the breadboard.
b) Connect pin no. 16 of both the chips to +Vcc and pin no. 8 to ground.
c) Make the other required connections as shown in the circuit diagram.
d) Verify the output and write the observation table.
55
OBSERVATION TABLE:
A B OUTPUT
***By using the above procedure implement other gates like NOT, AND, NOR, X-OR, X-
NOR and a Full Subtractor.
VIVA QUESTIONS:
1) Construct a 8:1 MUX using two 4:1 MUX.
2) Implement a full subtractor using 4:1 MUX.
3) Where we should be connected enable pin,ISTR, and 2STR pin?
56
EXPERIMENT-6
TITLE:- Realization of RS, JK and D flip flop using universal logic gates.
OBJECTIVE: To implement RS, JK and D flip flop using NAND gates.
EQUIPMENTS:
THEORY:
Flip Flops are memory elements capable of storing one bit of information. A flip flop circuit can
maintain a binary state indefinitely until directed by an input signal to switch states. A flip flop
has two states. A flip flop has two states i.e. set state when Q=1 and reset when Q=1.There are
different types of flip flops like RS,JK, D and T flip flops.
Preset (Pr) and Clear (Cr) inputs are called asynchronous inputs.
When Pr=1 and Cr=1 circuit will operate as normal flip flops.
When Pr=1 and Cr=0 the flop flop will reset.
When Pr=0 and Cr=1 the flip flop will set.
The condition Pr=Cr=0 must not be used since, this leads to uncertain state.
57
RS FLIP FLOP: Clocked RS flip flop consists of four NAND gates. When the clock input
is low the output remains unchanged. When the clock input is high, output changes
according to values of the present.
JK FLIP FLOP: JK flip flop is a refinement of an RS flip flop. The undefined states in a
SR flip flop are defined in a JK flip flop.
D FLIP FLOP:D flip flop receives its designation from its ability to transfer data into a
flip flop. It is basically. An SR flip flop with an inverter at the R input.
CIRCUIT DIAGRAM:-
58
SR FLIP FLOP
JK FLIP FLOP
59
Truth Table:
1 1 1 0 0 0 0 1
(previous
condition)
1 1 1 0 0 1 1 0
(previous
condition)
1 1 1 0 1 0 0 1
1 1 1 0 1 1 0 1
1 1 1 1 0 0 1 0
1 1 1 1 0 1 1 0
1 1 1 1 1 0 undefined undefined
1 1 1 1 1 1 undefined undefined
60
b) JK flip flop
1 1 1 0 0 0 0 1
(previous
condition)
1 1 1 0 0 1 1 0
(previous
condition)
1 1 1 0 1 0 0 1
1 1 1 0 1 1 0 1
1 1 1 1 0 0 1 0
1 1 1 1 0 1 1 0
1 1 1 1 1 0 1 (Toggle 0
State)
1 1 1 1 1 1 0 (Toggle 1
State)
61
c)D flip flop
Clear D Qn _
Clock Preset Qn+1
Cr Qn+1
Pr
CLK
1 1 1 0 0 0 1
1 1 1 0 1 0 1
1 1 1 1 0 1 0
1 1 1 1 1 1 0
OBSERVATION TABLE:
a)RS flip flop
Clock Preset Clear Qn+1 .
CK S R Qn
Pr Cr Qn+1
H H H L L L L H
H H H L L H H L
H H H L H L L H
H H H L H H L H
H H H H L L H L
H H H H L H H L
H H H H H L H H
(undefined) (undefined)
H H H H H H H H
(undefined) (undefined)
62
OBSERVATION TABLE:
b) JK flip flop
H H H L L L L H
(previous
condition)
H H H L L H H L
(previous
condition)
H H H L H L L H
H H H L H H L H
H H H H L L H L
H H H H L H H L
H H H H H L H L
(Toggle
State)
H H H H H H L (Toggle H
State)
63
c)D flip flop
OBSERVATION TABLE:
Qn _
Clock Preset Clear D Qn+1
Qn+1
Pr
CLK Cr
H H H L L L H
H H H L H L H
H H H H L H L
H H H H H H L
VIVA QUESTIONS:-
1. What is Latch?
2. What is the difference between combinational and sequential ckt.?
3. How a RS F/F is converted in a D F/F?
64
EXPERIMENT -7
THEORY:-
A counter is a circuit used for counting the number of pulses. There are two types of counters-
asynchronous counter and synchronous counter. In synchronous counter all the flip-flops are
clocked simultaneously.
A counter can count in the UP direction i.e. the decimal equivalent of the counter output
increases with successive clock pulses. It is also possible to make a counter in which the decimal
equivalent of the counter output decreases with successive clock pulses i.e. the counting process
in the DOWN direction. The former is referred to as an UP counter and later as a DOWN
counter.
The UP/DOWN operation can be combined in one circuit. A Synchronous UP/DOWN counter is
one which can count both in UP/DOWN direction depending on the status of the control input.
65
SEQUENCE OF COUNTER:
0 1 0 0 0
0 1 0 1 1
0 1 1 0 2
0 1 1 1 3
1 0 1 1 3
1 0 1 0 2
1 0 0 1 1
1 0 0 0 0
OBSERVATION TABLE:
L H L L 0
L H L H 1
L H H L 2
L H H H 3
H L H H 3
H L H L 2
H L L H 1
H L L L 0
66
JK FLIP FLOP
67
CIRCUIT DIAGRAM FOR 2-BIT ASYNCHRONOUS UP/DOWN COUNTER
68
TIMING DIAGRAM FOR 2-BIT ASYNCHRONOUS UP COUNTER
69
CONCLUSION .; Student will write conclusion in their own words.
VIVA QUESTIONS:
1.What is the difference between Synchronous and Asynchronous counter?
2.Draw the Timing diagram for down counter.
3. what do you mean by clock triggering?
4. What are the different types of clock trigger?
70
EXPERIMENT NO:-8
OBJECTIVE: Simulation of NMOS Inverter using different resistive load using PSPICE.
THEORY: As shown in the circuit diagram, the drain terminal is connected to the supply
voltage (Vdd) via a resistance (R). The source terminal is grounded and the input is given at the
gate terminal.
Now, when Gate is at logic 1 or high , the n-MOS is activated (turned on) and thus a low
resistance path is generated from vdd to ground. So, the output voltage is negligibly low or is at
logic ‘0’. Similarly when Gate is at logic ‘0’ or low, n-MOS remain off, so vout is directly
connected to vdd, hence it is at logic high. So, whatever is the input the gate terminal, the
inverted or complementary output is obtained at the output terminal.
TRUTH TABLE:
INPUT(A) OUTPUT(A̅)=Y
0 1
1 0
71
CIRCUIT DIAGRAM:
72
OUTPUT WAVEFORM:
VIVA QUESTIONS:
73
EXPERIMENT NO-9
OBJECTIVE: To design XOR gate and simulate its operation using Xilinx Software and
VHDL in dataflow model.
THEORY:
XOR gates have two inputs and one output and they implement the special Boolean logic of
inequality detection. The EXOR gate gives a high output every time it detects an inequality in
the inputs. Its equation is as follows Y (A xor B) = AB’ + A’B
This can be implemented using VHDL codes and can be simulated using a Verilog
program. It is verified by matching the output waveform with theoretical
knowledge.
74
VHDL PROGRAM:
entity XOR1 is
port(a: in STD_LOGIC;b: in STD_LOGIC;c: out STD_LOGIC;);
end XOR1;
architecture dataflow of XOR1 is
begin
c<=a XOR b;
end dataflow;
VERILOG PROGRAM:
Module XOR1
Reg a;
Reg b;
wire c;
XOR1 uut (a(a);b(b);c(c););
Initial begin
a=0;
b=0;
#100;
a=0;
b=1;
75
#100
a=1;
b=0;
#100
a=1;
b=1;
#100
End;
End module;
OUTPUT WAVEFORM:
76
CONCLUSION : Student will write conclusion in their own words.
VIVA QUESTIONS:
77
EXPERIMENT NO-10
THEORY:
S=A XOR B;
C=A AND B;
CIRCUIT DIAGRAM:
78
Truth Table:
Half adder
A B SUM CARRY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
This can be implemented using VHDL codes and can be simulated using a Verilog program. It is
verified by matching the output waveform with theoretical knowledge.
VHDL PROGRAM:
entity HA is
port(a: in STD_LOGIC;b: in STD_LOGIC;S: out STD_LOGIC;
C: out STD_LOGIC;);
end HA;
architecture dataflow of XOR1 is
Begin
S<=a XOR b;
C<=a AND b;
end dataflow;
79
VERILOG PROGRAM:
Module HA
Reg a;
Reg b;
Wire s;
Wire c;
XOR1 uut (.a(a);.b(b);.C(C);.S(S));
Initial begin
a=0;
b=0;
#100;
a=0;
b=1;
#100
a=1;
b=0;
#100
a=1;
b=1;
#100
End;
End module;
80
OUTPUT WAVEFORM:
VIVA QUESTIONS:
81
EXPERIMENT NO-11
THEORY:
A multiplexer is a data selector. It has multiple inputs, out of which it selects one and connects
that one to the output. This selection is done on the basis of the values of the select inputs. In this
program, we will write the VHDL code for a 4:1 Mux. A 4:1 mux will have two select inputs.
Since we are using behavioral architecture, it is necessary to understand and implement the logic
circuit’s truth table.
82
Truth table of a 4:1 Mux:
I0 I1 I2 I3 S0 S1 Y
I0 x x x 0 0 I0
x I1 x x 0 1 I1
x x I2 x 1 0 I2
x x x I3 1 1 I3
VHDL PROGRAM:
entity MUX_SOURCE is
Port ( S : in STD_LOGIC_VECTOR (1 downto 0);
I : in STD_LOGIC_VECTOR (3 downto 0);
Y : out STD_LOGIC);
end MUX_SOURCE;
architecture Behavioral of MUX_SOURCE is
begin
process (S,I)
begin
if (S <= "00") then
83
Y <= I(0);
elsif (S <= "01") then
Y <= I(1);
elsif (S <= "10") then
Y <= I(2);
else
Y <= I(3);
end if;
end process;
end Behavioral;
VERILOG PROGRAM:
module MUX_SOURCE;
reg [3:0] a;
reg [3:0] b;
reg [3:0] c;
reg [3:0] d;
wire [3:0] out;
reg [1:0] sel;
integer i;
MUX_SOURCE mux0 ( .a (a),
.b (b),
.c (c),
.d (d),
.sel (sel),
.out (out));
84
initial begin
// Launch a monitor in background to display values to log whenever a/b/c/d/sel/out changes//
$monitor ("[%0t] sel=0x%0h a=0x%0h b=0x%0h c=0x%0h d=0x%0h out=0x%0h", $time, sel, a,
b, c, d, out);
sel <= 0;
a <= $random;
b <= $random;
c <= $random;
d <= $random;
85
OUTPUT WAVEFORM:
VIVA QUESTIONS:
1. What is VHDL?
2. Are Verilog/vhdl Concurrent Or Sequential Language In Nature? ...
3. What is multiplexer in VHDl?
86
EXPERIMENT NO-12
THEORY:
A decoder is a combinational logic circuit that converts binary information from ‘n’ input lines
to a maximum of 2n unique output lines.
CIRCUIT DIAGRAM:
87
VHDL CODE:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decoder2to4 is
Port ( a : in
STD_LOGIC;
b : in STD_LOGIC;
z0 : out
STD_LOGIC; z1 :
out STD_LOGIC;
z2 : out
STD_LOGIC; z3 :
out
88
STD_LOGIC);
end decoder2to4;
begin
process(a,b)is
begin
if(a<='0' and b<='0')
then z0<='1';
z1<='0';
z2<='0';
z3<='0';
z0<='0';
z1<='1';
z2<='0';
z3<='0';
89
z2<='1';
z3<='0';
end Behavioral;
VERILOG CODE:
module decoder2to1;
//
Inputs
reg a;
reg b;
// Outputs wire z0; wire z1; wire z2; wire z3;
decoder2to4 uut (
90
.a(a),
.b(b),
.z0(z0),
.z1(z1),
.z2(z2),
.z3(z3)
);
initial begin
// Initialize Inputs
a = 0;
b = 0;
#100;
// Initialize Inputs
a = 0;
b = 1;
#100;
// Initialize Inputs
91
a = 1;
b = 0;
#100;
// Initialize Inputs
a = 1;
b = 1;
#100;
End module;
92
OUTPUT WAVEFORM:
VIVA QUESTIONS:
1. What are the IEEE STD-LOGIC_1164 data type for single logic signals and Buses?
2. What are the numerical data type?
3. What are the only two values for a Boolean type?
93
EXPERIMENT NO.-13
THEORY:
A JK flip-flop is a refinement of the SR flip-flop in that the indeterminate state of the SR type is
defined in the JK type. Inputs J and K behave like inputs S and R to set and clear the flip-flop
(note that in a JK flip-flop, the letter J is for set and the letter K is for clear). We will write the
VHDL code for a JK Flip/Flop.
CIRCUIT DIAGRAM:
94
Truth table of a JK Flip/Flop:
JK flip flop
1 1 1 0 0 0 0 1
(previous
condition)
1 1 1 0 0 1 1 0
(previous
condition)
1 1 1 0 1 0 0 1
1 1 1 0 1 1 0 1
1 1 1 1 0 0 1 0
1 1 1 1 0 1 1 0
1 1 1 1 1 0 1 (Toggle 0
State)
1 1 1 1 1 1 0 (Toggle 1
State)
95
VHDL Code:
entity jjff is
Port ( j : in
STD_L
OGIC; k
: in
STD_L
OGIC;
q1 : in
STD_L
OGIC; c
: in
STD_L
OGIC;
q2 : out STD_LOGIC);
end jjff;
architecture Behavioral
of jjff is begin
process(
j,k,q1,c)
is begin
if(j<='0' and k<='0' and q1<='0'
and c<='0') then q2<='0';
elsif(j<='0' and k<='0' and q1<='0'
and c<='1') then q2<='0';
elsif(j<='0' and k<='0' and q1<='1'
and c<='0') then q2<='0';
elsif(j<='0' and k<='0' and q1<='1'
and c<='1') then q2<='1';
elsif(j<='0' and k<='1' and q1<='0'
and c<='0') then q2<='0';
elsif(j<='0' and k<='1' and q1<='0'
and c<='1') then q2<='0';
elsif(j<='0' and k<='1' and q1<='1'
and c<='0') then q2<='0';
elsif(j<='0' and k<='1' and q1<='1'
and c<='1') then q2<='0';
96
elsif(j<='1' and k<='0' and q1<='0'
and c<='0') then q2<='0';
elsif(j<='1' and k<='0' and q1<='0'
and c<='1') then q2<='1';
elsif(j<='1' and k<='0' and q1<='1'
and c<='0') then q2<='0';
elsif(j<='1' and k<='0' and q1<='1'
and c<='1') then q2<='1';
elsif(j<='1' and k<='1' and q1<='0'
and c<='0') then q2<='0';
elsif(j<='1' and k<='1' and q1<='0'
and c<='1') then q2<='1';
elsif(j<='1' and k<='1' and q1<='1'
and c<='0') then q2<='0';
elsif(j<='1' and k<='1' and q1<='1' and c<='1') then
q2<='0';
end if;
end process; end Behavioral;
VERILOG Code
module JKFF;
//
Inputs
reg j;
reg k;
reg q1;
reg c;
// Outputs wire q2; j j f f u u t
(
.j(j),
.k(k),
.q1(q1),
.c(c),
.q2(q2)
);
97
j = 0;
k = 0;
q1 = 0;
c = 0;
#100;
j = 0;
k = 0;
q1 = 0;
c = 1;
#100;
j = 0;
k = 0;
q1 = 1;
c = 0;
#100;
j = 0;
k = 0;
q1 = 1;
c = 1;
#100;
j = 0;
k = 1;
q1 = 0;
c = 0;
#100;
j = 0;
k = 1;
q1 = 0;
c = 1;
#100;
j = 0;
k = 1;
q1 = 1;
c = 0;
#100;
j = 0;
98
k = 1;
q1 = 1;
c = 1;
#100;
j = 1;
k = 0;
q1 = 0;
c = 0;
#100;
j = 1;
k = 0;
q1 = 0;
c = 1;
#100;
j = 1;
k = 0;
q1 = 1;
c = 0;
#100;
j = 1;
k = 0;
q1 = 1;
c = 1;
#100;
j = 1;
k = 1;
q1 = 0;
c = 0;
#100;
j = 1;
k = 1;
q1 = 0;
c = 1;
#100;
99
j = 1;
k = 1;
q1 = 1;
c = 0;
#100;
j = 1;
k = 1;
q1 = 1;
c = 1;
#100;
End module;
WAVEFORM:
VIVA QUESTIONS:-
1. Why is it called JK flip flop?
2. What is the condition on JK F/F to work as D F/F?
3. How to calculate output of JK flip flop?
100