Lab Manual
Lab Manual
INDEX
Verify the truth table of one bit and two bit comparators
using logic gates and comparator IC
5 49
`
Digital Electronics Lab (Pattern 2015)
GROUP - A
3
Digital Electronics Lab (Pattern 2015)
Assignment: 1
Problem Statement:
To realize full adder and full substractor using
a) Basic gates
b) Universal gates
Theory:
1. Combinational circuit.
2. Half Adder.
3. Half Substractor.
4. Full Adder.
5. Full substracter.
a) Truth Table
b) K-Map.
c) MSI Circuits.
4
Digital Electronics Lab (Pattern 2015)
2. Half Adder:-
Truth Table:-
Input Output
X Y Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
K-Map:-
Logic Diagram:-
5
Digital Electronics Lab (Pattern 2015)
3. Half Substractor :-
Truth Table:-
Input Output
A B Difference Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
K-Map:-
Logic Gates:-
6
Digital Electronics Lab (Pattern 2015)
4. Full Adder:-
Truth Table:-
X Y Z 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
K-Map:-
Logic Gates:-
7
Digital Electronics Lab (Pattern 2015)
5. Full Substractor:-
Truth Table:-
X Y Z Difference Borrow
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
K-Map:-
8
Digital Electronics Lab (Pattern 2015)
Logic Gates:-
Outcomes:-
9
Digital Electronics Lab (Pattern 2015)
Assignment No: 2
Theory:
There is a wide variety of binary codes used in digital systems. Some of these codes are binary- coded-
decimal (BCD), Excess-3, Gray, octal, hexadecimal, etc. Often it is required to convert from one code to
another. For example the input to a digital system may be in natural BCD and output may be 7-segment
LEDs. The digital system used may be capable of processing the data in straight binary format. Therefore,
the data has to be converted from one type of code to another type for different purpose. The various code
converters can be designed using gates.
1) Binary Code:
It is straight binary code. The binary number system (with base 2) represents values using two symbols,
typically 0 and 1.Computers call these bits as either off (0) or on (1). The binary code are made up of
only zeros and ones, and used in computers to stand for letters and digits. It is used to represent numbers
using natural or straight binary form.
It is a weighted code since a weight is assigned to every position. Various arithmetic operations can be
performed in this form. Binary code is weighted and sequential code.
2) Gray Code:
It is a modified binary code in which a decimal number is represented in binary form in such a way that
each Gray- Code number differs from the preceding and the succeeding number by a single bit. (E.g. for
decimal number 5 the equivalent Gray code is 0111 and for 6 it is 0101. These two codes differ by only
one bit position i. e. third from the left.) Whereas by using binary code there is a possibility of change of
10
Digital Electronics Lab (Pattern 2015)
all bits if we move from one number to other in sequence (e.g. binary code for 7 is 0111 and for 8 it is
1000). Therefore it is more useful to use Gray code in some applications than binary code.
The Gray code is a nonweighted code i.e. there are no specific weights assigned to the bit positions.
Like binary numbers, the Gray code can have any no. of bits. It is also known as reflected code.
Applications:
1. Important feature of Gray code is it exhibits only a single bit change from one code word to the next in
sequence. This property is important in many applications such as Shaft encoders where error
susceptibility increases with number of bit changes between adjacent numbers in sequence.
2. It is sometimes convenient to use the Gray code to represent the digital data converted from the analog
data (Outputs of ADC).
3. Gray codes are used in angle-measuring devices in preference to straight forward binary encoding.
The disadvantage of Gray code is that it is not good for arithmetic operation
In this conversion, the input straight binary number can easily be converted to its Gray code equivalent.
0 0 1 1 Binary code
+ + +
0 0 1 0 Gray code
(MSB) (LSB)
11
Digital Electronics Lab (Pattern 2015)
1 0 1 1 Gray code
+ + +
1 1 0 1 Binary code
(MSB) (LSB)
Fig. 2 Gray to Binary Conversion
3) BCD Code:
Binary Coded Decimal (BCD) is used to represent each of decimal digits (0 to 9) with a 4-bit binary code.
For example (23)10 is represented by 0010 0011 using BCD code rather than(10111)2 This code is also
known as 8-4-2-1 code as 8421 indicates the binary weights of four bits(23, 22, 21, 20). It is easy to convert
between BCD code numbers and the familiar decimal numbers. It is the main advantage of this code.
With four bits, sixteen numbers (0000 to 1111) can be represented, but in BCD code only 10 of these are
used. The six code combinations (1010 to 1111) are not used and are invalid.
Applications: Some early computers processed BCD numbers. Arithmetic operations can be performed
using this code. Input to a digital system may be in natural BCD and output may be 7-segment LEDs.
It is observed that more number of bits are required to code a decimal number using BCD code than using
the straight binary code. However in spite of this disadvantage it is very convenient and useful code for
input and output operations in digital systems.
12
Digital Electronics Lab (Pattern 2015)
4) EXCESS-3 Code:
Excess-3, also called XS3, is a non weighted code used to express decimal numbers. It can be used for the
representation of multi-digit decimal numbers as can BCD.The code for each decimal number is obtained
by adding decimal 3 and then converting it to a 4-bit binary number. For e.g. decimal 2 is coded as 0010
+ 0011 = 0101 in Excess-3 code.
This is self complementing code which means 1‘s complement of the coded number yields 9‘s
complement of the number itself. Self complementing property of this helps considerably in
performing subtraction operation in digital systems, so this code is used for certain arithmetic
operations.
For converting 4 bit BCD code to Excess – 3, add 0011 i. e. decimal 3 to the respective code using rules
of binary addition.
The 4 bit Excess-3 coded digit can be converted into BCD code by subtracting decimal value 3 i.e. 0011
from 4 bit Excess-3 digit.
Design:
1) Truth Table:
13
Digital Electronics Lab (Pattern 2015)
B3 B2 B1 B0 G3 G2 G1 G0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
14
Digital Electronics Lab (Pattern 2015)
Fig. 4 K-Map for Reduced Boolean Expressions of Each Output (Gray Code)
15
Digital Electronics Lab (Pattern 2015)
3) Circuit Diagram:
1) Truth Table:
G3 G2 G1 G0 B3 B2 B1 B0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 1 0 0 1 0
0 0 1 0 0 0 1 1
16
Digital Electronics Lab (Pattern 2015)
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
0 1 0 1 0 1 1 0
0 1 0 0 0 1 1 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 0 1 0
1 1 1 0 1 0 1 1
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 0 0 1 1 1 1 0
1 0 0 0 1 1 1 1
17
Digital Electronics Lab (Pattern 2015)
Fig. 6 K-Map for Reduced Boolean Expressions of Each Output (Binary Code)
G1G0G2G3 00 01 11 10
00 0 11
1 0 11
Note:-Use this k-map instead one
01 1 0 1 0 that is given above.
1 1
11 0 0 1
1 1
10 11 0 0
11
18
Digital Electronics Lab (Pattern 2015)
3) Circuit Diagram:
Fig. 7
Logical Circuit Diagram for Gray to Binary Code Conversion
19
Digital Electronics Lab (Pattern 2015)
1) Truth Table:
B3 B2 B1 B0 E3 E2 E1 E0
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 x x x x
1 0 1 1 x x x x
1 1 0 0 x x x x
1 1 0 1 x x x x
1 1 1 0 x x x x
1 1 1 1 x x x x
20
Digital Electronics Lab (Pattern 2015)
Fig. 8 K-Map for Reduced Boolean Expressions Of Each Output (Excess-3 Code)
3) Circuit Diagram:
21
Digital Electronics Lab (Pattern 2015)
22
Digital Electronics Lab (Pattern 2015)
1) Truth Table:
E3 E2 E1 E0 B3 B2 B1 B0
0 0 0 0 X X X X
0 0 0 1 X X X X
0 0 1 0 X X X X
0 0 1 1 0 0 0 0
0 1 0 0 0 0 0 1
0 1 0 1 0 0 1 0
0 1 1 0 0 0 1 1
0 1 1 1 0 1 0 0
1 0 0 0 0 1 0 1
1 0 0 1 0 1 1 0
1 0 1 0 0 1 1 1
1 0 1 1 1 0 0 0
1 1 0 0 1 0 0 1
1 1 0 1 X X X X
1 1 1 0 X X X X
1 1 1 1 X X X X
23
Digital Electronics Lab (Pattern 2015)
Fig 10 K-Map For Reduced Boolean Expressions of Each Output (BCD Code)
24
Digital Electronics Lab (Pattern 2015)
3) Circuit Diagram:
Outcome:
The truth tables have been verified using IC 7486, 7432, 7408, and 7404.
Enhancements/modifications:
25
Digital Electronics Lab (Pattern 2015)
There is a wide variety of binary codes used in digital systems. Often it is required to convert from one
code to another. For example the input to a digital system may be in natural BCD and output may be 7-
segment LEDs. The digital system used may be capable of processing the data in straight binary format.
Therefore, the data has to be converted from one type of code to another type for different purpose.
It is a modified binary code in which a decimal number is represented in binary form in such a way that
each Gray- Code number differs from the preceding and the succeeding number by a single bit.
(e.g. for decimal number 5 the equivalent Gray code is 0111 and for 6 it is 0101. These two codes differ
by only one bit position i. e. third from the left.) It is non weighted code.
Important feature of Gray code is it exhibits only a single bit change from one code word to the next in
sequence. Whereas by using binary code there is a possibility of change of all bits if we move from one
number to other in sequence (e.g. binary code for 7 is 0111 and for 8 it is 1000). Therefore it is more
useful to use Gray code in some applications than binary code.
1. Important feature of Gray code is it exhibits only a single bit change from one code word to the next in
sequence. This property is important in many applications such as Shaft encoders where error
susceptibility increases with number of bit changes between adjacent numbers in sequence.
26
Digital Electronics Lab (Pattern 2015)
2. It is sometimes convenient to use the Gray code to represent the digital data converted from the analog
data (Outputs of ADC).
3. Gray codes are used in angle-measuring devices in preference to straight forward binary encoding.
In weighted codes each digit position of number represents a specific weight. The codes 8421, 2421, and
5211 are weighted codes.
Non weighted codes are not assigned with any weight to each digit position i.e. each digit position
within the number is not assigned a fixed value. Gray code, Excess-3 code are non-weighted code.
Excess-3 code is called self-complementing code because 9‘s complement of a coded number can be
obtained by just complementing each bit.
With four bits, sixteen numbers (0000 to 1111) can be represented, but in BCD code only 10 of these are
used as decimal numbers have only 10 digits fro 0 to 9. The six code combinations (1010 to 1111) are not
used and are invalid.
27
Digital Electronics Lab (Pattern 2015)
Assignment No: 3
Theory:
Carry Save Adder:
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.
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.
28
Digital Electronics Lab (Pattern 2015)
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 3 cases -
1. 0011
+ 0100
---------
0111
Answer is valid BCD number = (7) BCD & so 0110 is not added.
1. 0110
+ 0101
-----------
1011
29
Digital Electronics Lab (Pattern 2015)
2. 1011
+ 0110
-----------
1 0001
(1 1)BCD
1. 1001
+1001
-----------
10010
2. 1 0010
+0110
------------
11000
(1 8)BCD
Valid BCD result = (18) BCD
30
Digital Electronics Lab (Pattern 2015)
1. 4 bit binary adder is used for initial addition. i.e. binary addition of two 4 bit numbers.(
with Cin = 0 ),
2. Logic circuit to sense if sum exceeds 9 or carry = 1, this digital circuit will produce high
output otherwise its output will be zero.
3. One more 4-bit adder to add (0110)2 in the sum is greater than 9 or carry is 1.
31
Digital Electronics Lab (Pattern 2015)
Truth Table:-
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
32
Digital Electronics Lab (Pattern 2015)
K-map:-
Y= S3S2+S3S1
Circuit diagram:
33
Digital Electronics Lab (Pattern 2015)
34
Digital Electronics Lab (Pattern 2015)
INPUT OUTPUT
1st Operand 2nd Operand MSD LSD
A3 A2 A1 A0 B3 B2 B1 B0 Cout S3 S2 S1 S0
(MSB) (LSB) (MSB) (LSB) (MSB) (LSB)
Outcome:
Thus, we studied single bit BCD adder using 4 bit parallel binary adder / 4 bit full adder the observation
table has been verified have been verified using IC 7483 & some logic gates.
Assignments Questions:
35
Digital Electronics Lab (Pattern 2015)
Assignment No.-4
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
o 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.
o It select one of the many I/P at a time.
o Multiplexer improves the reliability of digital system because it
reduces the number of external wire connection.
36
Digital Electronics Lab (Pattern 2015)
4.Applications of MUX
Data selector to select one out of many data I/P.
In Data Acquisition system.
In the D/A converter.
Multiplexer Tree
It is nothing but construction of more number of line using less
number of lines.
It is possible to expand the range of inputs for multiplexers beyond the
available Range in the integrated circuits. This can be accomplished by
interconnecting several multiplexers.
8:1 MUX: The block diagram of 8:1 MUX & its TT is shown. It has eight data
I/P & one enable input, three select lines and one O/P.
Operating principle:
When the Strobe or Enable input is active low, we can select any one
of eight data I/P and connect to O/P.
Design:
37
Digital Electronics Lab (Pattern 2015)
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
Convert the given Boolean expression into standard SOP / POS format if required and complete
the logic diagram design accordingly for realization of the same.
i) As an example:
38
Digital Electronics Lab (Pattern 2015)
SELECTION STROBE
LINES 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.
39
Digital Electronics Lab (Pattern 2015)
ii) As an example
Function = Product of Sum (POS)
Y = ∏ M (0, 5, 6, 7)
SELECTION STROBE
LINES 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 0 1
1 1 0 0 0 1
1 1 1 0 0 1
40
Digital Electronics Lab (Pattern 2015)
POS Y = ∏ M (0, 5, 6, 7)
Use hardware reduction method and implement the given Boolean expression with the help of
neat logic diagram. (N-circle Method)
41
Digital Electronics Lab (Pattern 2015)
Solution:-
Step 1:- Apply B, C, D to select I/P & design table(Implementation table).
Step 2: Encircle those min terms which are present in output.
Step 3: If the min terms in a column are not circled then apply logic 0.
Step 4: If the min terms in a column are circled then apply logic 1.
Step 5: If only min term in 2nd row is encircled then ‗A‘ should be applied to
that data input. Hence apply ‗A‘ to D6.
Step 6: If only min term in 1st row is encircled then ‗ ‘ should be applied to
42
Digital Electronics Lab (Pattern 2015)
A B C D output output
0 0 0 0 0
0
0 0 0 1 0
0 0 1 0 1 ‾
0 0 1 1 0 D
0 1 0 0 1 ‾
0 1 0 1 0 D
0 1 1 0 1
1
0 1 1 1 1
1 0 0 0 0
D
1 0 0 1 1
1 0 1 0 1
1
1 0 1 1 1
1 1 0 0 1 ‾
1 1 0 1 0 D
1 1 1 0 0
D
1 1 1 1 1
43
Digital Electronics Lab (Pattern 2015)
Part-3 Implementation of 16:1 MUX using two 8:1 MUX (Cascading Method)
Step 1: Connect S2, S1, S0 select lines of two 8:1 MUX parallel whereas MSB
select input is used for enabling MUX.
44
Digital Electronics Lab (Pattern 2015)
Final
Select line Output Output
S3 S2 S1 S0 Y1 Y2 Y
0 0 0 0 D0 -- D0
0 0 0 1 D1 -- D1
0 0 1 0 D2 -- D2
0 0 1 1 D3 -- D3
0 1 0 0 D4 -- D4
0 1 0 1 D5 -- D5
0 1 1 0 D6 -- D6
1 1 1 1 D7 -- D7
1 0 0 0 -- D8 D8
1 0 0 1 -- D9 D9
1 0 1 0 -- D10 D10
1 0 1 1 -- D11 D11
1 1 0 0 -- D12 D12
1 1 0 1 -- D13 D13
1 1 1 0 -- D14 D14
1 1 1 1 -- D15 D15
45
Digital Electronics Lab (Pattern 2015)
Outcome:
Multiplexer is used as a data selector to select one out of many data inputs.
It is used for simplification of logic design.
It is used to design combinational circuit.
Use of multiplexer minimizes no. of connections.
FAQ:
.
1. Enlist applications of MUX
1. MUX is used as data selector.
2. It is used to design combinational circuit.
46
Digital Electronics Lab (Pattern 2015)
Decoders are used to decode a coded binary word like BCD to seven segment decoder. Thus
encoder and decoder are application specific logic develop, we cannot use any type of input for
any encoder and decoder.
47
Digital Electronics Lab (Pattern 2015)
Assignment No: 5
Title: - Comparators
Objective: - 1 bit, 2 bit Comparator.
Problem Statement: To verify truth table of 1 bit and 2 bit comparator using logic gate
and comparator IC.
Hardware & Software Requirement’s :
Digital Trainer Kit, Comparator IC-7485, patch cords, +5V power supply.
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
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. Which means: A is
greater than B, A is equal to B, and A is less than B
48
Digital Electronics Lab (Pattern 2015)
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
1. 1-bit comparator
Truth Table:-
Inputs Outputs
B A A>B A=B A<B
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
K-Map
49
Digital Electronics Lab (Pattern 2015)
2 Bit Comparator:-
Truth Table:-
50
Digital Electronics Lab (Pattern 2015)
K-map :-
1. For A>B:
2. For A=B
3. For A<B :-
51
Digital Electronics Lab (Pattern 2015)
Circuit Diagram:-
52
Digital Electronics Lab (Pattern 2015)
Digital comparators actually use Exclusive-NOR gates within their design for comparing their
respective pairs of bits. When we are comparing two binary or BCD values or variables against
each other, we are comparing the ―magnitudeǁ of these values, a logic ―0ǁ against a logic ―1ǁ
which is where the term Magnitude Comparator comes from.
As well as comparing individual bits, we can design larger bit comparators by cascading together
n of these and produce a n-bit comparator just as we did for the n-bit adder in the previous
tutorial. Multi-bit comparators can be constructed to compare whole binary or BCD words to
produce an output if one word is larger, equal to or less than the other.
Outcome:
Up and down counters are successfully implemented, the comparators are studied &
o/p are checked. The truth table is verified.
Assignments Questions:
53
Digital Electronics Lab (Pattern 2015)
Assignment: 6
Theory:
In digital communication, the digital data is sent over the telephone lines using
different binary codes.
Parity: A term used to specify the number of one‘s in a digital word as odd or even.
Even Parity Generator will produce a logic 1 at its output if the data word contains an odd
number of ones. If the data word contains an even number of ones then the output of the parity
generator will be low. By concatenating the Parity bit to the data word, a word will be formed
which always has an even number of ones i.e. has even parity.
Parity bit: An extra bit attached to a binary word to make the parity of resultant word even or
odd. Parity bits are extra signals which are added to a data word to enable error checking.
Definition:- 2 A check bit appended to an array of binary digit to make the sum of all binary
digits.
Parity generator: A logic circuit that generates an additional bit which when appended to a
digital word makes its parity as desired (odd or even).
o Parity generators calculate the parity of data packets and add a parity amount to them.
54
Digital Electronics Lab (Pattern 2015)
o Parity is used on communication links (e.g. Modem lines) and is often included in memory
systems.
Parity checker: At the receiving end a logic circuit is used to check the parity of received
information, and determines whether the error is included in the message or not.
Even bit Parity Code: The total number of ones in parity code word is even.
Odd bit Parity Code: The total number of ones in parity code word is odd.
The single parity bit code can detect the single bit error. If error is more than 1 bit, it is not
possible to detect the error.
Eg:- 1) Assume the even parity code word is sent by the transmitter is 10111, the
code word received by the receiver is 10011.
The parity of received code word is odd, it shows that one bit error is introduced over the
channel.
Eg:- 2) But if the received code word is 10001, the parity of received code is even and
shows that there is no error introduced over the channel.
Limitations: -
1) The one bit parity code word can detect one bit error.
2) It cannot detect the location of error and hence error cannot be corrected
1) Truth Table:
55
Digital Electronics Lab (Pattern 2015)
INPUT OUTPUT
B2 B1 B0 P
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
B1B0 00 01 11 10
B2
0 0 11
0 1
0 11 0
1 1
P = B2 (EX-OR) B1 (EX-OR) B0
56
Digital Electronics Lab (Pattern 2015)
3) Circuit Diagram:
INPUT OUTPUT
B2 B1 B0 P
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
57
Digital Electronics Lab (Pattern 2015)
B1B0
00 01 11 10
B2
0 0
0 1 1
0 0
1 1 1
P = B2 (EX-NOR) B1 (EX-NOR) B0
3) Circuit Diagram:
Odd parity generator:
58
Digital Electronics Lab (Pattern 2015)
0– Error
1– No Error
INPUT OUTPUT
P
Parity B2 B1 B0 PEC
Bit
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 0
1 1 1 0 0
1 1 1 1 1
59
Digital Electronics Lab (Pattern 2015)
PB B1B0 00 01 11 10
2
00 1 0 1 0
01 0 1 0 1
11 1 0 1 0
10 0 0
1 1
3) Circuit Diagram:
Even parity detector:
Even parity detector O/p: PEC = P (EX- NOR) B2 (EX- NOR) B1 (EX- NOR) B0
60
Digital Electronics Lab (Pattern 2015)
INPUT OUTPUT
P
Parity B2 B1 B0 PEC
Bit
0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 1
0 1 0 1 0
0 1 1 0 0
0 1 1 1 1
1 0 0 0 1
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
61
Digital Electronics Lab (Pattern 2015)
B1B0
PB2 00 01 11 10
0 0
00 1 1
0 0
01 1 1
0 0
11 1 1
0 0
10 1 1
3) Circuit Diagram:
Odd parity detector:
P
(MSB)
U2A
B2
7486N
U3A
B1
7486N
U1A (O/P)
B0 7486N
Odd parity detector O/p: PEC = P (EX- OR) B2 (EX- OR) B1 (EX- OR) B0
Outcome: Thus, we studied parity generator / checker and their working & limitation
62
Digital Electronics Lab (Pattern 2015)
63
Digital Electronics Lab (Pattern 2015)
GROUP – B
64
Digital Electronics Lab (Pattern 2015)
Assignment No: 7
Title: Flip-flop.
Problem Statement: Conversion from one type of flip-flop to another type of flip-flop.
.
Hardware & Software Requirement’s :
Digital Trainer Kit, IC 7476, IC 7474, IC 7408, IC 7432 & IC 7404.patch cords, +5V power
supply.
Theory:
A Flip – flop is an electronic device which is having two stable states and a feedback path
which is used to store 1 – bit of information by using the clock signal as input. Latches are also
used to do the same task except that they do not use a clock signal. Hence to say it simply, ―Flip
– flops are clocked latchesǁ. They are used to store only 1 – bit of information and it can remain
in the same state until the clock signal affects the state of the input.
SR flip – flop
D flip – flop
JK flip – flop
T flip-flop
Generally, JK flip – flops and D flip – flops are the most widely used flip – flops. And so their
availability in the form of integrated circuits (IC‘s) is abundant. Numerous varieties of JK flip –
flop and D flip – flop are available in the semiconductor market. The less popular SR flip – flop
and T flip – flop are not available in the market as integrated circuits (IC‘s) (even though a very
few number of SR flip – flops are available as IC‘s, they are not frequently used).
There might be a situation where the less popular flip – flops are required in order to implement
a logic circuit. In order use the less popular flip – flops, we will convert one type of flip – flop
into another. Some of the most common flip – flop conversions are:-
65
Digital Electronics Lab (Pattern 2015)
In order to convert one flip – flop to other type of flip – flop, we should design a combinational
circuit that is connected to the actual flip – flop. Inputs to combinational circuit are same as the
inputs of the desired flip – flop. Outputs of combinational circuit are same as the inputs of the
available flip – flop. So the output of combinational circuit is connected to the input of our
available flip – flop. The pictorial representation of the same is shown below.
Let‘s write a truth table for the two inputs, J and K. For two inputs along with the QP, we get 8
possible combinations in truth table. Consider that when the two inputs are applied, QP is the
present state and QN is the next state. For every combination of J, K , QP , we find the
corresponding QN state. Here QN will give the state values that to which the output of the JK flip
– flop will jump after the present state, on applying the inputs. Now we write all the
combinations of S and R in the truth table to get each QN value from corresponding QP. Hence
these are the values of S and R that are used to change the state of flip flop from QP to QN.
66
Digital Electronics Lab (Pattern 2015)
J K Qn Qn+1 S R
0 0 0 0 0 X
0 1 0 0 0 X
1 0 0 1 1 0
1 1 0 1 1 0
0 1 1 0 0 1
1 1 1 0 0 1
0 0 1 1 X 0
1 0 1 1 X 0
In order to deduce the Boolean equations of S and R in terms of J and K, we use Karnaugh maps
from the above table.
The K – map:-
67
Digital Electronics Lab (Pattern 2015)
.K map :-
The Boolean equations of S and R in terms of J, K and QP are: S = JQ‘P and R = KQP
JK flip – flop implemented from SR flip – flop is shown below. Here J and K are external inputs
to the circuit. S and R are the outputs of the designed combinational outputs.
Converting the SR flip – flop to D flip – flop involves connecting the Data input (D) to the SR
flip – flop. Here the Data input is connected directly to the S input and the inverted D input
(using a NOT gate) is connected to R input. The same can be derived from truth table and
corresponding K – maps. S and R are the inputs of the flip – flop while QP and QP‘ are the present
state and its complementary outputs of the flip – flop. We should design a combinational circuit
such that its input is D and outputs are S and R. Outputs from the combinational circuit S and R
are connected as inputs to the SR flip – flop.
The truth table for conversion of SR flip – flop to D flip – flop is shown below. The truth table is
drawn for the D input and QP output to find the corresponding QN output.
68
Digital Electronics Lab (Pattern 2015)
D Qn Qn+1 S R
0 0 0 0 X
1 0 1 1 0
0 1 0 0 1
1 1 1 X 0
The K – map:-
The K – map:-
69
Digital Electronics Lab (Pattern 2015)
The Boolean equation for S and R in terms of D are: S = D and R = D. The logic diagram of
implementation of D flip – flop from SR flip – flop is shown below.
The combinational circuit required in order to convert an SR flip – flop to T flip – flop can be
constructed from the truth table. The input to the combinational circuit is T (Toggle input) and
the outputs of the combinational circuit are S and R. Here S and R are the inputs of the actual flip
– flop. The output and the complement output of the flip – flop are QP and Q‘P. The truth table
consists of combinations of T and QP in order to get QN where QN is the next state output of the
flip – flop. The combinations of S and R which results in QN are also tabulated in the same table.
T Qn Qn+1 S R
0 0 0 0 X
1 0 1 1 0
1 1 0 1 0
0 1 1 X 0
70
Digital Electronics Lab (Pattern 2015)
The K – map:-
The K – map:-
The Boolean equations of S and R are: S = TQP and R = TQP. The logic circuit for the
implementation of T flip – flop from SR flip – flop is shown below.
71
Digital Electronics Lab (Pattern 2015)
To convert the JK flip – flop into SR flip – flop, we design a combinational circuit with S and R
as its inputs and J and K as its outputs. Here J and K are the inputs of actual flip – flop. So for
making this conversion, we should obtain the J &, K values in terms of S, R and QP.
Consider that when the two inputs S and R are applied, QP is the present state output and QN is
the next state output. For each combination of S, R and QP, we find the corresponding QN state.
Now, we prepare a truth table for the possible combination of the inputs S, R and QP. We can
make 8 possible combinations for the two S and R inputs along with QP. For each combination of
S and R inputs and QP we find the corresponding value of QN. Now we write all the values of J
and K in the truth table to get each QN value from corresponding QP. In SR flip – flop, when the 2
inputs are high i.e. S = 1 & R = 1,
S R Qn Qn+1 J K
0 0 0 0 0 X
0 1 0 0 0 X
1 0 0 1 1 X
1 0 0 1 1 X
0 1 1 0 X 1
0 1 1 0 X 1
0 0 1 1 X 0
1 0 1 1 X 0
72
Digital Electronics Lab (Pattern 2015)
The K – map:-
The K – map:-
The Boolean equations for J and K in terms of S and R are: J = S and K = R. Hence, there is no
requirement of any additional combinational circuit as S and R inputs are same as J and K inputs.
The logic circuit of implementing SR flip – flop from JK flip – flop is shown below.
73
Digital Electronics Lab (Pattern 2015)
Converting the JK flip – flop to D flip – flop, involves in connecting the Data input (D) to the JK
flip – flop through a combinational circuit. Here the Data input is connected directly to the J
input and the inverted D input (using a NOT gate) is connected to K input.
The design of the combinational circuit should be in such a way that D is its input and J & K are
its outputs. The outputs of the combinational circuit J & K are connected as inputs to the flip –
flop. QP is the present state output of the flip – flop. Q‘P is its complementary and QN is the
next state output. The truth table for converting JK flip – flop to D flip – flop is shown below.
The K – maps in order to solve for J and K in terms of D and QP are shown below.
D Qn Qn+1 J K
0 0 0 X 0
1 0 1 X 1
0 1 0 0 X
1 1 1 1 X
K – Map:-
74
Digital Electronics Lab (Pattern 2015)
K – Map:-
The Boolean equations for J and K are J = D and K = D‘. The logic diagram that represents the
implementation of D flip – flop from JK flip – flop is shown below.
Converting the JK flip – flop to T flip flop, involves in connecting the Toggle input (T) directly
to the J and K inputs. So toggle (T) will be the external input to the combinational circuit. Its
output is connected to the Input of actual flip – flop (JK flip – flop).
We prepare a truth table by considering 4 possible combinations of the Toggle input (T) along
with QP. QP and QP‘ are the present state output and its complement output of the flip – flop. QN is
the next state output. The truth table is drawn for the T input and QP output to find the
corresponding QN output. The truth table is shown below.
75
Digital Electronics Lab (Pattern 2015)
T Qn Qn+1 J K
0 0 0 0 X
1 0 1 1 X
1 1 0 X 1
0 1 1 X 0
The K – map:-
The K – map:-
76
Digital Electronics Lab (Pattern 2015)
The logic circuit for converting JK flip – flop to T flip – flop is shown below.
To convert the D flip – flop into SR flip – flop, a combinational circuit should be constructed
where its inputs are S and R and its output is D. Here Data (D) is the input of actual flip – flop.
The truth table is drawn with the 8 possible combinations of the two inputs S & R and QP. QP and
QP‘ are the present state and its complement outputs of the flip – flop.
When the two inputs of SR flip – flop are high i.e. S = 1 and R = 1, then the QP value is invalid
and hence the Data (D) inputs for the corresponding QP‘s are considered as ‗Don‘t cares‘.
The truth table for S, R and QP in order to get QN is shown below. It also consists of D inputs in
order to get the same QN.
77
Digital Electronics Lab (Pattern 2015)
S R Qn Qn+1 D
0 0 0 0 0
0 1 0 0 0
1 0 0 1 1
0 1 1 0 0
0 0 1 1 1
1 0 1 1 1
K MAP:-
The logic diagram using this equation to implement an SR flip – flop from D flip – flop is shown
below.
78
Digital Electronics Lab (Pattern 2015)
When we need to convert the D flip – flop into JK flip – flop, J and K are the inputs of the
combinational circuit with D as its output. Here Data (D) is the input of actual flip – flop. The
truth table is drawn with the 8 possible combinations of the two inputs J & K along with QP. QP
and QP‘ are the present state and its complement outputs of the flip – flop.The truth table consists
of combinations of J, K and QP in order to get QN. Here QN is the next state output of the flip –
flop. The truth table also consists of D inputs that lead to QN output.
The conversion table:-
J K Qn Qn+1 D
0 0 0 0 0
0 1 0 0 0
1 0 0 1 1
1 1 0 1 1
0 1 1 0 0
1 1 1 0 0
0 0 1 1 1
1 0 1 1 1
79
Digital Electronics Lab (Pattern 2015)
The K – map:-
D = JQ‘P + K‘QP.
The Boolean equation of D deduced from the above K – map is the logical representation of
implementing JK flip – flop from D flip – flop is shown below.
80
Digital Electronics Lab (Pattern 2015)
When we need to convert the D flip – flop into T flip – flop, T (Toggle input) is the input of the
combinational circuit with D as its output. Here Data (D) is the input of actual flip – flop. The
truth table is drawn with the 4 possible combinations of the input T along with QP. QP and QP‘ are
the present state and its complement outputs of the flip – flop.
The truth table consists of combinations of T and QP in order to get QN. Here QN is the next state
output of the flip – flop. The truth table also consists of D inputs that lead to QN output.
81
Digital Electronics Lab (Pattern 2015)
T Qn Qn+1 D
0 0 0 0
1 0 1 1
1 1 0 0
0 1 1 1
The K – map:-
D = TQP + TQP.
The Boolean equation of D in terms of T and QP is The logic circuit for implementing T flip –
flop with D flip – flop is shown below.
82
Digital Electronics Lab (Pattern 2015)
83
Digital Electronics Lab (Pattern 2015)
Assignment No: 8
Theory:
1) 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.
2) Up Counter:
3) Down Counter:
84
Digital Electronics Lab (Pattern 2015)
In both the counters Inputs J and K are connected to Vcc, hence J-K Flip flop can work in toggle
mode. Preset and Clear both are connected to logic 1.
Truth Table:
Fig 1:
3 Bit Asynchronous Up Counter
85
Digital Electronics Lab (Pattern 2015)
Timing Diagram:
CLK
Qa 0 0 0 0
3 1 1 1
Qb 0 0 1 1 0 0 1 1
Qc 0 0 0 0 1 1 1 1
86
Digital Electronics Lab (Pattern 2015)
CLK
Qc 0
1
0 1
0
1
0
1
Qb 0 1 1 0 0 1 1 0
Qa 0 0 0 0
1 1 1 1
Uses:
1) The counters are specially used as the counting devices.
2) They are also used to count number of pulses applied.
3) It also works for dividing frequency.
4) It helps in counting the number of product coming out of the machinery where
product is coming out at equal interval of time.
Outcomes: Thus, we implemented up and down ripple counter. Using IC 7476
Enhancements/modifications:
As the design part is done for the 3 bit Counter, we can implement the same for 4 bit counter.
87
Digital Electronics Lab (Pattern 2015)
Asynchronous Counter: In this counter, the first flip-flop is clocked by the external clock pulse
and then each successive flip-flop is clocked by the Q or Q‘ o/p of the previous flip-flop. Hence
in Asynchronous Counter flip-flops are not clocked simultaneously and hence called as Ripple
Counter.
Synchronous Counter: In this counter, the common clock input is connected to all the flip-
flops simultaneously.
What are the problems involved in Ripple Counter?
There are two problems in Ripple Counter as
i. Glitch
ii. Propagation delay of flip-flop.
Why asynchronous counters are called as ripple counters?
In asynchronous 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 of the previous flip-flop i.e. clock (pulses)
applied ripple from stage to stage to stage (LSB to MSB) hence asynchronous counters are called
as ripple counters.
What do you mean by pre-settable counters?
A counter in which starting state is not zero can be designed by making use of the
Preset inputs of the flip flops. This is referred to as loading the counter asynchronously. This is
referred to as pre-settable counter.
What are the applications of asynchronous counters?
Digital clock
Frequency divider circuits
Whether frequency division takes place in asynchronous counters?
Yes. In counter, the signal at the output of last flip flop (i.e. MSB) will have a frequency
equal to the input clock frequency divided by the MOD number of the counter.
Can n- bit up asynchronous counter will act as n- bit down asynchronous counter
without changing the position of the clock?
Yes. Instead of taking output of a counter from uncomplimentary output (Q), if we take it
from complimentary output (Q bar), the same counter circuit will work as down counter.
Assignments Questions:
88
Digital Electronics Lab (Pattern 2015)
Theory:
Counters: counters are logical device or registers capable of counting the no of states or no of
clock pulse arriving at its clock input where clock is a timing parameter arriving at regular
intervals of time, so counters can be also used to measure time & frequencies. They are made
up of flip flops. Where the pulse are counted to be made of it goes up step by step & the o/p of
counter in the flip flop is decoded to read the count to its starting step after counting n pulse
incase of module & counters.
Synchronous Counter:
In this counter, all the flip flops receive the external clock pulse simultaneously.
The gates propagation delay at reset time will not be present or we may
say will not occur.
1) Up counter.
2) Down counter.
3) Up down counter.
Up Counter:
89
Digital Electronics Lab (Pattern 2015)
The up counter counts binary form 0 to7 i.e.(000 to 111).It counts from small to
large number. It‘s O/P goes on increasing as they receive clock pulse
Down Counter:
This down counter counts binary from 7-0 i.e.(111-000).It counts from large to
small number. It‘s O/P goes on increasing as they receive clock pulse
Excitation Table:- The tabular representation of the operation of flip flop (i.e:
Operational Characteristic)
K- map Simplification:
90
Digital Electronics Lab (Pattern 2015)
QBQA QBQA 00 01 11 10
MQC 00 01 11 10 MQC
00 1 X X 1 00 X 1 1 X
01 1 X X 1 01 X 1 1 X
11 1 X X 1 11 X 1 1 X
10 1 X X 1 10 X 1 1 X
JA = 1 KA = 1
QBQA 00 01 11 10 QBQA
MQC MQC 00 01 11 10
00 0 1 X X 00 X X 1 0
01 0 1 X X 01 X X 1 0
11 1 0 X X 11 X X 0 1
10 1 0 X X 10 X X 0 1
JB = M QA + M QA KB = M QA + M QA
QBQA QBQA
00 01 11 10 MQC 00 01 11 10
MQC
00 0 0 1 0 00 X X X X
01 X X X X 01 0 0 1 0
11 X X X X 11 1 0 0 0
10 1 X 0 0 10 X X X X
JC = M QA QB + M QA QB KC = M QA QB + M QA QB
91
Digital Electronics Lab (Pattern 2015)
PR
VC
C J QA J QB J QC
QA QB QC
Uses:
2) The synchronous counter is specially used as the counting devices.
3) They are also used as counter to count the no of clock pulses applied.
4) It also works for counting frequency & is used in frequency divider circuit.
5) It is used in digital voltmeter.
6) It is also used in counter type A to D converter.
7) It is also used for time measurement.
8) It is also used in digital triangular wave generator.
9) It helps in counting the no of product coming out from machinery where product is
coming out at equal interval of time.
Outcome:
Up and down counters are successfully implemented, the counters are studied & o/p
are checked. The truth table is verified.
Enhancements/modifications:
As the design part is done for the 3 bit Counter, we can implement the same for 4 bit counter.
Assignments Questions:
92
Digital Electronics Lab (Pattern 2015)
clock inputs. Count represents the no. of clock pulses arrived. A specified sequence
of states appears as the counter output.
What are the types of Counters? Explain each.
There are two types of counters as Asynchronous Counter and Synchronous Counter.
Asynchronous Counter: In this counter, the first flip-flop is clocked by the external
clock pulse and then each successive flip-flop is clocked by the Q or Q‘ o/p of the
previous flip-flop. Hence in Asynchronous Counter flip-flops are not clocked
simultaneously and hence called as Ripple Counter.
Synchronous Counter: In this counter, the common clock input is connected to all
the flip-flops simultaneously.
What do you mean by pre-settable counters?
A counter in which starting state is not zero can be designed by making use of the
preset inputs of the flip flops. This is referred to as loading the counter
asynchronously. This is referred to as pre-settable counter.
What are the applications of synchronous counters?
Digital clock
Frequency divider circuits
Frequency counters
Used in analog to digital converters
What are the advantages of synchronous counters over asynchronous counters?
Propagation delay time is reduced
Can operate at a much higher frequency than the asynchronous counters.
Ring counter is an example of synchronous counters or asynchronous counter?
Synchronous counter. Since all the flip flops are clocked simultaneously.
Twisted Ring (Johnson’s) counter is an example of synchronous counters or
asynchronous counter?
Synchronous counter. Since all the flip flops are clocked simultaneously.
What is the difference between ring counter and twisted ring counter?
In ring counter pulses to be counted are applied to a counter , it goes from state to state and
the output of the flip flop s in the counter is decoded to read the count. Here the
93
Digital Electronics Lab (Pattern 2015)
uncomplimentary output (Q) of last flip flop is fed back as an input to first flip flop. Ring
counters are referred as MOD ‗N‘ counters.
But in Twisted ring counter the complimentary output (Q bar) of last flip flop is fed back as
an input to first flip flop. Twisted Ring counters are referred as MOD ‗2N‘ counters.
What are the applications of ring counters?
Ring counter outputs are sequential non-overlapping pulses which are useful for control state
counters,
Used in stepper motor, which requires pulses to rotate it from one position to the next.
Used as divide by ‗N‘ ((MOD ‗N‘) counters.
What are the applications of ring counter twisted ring counters?
Used as divide by ‗2N‘ ((MOD ‗2N‘) counters.
Used for control state counters.
Used for generation of multiphase clock.
List the Synchronous Counter ICs.
IC 74160 : Decade Up Counter
IC 74161 : 4 bit binary Up Counter
IC 74162 : Decade Up Counter
IC 74163 : 4 bit binary Up Counter
IC 74168 : Decade Up/Down Counter
IC 74169 : 4 bit Binary Up/Down Counter
IC 74190 : Decade Up/Down Counter
IC 74191 : 4 bit Binary Up/Down Counter
IC 74192 : Decade Up/Down Counter
IC 74193 : 4 bit Binary Up/Down Counter
94
Digital Electronics Lab (Pattern 2015)
Assignment: 09(b)
Conclusion:
1. If both the reset input Ro(1) & Ro(2) are at logic 1 then all the flip-flop will be reset and the
output is given by
QD QC QB QA = 0000
95
Digital Electronics Lab (Pattern 2015)
2. If both the reset input R9(1) & R9(2) are at logic 1 then the counter output is set to decimal
9.
QD QC QB QA = 1001
3. If any one pin of Ro(1) & Ro(2) and one of R9(1) & R9(2) are at low, then the counter
will be in counting mode.
The reset/count function table of IC7490 is shown in table 1.
IC 7490 is MOD-10 or decade counter. It is a 14 pin IC with the pin configuration as shown
in fig:
96
Digital Electronics Lab (Pattern 2015)
97
Digital Electronics Lab (Pattern 2015)
98
Digital Electronics Lab (Pattern 2015)
CLK
0 1 0 0 1 0 1 0 1 0
QA 1
0 0 0 0 1 0 0 0
QB 1 1 1
QC 0 0 0 0 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0
QD 1 1
Application Of IC 7490:
99
Digital Electronics Lab (Pattern 2015)
Outcomes:
Thus, we implemented divide by two (MOD-2) and divide by 5 (MOD-5) counter.
Using IC7490.
Assignments Questions:
1. Design using counter using 7490.
1) MOD-27
2) MOD-17
3) MOD-24
4) MOD-20
5) MOD-7
6) MOD- 98
7) MOD -97
8) MOD -45
9) MOD-56
100
Digital Electronics Lab (Pattern 2015)
Assignment: 10
Operation:
Initially a low clear (CLR) pulse is applied to all flip-flops. Hence FF-3, FF-2, FF-1 will be
reset but FF-0 will be set. So outputs are:
101
Digital Electronics Lab (Pattern 2015)
Q3 Q2 Q1 Q0 = 0001
The clear terminal is made inactive by applying a high level to it. The clock signal is then
applied to all the flip-flops simultaneously. Note that all the flip-flops are negative edge
triggered.
On first negative going CLK edge:
As soon as first falling edge of clock hits, only FF-1 will
be set Q0 = J1 = 1. The FF-0 will reset because J0=Q3=0 and there is no change in the status of
FF-2 and FF-3. Hence after the first clock pulse the outputs are:
Q3 Q2 Q1 Q0 = 0010
Q3 Q2 Q1 Q0 = 0100.
Q3 Q2 Q1 Q0 = 1000
Number Of Output States: The number of output states will be equal to number of flip-flops. So
for a 4 bit counter the number of states is equal to 4.
A3 A2 A1 A0
0 0 0 1
0 0 1 0
0 1 0 0
102
Digital Electronics Lab (Pattern 2015)
1 0 0 0
Applications:
Ring counter are used in those applications in which several operations are to be
controlled in sequential manner. In welding operations such as squeeze, hold, weld, etc.
103
Digital Electronics Lab (Pattern 2015)
In the ring counter the outputs of FF-3 were connected directly to inputs of FF-0 i.e. Q3
to J0 Q3 to k0.
Instead if the outputs are cross coupled to the inputs i.e. if Q3 is connected to k0 & Q3 is
connected to J0 then the circuit is called as twisted ring counter or Johnson‘s counter.
All the Flip-flops are negative edge, triggered, and clock pulses are applied to all of them
and simultaneously.
The clear inputs of all the flip-flops are connected together and connected to an external
clear signal. Note that all there clear inputs are active low inputs.
Operations:
Initially a short negative going pulses is applied to the clear input of all the flip-flop .
This will reset all the flip-flops. Hence initially the outputs are
1) As soon as the first negative edge of clock arrives, FF-0 will be set Hence Q0 will
become 1.
2) But there is no change in the status of any other flip-flop.
3) Hence after the first negative going edge of clock the flip –flop outputs are
104
Digital Electronics Lab (Pattern 2015)
Q3 Q2 Q1 Q0 = 0001
1) Before the second negative going clock edge, Q3=0 & Q3 =1, Hence J0=1and K0 =0.
Also Q0=1.Hence J1=1.
2) Hence the second falling clock edge arrives, FF-1 continues to be in the set mode and
FF-1 will now set. Hence Q1 will become 1 & Q1=0.
3) There is no change in the status of any other FF.
4) Hence the second clock edge the outputs are
Q3 Q2 Q1 Q0=0011
Q3 Q2 Q1 Q0=0111
Q3 Q2 Q1 Q0=1111
Hence as soon as the fifth negative going clock pulses strikes FF-0 will reset. But the
outputs of the other flip-flops will remain unchanged ,So after the fifth clock ,the outputs
are,
Q3 Q2 Q1 Q0=1110
This operation will continue till we reach to all zero output state
Q3 Q2 Q1 Q0=0000
In general we can say that the number of states of a Johnson‘s counter is twice the number of FF
used therefore for a 4-FF Johnson‘s counter; there are 8-distinct output states.
105
Digital Electronics Lab (Pattern 2015)
1 1 1 1 1 5 15
1 1 1 1 0 6 14
1 1 1 0 0 7 12
1 1 0 0 0 8 8
1 0 0 0 0 1 0
Outcomes:
Successfully implemented register as a counter
Assignments Questions:
106
Digital Electronics Lab (Pattern 2015)
Assignment N0. – 11
AIM : To design and implement sequence generator with and without bushing using
IC 7476.
THEORY :
A sequential circuit which generates a prescribed sequence of bits in synchronism with a
clock is referred to as a sequence generator. These pulse trains or sequence of bits can be used to
open valves, close gates, turn on lights, and turn off machines and other variety of jobs.
For the design of sequence generator, we first determine the required no. of flip flops and
the logic circuit for the next state decoder.
No. of flip flops required to generate particular sequence can be determined as follows.
The aim in this experiment is to design a sequence generator to generate a sequence of bit i.e.
10101.
m≤2n-1
107
Digital Electronics Lab (Pattern 2015)
For the given sequence no. of 1‘s=3 no. of 0‘s=2, so minimum value of n which satisfies above
relation is 3. Once the no. of flip flops are decided we have to assign unique states corresponding
to each bit in the given sequence such that flip flop representing least significant bit generates the
given sequence ( usually the o/p of flip flop representing the least significant bit is used to
generate the given sequence)
Design -
For the sequence of bits 10101 we require three flip flops as calculated above. The State
Diagram, state assignment for this problem is shown below. Where we will use the o/p FF 0 i.e.
o/p of first flip flop Q0 as a sequence of bits & assign unique states corresponding to each bit in
the sequence as shown in state assignment table.
Q2 Q1 Q0 STATES
0 0 1 1
0 0 0 0
0 1 1 3
0 1 0 2
1 0 1 5
State Diagram :-
5 0
2 3
State table :
108
Digital Electronics Lab (Pattern 2015)
Q2 Q1 Q0 Q2 Q1 Q0 J2 K2 J1 K1 J0 K0
0 0 0 0 1 1 0 X 1 X 1 X
0 0 1 0 0 0 0 X 0 X X 1
0 1 0 1 0 1 1 X X 1 1 X
0 1 1 0 1 0 0 X X 0 X 1
1 0 0 X X X X X X X X X
1 0 1 0 0 1 X 1 0 X X 0
1 1 0 X X X X X X X X X
1 1 1 X X X X X X X X X
K-Map simplification:
1) For J0 –
00 01 11 10
1 X X 1
X X X X
J0 = 1
109
Digital Electronics Lab (Pattern 2015)
2) For K0 –
00 01 11 10
X 1 1 X
X 0 X X
K0 = Q2
3) For J1 –
00 01 11 10
1 0 X X
X 0 X X
J1 = Q0
3) For K1 –
00 01 11 10
X X 0 1
X X X X
K1 = Q0
110
Digital Electronics Lab (Pattern 2015)
3) For J2–
00 01 11 10
0 0 0 1
X X X X
J2 = Q1Q0
3) For J1 –
00 01 11 10
X X X X
X 1 X X
K2 = 1
111
Digital Electronics Lab (Pattern 2015)
Logic Diagram-
vc
vc J0 Pr J1 Pr J2 Pr
Q0 Q1 Q2
Clk
Q0(LSB) Q1 Q2(MSB)
Hardware requirements:
JK F/F 7476 2
AND 7408 1
112
Digital Electronics Lab (Pattern 2015)
The state assignment for this is shown below as we have seen during designing of sequence
generator without using bushing we will have the output ‗C‘ i.e. the output of first Flip-Flop is a
sequence generator of bits and assign unique states corresponding to each bit in the sequence out with
bushing means we have to use unassigned states also that is 4,6,7.
Q2 Q1 Q0 STATES
0 0 1 1
0 0 0 0
0 1 1 3
0 1 0 2
1 0 1 5
State Diagram- 4
6
1
7
5 0
2 3
113
Digital Electronics Lab (Pattern 2015)
State Table :-
Q2 Q1 Q0 Q2 Q1 Q0 J0 K0 J1 K1 J2 K2
0 0 0 0 1 1 1 X 1 X 0 X
0 0 1 0 0 0 X 1 0 X 0 X
0 1 0 1 0 1 1 X X 1 1 X
0 1 1 0 1 0 X 1 X 0 0 X
1 0 0 0 0 0 0 X 0 X X 1
1 0 1 0 0 1 X 0 0 X X 1
1 1 0 0 0 0 0 X X 1 X 1
1 1 1 0 0 0 X 1 X 1 X 1
K Map Simplification :
For J0 –
00 01 11 10
1 X X 1
0 X X 0
J0 = Q2
114
Digital Electronics Lab (Pattern 2015)
3) For K0 –
00 01 11 10
0
X 1 1 X
X 0 1 X
K0 = Q2 + Q1
3) For J1 –
00 01 11 10
1 0 X X
0 0 X X
J1 = Q2Q0
3) For K1 –
00 01 11 10
X X 0 1
X X 1 1
K1 = Q2 + Q0
3) For J2–
00 01 11 10
0 0 0 1
X X X X
J2 = Q1Q0
3) For J1 –
115
Digital Electronics Lab (Pattern 2015)
00 01 11 10
X X X X
1 1 1 1
K2 = 1
Logic Diagram
vc
J0 pr J1 Pr J2 Pr Q2
Q0 Q1
F/F-
1
F/F- F/F-
2 3
vcc
cl
k
Q0 (LSB) Q1 Q2 (MSB)
116
Digital Electronics Lab (Pattern 2015)
4) Hardware requirements:
JK F/F 7476 2
AND 7408 1
OR 7432 1
Conclusion: In this way sequence generator with & without bushing is studied and implemented.
FAQs :
117
Digital Electronics Lab (Pattern 2015)
10. How many flip flops are required to design sequence generator using Counters:
max (0‘S,1‘S) in a given sequence <= 2(N - 1)
11. How many flip flops are required to design sequence generator using shift registers:
S<= 2N - 1
118
Digital Electronics Lab (Pattern 2015)
S= Length of sequence
pulses remains in invalid states only i. e. counter gets locked into invalid state
& this is called as lock out. Lock out can be avoided by providing bushing to
all the invalid states in such a way that after application of one or more clock
119
Digital Electronics Lab (Pattern 2015)
Assignment No. – 12
Equipments: Logic board with IC sockets & LEDs, DC power supply, IC 74194,7404,7486.
We know that a register may operate in any of the modes , like SISO, SIPO, PISO, PIPO or bi-
directional. 74194 has 4 parallel data i/p ( D0-D3) & S0 & S1 are the control i/ps.When S0 & S1 are
high , data appearing on D0-D3 i/ps is transffered to the Q0-Q3 o/ps respectively, following the
next Low to High transition of the clock shift right is accomplished by setting S1 S0 = 0 1, &
serial data is entered at the shift right serial i/p, DSR. Shift left is accomplished by setting S1 S0 =
1 0 , & serial data is entered at the shift left serial i/p, DSL.CP is clock pulse (positive edge
triggered).
I/Ps O/Ps
Reset (Clear) 0 0 0 0 0
1 1 0 0 Q1 Q2 Q3 0
Shift Left
1 1 0 1 Q1 Q2 Q3 1
1 0 1 0 0 Q0 Q1 Q2
Shift Right
1 0 1 1 1 Q0 Q1 Q2
Parallel Load 1 1 1 Dn D0 D1 D2 D3
Hold 1 0 0 Q0 Q1 Q2 Q3
120
Digital Electronics Lab (Pattern 2015)
Q3 Q2 Q1 Q0 = 0 0 1 1
121
Digital Electronics Lab (Pattern 2015)
The PRBS generator cannot generate a truly random sequence because this stucture is a
deterministic stucture. This is the reason why the sequence repeats itself. The maximum length
of the sequence will be 2m-1.This is because the state 0 0 0…….0 must be excluded.
001101011110001
Binary sequence of Q3
122
Digital Electronics Lab (Pattern 2015)
Application of PRBS:
Since the sequence produced is random, PRBS generator is also called as a Pseudo Noise
Generator. This noise can be used to test the noise immunity of the system under test.
PRBS generator is an important part of data encryption system. Such a system is required
to protect the data from data hackers.
Procedure:
EX-NOR PRB
Clock Shift Register
Gate Sequence
Pulse
Q3 Q2 Q1 Q0 Q3
0 0 0 0 0 00=1 0
1 0 0 0 1 00=1 0
2 0 0 1 1 00=1 0
3 0 1 1 1 01=0 0
4 1 1 1 0 11=1 1
5 1 1 0 1 11=1 1
6 1 0 1 1 10=0 1
7 0 1 1 0 01=0 0
8 1 1 0 0 11=1 1
9 1 0 0 1 10=0 1
123
Digital Electronics Lab (Pattern 2015)
10 0 0 1 0 00=1 0
11 0 1 0 1 01=0 0
12 1 0 1 1 10=0 1
13 0 1 0 0 01=0 0
14 1 0 0 0 10=0 1
15 0 0 0 0 00=1 0
16 0 0 0 1 00=1 0
17 0 0 1 1 00=1 0
18 0 1 1 1 01=0 0
19 1 1 1 0 11=1 1
Procedure:
124
Digital Electronics Lab (Pattern 2015)
Assignment No. – 13
AIM : To design & implement sequence detector to detect the given binary sequence.
External
External
Next Memory Output Output
Inputs state element logic s
Excitatio
s
125
Digital Electronics Lab (Pattern 2015)
State Diagram
Represents information in a state table in graphical form. In this state is
represented by a circle with the state indicated inside the circle. Directed lines
connecting the states indicate the transition between the states when the input is applied
and the circuit is clocked.
Input and output conditions for a particular transition to take place are labeled with the
directed lines, 1st binary number indicates input and 2nd binary number indicates output.
In case, if input condition doesn‘t cause change of state, the fact is indicated by the
directed line terminating on the same circle from which it is originated.
B. Sequence detector design
Sequence detector is an example of a clocked sequential circuit which is used to detect
desired binary sequence.
Sequence detector is a state Machine with total no. of States = No. of bits in the binary
sequence which is to be detected, one external input & one external output.
126
Digital Electronics Lab (Pattern 2015)
1. State Assignment -
Assign states preferably in binary.
2. State diagram –
To draw the state diagram, start from the first state, if the bit
applied on the external input is the desired bit on
the sequence to be detected, we have to go to the next state
otherwise we have to go to the previous state from where we
can continue the desired sequence. When complete sequence is
detected, make external output high or otherwise low. Once
complete sequence is detected, go to the initial state.
3. Draw state table from state diagram.
4. Get reduced Boolean expression for every flip flop input and external output
in terms of external input and present state.
5. Implement Boolean expression using logic gates and draw complete circuit
diagram with flip flops and logic gates.
127
Digital Electronics Lab (Pattern 2015)
PROBLEM STATEMENT -
Design sequence detector to detect sequence 1010 using JK flip flop IC 7476.
(Use Mealy Model)
Design -
1. No. of states = 4 (no. of bits in the sequence to be detected)
Min. no. of flip flops required (m) is given by relation 2m < 4.
Min. value of m to satisfy this relation is 2.
2. State Assignment - Binary assignment and states will be assigned as
M0 (00), M1 (01), M2 (10) & M3 (11).
3. State diagram.
a. Start with initial state. If the bit applied on the external input is the
desired bit in the length to be detected, we have to go the next state
when complete sequence is detected output must go
0/1
b. If the bit applied on the external input is not the desired bit in the
sequence to be detected, we have to go to the previous state from
where we can continue the desired sequence and will arrive at the
minimized state diagram. To do this we have to find out the largest
subsequence that is L– prefix of the given sequence to be detected i.e.
128
Digital Electronics Lab (Pattern 2015)
129
Digital Electronics Lab (Pattern 2015)
iv. Suppose following a reset 1011 is received what will the final state
?
So, R4 = 1011, D4 = 1010. To find GPSS, L = 4
4 - Prefix of D4 = 1010
4 - Suffix of R4 = 1011 .
130
Digital Electronics Lab (Pattern 2015)
Sequence Detector
0/0 1/0
1/0
M1 0/0 1/0 M3
M0 1/00 M2
0/0
0/1
Fig. 3 Complete State Diagram
4. State Table
Present Ext. Ext.
Sr. Next State Flip Flop inputs
State Input Output
No.
QB QA X QB QA Y JB JB JA JA
1 0 0 0 0 0 0 0 X 0 X
131
Digital Electronics Lab (Pattern 2015)
2 0 0 1 0 1 0 1 X 0 X
5.3 G 1 0 0 1 0 0 X 1 1 X
4e 1 0 1 0 1 0 X 0 0 X
5t 0 1 0 0 0 0 0 X X 1
6t 0 1 1 1 1 0 1 X X 0
7i 1 1 0 0 0 1 X 1 X 1
8n 1 1 1 0 1 0 X 0 X 1
g
M
6. M
0 0 1 1
X X X X
JA =X
X X 1 1
X X 1 0
132
Digital Electronics Lab (Pattern 2015)
KA =A + X
0 X X 0
1 X X 0
JB = QA X
X 1 0 X
X 1 1 1
KB = X + QA
11. Sequence Detector
0 0 0 0
0 0 1 0
Y = XQBQA
7. Logic Diagram –
133
Digital Electronics Lab (Pattern 2015)
GATE / IC Quantity
Flip Flop
MS JK FF 7476 1
NOT 7404 1
AND 7408 1
OR 7432 1
Conclusion: Thus GPSS ( Greatest common Prefix Suffix Subsequence ) can be used to
design sequence detector to get optimized state diagram with minimum
134
Digital Electronics Lab (Pattern 2015)
Enhancements / Modifications – Design (upto state diagram ) the sequence detector to detect
different binary sequences.
FAQ’s :
1. What is the state diagram?
In this state is represented by a circle with the state indicated inside the
circle. Directed lines connecting the states indicate the transition between the
states when the input is applied and the circuit is clocked.
Input and output conditions for a particular transition to take place are labeled
with the directed lines, 1st binary number indicates input and 2nd binary number
indicates output. In case, if input condition doesn‘t cause change of state, the
fact is indicated by the directed line terminating on the same circle from
which it is originated.
2. What do you mean by sequence detector?
Sequence detector is an example of a clocked sequential circuit which is used
to detect desired binary sequence.
11. Sequence Detector
Sequence detector is a state Machine with total no. of States = No. of bits in
the binary sequence which is to be detected, one external input & one external
output.
3. Sequence detector is a combinational or sequential logic circuit?
Sequence detector is an example of a clocked sequential circuit
4. How many flip-flops we need to design ‗n‘ bit sequence detector?
135
Digital Electronics Lab (Pattern 2015)
Find no. of states, in turn number of flip flops required. To do this general
rule is :
Total no. of states ( n ) = Total no. of bits in the binary sequence to be
detected.
Minimum number of flp flops required ( m ) is given by relation 2m <= n.
5. What is state table?
State table is a table which provides information about sequence of external inputs,
present state, next State, external outputs of a state machine and its general format
is
136
Digital Electronics Lab (Pattern 2015)
1. Usually it requires less number of states and thereby less hardware to solve any
problem.
2. Also the output is generated one clock cycle earlier.
9.What are the disadvantages of Mealy model ?
The input transients, glitches are directly conveyed to the output. Also if we
want Output transitions to be synchronized while input can change any time .
Hence Mealy model is not preferred.
10. What are the advantages of Moore model over Mealy model?
In this model the output remains stable over entire clock period and changes
only when there occurs a state change at clock trigger based on input
available at that time.
11. Is there any difference in hardware requirement between Moore and Mealy machine?
Yes. Comparatively less hardware is requirement in Mealy machine than Moore
machines.
12. What are the disadvantages of state transition diagrams?
Though state transition diagrams are more compact in representation, for
relatively more complex problem where number of inputs and states are higher
the state diagram space becomes so crowded that it is difficult to read. In such
situations ASM charts are preferred
137
Digital Electronics Lab (Pattern 2015)
Assignment No - 14
Hardware & software requirements: Digital Trainer Kit, 74151(8:1 MUX), 7474 (D
Flip-flop), Power supply, Patch Cord.
Theory:
1. ASM chart means algorithmic state machine chart.
2. It is a type of flowchart that can be used to represent the state transitions and generated
outputs for finite state machine(FSM)
3. ASM charts are similar to traditional flowcharts.
4. Unlike a traditional flowchart, this includes timing information. This chart specifies that
the FSM flows from one state to another only after each active clock edge.
1. State Box- A rectangle represents a state of the FSM. It is equivalent to node in the state
diagram or row in the state table. The name of the state should be indicated outside the
box in left top corner. Moore type of outputs is listed inside the box.
2. Decision Box- A diamond indicates that the stated condition expression has to be tested
and an exit path has to be chosen accordingly. The condition expression consists of one
or many inputs.
3. Conditional output Box- The oval denotes the output signals that are of Mealy type.
These output depend on the values of state variables and the Inputs of FSM .the condition
that determines whether such Outputs are generated is specified in a decision box.
138
Digital Electronics Lab (Pattern 2015)
State Name
Significance : It is an aid to design the complex circuits.ASM charts are used to describe
complex circuits that include one or more FSM‘s and another circuitry such as
registers,counters,adders,multipliers,etc.
ASM Block
1. It is a structure which consists of single state box and any decision and conditional output
boxes that the state box may be connected to.
2. It has one entrance and any number of exit paths.
Each block describes the state of the system during the interval of one clock pulse. Multiplexer
controller method of design has three levels of components as shown in the figure below:
1. The multiplexer outputs are applied to the input of the flip-flop forming the register at the
second level to hold the present state inputs.
2. The multiplexers decide the next state of the register as outputs of MUX has been
connected to flip-flop inputs.
3. Third level is the decoder which provides separate output for each control state. The
decoder can be replaced by the combinational circuit.
139
Digital Electronics Lab (Pattern 2015)
First level
(Multiplexers) Second level
(Register)
FF
MUX Output MUX 1 Third level
1 (Decoder)
Select
Output
MUX
Inputs
Select
MUX FF
MUX Output
2 2
S0
1=M
1
1 1
S2
140
Digital Electronics Lab (Pattern 2015)
00
01
0 1
M
10
0 1
M
11
141
Digital Electronics Lab (Pattern 2015)
Qn Qn+1 Dn
0 0 0
0 1 1
1 0 0
1 1 1
State Table :
Logic Diagram:
142
Digital Electronics Lab (Pattern 2015)
+VCC
D0
D1
D2 Y1
DB QB
D3
8:1
MUX-1
D4
D5 FF
D6
D7
S2 S1 S0
QB
Mode (M)
+VCC
S2 S1 S0
D0
D1
Y2
D2 DA QA
D3
8:1
MUX-2
D4
FF
D5
D6
D7
QA
Clock
Outcome: ASM chart is drawn as per the state diagram and verified the functionality
of given FSM using multiplexer controller method.
FAQ’s:
143
Digital Electronics Lab (Pattern 2015)
A finite state machine (FSM) or finite state automaton (plural: automata) or simply a state
machine, is a model of behavior composed of a finite number of states, transitions between those
states, and actions. A finite state machine is an abstract model of a machine with a primitive
internal memory.
2. What is the major difference between ASM chart and traditional flowchart?
ASM charts are similar to traditional flowcharts. Unlike a traditional flowchart, this includes
timing information. This chart specifies that the FSM flows from one state to another only after
each active clock edge.
It is an aid to design the complex circuits. ASM charts are used to describe complex circuits that
include one or more FSM‘s and another circuitary such as registers, counters, adders, multipliers
etc.
144
Digital Electronics Lab (Pattern 2015)
GROUP - C
145
Digital Electronics Lab (Pattern 2015)
Assignment No: 15
Theory:
PLA is a programmable logic device. PLA consist of two level AND-OR configuration. The
input are applied to the AND matrix through input buffer and output buffer of AND matrix is
applied to the OR matrix. The input of two or more
PLA devices should be connected individually in parallel, then this connection the
Number of input and the number of product terms will remain unchanged but the
Number of output lines is increased.
Applications:
1. We can implement the combinational circuit using PLA.
2. We can also implement the sequential circuit using PLA.
146
Digital Electronics Lab (Pattern 2015)
3. For implementation the combinational circuit, the PLA device with only output buffer are used
whereas to implement the sequential circuit we use the PLA device with flip flop and buffers
included in output stage.
Block Diagram:
147
Digital Electronics Lab (Pattern 2015)
148
Digital Electronics Lab (Pattern 2015)
Step 2: K-Map
Fig. 8 K-Map For Reduced Boolean Expressions Of Each Output (Excess-3 Code)
The four simplified expression and associated product terms are as follow:-
E3= B3 + B2B0 + B2B1
| | |
(1) (2) (3)
149
Digital Electronics Lab (Pattern 2015)
E0 =B0
|
(9)
Step 3: Prepare the PLA program table
Table 2: PLA programming table
Product I/P O/P
term
Product term
B3 B2 B1 B0 E3 E2 E1 E0
No.
1 1 _ _ _ 1 _ _ _
B3
2 _ 1 _ 1 1 _ _ _
B2B0
3 _ 1 1 _ 1 _ _ _
B2B1
4 _ 0 1 _ _ 1 _ _
B2B1
5 _ 0 _ 1 _ 1 _ _
B2B0
6 _ 1 0 0 _ 1 _ _
B2B1B0
7 _ _ 0 0 _ _ 1 _
B1B0
8 _ _ 1 1 _ _ 1 _
B1B0
9 _ _ _ 0 _ _ _ 1
B0
150
Digital Electronics Lab (Pattern 2015)
Outcome:
Test the circuit for all possible combinations of input and output codes.
Assignment Question:
151
Digital Electronics Lab (Pattern 2015)
Assignment No. – 16
Title: Design and simulation of - Full adder, Flip flop, MUX using VHDL (Any 2) Use different
modeling styles.
Objective: Learn H/W programming
Problem Statement : Implementation of Full Adder and VHDL for 4:1 MUX
Hardware & software requirements: Verilog Simulator
Introduction to VHDL:
Very High-Speed Integrated Circuit (VHSIC) HDL (VHDL) was developed by US army in
1982.VHDL is a programming language for describing the behavior of digital systems. This
language has constructs that enable to express the concurrent or sequential behavior of digital
system with or without timing, it also allows interconnecting component.
VHDL is one of a few HDLs in widespread use today. VHDL is recognized as a standard HDI
by the Institute of Electrical and Electronics Engineers (IEEE Standard 1076, ratified in 1987
and by the United States Department of Defense (MIL-STD-454L).
VHDL has many features appropriate for describing the behavior of electronic component
ranging from simple logic gates to complete microprocessors and custom chips.VHDL allows
the behavior of complex electronic circuits to be captured into a design system for automatic
circuit synthesis or for system simulation.
One of the most important applications of VHDL is to capture the performance specification for
circuit, in the form of what is commonly referred to as a test bench.
Features Of VHDL:
152
Digital Electronics Lab (Pattern 2015)
1. LIBRARY Declarations :
A LIBRARY is a collection of commonly used pieces of code. Placing such pieces inside
a library allows them to be reused or shared by other designs.
The typical structure of a library is illustrated in fig. 2 . The code is usually written in the
form of FUNCTIONS, PROCEDURES, or COMPONENTS, which are placed inside
PACKAGES, and then compiled into the destination library. To declare a LIBRARY two
lines of code are needed one containing the name of the library and the other a use clause, as
shown in the syntax below.
LIBRARY library_name;
USE Library_name_package_name.package_parts;
At least three packages, from three different libraries, are usually needed in a design that is:
153
Digital Electronics Lab (Pattern 2015)
LIBRARY work;
USE work.all;
2. Entity:
A VHDL entity specifies the name of the entity, the ports of the entity, and entity-related
information. All designs are created using one or more entities. Entity is the description of the
interface between a design and external environment. An entity defines the input and output
ports of a design.A design can contain more than one entity.Each entity has its own architecture
statement.
The syntax of entity is as shown in following:
entity entity_name is
end [entity_name];
Entity_name:
Port_name:
Port_type:
In: input port. A variable or a signal can read a value from a port of mode in, but is not
allowed to assign a value to it.
Out : output port. It is allowed to make signal assignments to a port of the mode out, but
it is not legal to read from it.
154
Digital Electronics Lab (Pattern 2015)
Inout : bi-directional port. Bothassignments to such a port and reading from it are
allowed.
Buffer : output port with read capability. It differs from inout in that it can be updated by
at most one source, whereas inout can be updated by zero or more sources.
Fig. Legend of
Entity
declaration
3. Architecture:
Architecture is always related to an entity and describes the behavior of that entity.
The syntax is:
architecture architecture_name of entity_name is
{ block_declarative_item }
begin
{ concurrent_statement }
end [ architecture_name ];
155
Digital Electronics Lab (Pattern 2015)
156
Digital Electronics Lab (Pattern 2015)
-- Company:
-- Engineer:
--
-- Design Name:
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
157
Digital Electronics Lab (Pattern 2015)
--
-- Revision:
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity mux is
Y : out STD_LOGIC);
end mux;
begin
with S select
158
Digital Electronics Lab (Pattern 2015)
end Behavioral;
---------------------end code----------------------------------
159
Digital Electronics Lab (Pattern 2015)
Simulation:-
160
Digital Electronics Lab (Pattern 2015)
161
Digital Electronics Lab (Pattern 2015)
Assignment No. – 17
Fig. A
VHDL
Statements
162
Digital Electronics Lab (Pattern 2015)
• If Statements
• Case Statements
• Loop Statements
• Next Statements
• Exit Statements
• Subprograms
• Return Statement
• Wait Statements
• Null Statements
Concurrent Statements:
The functionality of a design is defined in VHDL by a set of concurrent statements.
These statements mimic hardware in that many of these statements can be active at the same
time. All concurrent statements describe the functionality of multiplexer structures. It is
impossible to model storage elements, like Flip Flops with concurrent statements, only.
The main concurrent statements:
1. Process Statements
2. Block Statements
4. Direct Instantiation
5. Generate Statements
Process Statements:
163
Digital Electronics Lab (Pattern 2015)
Target:
164
Digital Electronics Lab (Pattern 2015)
else
sequential_statements
end if;
165
Digital Electronics Lab (Pattern 2015)
3) if-then-elsif-else statement
if condition then
sequential_statements
eLsif condition then
sequential_statements
else
sequential_statements
end if;
3. Case Statements:
Definition:
The case statement selects for execution one of several alternative sequences of
statements; the alternative is chosen based on the value of the associated expression.
The syntax is:
case expression is
when choices =>
{ sequentiaL_statement }
{ when choices =>
{ sequentiaL_statement } }
end case;
4. Loop Statements:
Definition:
A loop statement repeatedly executes a sequence of statements.
The syntax is:
[ Label: ] [ iteration_scheme]loop
{ sequential_statement }
{ next [ tabel] [ when condition ] ; }
{ exit [ label] [ condition ] ; }
end Loop [label];
5. For---Loop Statements
166
Digital Electronics Lab (Pattern 2015)
The for loop is a sequential statement that allows you to specify a fixed number of
iterations in a behavioral design description. The for loop includes an automatic declaration for
the index (i in following example). You do not need to separately declare the index variable.
The syntax is:
[label:] for identifier in range Loop
{ sequential_ statement }
end loop [label]
6. Next Statements:
The next statement allows skipping a part of an iteration loop. If the condition specified
after the when reserved word is TRUE, or if there is no condition at all, then the statement is
executed.
The syntax is:
next [label] [ when condition ];
7. Exit Statements:
The exit statement completes execution of an enclosing iôop statement, called label in the
syntax. The completion is conditional if the statement includes a condition, such as the when
condition.
The execution of the exit statement depends on a condition placed at the end of the
statement, right after the when reserved word. When the condition is TRUE (or if there is no
condition at all) the exit statement is executed and the control is passed to the first statement after
the end loop.
The syntax is:
8. Return Statements:
return; -- Procedures
9. Null Statements:
167
Digital Electronics Lab (Pattern 2015)
The null statement explicitly states that no action is required. It is often used in case
statements because all choices must be covered, even if some of the choices are ignored.
null;
The behavioral VHDL code for the 4-bit binary down counter is Shown in Fig.B
168
Digital Electronics Lab (Pattern 2015)
Assignment No. – 18
Equipments: Logic board with IC sockets & LEDs, DC power supply, IC 7432,7404,7408,
7411.
Theory:
While designing with PAL, the function in its sum of products form need to be simplified to fit
into each section. Since OR array is fixed, number of product terms per OR gate cannot be
changed. Hence if number of product terms in any function are more, then it may be necessary to
section to implement the Boolean function. In PALs , unlike the PALs, a product term cannot be
shared among two or more OR gates.
Example:
A(x,y,z) = m ( 1,2,4,6)
B(x,y,z) = m (0,1,3,6,7)
C(x,y,z) = m(2,6)
D(x,y,z) = m(1,2,3,5,7)
Solution:
YZ
X 00 01 11 10
0
0 1 0 1
1
1 0 0 1
A=XYZ+XZ+YZ
169
Digital Electronics Lab (Pattern 2015)
For B
00 01 11 10
0
1 1 1 0
1 0 1
0 1
B=XY+YZ+XY
For C
00 01 11 10
0 0 0 0 1
1 0 0 0 1
C=YZ
For D
00 01 11 10
0
0 1 1 1
1
0 1 1 0
D=Z+XY
The PAL program table shown in below table contains three columns specifying product terms ,
inputs & outputs.
170
Digital Electronics Lab (Pattern 2015)
Procedure:
2. Connect DC power supply and check all the conditions given in the PAL program table.
171
Digital Electronics Lab (Pattern 2015)
X Y Z
X Y Z
172
Design Expt.
A(x,y,) = m ( 0,1)
B(x,y,) = m (2,3)
A(x,y,z) = m ( 0,7,6,4)
B(x,y,z) = m (1,2,3,4)
C(x,y,z) = m(2,6)
D(x,y,z) = m(1,2,3,5,7)
A(x,y,z,w) = m ( 4,6,8,10)
B(x,y,z,w) = m (1,3,5,7)
C(x,y,z,w) = m(12,14)
D(x,y,z,w) = m(10,11,12,15)