DLD - DE LAB
DLD - DE LAB
LAB MANUAL
Prepared By
1
DIGITAL LOGIC DESIGN LAB MANUAL
Name:_____________________________________________
H.T.No:____________________________________________
Year/Semester:______________________________________
2
CHAITANYA DEEMED TO BE UNIVERSITY, HYDERABAD
Dept. of Electronics and Communication Engineering
Mission_2: To enable students to develop skill sets through adequate facilities, training on core
and multidisciplinary technologies and Competency Enhancement Programs.
Mission_3: To provide training, instill creative thinking and research attitude to the students
through Industry-Institute Interaction along with Professional Ethics and values.
PEO 1: To prepare the graduates to be able to plan, analyze and provide innovative ideas to
investigate complex engineering problems of industry in the field of Electronics and
Communication Engineering using contemporary design and simulation tools.
PEO-2: To provide students with solid fundamentals in core and multidisciplinary domain for
successful implementation of engineering products and also to pursue higher studies.
PEO-3: To inculcate learners with professional and ethical attitude, effective communication
skills, teamwork skills, and an ability to relate engineering issues to broader social context at
work place
3
Programme Outcomes(Pos)
4
CHAITANYA DEEMED TO BE UNIVERSITY, HYDERABAD
II B.Tech. III-Sem (EEE)
DIGITAL LOGIC DESIGN LABORATORY
COURSE OUTCOMES(COS)
CO1 Understand the pin configuration of various digital ICs used in the lab
CO2 Conduct the experiment and verify the properties of various logic circuits.
CO3 Analyze the sequential and combinational circuits.
CO4 Design of any sequential/combinational circuit using Hardware
PART A:
LIST OF EXPERIMENTS:
1. Verification of truth tables of the following Logic gates
Two input (i) OR (ii) AND (iii) NOR (iv) NAND (v) Exclusive-OR (vi) Exclusive-NOR
2. Design a simple combinational circuit with four variables and obtain minimal expression
and verify the truth table using Digital Trainer Kit.
3. Verification of functional table of 3 to 8-line Decoder /De-multiplexer.
4. 4variable logic function verification using 8 to1 multiplexer.
5. Design full adder circuit and verify its functional table.
6. Verification of functional tables of (i) JK Edge triggered Flip–Flop (ii) JK Master Slav
Flip–Flop (iii) D Flip-Flop
7. Design a four-bit ring counter using D Flip–Flops/JK Flip Flop and verify output
8. Design a four bit Johnson’s counter using D Flip-Flops/JK Flip Flops and verify output
9. Verify the operation of 4-bit Universal Shift Register for different Modes of operation.
10. Draw the circuit diagram of MOD-8 ripple counter and construct a circuit using T-Flip-
Flops and Test It with a low frequency clock and sketch the output waveforms.
11.Design MOD–8 synchronous counter using T Flip-Flop and verify the result and sketch
the output waveforms.
12. (a) Draw the circuit diagram of a single bit comparator and test the output
(b) Construct 7 Segment Display Circuit Using Decoder and7 Segment LED and test it.
5
CHAITANYA DEEMED TO BE UNIVERSITY, HYDERABAD
HARDWARE EXPERIMENTS
1. Logic Gates.
4. 8 to1 multiplexer.
5. Full adder.
6. Functional tables of (i) JK Edge triggered Flip–Flop (ii) JK Master Slav Flip–Flop (iii) D
Flip-Flop.
ADDITIONAL EXPERIMENTS:
6
CONTENTS
4 8 to1 multiplexer.
Full adder.
5
Functional tables of (i) JK Edge triggered Flip–Flop (ii) JK Master
6 Slav Flip–Flop (iii) D Flip-Flop.
7 Four-bit ring counter using D Flip–Flops/JK Flip Flop.
ADDITIONAL EXPERIMENTS
1 BCD Adder Circuit.
7
DOS & DONTS IN LABORATORY
DO’s
8
SCHEME OF EVALUATION
Marks Awarded
Total
S.No Program Date Record Obs. Viva Attd. 35(M)
(10M) (15M) (5M) (5M)
1 Logic Gates.
Design of combinational
2 circuits with four
variables.
3 to 8-line Decoder /De-
3
multiplexer.
4 8 to1 multiplexer.
5 Full adder.
Functional tables of (i)
JK Edge triggered Flip–
6 Flop (ii) JK Master Slav
Flip–Flop (iii) D Flip-
Flop.
Four-bit ring counter
7 using D Flip–Flops/JK
Flip Flop.
Four bit Johnson’s
8 counter using D Flip-
Flops/JK Flip Flops.
9 4-bit Universal Shift
Register.
10 MOD-8 ripple counter
using T-Flip-Flops.
MOD–8 synchronous
11 counter using T Flip-
Flop.
A. single bit comparator
B.7 Segment Display
12
Circuit Using Decoder
and7 Segment LED
ADDITIONAL EXPERIMENTS
1 BCD Adder Circuit.
2 74154 De-Multiplexer
using LEDs for outputs.
9
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAMS:
NOT GATE
OR GATE
AND GATE
NAND GATE
10
DLD/DE LABORATORY II B.Tech III Sem
EXP.NO : DATE:
LOGIC GATES
AIM: Verification of Truth Table for AND, OR, NOT, NAND, NOR and EX-OR gates.
APPARATUS REQUIRED:
THEORY:
The basic logic gates are the building blocks of more complex logic circuits. These logic
gates perform the basic Boolean functions, such as AND, OR, NAND, NOR, Inversion,
Exclusive-OR, Exclusive-NOR. Fig. below shows the circuit symbol, Boolean function, and
truth. It is seen from the Fig that each gate has one or two binary inputs, A and B, and one
binary output, C. The small circle on the output of the circuit symbols designates the logic
complement. The AND, OR, NAND, and NOR gates can be extended to have more than
two inputs. A gate can be extended to have multiple inputs if the binary operation it
represents is commutative and associative.
11
DLD/DE LABORATORY II B.Tech III Sem
NOR GATE
XOR GATE
EX-NOR GATE
12
DLD/DE LABORATORY II B.Tech III Sem
PROCEDURE:
3. Switch on the supply on the trainer and verify the truth table of the gates
RESULT:
CONCLUSION:
VIVA QUESTIONS:
3. Give the truth table for EX-NOR and realize using NAND gates?
13
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
FUNCTION TABLE
SELECTION
STROBE
LINES OUTPUTS
C B A E Y Y
X X X 1 0 1
0 0 0 0 D0 D0
0 0 1 0 D1 D1
0 1 0 0 D2 D2
0 1 1 0 D3 D3
1 0 0 0 D4 D4
1 0 1 0 D5 D5
1 1 0 0 D6 D6
1 1 1 0 D7 D7
14
DLD/DE LABORATORY II B.Tech III Sem
EXP NO : DATE:
APPARATUS REQUIRED:
Digital trainer board, IC 74151, IC 7404, IC 7432, patch cords, + 5V Power supply
THEORY:
1 .What is multiplexer?
Multiplexer is a digital switch which allows digital information from several sources to
be routed onto a single output line. Basic multiplexer has several data inputs and a single
output line. The selection of a particular input line is controlled by a set of selection line.
There are 2n input lines & n is the number of selection line whose bit
combinations determines which input is selected .It is “Many into One”.
Strobe: - It is used to enable/ disable the logic circuit OR ‘E’ is called as enable I/P which
is generally active LOW. It is used for cascading MUX is a single pole multiple way switch.
2. Necessity of multiplexer?
In most of the electronic systems, digital data is available on more than one lines. It is necessary
to route this data over a single line. It select one of the many I/P at a time.
Multiplexer improves the reliability of digital system because it reduces the number of
external wire connection.
15
DLD/DE LABORATORY II B.Tech III Sem
Example:
SELECTION STROB
LINES E OUTPUTS
C B A Y Y
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 0
0 1 1 0 1 0
1 0 0 0 1 0
1 0 1 0 1 0
1 1 0 0 1 0
1 1 1 0 1 0
SOP Y = ∑m (1, 2, 3, 4, 5, 6, 7)
Solution:- Since there are 3 variable, the multiplexer have 3 select I/P should be used. Hence one
8:1 mux should be used.
Ste p 1:-Identify the number decimal corresponding to each minterm.
Here 1,2,3,4,5,6,7
Step 2:-Connect the data input lines 1,2,3,4,5,6,7 to logic 1(+Vcc) &
remaining input line 0 to logic 0(GND)
Step 3:-Connect variables A, B & C to select input.
16
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
5. What is a multiplexer?
LOGIC DIAGRAM:
17
DLD/DE LABORATORY II B.Tech III Sem
18
DLD/DE LABORATORY II B.Tech III Sem
APPARATUS REQUIRED:
ENCODER:
An encoder is a device, circuit, transducer, software program, algorithm or person that converts
information from one format or code to another, for the purposes of standardization, speed,
secrecy, security, or saving space by shrinking size. An encoder has M input and N output
lines. Out of M input lines only one is activated at a time and produces equivalent code on
output N lines. If a device output code has fewer bits than the input code has, the device is
usually called an encoder. For example Octal-to-Binary Encoder take 8 inputs and provides 3
outputs, thus doing the opposite of what the 3-to-8 decoder does. At any one time, only one
input line has a value of 1. The figure below shows the truth table of an Octal-to-binary
encoder.
For an 8-to-3 binary encoder with inputs I0-I7 the logic expressions of the outputs Y0-
Y2 are:
Y0=I1+I3+I5+I7Y1=I2+I3+I6+I7Y2=I4+I5+I6+I7
DECODER:
A decoder is a device which does the reverse operation of an encoder, undoing the encoding so
that the original information can be retrieved. The same method used to encode is usually just
reversed in order to decode. It is a combinational circuit that converts binary information from
n input lines to a maximum of 2n unique output lines. In digital electronics, a decoder can take
the form of a multiple-input, multiple-output logic circuit that converts coded inputs into coded
outputs, where the input and output codes are different. e.g. n-to-2n, binary-coded decimal
decoders. Enable inputs must be on for the decoder to function, otherwise its outputs assume a
single "disabled" output code word. In case of decoding all combinations of three bits eight
(23=8) decoding gates are required. This type of decoder is called 3-8 decoder because 3 inputs
and 8 outputs. For any input combination decoder outputs are 1.
19
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
20
DLD/DE LABORATORY II B.Tech III Sem
DEMULTIPLEXER:
PROCEDURE:
PRECAUTIONS:
RESULT:
CONCLUSION:
VIVA QUESTIONS:
2. What is demultiplexer?
21
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
FUNCTION TABLE
SELECTION STROBE
LINES OUTPUTS
C B A E Y Y
X X X 1 0 1
0 0 0 0 D0 D0
0 0 1 0 D1 D1
0 1 0 0 D2 D2
0 1 1 0 D3 D3
1 0 0 0 D4 D4
1 0 1 0 D5 D5
1 1 0 0 D6 D6
1 1 1 0 D7 D7
22
DLD/DE LABORATORY II B.Tech III Sem
8:1 MULTIPLEXER
AIM: 3 variable logic function verification using 8 to1 multiplexer.
APPARATUS REQUIRED:
THEORY:
The Multiplexers or data selector is a logic circuit that selects one out of several
inputs to a single output. The input selected is controlled by a set of select lines. For selecting
one output line from n-input lines, a set of m-select lines is required. The relationship
between the number of input lines and the select lines is given by 2 m = n.
PROCEDURE:
1. Connections are made as shown in the logic diagram using the pin details of the
gates.
2. Connect Vcc and GND to respective pins of each IC.
3. Connect the data, select and enable inputs to the toggle switches and outputs to the
LED‟s
4. Switch on the Trainer
5. Verify the truth table of the Multiplexer.
INPUTS OUTPUTS
S COUT
X Y 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
23
DLD/DE LABORATORY II B.Tech III Sem
Sum = Σm (1,2,4,7)
Carry = Σm (3,5,6,7)
RESULT :
24
DLD/DE LABORATORY II B.Tech III Sem
CONCLUSION:
VIVA QUESTIONS:
1. What is a multiplexer?
3. What is a de-multiplexer?
25
DLD/DE LABORATORY II B.Tech III Sem
CIRCUIT DIAGRAM:
TRUTH TABLE
26
DLD/DE LABORATORY II B.Tech III Sem
APPARATUS REQUIRED:
THEORY:
Full adder
A Full adder is a combinational circuit that performs addition of three input bits. Half adder
has inputs X, Y, Z and outputs sum (S) and carry(C). The truth table is
27
DLD/DE LABORATORY II B.Tech III Sem
28
DLD/DE LABORATORY II B.Tech III Sem
A full adder can also be implemented using two half adders and one OR gate as shown in
fig.The sum output from second half adder is
C=xy+yz+xz
PROCEDURE:
1. The IC’s are placed on the bread board.
2. A voltage of +5V is applied to pin no.14 and –Ve is applied to pin no.7.
3. Inputs and Outputs are connected according the gates which are taken. 10.
For the input 1 we have to connect the input terminal to +5V and for 0 to –Ve.
4. Output is verified in LED. If the LED is ON the output is 1, if OFF it is 0.According to
the Logic gates truth table we have to verify the inputs and outputs.
RESULT:
CONCLUSION
VIVA QUESTIONS:
29
DLD/DE LABORATORY II B.Tech III Sem
CIRCUIT IMPLEMENTATION:
Where
Q Present State
Characteristic eqn Q t + 1 = J Q + K Q
Inputs Outputs
Q J K Qt + 1
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
30
DLD/DE LABORATORY II B.Tech III Sem
AIM: Verification of functional tables of (i) JK Edge triggered Flip–Flop (ii) JK Master Slav Flip–
Flop (iii) D Flip-Flop
APPARATUS REQUIRED:
THEORY:
Basically Flip-Flops are the bistable multivibrators that stores logic 1 and logic 0.Shift
registers, memory, and counters are built by using Flip – Flops. Any complex sequential
machines are build using Flip – Flops. Sequential circuit (machine) output depends on the
present state and input applied at that instant.
Mealy Machine is one whose output depends on both the present state and the input.
Moore machines one whose output depends only on the present state of the sequential circuit.
Note that the truth table of J – K Flip – Flop is same as the Master – Slave.
J – K Flip Flop and they must be remain same because IC – 7476is –ve edge trigged flip
– flop and we know that race around condition is eliminated by edge triggered flip – flop.
Another way of eliminating race around condition is by using Master – Slave J –K Flip – Flop.
When J = K = 1 (logic HIGH), J – K Flip – Flop changes output many times for single clock
pulse, it is Smaller than width of the clock pulse.
CIRCUIT IMPLEMENTATION:
32
DLD/DE LABORATORY II B.Tech III Sem
Where
Q Present State
Qt+1 Next State
Input Outputs
s
Q J K Qt + 1
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0 Characteristic eqn Q t+1 =J Q+ K Q
PROCEDURE:
1) Connections are made as per the circuit diagram.
2) Apply the –ve edge triggered, +ve edge triggered and level sensitive
clock pulses as required.
3) Verify the truth table of all the Flip – Flops.
4) Switch - off the power supply and disconnect the circuit.
RESULT:
CONCLUSION:
VIVA QUESTIONS:
1. What is flip-flop?
33
DLD/DE LABORATORY II B.Tech III Sem
CIRCUIT IMPLEMENTATION:
Where
Q Present State
D Data Input
Qt + 1 Next State
Characteristic eqn Qt + 1 = D
34
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
35
DLD/DE LABORATORY II B.Tech III Sem
APPARATUS REQUIRED:
THEORY:
Ring counter and Johnson counters are basically shift registers Ring
Ring counter:
As it can be seen from the truth table there are four unique output stages for this counter. The
modulus value of a ring counter is n, where n is the number of flip flops. Ring counter is
called divided by N counter where N is the number of FF
PROCEDURE:
1. Set up the ring counter and set clear Q outputs using PRESET and apply mono pulse.
2. Note down the state of the ring counter on the truth table for successive clock 0.
36
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
COCLUSION:
VIVA QUESTIONS:
37
DLD/DE LABORATORY II B.Tech III Sem
AIM: Design a four bit Johnson’s counter using D Flip-Flops/JK Flip Flops.
APPARATUS REQUIRED:
THEORY:
The modulus value of a ring counter can be doubled by making a small change in the ring counter circuit.
The Q‟ and Q of the last FFS are connected to the J and K input of the first FFrespectively. This is the
Johnson counter.
Initially the FFs are reset. After first clock pulse FF0 is set and the remaining FFs are reset.
After the eight clock pulse all the FFS are reset. There are eight different conditions creating a
mode 8 Johnson counter. Johnson counter is called a twisted ring counter or divide by 2N
counter.
PROCEDURE:
1. Set up the Johnson counter and set clear Q outputs using PRESET and apply mono
pulse.
2. Note down the state of the Johnson counter on the truth table for successive clock 0.
38
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
39
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
COCLUSION:
VIVA QUESTIONS:
2. What is the difference between the counting sequence of an up counter and a down
counter?
40
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
41
DLD/DE LABORATORY II B.Tech III Sem
AIM: Verify the operation of 4-bit Universal Shift Register for different Modes of operation.
THEORY:
Shift registers are the sequential logic circuits that can store the data temporarily and provides the
data transfer towards its output device for every clock pulse. These are capable of
transferring/shifting the data either towards the right or left in serial and parallel modes. Based on
the mode of input/output operations, shift registers can be used as a serial-in-parallel-out shift
register, serial-in-serial-out shift register, parallel-in-parallel-out shift register, parallel-in-
parallel-out shift register. Based on shifting the data, there are universal shift registers and
bidirectional shift registers. Here is a complete description of the universal shift register.
What is a Universal Shift Register?
Definition: A register that can store the data and /shifts the data towards the right and left along
with the parallel load capability is known as a universal shift register. It can be used to perform
input/output operations in both serial and parallel modes. Unidirectional shift registers and
bidirectional shift registers are combined together to get the design of the universal shift register.
It is also known as a parallel-in-parallel-out shift register or shift register with the parallel load.
Universal shift registers are capable of performing 3 operations as listed below.
• Parallel load operation – stores the data in parallel as well as the data in parallel
• Shift left operation – stores the data and transfers the data shifting towards left in the
serial path
• Shift right operation – stores the data and transfers the data by shifting towards right in
the serial path.
Hence, Universal shift registers can perform input/output operations with both serial and parallel
loads.
• Serial input for shift-right control enables the data transfer towards the right and all the
serial input and output lines are connected to the shift-right mode. The input is given to
the AND gate-1 of the flip-flop -1 as shown in the figure via serial input pin.
• Serial input for shift-left enables the data transfer towards the left and all the serial input
and output lines are connected to shift-left mode.
• In parallel data transfer, all the parallel inputs and outputs lines are associated with the
parallel load.
• Clear pin clears the register and set to 0.
• CLK pin provides clock pulses to synchronize all the operations.
• In the control state, the information or data in the register would not change even though
the clock pulse is applied.
• If the register operates with a parallel load and shifts the data towards the right and left,
then it acts as a universal shift register.
• From the above figure, selected pins the mode of operation of the universal shift register.
Serial input shifts the data towards the right and left and stores the data within the register.
42
DLD/DE LABORATORY II B.Tech III Sem
FUNCTION TABLE:
S0 S1 Mode of Operation
0
0 Locked state (No change)
0
1 Shift-Left
Shift-Right
1 0
Parallel Loading
1 1
43
DLD/DE LABORATORY II B.Tech III Sem
PROCEDURE:
1. S0 and S1 are the selected pins that are used to select the mode of operation of this
register. It may be shift left operation or shift right operation or parallel mode.
2. Pin-0 of first 4×1Mux is fed to the output pin of the first flip-flop. Observe the
connections as shown in the figure.
3. Pin-1 of the first 4X1 MUX is connected to serial input for shift right. In this mode, the
register shifts the data towards the right.
4. Similarly, pin-2 of 4X1 MUX is connected to the serial input for shift-left. In this mode,
the universal shift register shifts the data towards the left.
5. M1 is the parallel input data given to the pin-3 of the first 4×1 MUX to provide parallel
mode operation and stores the data into the register.
6. Similarly, remaining individual parallel input data bits are given to the pin-3 of related
4X1MUX to provide parallel loading.
7. F1, F2, F3, and F4 are the parallel outputs of Flip-flops, which are associated with the 4×1
MUX.
44
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
2. Explain the operation of a left shift register & a right shift register?
5. Explain the various modes in which the data can be entered or taken out from a register?
45
DLD/DE LABORATORY II B.Tech III Sem
AIM: Draw the circuit diagram of MOD-8 ripple counter and construct a circuit using T-Flip-Flops
and Test It with a low frequency clock and sketch the output waveforms.
APPARATUS REQUIRED:
IC 7474 (T- Flip-flop), Digital Trainer Kit, patch cords, +5V power supply.
THEORY:
Asynchronous counter:
A digital counter is a set of flip flop. An Asynchronous counter uses T flip flop to perform a
counting function. The actual hardware used is usually J-K flip-flop connected to logic 1.
In ripple counter, the first flip-flop is clocked by the external clock pulse & then each successive
flip-flop is clocked by the Q or /Q‘ output the previous flip-flop. Therefore in an asynchronous
counter the flip-flop are not clocked simultaneously. The input of MS-JK is connected to VCC
because when both inputs are one output is toggled. As MS-JK is negative edge triggered at each
high to low transition the next flip-flop is triggered. On this basis the design is done for MOD-8
counter.
1) Up Counter:
Fig shows 3 bit Asynchronous Up Counter. Here Flip-flop A act as a MSB Flip-flop and
Flip-flop C can act as a LSB Flip-flop. Clock pulse is connected to the Clock of flip-flop C.
Output of Flip-flop C (Qc) is connected to clock of next flip-flop(i.e. Flip-flop B) and so on. As
soon as clock pulse changes output is going to -change(at the negative edge of clock pulse) as a
Up count sequence. For 3 bit Up counter Truth table is as shown below.
2) Down Counter:
Fig shows 3 bit Asynchronous Down Counter. Here Flip-flop a act as a MSB Flip-flop and Flip-
flop C can act as a LSB Flip-flop. Clock pulse is connected to the Clock of flip-flop C. Output of
Flip-flop C (Qc‘) is connected to clock of next flip- flop (i.e. Flip-flop B) and so on. As soon as
clock pulse changes output is going to change(at the negative edge of clock pulse) as a down
count sequence. For 3 bit down counter Truth table is as shown below.
46
DLD/DE LABORATORY II B.Tech III Sem
Truth Table:
LOGIC DIAGRAM:
47
DLD/DE LABORATORY II B.Tech III Sem
TIMING DIAGRAM:
CLK
Qa 0 3 0 1 0 0
1 1
Qb 0 0 1 1 0 0 1 1
Qc 0 0 0 0 1 1 1 1
CLK
Qc 0 0 0 0
1 1 1 1
Qb 0 1 1 0 0 1 1 0
Qa 0 0 0 0
1 1 1 1
48
DLD/DE LABORATORY II B.Tech III Sem
PROCEDURE:
PRECAUTIONS:
1. Make the connections according to the IC pin diagram.
2. The connections should be tight.
3. The Vcc and ground should be applied carefully at the specified pin only.
RESULT:
CONCLUSION:
VIVA QUESTIONS:
49
DLD/DE LABORATORY II B.Tech III Sem
APPARATUS REQUIRED:
IC 7474 (T- Flip-flop), Digital Trainer Kit, patch cords, +5V power supply.
THEORY:
A counter in which each flip-flop is triggered by the output goes to previous flip-flop. As all the
flip-flops do not change states simultaneously in asynchronous counter, spike occur at the
output. To avoid this, strobe pulse is required. Because of the propagation delay the operating
speed of asynchronous counter is low. This problem can be solved by triggering all the flip-flops
in synchronous with the clock signal and such counters are called synchronous counters.
PROCEDURE:
• Check all the components for their working.
• Insert the appropriate IC into the IC base.
• Make connections as shown in the circuit diagram.
• Verify the Truth Table and observe the outputs.
50
DLD/DE LABORATORY II B.Tech III Sem
MOD 8 COUNTER:
LOGIC DIAGRAM:
TRUTH TABLE:
States Input
Present Next T
0 0 0
0 1 1
1 0 1
1 1 0
51
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
52
DLD/DE LABORATORY II B.Tech III Sem
LOGIC DIAGRAM:
INPUTS OUTPUTS
A B A>B A=B A<B A>B = AB
0 0 0 1 0 _
A<B = AB
0 1 0 0 1 _ _
1 0 1 0 0 A=B=A B+AB
1 1 0 1 0
53
DLD/DE LABORATORY II B.Tech III Sem
AIM: Draw the circuit diagram of a single bit comparator and test the output.
APPARATUS REQUIRED:
IC 7400, IC 7410, IC 7420, IC 7432, IC 7486, IC 7402, IC 7408, IC 7404, IC 7485, Patch
Cords & ICTrainer Kit.
THEORY:
Magnitude Comparator is a logical circuit, which compares two signals A and B and generates
three logical outputs, whether A > B, A = B, or A < B. IC 7485 is a high
speed 4-bit Magnitude comparator , which compares two 4-bit words . The A = B Input must be
held high for proper compare operation.
PROCEDURE:
1. Check all the components for their working.
2. Insert the appropriate IC into the IC base.
3. Make connections as shown in the circuit diagram.
4. Verify the Truth Table and observe the outputs.
54
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
1. What is a comparator?
3. Derive the Boolean expressions of one bit comparator and two bit comparators.
4. How do you realize a higher magnitude comparator using lower bit comparator
55
DLD/DE LABORATORY II B.Tech III Sem
AIM: Construct 7 Segment Display Circuit Using Decoder and7 Segment LED and test it.
APPARATUS REQUIRED:
THEORY:
The functions of LT, RBI, RBO and BI are given below. LT This is called the LAMP TEST
terminal and is used for segment testing. If it is connected to logic ‘0’ level, all the segements of
the display connected to the decoder will be ON. For normal decoding operation, this terminal is
to be connected to logic ‘1’ level. RBI For normal decoding operation, this is connected to logic
‘1’ level. If it is connected to logic ‘0’, the segment outputs will generate the data for normal 7-
segment decoding, for all BCD inputs except Zero. Whenever the BCD inputs correspond to
Zero, the 7-segment display switches off. This is used for zero blanking in multi-digit displays.
BI If it is connected to logic ‘0’ level, the display is switched-off irrespective of the BCD inputs.
This is used for conserving the power in multiplexed displays. RBO This output is used for
cascading purposes and is connected to the RBI terminal of the succeeding stage.
PROCEDURE:
• Set up the Ckt as shown in fig.
• Apply logic ‘0’ level to LT and observe the seven segments of the LED. All
the segments must be ON.
• Apply logic ‘0’ level to BI/RBO and observe the seven segments of the LED. All the
segments must be OFF.
• Apply logic ‘1’ to LT and RBI and observe the number displayed on the LED for
all the inputs 0000 through 1111. This is the normal decoding mode.
• Apply logic ‘1’ to LT and logic ‘0’ to RBI, and observe the BI/RBO output and the
number displayed on the LED for all the inputs 0000 through 1111. This is the normal
decoding mode with zero blanking.
56
DLD/DE LABORATORY II B.Tech III Sem
CIRCUIT DIAGRAM:
Display
D C B A a b c d e f g
Number
0 0 0 0 0 0 0 0 0 0 1
0 0 0 1 1 0 0 1 1 1 1
0 0 1 0 0 0 1 0 0 1 0
0 0 1 1 0 0 0 0 1 1 0
0 1 0 0 1 0 0 1 1 0 0
0 1 0 1 0 1 0 0 1 0 0
0 1 1 0 1 1 0 0 0 0 0
0 1 1 1 0 0 0 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 1 1 0 0
57
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
2. Can you use the segments outputs of 7448 decoder directly to drive a 7-Segment LED? If
not suggest a suitable interface?
5. What is the difference between common anode & common cathode display?
58
DLD/DE LABORATORY II B.Tech III Sem
ADDITIONAL EXPERIMENTS
59
DLD/DE LABORATORY II B.Tech III Sem
CIRCUIT DIAGRAM:
INPUT OUTPUT
60
DLD/DE LABORATORY II B.Tech III Sem
AIM: Design BCD Adder Circuit and Test the Same using Relevant IC.
APPARATUS REQUIRED:
Digital Trainer Kit, IC 7483, 7432 7408, Patch Cord ,+ 5V Power Supply
THEORY:
A carry save adder is just a set of one bit full adder, without any carry chaining. Therefore n-bit
CSA receivers three n-bit operands, namely A(n-1),A(0) and CIN(n-1)CIN(0) and generate two
n-bit result values, sum(n-1)-----------sum(0) and count(n-1)count(0).
The parallel adder is ripple carry type in which the carry output of each full adder stage is
connected to the carry input of the next highest order stage.
Therefore, the sum and carry outputs of any stage cannot be produced until the carry occurs.
This leads to a time delay in addition process.
This is known as Carry Propagation Delay.
BCD Adder:
It is a circuit that adds two BCD digits & produces a sum of digits also in BCD.
2. If the 4 bit sum is greater than 9 or if carry is generated then the sum is
invalid. To correct the sum add 0110 i.e. (6)10 to sum. If carry is
generated from this addition add it to next higher order BCD digit.
3. If the 4 bit sum is less than 9 or equal to 9 then sum is in proper form.
The BCD addition can be explained with the help of following 3cases
61
DLD/DE LABORATORY II B.Tech III Sem
TruthTable:-
For design of combinational circuit for BCD adder to check invalid BCD
INPUT OUTPUT
S3 S2 S1 S0 Y
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
K-map:-
Y= S3S2+S3S1
62
DLD/DE LABORATORY II B.Tech III Sem
✓
CASE I: Sum <= 9 & carry = 0.
Add BCD digits 3 & 4
1. 0011
+ 0100
0111
Answer is valid BCD number = (7) BCD & so 0110 is not added.
CASE II: Sum > 9 & carry = 0.
Add BCD digits 6 & 5
1. 0110
+ 0101
1011
2. 1011
+ 0110
1 0001
(1 1)BCD
63
DLD/DE LABORATORY II B.Tech III Sem
64
DLD/DE LABORATORY II B.Tech III Sem
1. 1001
+1001
10010
2. 1 0010
+ 0110
11000
(1 8)BCD
65
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVA QUESTIONS:
1. What is the need of code converters?
66
DLD/DE LABORATORY II B.Tech III Sem
BLOCK DIAGRAM:
PIN CONFIGURATION:
FUNCTION TABLE:
S1 S0 INPUT
0 0 D0=XS1’S0
0 1 D1=XS1’S0
1 0 D2=XS1S0’
1 1 D3=XS1S0
Y=XS1’S0+XS1’S0+XS1S0’+XS1S0
CIRCUIT DIAGRAM:
67
DLD/DE LABORATORY II B.Tech III Sem
APPARATUS REQUIRED: -
THEORY:
A Demultiplexer performs the reverse operation of a Multiplexer. It accepts a single input and
distributes it over several outputs. The SELECT input code determines to which output the data
input will be transmitted. The Demultiplexer becomes enabled when the strobe signal is active
LOW.
This circuit can also be used as binary-to-decimal decoder with binary inputs applied at the select
input lines and the output will be obtained on the corresponding line. These devices are available
as 2-line-to-4-line decoder, 3-line-to- 8-line decoder, 4-line-to-16-line decoder. The output of
these devices is active LOW. Also there is an active low enable/data input terminal available.
Figure below shows the block diagram of a Demultiplexer.
In this diagram the inputs and outputs are indicated by means of broad arrows to indicate that
there may be one or more lines. Depending upon the digital code applied at the SELECT inputs,
one data is transmitted to the single output channel out of many. The pin out of a 16:1
Demultiplexer IC 74154 is shown above. The output of this circuit is active low. This is a 24-pin
DIP.
PROCEDURE: -
PRECAUTIONS:
68
DLD/DE LABORATORY II B.Tech III Sem
PIN DIAGRAM:
TRUTH TABLE:
TRUTH TABLE
INPUT OUTPUT
S1 S0 I/P D0 D1 D2 D3
0 0 0 0 0 0 0
0 0 1 1 0 0 0
0 1 0 0 0 0 0
0 1 1 0 1 0 0
1 0 0 0 0 0 0
1 0 1 0 0 1 0
1 1 0 0 0 0 0
1 1 1 0 0 0 1
69
DLD/DE LABORATORY II B.Tech III Sem
RESULT:
CONCLUSION:
VIVAQUESTIONS:
70
HDL Simulation programs
Programming can be done using any compiler. Download the programs on FPGA / CPLD
boards and performance testing may be done using pattern generator / logic analyzer apart
from verification by simulation using Cadence / Mentor Graphics / Synopsys / Equivalent
front end CAD tools.
71
INTRODUCTION-XILINX
Xilinx ISE is a software tool produced by Xilinx for synthesis and analysis of HDL designs, which
enables the developer to synthesize ("compile") their designs, perform timing analysis, examine
RTL diagrams, simulate a design's reaction to different stimuli, and configure the target device
with the programmer.
Inour Lab, the scope is limited to design and analyze the design using testbenches & simulation.
The following is the step by step procedure to design in the XilinxISE simulator tool:
Once the Xilinx ISE Design suite is started, open a new project &enter your design name and the
location path. By default "HDL" is selected as the top-level source type. (If not, please select
Top-level source type as "HDL").
72
DLD/DE LABORATORY CDU- ECE
3 Continue to the next window and check if the Preferred Language is selected as ‘Verilog’.
3. Proceed by clicking ‘Next’ and create a "New Source" using the "Create New Source"
Window.
73
DLD/DE LABORATORY CDU- ECE
4. Select the source type as ‘Verilog Module’ and input a filename and proceed to ‘Next’. In the
next window ‘Define Module’ enter the ports.
74
DLD/DE LABORATORY CDU- ECE
6. Once ‘Finish’ is selected a pop-up appears to create the directory. Select ‘yes’.
6. Then proceed to ‘Next’ in the “New Project Wizard’ to ‘Add Existing Sources’. ‘Add source’ if
an existing source is available, If not proceed to ‘Next’ and finish with the ‘Project Summary’
window.
75
DLD/DE LABORATORY CDU- ECE
The ports defined during the ‘Project Creation’ are defined as a module in the ‘filename.v’ file.
76
DLD/DE LABORATORY CDU- ECE
• Select the design from the ‘Hierarchy‘ window. In the below window of Processes
‘Implement Design‘ would be orange (in color) ready for implementation.
6. Double click on implement design, it turns green (in color) once the design is implemented
successfully and the Summary report is displayed.
77
DLD/DE LABORATORY CDU- ECE
To add a test-bench to the existing design, right click on the‘.v’ file from the Hierarchy window
and select ‘New Source’.
13. Select ‘Verilog Text Fixture’ from the Select Source Type and name theTest-Bench.
78
DLD/DE LABORATORY CDU- ECE
4) Edit the test bench as per your simulation requirements and select ‘Behavioral Simulation’
in the ‘Design Window’.
5) In the Processes window Isim Simulator would be displayed. First Proceed with the
Behavioral Check Syntax.
79
DLD/DE LABORATORY CDU- ECE
EXPERIMENT- 1
AIM: To develop the source code for logic gates by using VERILOG and obtain the simulation
results.
4) XILINX9.2i
5) FPGA-SPARTAN-3E
LOGIC DIAGRAMS:
AND GATE:
OR GATE:
NOT GATE:
80
DLD/DE LABORATORY CDU- ECE
NAND GATE:
NOR GATE:
XOR GATE:
XNOR GATE:
0 0 1
0 1 0
1 0 0
1 1 1
81
DLD/DE LABORATORY CDU- ECE
6. Inputs
reg a; reg
b;
7. Outputs
wire [6:0] c;
8. Instantiate the Unit Under Test (UUT)
logicgates1 uut (
.a(a),
.b(b),
.c(c)
);
initial begin
6. Initialize Inputs
a = 0;b = 0;
#5 a = 0;b = 1;
#5 a = 1;b = 0;
#5 a = 1;b = 1;
#5 $finish;
end
initial $monitor($time, " a=%b,b=%b,c=%b",a,b,c);
endmodule
82
DLD/DE LABORATORY CDU- ECE
SIMULATION OUTPUT:
RESULT:
83
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-2
AIM: To develop the source code for 2 to 4 Decoder by using VERILOG and obtain the
simulation.
6. XILINX9.2i
7. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
TRUTH TABLE:
84
DLD/DE LABORATORY CDU- ECE
module decoder24_assign(en,a,b,y);
5. declare input and output ports
input en,a,b;
output [3:0]y;
endmodule
initial
begin
$monitor("en=%b a=%b b=%b y=%b",en,a,b,y);
ii) with reference to truth
iii) table provide input
values
en=1;a=1'bx;b=1'bx;#5
en=0;a=0;b=0;#5
85
DLD/DE LABORATORY CDU- ECE
en=0;a=0;b=1;#5
en=0;a=1;b=0;#5
en=0;a=1;b=1;#5
// terminate simulation using $finish system task
$finish;
end
initial $monitor($time, " en=%b,a=%b,b=%b,y=%b",en,a,b,y);
endmodule
SIMULATION OUTPUT:
RESULT:
86
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-3
AIM: To develop the source code for 8 to 3 decoder by using VERILOG and obtain the
simulation.
iii)XILINX9.2i
iv)FPGA-SPARTAN-3E
LOGIC DIAGRAM:
TRUTH TABLE:
D7 D6 D5 D4 D3 D2 D1 D0 X Y Z
d[7] d6] d[5] d[4] d[3] d[2] d[1] d[0] a b c
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
87
DLD/DE LABORATORY CDU- ECE
endmodule
88
DLD/DE LABORATORY CDU- ECE
SIMULATION OUTPUT:
RESULT:
89
DLD/DE LABORATORY CDU- ECE
90
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-4
AIM: To develop the source code for Priority Encoder by using VERILOG and obtain
the simulation.
GG XILINX9.2i
HH FPGA-SPARTAN-3E
Input Output
en i7 i6 i5 i4 i3 i2 i1 i0 y2 y1 y0
0 x x x x x x x x z z z
1 0 0 0 0 0 0 0 1 0 0 0
1 0 0 0 0 0 0 1 x 0 0 1
1 0 0 0 0 0 1 x x 0 1 0
1 0 0 0 0 1 x x x 0 1 1
1 0 0 0 1 x x x x 1 0 0
1 0 0 1 x x x x x 1 0 1
1 0 1 x x x x x x 1 1 0
1 1 x x x x x x x 1 1 1
91
DLD/DE LABORATORY CDU- ECE
module priorityenoder83_dataflow(en,i,y);
3. declare port list via input and output
input en;
input [7:0]i;
output [2:0]y;
endmodule
92
DLD/DE LABORATORY CDU- ECE
en=0;i=8'bx;#5
$finish;
end
endmodule
SIMULATION OUTPUT:
RESULT:
93
DLD/DE LABORATORY CDU- ECE
94
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-5
AIM: To develop the source code for 8X1 Multiplexer by using VERILOG and obtain the
simulation.
3. XILINX9.2i
4. FPGA-SPARTAN-3E
THEORY:
A digital multiplexer is a combinational circuit that selects binary information from one of many
input lines and directs it to a single output line. Multiplexing means transmitting a large number
of information units over a smaller number of channels or lines. The selection of a particular
n
input line is controlled by a set of selection lines. Normally, there are 2 input lines and n
selection lines whose bit combinations determine which input is selected. A multiplexer is also
called a data selector, since it selects one of many inputs and steers the binary information to
the output lines. Multiplexer ICs may have an enable input to control the operation of the unit.
When the enable input is in a given binary state (the disable state), the outputs are disabled,
and when it is in the other state (the enable state), the circuit functions as normal multiplexer.
The enable input (sometimes called strobe) can be used to expand two or more multiplexer ICs
to digital multiplexers with a larger number of inputs. The size of the multiplexer is specified by
n n
the number 2 of its input lines and the single output line. In general, a 2 to 1 line multiplexer
n n
is constructed from an n to 2 decoder by adding to it 2 input lines, one to each AND gate.
The outputs of the AND gates are applied to a single OR gate to provide the 1 – line output.
95
DLD/DE LABORATORY CDU- ECE
LOGIC DIAGRAM:
TRUTH TABLE:
96
DLD/DE LABORATORY CDU- ECE
module m81(output out, input D0, D1, D2, D3, D4, D5, D6, D7, S0, S1, S2);
wire w0,w1,w2,w3,w4,w5,w6,w7;
assign w0=(D0 & ~S2 & ~S1 & ~S0);
assign w1=(D1 & ~S2 & ~S1 & S0) ;
assign w2=(D2 & ~S2 & S1 & ~S0);
assign w3=(D3 & ~S2 & S1 & S0);
assign w4=(D4 & S2 & ~S1 & ~S0);
assign w5=(D5 & S2 & ~S1 & S0);
assign w6=(D6 & S2 & S1 & ~S0);
assign w7=(D7 & S2 & S1 & S0);
assign out = w0 | w1 | w2 | w3 | w4 | w5 | w6 | w7 ;
endmodule
97
DLD/DE LABORATORY CDU- ECE
always@(D0 or D1 or D2 or D3 or D4 or D5 or D6 or D7 or S0 or S1 or S2)
$monitor("At time = %t, Output = %d", $time, out);
endmodule
SIMULATION OUTPUT:
RESULT:
98
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-6
AIM: To develop the source code for 1x8 De-multiplexer by using VERILOG and obtain the
simulation.
6. XILINX9.2i
7. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
99
DLD/DE LABORATORY CDU- ECE
TRUTH TABLE:
module demux_1_8(y,s,a);
output reg [7:0]y;
input [2:0]s;
input a;
always @(*)
begin
y=0;
case(s)
3'd0: y[0]=a;
3'd1: y[1]=a;
3'd2: y[2]=a;
3'd3: y[3]=a;
3'd4: y[4]=a;
3'd5: y[5]=a;
3'd6: y[6]=a;
3'd7: y[7]=a;
endcase
end
endmodule
TEST BENCH:
module TestModule;
Inputs
reg in;
100
DLD/DE LABORATORY CDU- ECE
reg s0;
reg s1;
reg s2;
Outputs
wire d0;
wire d1;
wire d2;
wire d3;
wire d4;
wire d5;
wire d6;
wire d7;
.in(in),
.s0(s0),
.s1(s1),
.s2(s2),
.d0(d0),
.d1(d1),
.d2(d2),
.d3(d3),
.d4(d4),
.d5(d5),
101
DLD/DE LABORATORY CDU- ECE
.d6(d6),
.d7(d7)
);
initial begin
// Initialize Inputs
end
endmodule
SIMULATION OUTPUT:
RESULT:
102
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-7
AIM: To develop the source code for 4 Bit Binary to Gray Code Converter by using VERILOG and
obtain the simulation.
8. XILINX9.2i
9. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
TRUTH TABLE:
103
DLD/DE LABORATORY CDU- ECE
TECHTBENCH
module tb();
104
DLD/DE LABORATORY CDU- ECE
6. stimulus
always
begin
bin <= 0; #10;
bin <= 1; #10;
bin <= 2; #10;
bin <= 3; #10;
bin <= 4; #10;
bin <= 5; #10;
bin <= 6; #10;
bin <= 7; #10;
bin <= 8; #10;
bin <= 9; #10;
bin <= 10; #10;
bin <= 11; #10;
bin <= 12; #10;
bin <= 13; #10;
bin <= 14; #10;
bin <= 15; #10;
#100;
$stop;
end
endmodule
SIMULATION OUTPUT:
RESULT:
105
DLD/DE LABORATORY CDU- ECE
106
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-8
AIM: To develop the source code for 4 Bit Comparator by using VERILOG and obtain the
simulation.
4. XILINX9.2i
5. FPGA-SPARTAN-3E
107
DLD/DE LABORATORY CDU- ECE
6. Inputs
reg [1:0] A;
reg [1:0] B;
7. Outputs wire
A_less_B; wire
A_equal_B; wire
A_greater_B;
108
DLD/DE LABORATORY CDU- ECE
.A_greater_B(A_greater_B)
);
initial begin
// Initialize Inputs
A=0; B=0;
#5 A=2'b01; B=2'b10;
#5 A=2'b11; B=2'b10;
#5 A=2'b10; B=2'b10;
#5 A=2'b01; B=2'b10;
#5 A=2'b11; B=2'b01;
#5 A=2'b11; B=2'b11;
#5 $finish;
end
initial $monitor($time, " A=%b,B=%b A_less_B=%b, A_equal_B=%b,
A_greater_B=%b",A,B,A_less_B, A_equal_B, A_greater_B);
endmodule
SIMULATION OUTPUT:
RESULT:
109
110
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-9
AIM: To develop the source code for Full Adder using 3 modeling styles in VERILOG and obtain
the simulation.
XILINX9.2i
FPGA-SPARTAN-3E
LOGIC DIAGRAM:
TRUTH TABLE:
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
111
DLD/DE LABORATORY CDU- ECE
Dataflow Modeling:
Behavioral Modeling:
module fulladdtst;
6. Inputs
reg a; reg
b; reg c;
7. Outputs
wire sum;
wire cout;
112
DLD/DE LABORATORY CDU- ECE
.b(b),
.c(c),
.sum(sum),
.cout(cout)
);
initial begin
// Initialize Inputs
a = 0; b = 0; c = 0;
#5 a = 0; b = 0; c = 1;
#5 a = 0; b = 1; c = 0;
#5 a = 0; b = 1; c = 1;
#5 a = 1; b = 0; c = 0;
#5 a = 1; b = 0; c = 1;
#5 a = 1; b = 1; c = 0;
#5 a = 1; b = 1; c = 1;
#5 $finish;
end
initial $monitor($time, " a=%b,b=%b, c=%b, sum=%b,cout=%b ",a,b,c,sum,cout);
endmodule
SIMULATION OUTPUT:
RESULT:
113
DLD/DE LABORATORY CDU- ECE
114
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-10
AIM: To develop the source code for Full Subtractor by using VERILOG and obtain the
simulation.
5. XILINX9.2i
6. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
TRUTH TABLE:
115
DLD/DE LABORATORY CDU- ECE
SIMULATION OUTPUT:
RESULT:
116
DLD/DE LABORATORY CDU- ECE
EXPERIMENT-11
AIM: To develop the source code for SR, JK, T & D Flip Flops by using VERILOG and obtain
the simulation.
6. XILINX9.2i
7. FPGA-SPARTAN-3E
LOGIC DIAGRAM:
SR FLIPFLOP:
TRUTH TABLE:
Q(t) S R Q(t+1)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 X
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 X
117
DLD/DE LABORATORY CDU- ECE
Behavioral Modeling:
SIMULATION OUTPUT:
118
DLD/DE LABORATORY CDU- ECE
JKFLIPFLOP:
TRUTH TABLE:
Q(t) J K Q(t+1)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Behavioral Modeling:
module jkff(j,k,clk,rst,q,qbar);
input j, k, clk, rst;
output q, qbar;
reg q, qbar;
always@(posedge (clk) or posedge (rst))
begin
if(rst==1'b1)
begin
q=1'b0;
qbar=1'b1;
end
elseif(j==1'b0 && k==1'b0)
begin
119
DLD/DE LABORATORY CDU- ECE
q=q;
qbar=qbar;
end
elseif(j==1'b0&&k==1'b1)
begin
q=1'b0;
qbar=1'b1;
end
elseif(j==1'b1&&k==1'b0)
begin
q=1'b1;
qbar=1'b0;
end
else
begin
q=~q;
qbar=~qbar;
end
end
endmodule
SIMULATION OUTPUT:
T-FLIPFLOP:
120
DLD/DE LABORATORY CDU- ECE
TRUTH TABLE:
Behavioral Modeling:
module t_flip_flop(t,clk,reset,dout);
output dout ;
input t, clk;
always@(posedge (clk))
begin
if(reset)
dout <= 0;
else
begin
if(t)
dout <= ~dout;
end
end
endmodule
SIMULATION OUTPUT:
121
DLD/DE LABORATORY CDU- ECE
D FLIP FLOP:
LOGIC DIAGRAM:
TRUTH TABLE:
122
DLD/DE LABORATORY CDU- ECE
Behavioral Model:
TEST BENCH:
initial
begin
clk = 1'b0;
forever #20 clk = ~clk ;
end
initial
begin
reset = 1'b1;
#40;
reset = 1'b0;
#40;
D = 1'b0;
#40;
D = 1'b1;
#40;
$finish ;
end
endmodule
123
DLD/DE LABORATORY CDU- ECE
SIMMULATION RESULT:
RESULT:
Thus the OUTPUT’s of SR, JK, T & D Flip Flops are verified by simulating the VERILOG code.
124