Ic HDL Lab Manual
Ic HDL Lab Manual
Ic HDL Lab Manual
Prepared by
Mr. M. Vedachary, Associate Professor, ECE
Ms. T. Swapna Rani, Assistant Professor, ECE
Introduction 3
Introduction
10 Binary Multiplier
Symbol
Fig.a
Pin Configuration
Fig.b
Maximum Ratings:
Applications:
Non-inverting amplifier
Inverting amplifier
Integrator
Differentiator
Low Pass, High Pass, Band pass and Band Reject Filters
Features:
No External frequency compensation is required
No-Latch up Problem
741 is available in three packages :- 8-pin metal can, 10-pin flat pack and 8 or 14-pin DIP
Fig.(c) Fig(d)
Fig(e)
Specifications:
555 timers are reliable, easy to use and low cost. The device is available as an 8 pin metal can, an
8 –pin mini DIP or a 14 Pin DIP
Pin configuration:
Fig.(f) Fig(g)
Specifications:
Minimum input for lock 1 mV
VCO Frequency 0.5MHz
Lock range 60%
VCC Minimum 10V
VCC Maximum 26 Volts
Applications:
Frequency multiplier,
Frequency Shift Keying (FSK) Demodulator
Frequency Translation or shifting
Frequency demodulation.
Features:
Extreme Stability of Center frequency
Very high linearity of De modulated output
TTL Compatible square wave output
Highly Linear tri angular output
Loop can be broken to insert digital frequency divider
EXPERIMENT NO : 1
AIM : To design an adder, Subtractor & comparator circuits using OP- AMP 741 IC.
Adder :
Fig.(a)
Subtractor :
Fig.(b)
Comparator :
Fig.(c)
THEORY :
Adder : Adder circuit is a Summing Amplifier. Op-amp can be used to design a circuit whose
output is the sum of several input signals. Such a circuit is called a summing amplifier or a
summer. Summing amplifier can be classified as inverting & non-inverting summer depending
on the input applied to inverting & non-inverting terminals respectively. Fig shows an inverting
summer with two inputs. Here the output will be the linear summation of input voltages. Here the
feedback forces a virtual ground to exist at the inverting input . The output is equal to the
negative weighted sum of the input voltages. The summing operation depends exclusively on the
sum of the resistor ratios. Fig . shows the inverting configuration with three inputs Va, Vb, Vc
depending on the relationship between the feedback resistor RF and the input resistors Ra ,Rb and
Rc , the circuit can be used as either a summing amplifier, scaling amplifier, or averaging
amplifier. By connecting more than one input voltages to the inverting input, the resulting circuit
is the Adder.
Va Vb Vc
Ra Rb Rc
V0 = - Rf.I
Va Vb Vc
Ra Rb Rc
If Ra = Rb = Rc = R
This means that the output voltage is equal to the negative sum of all the inputs
times the gain of the circuit is called a summing amplifier. Obviously, when the gain of the
circuit is 1, that is , Ra = Rb = Rc = RF , the output voltage is equal to the negative sum of all
input voltages. Thus
V0 = - (Va + Vb + Vc)
Subtractor : A subtractor is a circuit that gives the difference of the two inputs. Vo =V1-V2 ,
Where V1 and V2 are the inputs.
By connecting one input voltage V1 to inverting terminal and another input voltage V2 to the non
– inverting terminal then the resulting circuit is the Subtractor.
Vo=(-Rf/R1)(V1-V2)
If all external resistors are equal in value, then the gain of the amplifier is equal to 1. The output
voltage of the differential amplifier with a gain of 1 is
V0 = (V2-V1)
Thus the output voltage V0 is equal to the voltage V2 applied to the non – inverting
terminal minus the voltage V1 applied to the inverting terminal. Hence the circuit is called a
Subtractor.
Fig.(d)
PROCEDURE :
Adder :
1. Connect the adder circuit as shown in fig.(a) by connecting the appropriate resistors to 741 IC.
2. Switch on the trainer.
3. Apply dc voltages at each input terminals for V1 and V2 from the dc supply and check the
output voltage Vo at the output terminal.
4. Tabulate the readings.
5. Compare practical Vo with the theoretical output voltage Vo=-Rf[(V1/R1)+(V2/R2)].
Subtractor :
1. Connect the subtractor circuit as shown in fig.(b) by connecting the appropriate resistors to
741 IC.
2. Switch on the trainer.
3. Apply dc voltages at each input terminals for V1 and V2 from the dc supply and check the
output voltage Vo at the output terminal.
4. Tabulate the readings.
5. Compare the practical Vo with the theoretical output voltage Vo=(-Rf/R1)(V2-V1) value.
Comparator :
TABULAR COLUMN;
Adder :
R1 = 10 K R2 = 10K Rf =10K
Subtractor :
R1 = R2 = Rf= 10K
EXPECTED WAVEFORMS:
Fig.(e)
Fig.(f)
RESULT :
Adder: Adder circuit is implemented as per the circuit. The practical values are differs slightly
with theoretical values due to the offset voltage
Substractor: Substractor circuit is implemented as per the circuit. The practical values are differs
slightly with theoretical values due to the offset voltage
Comparator: The circuit to compare the input signal with the reference voltages and then found
the output wave forms
VIVA VOCE:
1. What is an Op-Amp.
2. What are the different Linear IC Packages.
3.List five characteristics of an idal Op-Amp.
4.Define Commom Mode Rejection Ratio.
5.What are the various DC Characteristics of an Op-Amp.
EXPERIMENT NO :2
Differentiator:
Fig.(a)
Integrator :
Fig(b)
THEORY:
Integrator.
In the practical integrator to reduce the error voltage at the output, a resistor R F is connected
across the feedback capacitor CF. Thus, RF limits the low-frequency gain and hence minimizes
the variations in the output voltage.
Fig.(c)
The frequency response of the basic integrator is shown in the fig(c) fb is the frequency at
which the gain is 0 dB and is given by
fb = 1/2 R1Cf.
In this fig(c) is some relative operating frequency, and for frequencies f to fa the gain
RF/R1 is constant. However, after fa the gain decreases at a rate of 20 dB/decade. In other words,
between fa and fb the circuit of fig(b), acts as an integrator. The gain-limiting frequency fa is
given by
fa = 1/2 RfCf.
Generally, the value of fa and in turn R1Cf and RfCf values should be selected such that fa
< fb. For example, if fa = fb / 10, then Rf = 10R1. In fact, the fig(c), frequency response of basic
and practical integrators.
The input signal will be integrated properly if the time period T of the signal is larger
than or equal to RfCf. i.e., T > RfCf
The frequency response of the basic differentiator is shown in fig(c), in this fig(c), fa is
the frequency at which the gain is 0 dB and is given by
fa = 1/2 RfC1
Both the stability and the high-frequency noise problems can be corrected by the addition
of two components: R1 and Cf, as shown in fig(a), This circuit is a practical differentiator, the
frequency response of which is shown in fig(c) by a dashed line.
From frequency f and fb, the gain increases at 20 dB/decade. However, after fb the gain
decreases at 20 dB/decade. This 40-dB/decade change in gain is caused by the R1C1 and RfCf
combinations. The gain-limiting frequency fb is given by
fb = 1 / 2 R1C1.
Thus R1C1 and RfCf help to reduce significantly the effect of high-frequency input,
amplifier noise, and offsets. Above all, it makes the circuit more stable by preventing the
increase in gain with frequency. Generally, the value of fb and in turn R1C1and RFCF values
should be selected such that fa<fb<fc
Where fa = 1 / 2 RfC1
fb = 1 / 2 R1C1 = 1 / 2 RfCf
fc = unity gain-bandwidth
The input signal will be differentiated properly if the time period T of the input signal is
larger than or equal to RfCf. That is, T> RfC1
PROCEDURE:
Differentiator:
EXPECTED WAVEFORMS:
Differentiator:
Integrator :
RESULT: Studied about the Operation of Integrator and Differentiator using Op-Amp 741 and
output waveforms are observed on CRO for sine and square inputs.
VIVA VOCE:
1.List various Operational Amplifier parameters.
2.Define Slew Rate.
3. What are the various specifications of Op-Amp 741.
4. What are the various factors effecting the parameters of Op-Amp.
5.Define input offset voltage.
EXPERIMENT NO : 3
AIM : To plot the frequency response characteristics of a second order Butterworth low pass
filter.
Connecting wires.
CIRCUIT DIAGRAM:
THEORY :
In case of Low Pass Filter, it is always desirable that the gain rolls off very fast after the
cut-off frequency i.e. in the Stop Band. In case of first order filter, it rolls off at a rate of 20 dB
/decade. In case of second order filter, the gain rolls off at a rate of 40 dB/ decade. Thus, the
slope of the frequency response after f = fH is -40dB/ decade, for a second order low pass filter.
A first order filter can be converted to second order type by using an additional
RC network as Shown in the fig. The cut-off frequency fH for the filter is decided by R2, C1, R3,
and C2. The gain of the filter is as usual decided by op-amp i.e. the resistance R1 and Rf.
1
Higher Cut off Frequency f H =
2π√(R2 R3 C1 C2)
Af
A = |V /V |=
Gain of the Second Order Filter 0 in
1 ( f / fH )4
1
Then calculate R using the f H =
2π√(R2 R3 C1 C2)
R2 = R3 = R
C1 = C2 = C
So f H = 1/ 2 RC
723 = 1/ 2 . R. 0.022
R2 = R3 = R = 10KΩ .
PROCEDURE :
EXPECTED GRAPH:
Theoretical fH=
Practical fH=
RESULT : The frequency response of 1st order Low Pass Filter is plotted. The cut off
frequency is calculated and is verified with the theoretical value.
Resistors : 10K -1
20K -1.
CIRCUIT DIAGRAM:
THEORY : In case of High Pass Filter, it is always desirable that the gain rolls off
very fast before the cut-off frequency i.e. in the Stop Band. In case of first order filter, it rolls off
at a rate of 20 dB /decade. In case of second order filter, the gain rolls off at a rate of 40 dB/
decade. Thus, the slope of the frequency response before f = fL is +40dB/ decade, for a second
order high pass filter.
A Second order Low pass filter can be converted to second order High pass Filter
type by interchanging the positions of Capacitors and Resistors as given in fig. The cut-off
frequency fL for the filter is decided by R2, C1, R3, and C2. The gain of the filter is as usual
decided by op-amp i.e. the resistance R1 and Rf
1
Lower Cut off Frequency f L =
2π√R2 R3 C1 C2
Af
= |V /V |=
Gain of the Second Order Filter A 0 in
1 ( fL / f )4
PROCEDURE:
EXPECTED GRAPH:
THEORITICAL PRACTICAL
RESULT : The frequency response of 1st order High Pass Filter is plotted. The cut off
frequency is calculated and is verified with the theoretical value.
Viva Voice : 1. Draw the Circuit of Third Order Low Pass Filter.
2. Draw the Frequency Response of Band Pass Filter.
3. Draw the Ideal Frequency Response of All types of Filers.
EXPERIMENT NO :4
Fig(a)
THEORY :
Oscillator is a circuit which generates output without any input. Oscillator can be defined
as a device that converts dc to ac.
The circuit will produce a sinusoidal waveform of frequency fo if the gain is 29 and the total
Phase shift around the circuit is exactly 360o or 0o. For desired frequency of oscillation. Choose a
capacitor C, and then calculate the value of R.
PROCEDURE :
TABULAR COLUMN:
EXPECTED WAVEFORMS :
Fig(b)
RESULT: Practical frequency of oscillation of RC Phase Shift Oscillator is compared with the
theoretical value.
VIVA VOCE:
1. Define Oscillator
2. What is the frequency of oscillation i.e f0 for RC Phase shift Oscillator.
3.What is the minimum gain required in RC Phase shift Oscillator.
4. What is the phase shift provided by each RC section at the frequency of oscillation.
5. What is Barkhusen’s criteria for oscillations
AIM : To compare theoretical and practical frequency of oscillation of Wein Bridge Oscillator.
APPARATUS : CRO
Probes
Connecting wires
Rf=100 KΩ (pot),R1=10 KΩ
R=4.7 KΩ,C=0.047µf
CIRCUIT DIAGRAM :
Fig.(a)
THEORY :
Many electronic devices require a source of energy at a specific frequency which may
range a few Hz to several MHz. This is achieved by an electronic device called an oscillator.
Oscillator is a circuit which generates output without any input. Oscillator can be defined as a
device that converts dc to ac. Oscillators can be classified as
Crystal Oscillators
This wein Bridge Oscillator is the standard oscillator circuit for low to moderate
frequencies, in the range of 5 Hz to about 1 MHz . This oscillator is preferred for commercial
audio generators and other low frequency applications. To avoid the damped oscillations at the
output the Wein Bridge oscillator it uses a feedback circuit called a lead – lag network. To
generate un damped oscillations, the positive feedback must be used because the output must
generate itself.
1) For sustained oscillations the phase shift around the circuit( amplifier and feedback
circuit) should be 360o or 0o.
The commonly used audio frequency oscillator is Wein Bridge oscillator as shown in the
circuit. The feedback signal in this circuit is connected to the non-inverting terminal, therefore
the Op-Amp is working in non-inverting mode. Hence this amplifier doesn’t provide any phase
shift. There fore the feedback network need not provide any phase shift. The condition of zero
Phase shift around the circuit is achieved by balancing the bridge.
For sustained oscillations, the amplifier must have a gain of precisely 3. but practically
Av may be slightly less or greater than 3.
For Av < 3, the oscillations will either die down or fail to start.
PROCEDURE :
4. Calculate the practical frequency of oscillation f = 1/T by observing the timeperiod of the
output sinusoidal waveform on the CRO and compare it with theoretical frequency of Oscillation
f = 1/2πRC
5. Sketch the output waveform by noting the timeperiod and peak to peak voltage of the output
waveform
TABULAR COLUMN:
EXPECTED WAVEFORMS :
Fig(b)
RESULT: Practical frequency of oscillation of Wein Bridge Oscillator is compared with the
theoretical value.
VIVA VOCE:
1.What is the resonant frequency of the balanced wein bridge oscillator.
2.What is the relationship between RF and R1 in Wein bridge Oscillator.
3.What are the two requirements for oscillation.
4. Why RC oscillators are called low frequency oscillators
5.What is the advantage by using IC 741 op-amp in the oscillator circuit
EXPERIMENT NO :5
AIM : To generate a pulse waveform of required pulse width by using 555 timer.
Fig(a)
Fig(b)
THEORY:
Monostable can also called as One – shot Multivibrator. when the output is low, the
circuit is in stable state, Transistor Q1 is ON and Capacitor C is shorted out to ground. However,
upon application of a negative trigger pulse to Pin – 2, transistor Q1 is turned OFF , which
releases short circuit across the external capacitor and drives the output High. The capacitor C
now starts charging up toward VCC through RA . However when the voltage across the external
capacitor equals 2/ 3 VCC comparator – 1’s (C1 ) output switches from low to high, which is
turn derives the output to its low state via the output of the flip flop turns transistor Q1 ON, and
hence, capacitor C rapidly discharges through the transistor. The output of the Monostable
remains low until a trigger pulse is again applied. Then the cycle repeats. The time during which
the output remains high is given by Tp = 1.1 R C
Fig.(c)
Fig.(d)
Once triggered, the circuit ‘s output will remain in the high state until the set time tp
elapses. The output will not change its state even if an input trigger is applied again during this
time interval tp.
PROCEDURE:
tp =1.1RC tp
Pulse width
EXPECTED WAVEFORMS:
Fig (e)
VIVA VOCE:
1.List various applications of 555 timer.
2.Explain the function of RESET in 555 timer.
3.What are the modes of operation of a timer.
4.What is supply voltage of 555 timer.
5.What are the various applications in Monostable mode.
EXPERIMENT NO : 6
AIM : To verify the action of IC723 as a voltage regulator and to find the values of load
regulation and line regulation.
CIRCUIT DIAGRAM :
Fig(a)
THEORY:
IC723 device is most versatile of monolithic regulators. It can be used to provide high
and low positive regulated voltages, negative regulated voltages and can be used as positive and
negative switching regulator.
IC 723 by itself can supply output current upto 120mA. External resistors can be
added to provide higher load currents. It takes input voltage upto 40 V. The output voltage is
adjustable from 2V to 35 V. This can be either a linear or switching regulator. This can be also
used as shunt regulator, a current regulator or a temperature controller.
PROCEDURE:
1. Connect the circuit as shown in figure(a)by connecting appropriate resistors and capacitors.
2. Measure the reference voltage at Pin 6(it should be greater than 7V)
3. The internal reference voltage are applied to the potential divider R1 & R2.
4. Keeping R1 constant, vary R 2 and R3 . The output voltage Vo is measured .
5. Compare this output voltage with the theoretical value
6. Tabulate the result for different values of R2 ,R3.
7. Calculate load Regulation & line regulation
CALCULATIONS:
VNL = VFL =
VO1 = VO2 =
CIRCUIT DIAGRAM :
78XX voltage Regulator
Fig(a)
Fig(b)
THEORY :
A three terminal voltage regulator is a regulator in which the output voltage is set at some
predetermined value. Such regulator does not require any external feedback connections. Hence
only three terminals are required for device of such type :
input Vin,
Output Vo &
a ground terminal.
The voltage regulators of 78XX series all have the same internal circuitry, expect for
different values of one resistor, which determines the output voltage level.
Fig represents the circuit connections for 78XX series. Pin 1 represents the input, Pin 2
represents ground and Pin3 represents the output terminal.
The 79XX series of fixed output negative voltage regulators are complements to the 78XX series
devices. The negative regulators are available in the output voltage options -2, -5, -5.2, -6, -8, -
12, -15, -18 and -24 V. The maximum input voltage for Vo=24v is 40V, while for the remaining
options is -35V
PROCEDURE:
1. Connect the circuit as shown in fig.
2. Switch ON the 3 Pin regulator IC trainer.
3. Observe the o/p voltages for 78XX &79XX IC regulators at Pin 2 by applying input at Pin 1.
4. Tabulate the reading for different IC’s.
TABULAR COLUMN:
1 7805
2 7806
3 7812
4 7905
5 7912
6 7924
RESULT: 78XX and 79XX 3 pin IC voltage regulators output voltages are observed.
EXPERIMENT NO: 7
3-8 DECODER – 74LS138
1. AIM:
To verify the truth table of 3 to 8 decoder by using ic 74IC138.
2. HARDWARE:
i. IC 74LS138.
ii. Connecting probes.
3. PIN DIAGRAM
5. TRUTH TABLE:
6. THEORY:
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. Decoding is necessary in applications
such as data multiplexing, 7 segment display and memory address decoding.
The example decoder circuit would be an AND gate because the output of an AND gate is
"High" (1) only when all its inputs are "High." Such output is called as "active High output". If
instead of AND gate, the NAND gate is connected the output will be "Low" (0) only when all its
inputs are "High". Such output is called as "active low output".
A slightly more complex decoder would be the n-to-2n type binary decoders. These types of
decoders are combinational circuits that convert binary information from 'n' coded inputs to a
maximum of 2n unique outputs. In case the 'n' bit coded information has unused bit
combinations, the decoder may have less than 2n outputs. 2-to-4 decoder, 3-to-8 decoder or 4-to-
16 decoder are other examples.
The input to a decoder is parallel binary number and it is used to detect the presence of a
particular binary number at the input. The output indicates presence or absence of specific
number at the decoder input.
3:8 decoder
It uses all AND gates, and therefore, the outputs are active- high. For active- low outputs, NAND
gates are used. It has 3 input lines and 8 output lines. It is also called as binary to octal decoder it
takes a 3-bit binary input code and activates one of the 8(octal) outputs corresponding to that
code.
7. PROCEDURE:
9. VIVA QUESTIONS:
1. A device that converts from decimal to binary numbered is called?
2. What is a Combinational circuit?
3. What is a Decoder?
4. In 3: 8 decoder the no. of inputs are how many?
5. Which circuit can be used as parallel to series converter?
EXPERIMENT NO : 8
4 BIT COMPARATOR 74LS85.
1. AIM:
To verify the truth table of 4 bit comparator by using IC 74LS85.
2. HARDWARE:
i.IC74LS85
ii. Connecting probes
3. PIN DIAGRAM
4. LOGIC DIAGRAM:
5.TRUTH TABLE:
6. THEORY :
Another common and very useful combinational logic circuit is that of the Digital Comparator
circuit. Digital or Binary Comparators are made up from standard AND, NOR and NOT gates
that compare the digital signals present at their input terminals and produce an output depending
upon the condition of those inputs.
For example, along with being able to add and subtract binary numbers we need to be able to
compare them and determine whether the value of input A is greater than, smaller than or equal
to the value at input B etc. The digital comparator accomplishes this using several logic gates
that operate on the principles of Boolean Algebra. There are two main types of Digital
Comparator available and these are.
1. Identity Comparator – an Identity Comparator is a digital comparator that has only one
output terminal for when A = B either “HIGH” A = B = 1 or “LOW” A = B = 0
2. Magnitude Comparator – a Magnitude Comparator is a digital comparator which has
three output terminals, one each for equality, A = B greater than, A > B and less than
A<B
The purpose of a Digital Comparator is to compare a set of variables or unknown numbers, for
example A (A1, A2, A3, …. An, etc) against that of a constant or unknown value such as B (B1,
B2, B3, …. Bn, etc) and produce an output condition or flag depending upon the result of the
comparison. For example, a magnitude comparator of two 1-bits, (A and B) inputs would
produce the following three output conditions when compared to each other.
This is useful if we want to compare two variables and want to produce an output when any of
the above three conditions are achieved. For example, produce an output from a counter when a
certain count number is reached. Consider the simple 1-bit comparator below.
7. PROCEDURE
I. Connect the Probes As Per Diagram (SWITCHES)
9. VIVA QUESTIONS:
1. A circuit which converts some binary code into a singular active output representing its
numerical value is ?
2. A logic circuit which determines if one input is equal to another is called?
3. Comparator requires which type of gate?
4. Why clamp diodes are used in comparator?
5. How to obtain high rate of accuracy in comparator
EXPERIMENT NO : 9
D FLIP-FLOP (74LS74) AND JK MASTER –SLAVE FLIP-FLOP (74LS73).
1. AIM:
To verify the truth table of D flip flop and JK master Slave Flip flop by using ICs 74LS74,
74LS73.
2. HARDWARE:
i.IC74L74, 74LS73
ii. Connecting probes
3. PIN DIAGRAM
4. LOGIC DIAGRAM:
5.TRUTH TABLE:
6.THEORY :
In electronics, a flip-flop or latch is a circuit that has two stable states and can be used to store
state information. A flip-flop is a bistable multivibrator. The circuit can be made to change state
by signals applied to one or more control inputs and will have one or two outputs. It is the basic
storage element in sequential logic. Flip-flops and latches are fundamental building blocks of
digital electronics systems used in computers, communications, and many other types of
systems.
Flip-flops and latches are used as data storage elements. A flip-flop stores a single bit (binary
digit) of data; one of its two states represents a "one" and the other represents a "zero". Such data
storage can be used for storage of state, and such a circuit is described as sequential logic. When
used in a finite-state machine, the output and next state depend not only on its current input, but
also on its current state (and hence, previous inputs). It can also be used for counting of pulses,
and for synchronizing variably-timed input signals to some reference timing signal.
Using this terminology, a latch is level-sensitive, whereas a flip-flop is edge-sensitive. That is,
when a latch is enabled it becomes transparent, while a flip flop's output only changes on a single
type (positive going or negative going) of clock edge.
Simple flip-flops can be built around a single pair of cross-coupled inverting elements: vacuum
tubes, bipolar transistors, field effect transistors, inverters, and inverting logic gates have all been
used in practical circuits.
Clocked devices are specially designed for synchronous systems; such devices ignore their inputs
except at the transition of a dedicated clock signal (known as clocking, pulsing, or strobing).
Clocking causes the flip-flop either to change or to retain its output signal based upon the values
of the input signals at the transition. Some flip-flops change output on the rising edge of the
clock, others on the falling edge.
Since the elementary amplifying stages are inverting, two stages can be connected in succession
(as a cascade) to form the needed non-inverting amplifier. In this configuration, each amplifier
may be considered as an active inverting feedback network for the other inverting amplifier.
Thus the two stages are connected in a non-inverting loop although the circuit diagram is usually
drawn as a symmetric cross-coupled pair (both the drawings are initially introduced in the
Eccles–Jordan patent).
The D flip-flop captures the value of the D-input at a definite portion of the clock cycle (such as
the rising edge of the clock). That captured value becomes the Q output. At other times, the
output Q does not change
The JK flip-flop augments the behavior of the SR flip-flop (J=Set, K=Reset) by interpreting the J
= K = 1 condition as a "flip" or toggle command. Specifically, the combination J = 1, K = 0 is a
command to set the flip-flop; the combination J = 0, K = 1 is a command to reset the flip-flop;
and the combination J = K = 1 is a command to toggle the flip-flop, i.e., change its output to the
logical complement of its current value. Setting J = K = 0 maintains the current state. To
synthesize a D flip-flop, simply set K equal to the complement of J. Similarly, to synthesize a T
flip-flop, set K equal to J. The JK flip-flop is therefore a universal flip-flop, because it can be
configured to work as an SR flip-flop, a D flip-flop, or a T flip-flop.
7. PROCEDURE
I. Connect The Probes As Per Diagram (SWITCHES)
8. RESULT: Truth table of D flip flop and JK master Slave Flip flop by using ICs
74LS74,74LS73 is verified.
9. VIVA QUESTIONS:
EXPERIMENT NO : 10
UNIVERSAL SHIFT REGISTERS-74LS194/195.
1. AIM:
To verify the truth table of universal shift register by using IC 74L194/195.
2. HARDWARE:
i. IC74LS194/195
ii. Connecting probes
3. PIN DIAGRAM
5. THEORY:
Universal Shift Register is a register which can be configured to load and/or retrieve the data in
any mode (either serial or parallel) by shifting it either towards right or towards left. In other
words, a combined design of unidirectional (either right- or left-shift of data bits as in case of
SISO, SIPO, PISO, PIPO) and bidirectional shift register along with parallel load provision is
referred to as universal shift register. Such a shift register capable of storing n input bits is
shown by Figure 1. The design shown by Figure 1 uses n 4×1 multiplexers to drive the
input pins of n flip-flops in the register which are also connected to clock and clear inputs. All of
the multiplexers in the circuit share the same select lines, S1 and S0 (pink lines in the figure), in
order to select the mode in which the shift registers operates. It is also seen that the MUX driving
a particular flip-flop has its
1. First input (Pin Number 0) connected to the output pin of the same flip-flop i.e. zeroth pin
of MUX1 is connected to Q1, zeroth pin of MUX2 is connected to Q2, … zeroth pin of
MUXn is connected to Qn.
2. Second input (Pin Number 1) connected to the output of the very-previous flip-flop
(except the first flip-flop FF1 where it acts like an serial-input to the input data bits which
are to be shifted towards right) i.e. first pin of MUX2 is connected to Q1, first pin of
MUX3 is connected to Q2, … first pin of MUXn is connected to Qn-1.
3. Third input (Pin Number 2) connected to the output of the very-next flip-flop (except the
first flip-flop FFn where it acts like an serial-input to the input data bits which are to be
shifted towards left) i.e. second pin of MUX1 is connected to Q2, second pin of MUX2 is
connected to Q3,… second pin of MUXn-1 is connected to Qn.
4. Fourth input (Pin Number 3) connected to the individual bits of the input data word
which is to be stored into the register, thus providing the facility for parallel loading.
7. PROCEDURE
9. VIVA QUESTIONS:
1. On the fifth clock pulse, a 4-bit Johnson sequence is Q0 = 0, Q1 = 1, Q2 = 1, and Q3 = 1. On the
sixth clock pulse, the sequence is..
2. What is a shift register that will accept a parallel input, or a bidirectional serial load and
internal shift features, called?
5. In a 6-bit Johnson counter sequence there are a total of how many states, or bit patterns?
In our Lab, the scope is limited to design and analyze the design using test benches
&Simulation.
The following is the step by step procedure to design in the Xilinx ISE
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
2. 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
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.
5. Finish with the new project setup with the Summary window.
6. Once Finish is selected a pop-up appears to create the directory. Select yes
7. 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
The ports defined during the Project Creation are defined as a module in the filename File
10. Select the design from the Hierarchy window. In the below window of Processes Implement
Design would be orange (in color) ready for implementation
11. Double click on implement design, it turns green (in color) once the design is
implemented successfully and the Summary report is displayed.
To add a test-bench to the existing design, right click on the v file from the
HierarchyWindow and select New Source
13. Select Verilog Text Fixture from the Select Source Type and name the Test-Bench
14. Continue toFinish and a test bench is added in the project area
15. Edit the test bench as per your simulation requirements and select Behavioral
Simulation in the Design Window. In the Processes window Simulator would be displayed. First
Proceed with the Behavior al Check Syntax.
EXPERIMENT 1
AIM: To develop the source code for logic gates by using VERILOG and obtain the
simulation, synthesis, place and route and implement into FPGA.
SOFTWARE & HARDWARE REQUIREMENTS:
THEORY:
B/W A & B
AND A.B
OR A+B
NOT
NAND
NOR
XOR
XNOR OR
AND gate
OR gate
NOT gate
NAND gate
NOR gate
EX-OR gate
EX-NOR gate
SOURCE CODE:
Module logicgates(
input A,
input B,
output notA,
output andAB,
output orAB,
output nandAB,
output norAB,
output xorAB,
output xnorAB
);
assign notA=~A;
endmodule
OBSERVATION:
RTL SCHEMATIC:
TECHNOLOGY SCHEMATIC
RESULT: Thus the Output’s of All Logic Gate are verified by synthesizing and
simulating the VERILOG code.
EXPERIMENT 2
AIM: To develop the source code for full adder in three modelling styles by using VERILOG and
obtain the simulation, synthesis, place and route and implement into FPGA.
SUM=A^B^C
CARRY=AB+BC+CA
SOURCE CODE:
assign S= A^B^Ci;
assign Co= (A&B)|(B&Ci)|(A&Ci);
endmodule
B) STRUCTURAL MODEL
module fulladder(
input A,
input B,
inputCi,
output S,
output Co
);
wire z1,z2,z3,z4;
and AND1(z1,A,B);
and AND2(z2,B,Ci);
and AND3(z3,A,Ci);
or OR1(Co,z1,z2,z3);
xor XOR1(z4,A,B);
xor XOR2(S,z4,Ci);
endmodule
C) BEHAVIORAL ARRANGEMENT
module fulladder(
input A,
input B,
inputCi,
output reg S,
output reg Co
);
always @(Ci,A,B)
begin
Case({Ci,A,B})
3’b000:{Co,S}= 2’b00;
3’b001:{Co,S}= 2’b01;
3’b010:{Co,S}= 2’b01;
3’b011:{Co,S}= 2’b10;
3’b100:{Co,S}= 2’b01;
3’b101:{Co,S}= 2’b10;
3’b110:{Co,S}= 2’b10;
3’b111:{Co,S}= 2’b11;
endcase
end
endmodule
OBSERVATION:
LUT3_96
LUT-E8
RESULT: Thus the Outputs of Full Adder are verified by synthesizing and simulating the
VERILOG code
EXPERIMENT 3
AIM:To develop the source code for Binary to Gray and Gray to Binary Converters by using
VERILOG and obtain the simulation, synthesis, place and route and implement into FPGA.
SOURCE CODE:
A) Data flow
module converter(
input B3,
input B2,
input B1,
input B0,
output G3,
output G2,
output G1,
output G0);
assign G1=B2^B1;
endmodule
module converter(
input [3:0] G,
assign B[1]=B[2]^G[1];
endmodule
OBSERVATION:
RESULT: Thus the Outputs of Binary to Gray and Gray to Binary Converters are verified by
synthesizing and simulating the VERILOG code.
EXPERIMENT 4
AIM:To develop the source code for 3X8 DECODER and 8x3 ENCODER by using VERILOG
and obtain the simulation, synthesis, place and route and implement into FPGA.
THEORY:
An encoder is a digital circuit which performs the inverse of decoder. An encoder has
2^N input lines and N output lines. In encoder the output lines generate the binary code
corresponding to input value. The decimal to bcd encoder usually has 10 input lines and 4 output
lines. The decoder decimal data as an input for decoder an encoded bcd output is available at 4
output lines.
Y2 = w7 + w6 + w5 + w4
Y1 = w7 + w6 + w3 + w2
Y0 = w7 + w5 + w3 + w1
3 TO 8 DECODER:
8 TO 3 ENCODER:
SOURCE CODE:
always @(din)
begin
else dout=3'bX;
end
endmodule
OBSERVATION:
EXPECTED WAVEFORMS
RTL SCHEMATIC:
3 TO 8 DECODER
module decoder_3to8(Y7, Y6, Y5, Y4, Y3, Y2, Y1, Y0, A, B, C, en);
input A, B, C;
input en;
8'b1111_1111;
endmodule
OBSERVATION:
EXPECTED WAVEFORMS
RTL SCHEMATIC:
RESULT: Thus the Outputs of 3X8 DECODER and 8x3 ENCODER are verified by
synthesizing and simulating the VERILOG code.
EXPERIMENT 5
Aim:To develop the source code for 8X1 Multiplexer using 4x1 MUX and 1X8
DEMULTIPLEXER by using VERILOG and obtain the simulation, synthesis, place and route
and implement into FPGA.
THEORY:
input S2 S1 S0 Output
L0 0 0 0 L0
L1 0 0 1 L1
L2 0 1 0 L2
L3 0 1 1 L3
L4 1 0 0 L4
L5 1 0 1 L5
L6 1 1 0 L6
L7 1 1 1 L7
SOUR CE CODE:
8X1 MULTIPLEXER:
module mux2to1(a,b,sel,out);
input a,b,sel;
output out;
tri out;
bufif1 (out,a,sel);
bufif0 (out,b,sel);
endmodule
module mux4to1(a,sel,out);
input [3:0] a;
output out;
wire mux[2:0];
mux2to1 m1 (a[3],a[2],sel[0],mux_1),
m2 (a[1],a[3],sel[0],mux_2),
m3 (mux_1,mux_2,sel[1],out);
endmodule
module mux8to1(a,sel,out);
input [7:0] a;
output out;
wire mux[2:0];
mux4to1 m1 (a[7:4],sel[1:0],mux_1),
m2 (a[3:0],sel[1:0],mux_2);
mux2to1 m3 (mux_1,mux_2,sel[2],out);
endmodule
DEMULTIPLEXER
moduledemux(
input [2:0] s,
input x,
output [7:0] y
);
wire z1,z2,z3,z4;
not NOT1(z1,s[0]);
not NOT2(z2,s[1]);
not NOT3(z3,s[2]);
and AND1(y[0],z3,z2,z1);
and AND2(y[1],z3,z2,s[0]);
and AND3(y[2],z3,s[1],z1);
and AND4(y[3],z3,s[1],s[0]);
and AND5(y[4],s[2],z2,z1);
and AND6(y[5],s[2],z2,s[0]);
and AND7(y[6],s[2],s[1],z1);
and AND8(y[0],s[2],s[1],s[0]);
end module
OBSERVATION:
RTL SCHEMATIC:
8X1 MUX:
RESULT: Thus the Outputs of 8x1 Multiplexer and 1x8 Demultiplexer are verified by
synthesizing and simulating the VERILOG code.
EXPERIMENT 6
Aim:To develop the source code for SR and D Flip –Flops By using VERILOG and obtain the
simulation, synthesis, place and route and implement into FPGA.
SOUR CE CODE:
module DFF(
input wire D,
outputreg Q=0,
outputregQbar=1
);
begin
Q=D;
Qbar= ~Q;
end
endmodule
OBSERVATION:
SR FLIP FLOP
THEORY:
SOUR CE CODE:
module SR(
input S,
input R,
inputClk,
outputregQa=1’b0,
outputregQb=1’b1
);
wireS,R,Clk;
rega,b;
always @(S,R,Clk)
begin
a=Qa;
b=Qb;
if(Clk==1’b1)
case({S,R})
‘b00:{Qa,Qb}={a,b};
‘b01:{Qa,Qb}=’b01;
‘b10:{Qa,Qb}=’b10;
endcase
elseif(Clk==1’b0)
{Qa,Qb}={a,b};
end
endmodule
OBSERVATION:
RESULT: Thus the Outputs of all the SR and D FLIP-FLOPs are verified by synthesizing and
simulating the VERILOG code.
EXPERIMENT 6
Aim:To develop the source code for JK and T Flip –Flops By using VERILOG and obtain the
simulation, synthesis, place and route and implement into FPGA.
THEORY:
T FLIP FLOP
THEORY:
PROGRAM CODE:
module TFF(
input T,
inputClk,
outputreg Q=0,
outputregQbar=1,
outputreg Di
);
always @(posedgeClk)
Begin
Di=T;
Q=Di;
Qbar=~Q;
end
endcase
OBSERVATION:
JK FLIP FLOP
THEORY:
SOURCE CODE:
module JKFF(
input wire J,
input wire K,
outputreg Q=0,
outputregQbar=1
);
rega,b;
always @(posedgeClk)
begin
a=Q;
b=~Q;
case({J,K})
‘b00:{Q,Qbar}={a,b};
‘b01:
begin
Q=0;
a=Q;
b=~Q;
Qbar=b;
end
‘b10:
begin
end
‘b11:{Q,Qbar}={b,a};
endcase
end
endmodule
OBSERVATION:
RESULT: Thus the Outputs of all the SR and D FLIP-FLOPs are verified by synthesizing and
simulating the VERILOG code.
EXPERIMENT 8
Aim:To develop the source code for Decade Counter By using VERILOG and obtain the
simulation, synthesis, place and route and implement into FPGA.
Theory
A binary counter can be constructed from J-K flip-flops by taking the output of one cell to the
clock input of the next. The J and K inputs of each flip-flop are set to 1 to produce a toggle at
each cycle of the clock input. For each two toggles of the first cell, a toggle is produced in the
second cell, and so on down to the fourth cell. This produces a binary number equal to the
number of cycles of the input clock signal. This device is sometimes called a "ripple through"
counter. The same device is useful as a frequency divider.
DECADE COUNTER:
PROGRAM:
module decade_counter(
input clock,
input reset,
always@(posedge clock)
begin
if(reset)
q <=4'b0000;
else if(q<=4'b1000)
q <= q+1'b1;
else
q <= 4'b0000;
end
endmodule
OBSERVATION:
RTL SCHEMATIC:
WAVE FORMS:
UP-DOWN COUNTER:
PROGRAM:
module up_down_counter (
);
//----------Output Ports--------------
//------------Input Ports--------------
//------------Internal Variables--------
end
endmodule
OBSERVATION:
RTL SCHEMATIC:
WAVE FORMS:
RESULT: Thus the Outputs of Counter is verified by synthesizing and simulating the VERILOG
code.
EXPERIMENT 9
THEORY:
Universal shift registers are very useful digital devices. They can be configured to
respond to operations that require some form of temporary memory, delay information such as
the SISO or PIPO configuration modes or transfer data from one point to another in either a
serial or parallel format. Universal shift registers are frequently used in arithmetic operations to
shift data to the left or right for multiplication or division.
PROGRAM:
module Universal_shift_reg (data_out, msb_out, lsb_out, data_in, msb_in, lasb_in, s1, s0, clk,
rst);
output [3:0] data_out; // Hold
output msb_out, lsb_out; // Serial shift from msb
input [3:0] data_in; // Serial shift from lsb
input msb_in, lsb_in; // Parallel load
input s1, s0, clk, rst;
reg data_out;
assign msb_out= data_out[3];
assign lsb_out= data-out[0];
always @ (posedge clk)
begin
if (rst) data_out<=0;
else case ({s1, s0})
0 : data_out <= data_out;
1 : data_out <= {msb_in, data_out[3:1]};
2 : data_out <= {data_out[2:0], lsb_in};
3 : data_out <= data_in;
endcase
end
endmodule
SIMULATION OUTPUT:
EXPERIMENT 10
BINARY MULTIPLIER
Aim:To develop the source code for Binary Multiplier by using VERILOG and obtain the
simulation, synthesis, place and route and implement into FPGA.
Theory
Program
module mult8(p,x,y);
output [15:0]p;
input [7:0]x,y;
reg [15:0]p=0;
reg [7:0]a;
integer i;
always @(x , y)
begin
a=x;
for(i=0;i<8;i=i+1)
begin
if(y[i])
begin
p<=p+a;
a=a<<1;
end
else
a=a<<1;
end
end
endmodule
OBSERVATIONS:
RESULT: Thus the Outputs of Binary Multiplier is verified by synthesizing and simulating the
VERILOG code.