Digital Electronics
Digital Electronics
Manoj Pandya
+91 - 9460378169
UNIT - I
Positional Number System: Binary, decimal, octal and Hexadecimal number system.
conversion from one base to another base. Representation of positive and negative integers,
Real numbers, Characters.
Digital codes: weighted binary code, Non weighted code, Gray code. Binary to Gray
conversion, Gray to binary conversion. BCD code. Binary Arithmetic in 1's and 2's
complement.
UNIT-II
Boolean Algebra: Binary valued quantities, Logical Operations, Basic postulates of Boolean
Algebra, Principle of Duality , Basic theorems of Boolean algebra , De- Morgan's Theorem.
Finding complements of Boolean expressions. Minterm and Maxterm of Boolean Function.
Simplifications of SOP Boolean expressions using karnaugh map - 3 variables Boolean
function, 4 variables Boolean Function.
UNIT - III
Basic Logic Gate: Universal Logic gate , Exclusive -OR, Equivalence OR gates.
Combinational Circuits: Half Adder , Full Adder, Parallel Binary Adder, Subtractor,
Comparator , Decoder , Encoder , Multiplexer, Demultiplexer.
UNIT - IV
Combinational versus Synchronous circuits.
Flip Flop: : Edge Triggered versus Pulse Triggered Flip Flop, S-R , D , J-K , T edge triggered
Flip flop. J-K Master slave Flip flop
UNIT - V
Shift Register: Shift Register Function , Serial and Parallel Shift registers , Bi-directional
Shift registers.
Counters: Asynchronous and Synchronous counters, Up/Down Counters, Decade Counters
2
Unit - I
3
Introduction:-
Digital electronics deals with the electronic manipulation of numbers, or with
the manipulation of varying quantities by means of numbers. Because it is convenient to do so, today's
digital systems deal only with the numbers 'zero' and 'one', because they can be represented easily by
'off and 'on' within a circuit.
1. Binary Number System:- All digital circuits and systems use this binary number system. The
base or radix of this number system is 2. So, the numbers 0 and 1 are used in this number system. The
part of the number, which lies to the left of the binary point is known as integer part. Similarly, the part
of the number, which lies to the right of the binary point is known as fractional part. In this number
system, the successive positions to the left of the binary point having weights of 20, 21, 22, 23 and so on.
Similarly, the successive positions to the right of the binary point having weights of 2-1, 2-2, 2-3 and so on.
That means, each position has specific weight, which is power of base 2.
2. Octal Number System: The base or radix of octal number system is 8. So, the numbers
ranging from 0 to 7 are used in this number system. The part of the number that lies to the left of
the octal point is known as integer part. Similarly, the part of the number that lies to the right of
the octal point is known as fractional part. In this number system, the successive positions to the
left of the octal point having weights of 80, 81, 82, 83 and so on. Similarly, the successive
positions to the right of the octal point having weights of 8-1, 8-2, 8-3 and so on. That means, each
position has specific weight, which is power of base 8.
3. Decimal Number System: The base or radix of Decimal number system is 10. So, the
numbers ranging from 0 to 9 are used in this number system. The part of the number that lies to
the left of the decimal point is known as integer part. Similarly, the part of the number that lies
to the right of the decimal point is known as fractional part. In this number system, the
successive positions to the left of the decimal point having weights of 100, 101, 102, 103 and so
on. Similarly, the successive positions to the right of the decimal point having weights of 10-1,
10-2, 10-3 and so on. That means, each position has specific weight, which is power of base 10.
4
4. Hexa-Decimal Number System:- The base or radix of Hexa-decimal number system is 16.
So, the numbers ranging from 0 to 9 and the letters from A to F are used in this number system.
The decimal equivalent of Hexa-decimal digits from A to F are 10 to 15. The part of the number,
which lies to the left of the hexadecimal point is known as integer part. Similarly, the part of the
number, which lies to the right of the Hexa-decimal point is known as fractional part. In this
number system, the successive positions to the left of the Hexa-decimal point having weights of
160, 161, 162, 163 and so on. Similarly, the successive positions to the right of the Hexa-decimal
point having weights of 16-1, 16-2, 16-3 and so on. That means, each position has specific weight,
which is power of base 16.
Base Conversion:-
5
Representation of Positive and negative Integer:-
Then we can use a single bit to identify the sign of a signed binary
number as being positive or negative in value. So to represent a positive binary number (+n) and
a negative (-n) binary number, we can use them with the addition of a sign.
For signed binary numbers the most significant bit (MSB) is used
as the sign bit. If the sign bit is “0”, this means the number is positive in value. If the sign bit is
“1”, then the number is negative in value. The remaining bits in the number are used to represent
the magnitude of the binary number in the usual unsigned binary number format way.
6
Representation of real numbers:-
The goal is to represent a number with a decimal point in binary (for example, 101.01, which is
not read one hundred one point zero one because it is in fact a binary number, i.e. 5.25 in
decimal) using the form 1.XXXXX... * 2n (in our example, 1.0101*22). IEEE standard 754
defines how to encode a real number.
This standard offers a way to code a number using 32 bits, and defines three components:
the plus/minus sign is represented by one bit, the highest-weighted bit (furthest to the
left)
the exponent is encoded using 8 bits immediately after the sign
the mantissa (the bits after the decimal point) with the remaining 23 bits
seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm
7
However, there are some restrictions for exponents:
where:
Here is an example:
The value 525.5 is to be encoded.
8
Representation of Characters:-
Binary Dec Ascii Binary Dec Ascii Binary Dec Ascii Binary Dec Ascii
000 010 100 110
0 NUL 32 space 64 @ 96 `
0000 0000 0000 0000
000 010 100 110
1 SOH 33 ! 65 A 97 a
0001 0001 0001 0001
000 010 100 110
2 STX 34 " 66 B 98 b
0010 0010 0010 0010
000 010 100 110
3 ETX 35 # 67 C 99 c
0011 0011 0011 0011
000 010 100 110
4 EOT 36 $ 68 D 100 d
0100 0100 0100 0100
000 010 100 110
5 ENQ 37 % 69 E 101 e
0101 0101 0101 0101
000 010 100 110
6 ACK 38 & 70 F 102 f
0110 0110 0110 0110
000 010 100 110
7 BEL 39 ' 71 G 103 g
0111 0111 0111 0111
000 010 100 110
8 BS 40 ( 72 H 104 h
1000 1000 1000 1000
000 010 100 110
9 HT 41 ) 73 I 105 i
1001 1001 1001 1001
000 010 100 110
10 LF 42 * 74 J 106 j
1010 1010 1010 1010
000 010 100 110
11 VT 43 + 75 K 107 k
1011 1011 1011 1011
000 010 100 110
12 FF 44 , 76 L 108 l
1100 1100 1100 1100
000 010 100 110
13 CR 45 -- 77 M 109 m
1101 1101 1101 1101
000 010 100 110
14 SO 46 . 78 N 110 n
1110 1110 1110 1110
000 010 100 110
15 SI 47 / 79 O 111 o
1111 1111 1111 1111
001 011 101 111
16 DLE 48 0 80 P 112 p
0000 0000 0000 0000
9
001 011 101 111
17 DC1 49 1 81 Q 113 q
0001 0001 0001 0001
001 011 101 111
18 DC2 50 2 82 R 114 r
0010 0010 0010 0010
001 011 101 111
19 DC3 51 3 83 S 115 s
0011 0011 0011 0011
001 011 101 111
20 DC4 52 4 84 T 116 t
0100 0100 0100 0100
001 011 101 111
21 NAK 53 5 85 U 117 u
0101 0101 0101 0101
001 011 101 111
22 SYN 54 6 86 V 118 v
0110 0110 0110 0110
001 011 101 111
23 ETB 55 7 87 W 119 w
0111 0111 0111 0111
001 011 101 111
24 CAN 56 8 88 X 120 x
1000 1000 1000 1000
001 011 101 111
25 EM 57 9 89 Y 121 y
1001 1001 1001 1001
001 011 101 111
26 SUB 58 : 90 Z 122 z
1010 1010 1010 1010
001 011 101 111
27 ESC 59 ; 91 [ 123 {
1011 1011 1011 1011
001 011 101 111
28 FS 60 < 92 \ 124 |
1100 1100 1100 1100
001 011 101 111
29 GS 61 = 93 ] 125 }
1101 1101 1101 1101
001 011 101 111
30 RS 62 > 94 ^ 126 ~
1110 1110 1110 1110
001 011 101 110
31 US 63 ? 95 _ 127 DEL
1111 1111 1111 0000
10
Digital or Binary Codes:-
Weighted binary codes are those binary codes which obey the positional
weight principle. Each position of the number represents a specific weight. Several systems of
the codes are used to express the decimal digits 0 through 9. In these codes each decimal digit is
represented by a group of four bits.
11
Non weighted codes:-
In this type of binary codes, the positional weights are not assigned. The
examples of non-weighted codes are Excess-3 code and Gray code.
Excess-3 codes:- The Excess-3 code is also called as XS-3 code. It is non-weighted code used to
express decimal numbers. The Excess-3 code words are derived from the 8421 BCD code words
adding (0011)2 or (3)10 to each code word in 8421. The excess-3 codes are obtained as follows-
Example:-
Gray Code:-
It is the non-weighted code and it is not arithmetic codes. That means there
are no specific weights assigned to the bit position. It has a very special feature that, only one bit
will change each time the decimal number is incremented as shown in fig. As only one bit
changes at a time, the gray code is called as a unit distance code. The gray code is a cyclic code.
Gray code cannot be used for arithmetic operation.
12
Applications of gray code:-
1. The Most Significant Bit (MSB) of the gray code is always equal to the MSB of the given
binary code.
2. Other bits of the output gray code can be obtained by XORing binary code bit at that
index and previous index.
13
Gray to Binary Conversion:-
This gray to binary conversion method also uses the working concept of
EX-OR logic gate among the bits of gray as well as binary bits.
1. The Most Significant Bit (MSB) of the binary code is always equal to the MSB of the
given binary number.
2. Other bits of the output binary code can be obtained by checking gray code bit at that
index. If current gray code bit is 0, then copy previous binary code bit, else copy invert of
previous binary code bit.
for example, 35710 (Three Hundred and Fifty Seven) in decimal would be presented in Binary
Coded Decimal as:
Then we can see that BCD uses weighted codification, because the binary bit of each 4-bit group
represents a given weight of the final value. In other words, the BCD is a weighted code and the
weights used in binary coded decimal code are 8, 4, 2, 1, commonly called the 8421 code as it
14
forms the 4-bit
bit binary representation of the relevant decimal digit.
15
Arithmetic in 1's and 2's complement:-
Simply invert each bit of given binary number, so 1’s complement of given number will be
01010001.
Simply invert each bit of given binary number, so 1’s complement of given number will be
01110.110.
There are difference scenario for addition of two binary numbers using 1’s complement. These
are explained as following below.
Case-1: Addition of positive and negative number when positive number has greater
magnitude:
When positive number has greater magnitude, then take simply 1’s complement of negative
number and the end-around carry of the sum is added to the least significant bit (LSB).
So, take 1’s complement of 1101, which will be 0010, then add with given number. So,
1110+0010=1 0000 , then add this carry bit to the LSB, 0000+1=0001 , which is the answer.
Note that if the register size is big then fill the same value of MSB to preserve sign magnitude
for inputs and output.
16
Case-2: Addition of positive and negative number when negative number has greater
magnitude:
When the negative number has greater magnitude, then take 1’s complement of negative number
and add with given positive number. Since there will not be any end-around carry bit, so take 1’s
complement of the result and this result will be negative.
Note that there are five-bit registers, so these new numbers will be 01010 and -01100.
Now take 1’s complement of 01100 which will be 10011 and add 01010+10011=11101 . Then
take 1’s complement of this result, which will be 00010 and this will be negative number, i.e., -
00010, which is the answer.
You need to take 1’s complement for both numbers, then add these 1’s complement of numbers.
Since there will always be end-around carry bit, so add this again to the MSB of result. Now,
take 1’s complement also of previous result, so this will be negative number.
Alternatively, you can add both negative number directly, and get this result which will be
negative only.
These five bit numbers are -01010 and -00101. Add complements of these numbers,
10101+11010 =1 01111 . Since, there is a carry bit 1, so add this to the LSB of result, i.e.,
01111+1=10000 . Now take the 1’s complement of this result, which will be 01111 and this
number is negative, i.e, -01111, which is answer.
The algorithm to subtract two binary number using 1’s complement is explained as following
below:
Note that subtrahend is number that to be subtracted from the another number, i.e., minuend.
17
Example (Case-1: When Carry bit 1): Evaluate 10101 - 00101
According to above algorithm, take 1’s complement of subtrahend 00101, which will be 11010,
then add both of these. So, 10101 + 11010 =1 01111 . Since, there is carry bit 1, so add this to
the LSB of given result, i.e., 01111+1=10000 which is the answer.
According to above algorithm, take 1’s complement of subtrahend 11110, which will be 00011.
Then add both of these, So, 11001 + 00011 =11100 . Since there is no carry bit 1, so take 1’s
complement of above result, which will be 00011, and this is negative number, i.e, 00011, which
is the answer.
2’s complement of a binary number is 1 added to the 1’s complement of the binary number.
Examples:
For subtracting a smaller number from a larger number, the 2s complement method is as
follows:
Example:
11001 - 10011
18
For subtracting a larger number from a smaller number, the 2s complement method is as follows:
3. There is no carry from the left-most column. The result is in 2s complement form and is
negative.
4. Change the sign and take the 2s complement of the result to get the final answer.
Example:
1001 - 1101
19
(ii) + 0111 and – 0011.
Solution:
+0111 ⇒ 00111
-0011 ⇒ 11101
In a 5-bit register find the sum of the following by using 2’s complement:
(i) + 0 0 1 1 and - 0 1 0 1
Solution:
+0011 ⇒ 00011
11110
2’s complement of 1110 is (0001 + 0001) or 0010.
Hence the required sum is - 0010.
(ii) + 0 1 0 0 and - 0 1 1 1
Solution:
+0100 ⇒ 00100
11101
2’s complement of 1101 is 0011.
Hence the required sum is – 0011.
When two negative numbers are added a carry will be generated from the sign bit which will be
discarded. 2’s complement of the magnitude bits of the operation will be the final sum.
20
In a 5-bit register find the sum of the following by using 2’s complement:
(i) – 0011 and – 0101
Solution:
-0011 ⇒ 11101 (2’s complement)
21
Unit -II
22
Boolean Algebra:-
In mathematics and mathematical logic, Boolean algebra is the
branch of algebra in which the values of the variables are the truth values true and false, usually
denoted 1 and 0 respectively. Instead of elementary algebra where the values of the variables are
numbers, and the prime operations are addition and multiplication.
Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
Complement of a variable is represented by an overbar (-). Thus, complement of variable
B is represented as . Thus if B = 0 then = 1 and B = 1 then = 0.
ORing of the variables is represented by a plus (+) sign between them. For example
ORing of A, B, C is represented as A + B + C.
Logical ANDing of the two or more variable is represented by writing a dot between
them such as A.B.C. Sometime the dot may be omitted like ABC.
Logical Operations:-
There are three basic operations. These are used often in Boolean expressions
but are also used to create more complex operations.
23
Basic Postulates of Boolean Algebra:-
1. Idempotent Law
o A*A=A
o A+A=A
2. Associative Law
o (A * B) * C = A * (B * C)
o (A + B) + C = A + (B + C)
3. Commutative Law
o A*B=B*A
o A+B=B+A
4. Distributive Law
o A * (B + C) = A * B + A * C
o A + (B * C) = (A + B) * (A + C)
5. Identity Law
o A*0=0 A*1=A
o A+1=1 A+0=A
6. Complement Law
o A * ~A = 0
o A + ~A = 1
7. Involution Law
o ~(~A) = A
8. DeMorgan’s Law
o ~(A * B) = ~A + ~B
o ~(A + B) = ~A * ~B
Redundancy Laws
9. Absorption
o A + (A * B) = A
o A * (A + B) = A
o (A * B) + (A * ~B) = A
o (A + B) * (A + ~B) = A
o A + (~A * B) = A + B
o A * (~A + B) = A * B
24
Rules for Boolean Algebra:-
25
Principle of Duality:-
(*) 1 + 0 = 1
(**) 0 . 1 = 0
As we can see, the dual of the true Boolean statement (*) is (**). We found (**) by replacing
each symbol from (*) with its Boolean counterpart as described above. Clearly, (**) is also a true
Boolean statement.
De-Morgan's Theorem:-
De-Morgan, a mathematician who knew Boole, proposed
two theorems that are an important part of Boolean Algebra. In practical terms, De-Morgan's
theorems provide mathematical verification of the equivalency of the NAND and negative-OR
gates and the equivalency of the NOR and negative-AND gates.
Theorem 1- The complement of a product of variables is equal to the sum of the complements of
the variables.
Theorem 2- The complement of a sum of variables is equal to the product of the complements
of the variables.
26
Ex.-
27
28
Proof of De-Morgan's Theorem 2:
For any theorem X=Y, if we can show that X Y = 0, and that X + Y = 1, then
by the complement postulates, A A = 0 and A + A = 1,
X = Y. By the uniqueness of the complement, X = Y.
Thus the proof consists of showing that (A*B)*( A + B) = 0; and also that (A*B) + ( A + B) = 1.
Prove: (A*B)*( A + B) = 0
(A*B)*( A + B) = (A*B)*A + (A*B)*B) by distributive postulate
= (A*A)*B + A*(B*B) by associativity postulate
= 0*B + A*0 by complement postulate
=0+0 by nullity theorem
=0 by identity theorem
(A*B)*( A + B) = 0 Q.E.D.
Prove: (A*B) + ( A + B) =1
(A*B) + ( A + B) =(A + A + B))*(B + A + B) by distributive ***
(A*B) + ( A + B) =(A + A + B))*(B + B + A) by associativity postulate
=(1 + B)*(1 + A) by complement postulate
=1*1 by nullity theorem
=1 by identity theorem
(A*B) + ( A + B) =1 Q.E.D.
29
Finding complements of the Boolean expressions:-
1. F = X'YZ' + X'Y'Z
Sol:-
Complement of F is F'
= (X'YZ')' . (X'Y'Z)'
= ( X + Y' + Z ) . (X + Y + Z')
2. F = X(Y'Z' + YZ)
Sol:-
Each row of a truth table can be associated with a minterm and a maxterm.
A minterm l is a product (AND) of all variables in the function, in direct or complemented form.
A minterm has the property that it is equal to 1 on exactly one row of the truth table.
A maxterm 0 is a sum (OR) of all the variables in the function, in direct or complemented form.
A maxterm has the property that it is equal to 0 on exactly one row of the truth table.
30
Truth Table:
Maxterm is-
F = m1 . m2 . m3 . m5 . m6
= (a+b+c').(a+b'+c).(a+b'+c').(a'+b+c').(a'+b'+c)
31
Sum of Products:-
Min Term
Minterm means the term that is true for a minimum number of combination of inputs. That is
true for only one combination of inputs. Since AND gate also gives True only when all of its
inputs are true so we can say min terms are AND of input combinations like in the table given
below.
3 inputs have 8 different combinations. Each combination has a min terms denoted by
small m and its decimal combination number written in subscript. Each of these minterms will be
only true for the specific input combination.
32
Canonical SOP Form:-
Which means that the function is true for the min terms {1, 2, 3, 5}.
F = m1 + m2 + m3 + m5
Canonical form contains all inputs either complemented or non-complemented in its product
terms.
33
Non-Canonical SOP Form:-
This expression is still in Sum of Product form but it is non-canonical or non-standardized form.
34
it's K-map is given below-
According to the K-map, the output expression will be:- F = B̅C + A̅B
This is the most simplified & optimized expression for the said function. This
expression requires only two 2-input AND gates & one 2-input OR gate. However, the canonical
form needs four 3-input AND gates & one 4-input OR gate, which is relatively more costly than
minimal form implementation.
Product of Sums:-
The product of Sum form is a form in which products of different sum terms
of inputs are taken. These are not arithmetic product and sum but they are logical Boolean AND
and OR respectively. To better understand about Product of Sum, we need to know about Max
term.
Max Term
Maxterm means the term or expression that is true for a maximum number of
input combinations or that is false for only one combination of inputs. Since OR gate also gives
false for only one input combination. So Maxterm is OR of either complemented or non-
complemented inputs. Max terms for 3 input variables are given below.
35
3 inputs have 8 different combinations so it will have 8 maxterms. Maxterms
are denoted by capital M and decimal combination number In the subscript as shown in the table
given above. In maxterm, each input is complemented because Maxterm gives ‘0’ only when the
mentioned combination is applied and Maxterm is complement of minterm.
M3 = m̅3
M3 = (A̅BC)’
M3 = A + B̅ +C̅ DE Morgan’s law
Which is why for A=0 Max term consist A & for A=1 Max term consist A̅.
36
Canonical POS Form:-
The canonical form contains all inputs either complemented or non-complemented in its each
Sum term.
37
Minimal POS Form:-
This is the most simplified and optimized form of a POS expression which is
non-canonical. Minimal Product of Sum form can be achieved using Boolean algebraic theorems
like in the non-canonical example given above. Another method of achieving minimal POS form
is by using Karnaugh map which is comparatively easier than using Boolean algebraic theorems.
Minimal POS form uses less number of inputs and logic gates during its implementation, that’s
why they are being preferred over canonical form for their compact,fast and low-cost
implementation. Let’s take the above-given function as example K-map of the function
F = (B+C) (A̅+B̅)
The achieved expression is the minimal product of sum form. It is still Product of Sum
expression But it needs only 2 inputs two OR gates and a single 2 input AND gate. However, the
canonical form needs 4 OR gates of 3 inputs and 1 AND gate of 4 inputs.
Karnaugh Map:- A Karnaugh map provides a systematic method for simplifying Boolean
expressions and, if properly used, will produce the simplest SOP or POS expression possible,
known as the minimum expression. We know that effectiveness of algebraic simplification
depends on your familiarity with all the laws, rules and theorems of Boolean algebra and on
your ability to apply them.
38
A Karnaugh map is similar to a truth table because it presents all of
the possible values of input variables and the resulting output for each value. Instead of being
organized into columns and rows like a truth tab le, the karnaugh map is an array of cells in
which each cell represents a binary value of the input variables. The cells are arranged in a way
so that simplification of given expressions with two, three, four and five variables.
39
4- variable Karnaugh Map:-
The 4-variable Karnaugh map is an array of sixteen cells, as shown in Figure(a). Binary
values of A and B are along the left side and the values of C and D are across the top. The value
of a given cell is the binary values of A and B at the left in the same row combined with the
binary values of C and D at the top in the same column. For example, the cell in the upper right
corner has a binary value of 0010 and the cell in the lower right corner has a binary value of
1010. Part (b) of the figure shows the standard product terms, which are represented by each cell
in the 4-variable Karnaugh map.
40
Mapping a Standard SOP Expression using 3 variables:-
Step 1. Determine the binary value of each product term in the standard SOP expression. After
some practice, you can usually do the evaluation of terms mentally.
Step 2. As each product term is evaluated, place a 1 on the Karnaugh map in the cell having the
same value as the product term. A Boolean expression must first be in standard form
before you use a Karnaugh map. If an expression is not in standard form, then it must be
converted to standard form by the procedure covered in earlier discussion or by
numerical expansion. Since an expression should be evaluated before mapping anyway,
numerical expansion is probably the most efficient approach.
41
42
Mapping a Standard SOP Expression using 4 variables:-
43
Ex:-
44
Unit - III
45
Basic Logic Gates:-
In electronics, Logic gates are the building blocks of every electronic
circuit. Logic gates defined as the simple electronic circuits having one or more input and a
single output. Their operation varies from one type of logic gate to another. The relationship
between input and output follow a certain logical equation.
Logic gate can be defined as a simple boolean function, which means
that it has only either of two outputs. Either 1 or 0, high or low, true or false, whatever you can
call it. It is the most elementary tool in building a circuit. A logic gate performs a logical
operation on input and gives the appropriate output for it.
The relationship between the i/p and the o/p is based on a certain logic.
These gates are implemented using electronic switches like transistors, diodes. But, in practice
basic logic gates are built using CMOS technology, FETS and MOSFET(Metal Oxide
Semiconductor FET)s. Logic gates are used in microprocessors, microcontrollers, embedded
system applications and in electronic and electrical project circuits.
The basic logic gates are categorized into seven: AND, OR, XOR, NAND,
NOR, XNOR and NOT. These logic gates with their logic gate symbols and truth tables are
explained below.
46
AND Gate:-
The AND gate is a digital logic gate with ‘n’ i/ps one o/p, which perform
logical conjunction based on the combinations of its inputs.The output of this gate is true only
when all the inputs are true. When one or more inputs of the AND gate’s i/ps are false, then only
the output of the AND gate is false. The symbol and truth table of an AND gate with two inputs
is shown below.
OR Gate:-
The OR gate is a digital logic gate with ‘n’ i/ps and one o/p, that performs a
logical conjunction based on the combinations of its inputs.The output of the OR gate is true
only when one or more inputs are true. If all the i/ps of the gate are false, then only the output of
the OR gate is false. The symbol and truth table of an OR gate with two inputs is shown below.
47
NOT Gate:-
The NOT gate is a digital logic gate with one input and one output that
operates an inverter operation of the input. The output of the NOT gate is the reverse of the
input. When the input of the NOT gate is true then the output will be false and vice versa. The
symbol and truth table of a NOT gate with one input is shown below. By using this gate, we can
implement NOR and NAND gates.
NAND Gate:-
The NAND gate is a digital logic gate with ‘n’ i/ps and one o/p, that
performs the operation of the AND gate followed by the operation of the NOT gate. NAND gate
is designed by combining the AND and NOT gates. If the input of the NAND gate high, then the
output of the gate will be low. The symbol and truth table of the NAND gate with two inputs is
shown below.
48
NOR Gate:-
The NOR gate is a digital logic gate with n inputs and one output, that
performs the operation of the OR gate followed by the NOT gate. NOR gate is designed by
combining the OR and NOT gate. When any one of the i/ps of the NOR gate is true, then the
output of the NOR gate will be false. The symbol and truth table of the NOR gate with truth table
is shown below.
The Exclusive-OR gate is a digital logic gate with two inputs and one
output. The short form of this gate is Ex-OR. It performs based on the operation of OR gate. . If
any one of the inputs of this gate is high, then the output of the EX-OR gate will be high. The
symbol and truth table of the EX-OR are shown below.
49
This logic gate symbol is seldom used in Boolean expressions because the
identities, laws, and rules of simplification involving addition, multiplication, and
complementation do not apply to it. However, there is a way to represent the Exclusive-OR
function in terms of OR and AND, as has been shown as: AB’ + A’B
50
Exclusive-NOR Gate(XNOR):-
The Exclusive-NOR gate is a digital logic gate with two inputs and one
output. The short form of this gate is Ex-NOR. It performs based on the operation of NOR gate. When
both the inputs of this gate are high, then the output of the EX-NOR gate will be high. But, if any one of
the inputs is high (but not both), then the output will be low. The symbol and truth table of the EX-NOR
are shown below.
The expression of XNOR operation can be realized by using two NOT gates, two AND gates and
one OR gate as followers,
NOR gate is a NOT gate followed by an XOR gate. As we know that XOR operation of
inputs A and B is A ⊕ B, therefore XNOR operation those inputs will be (A + B) ̅. That means,
output of XOR gate is inverted in XNOR gate. In XOR operation, the output is only 1 when only
one input is 1. The output is logical 0 when both inputs are same that means they are either 1 or
0. But in the case of XNOR gate, the output is 0 when only one input is 0 and the output is 1
when both inputs are same that is either both of them are 0 or 1.
51
Logic Gates Formulas:-
This is all about the basic logic gates, which includes AND gate, OR gate,
NAND gate, NOR gate, EX-OR gate and EX-NOR gate. In this, AND, NOT and OR gates are
the basic logic gates. By using these gates we can create any logic gate by combining them.
Where, NAND and NOR gates are called universal gates. These gates have a particular property
with which they can create any logical Boolean expression if designed in a proper way.
Combinational Circuits:-
Combinational Circuits (CC) are circuits made up of different types of logic gates.
A logic gate is a basic building block of any electronic circuit. The output of the combinational
circuit depends on the values at the input at any given time. The circuits do not make use of any
memory or storage device.
Block Diagram:-
52
Some of the characteristics of combinational circuits are following:-
The output of combinational circuit at any instant of time, depends only on the levels
present at input terminals.
The combinational circuit do not use any memory. The previous state of input does not
have any effect on the present state of the circuit.
A combinational circuit can have an n number of inputs and m number of outputs.
The Adder:- An Adder is a digital circuit that is used to perform the addition of numeric
values. It is one of the most basic circuits and is found in Arithmetic Logic Units of computing
devices. There are two types of adders. Half Adders compute single digit numbers while Full
Adders compute larger numbers.
Half Adder:-
The Half Adder adds two single digit binary numbers and forms the
foundation for all addition operations in computing. If we have two single binary digits A and B
then the Half Adder adds them with the circuit carrying two outputs; the sum and the carry. The
carry represents any overflow from the addition of the two numbers. This is represented in the
following block diagram figure
Block Diagram:-
Truth Table:-
53
Logic Circuit:-
Full Adder:-
The Full Adder overcomes the disadvantages of the half adder in that it can
add two single bit numbers in addition to the carry digit at its input as seen in Figure
Block Diagram:-
Truth Table:-
54
Logic Circuit:-
Boolean expression for the full adder is S= A'B'Cin + A'BCin' + AB'Cin' + ABCin
where A and B are all the possible binary inputs and C is the Carry in
S = 1 and C = 0
55
Block Diagram:-
56
The 2-Bit parallel adder can be designed with the help of EX-OR
(Exclusive OR) gate and AND gate. If you will carefully observe the logic circuit of 2-Bit
Parallel Binary Adder, you will notice 2-full adder are connected in a parallel manner. Now, you
can easily guess how this will work.
Half adder is a logic circuit which adds two 1-bit numbers but does not add
carry from previous addition. Therefore, full adders came into existence. A full adder can add
two 1-bit numbers along with the carry from previous addition. Now, coming back to the parallel
binary adder, it also has two full adders. When we start addition of two numbers, the first step we
follow is the addition of LSB (Least Significant Bits) of two numbers. After this, if we have any
carry we forward it to higher order columns. Now, the adder performs the similar task; it adds
the LSBs of both the numbers and if any carry bit is there it passes it to the carry-in terminal of
another.
Subtractor:-
A Subtractor is used to subtract one number from the other
another. Because we are dealing with binary digits, the 1s complement and 2s complement of the
numbers are used to achieve this. Three bits are involved in performing the basic subtraction: the
minuend (X), the subtrahend (Y) and the borrow (Bi) which is input from the previous bit. The
outputs are the difference (D) and the borrow bit (Bout).
Half Subtractor:-
Logic Circuit:-
57
Truth Table:-
D = X'Y + XY'
Bout = X'Y
Example, if our inputs X and Y are 0 and 1 then Compliment of 0 is 1 and vice versa
Full Subtractor:-
58
Truth Table:-
Camparator:-
59
Basic Operation Terms of Comparator:-
Consider two binary numbers “A” and “B” as inputs to the digital comparator
LESS THAN:
1. If binary number “A” is less than “B” than “less than” output will produce HIGH state
“1” also known as true.
2. If binary number “A” is greater than or equal to “B” than “less than” output will produce
LOW state “0” also known as false.
EQUAL TO:
1. If and only if number A is equal to number B than “equal to” output will produce logic
HIGH state “1”. Otherwise, the output will be LOW state “0”.
GREATER THAN:
1. If number A is greater than B than “greater than” output will produce HIGH state”1”.
2. If A is less than or equal to B than “greater than” output will produce LOW state “0”.
This is the basic unit of a multi bit comparator which compares a single binary bit and produces
output according to those bits.
According to the truth table of Single Bit Comparator Sum of Product expression for A<B is
(A<B) = A̅B
Its output will be only true when “A” is less than “B”.
60
Equal to :- The output of “Equal to ” is represented by (A = B)
According to the truth table of Single Bit Comparator Sum of Product expression for A=B is
Observe the expression above. You will notice that XNOR expression is exactly the same. So it
can also be replaced with XNOR as shown in below figure We will represent it with ‘X’ such
that
X = A̅B̅ + AB = (A XNOR B)
According to the truth table of Single Bit Comparator Sum of Product expression for A>B is
(A>B) = AB̅
Its output will be only true when “A” is greater than “B”.
61
Decoder:-
Block Diagram:-
Code converters
BCD to seven segment decoders
Nixie tube decoders
Relay actuator
2 to 4 Line Decoder:-
Block Diagram:-
62
Truth Table:-
Logic Circuit:-
63
Encoder:-
Block Diagram:-
Priority encoders
Decimal to BCD encoder
Octal to binary encoder
Hexadecimal to binary encoder
Priority Encoder:-
Block Diagram:-
64
Truth Table:-
Logic Circuit:-
65
Multiplexer:-
Multiplexer is a special type of combinational circuit. There are n-data
inputs, one output and m select inputs with 2m = n. It is a digital circuit which selects one of the
n data inputs and routes it to the output. The selection of one of the n inputs is done by the
selected inputs. Depending on the digital code applied at the selected inputs, one out of n data
sources is selected and transmitted to the single output Y. E is called the strobe or enable input
which is useful for the cascading. It is generally an active low terminal that means it will perform
the required operation when it is low.
Block Diagram:-
2 : 1 multiplexer
4 : 1 multiplexer
16 : 1 multiplexer
32 : 1 multiplexer
66
2:1 Multiplexer:-
The input A of this simple 2-1 line multiplexer circuit constructed from standard NAND gates
acts to control which input ( I0 or I1 ) gets passed to the output at Q.
From the truth table above, we can see that when the data select input, A is LOW at logic 0,
input I1 passes its data through the NAND gate multiplexer circuit to the output, while input I0 is
blocked. When the data select A is HIGH at logic 1, the reverse happens and now input I0 passes
data to the output Q while input I1 is blocked.
So by the application of either a logic “0” or a logic “1” at A we can select the appropriate input,
I0 or I1 with the circuit acting a bit like a single pole double throw (SPDT) switch.
As we only have one control line, (A) then we can only switch 21 inputs and in this simple
example, the 2-input multiplexer connects one of two 1-bit sources to a common output,
producing a 2-to-1-line multiplexer. We can confirm this in the following Boolean expression.
and for our 2-input multiplexer circuit above, this can be simplified too:
Q = A.I1 + A.I0
67
We can increase the number of data inputs to be selected further simply by following the same
procedure and larger multiplexer circuits can be implemented using smaller 2-to-1 multiplexers
as their basic building blocks. So for a 4-input multiplexer we would therefore require two data
select lines as 4-inputs represents 22 data control lines give a circuit with four inputs, I0, I1, I2, I3
and two data select lines A and B as shown.
4: 1 Multiplexer:-
The Boolean expression for this 4-to-1 Multiplexer above with inputs A to D and data select
lines a, b is given as:
In this example at any one instant in time only ONE of the four analogue switches is closed,
connecting only one of the input lines A to D to the single output at Q. As to which switch is
closed depends upon the addressing input code on lines “a” and “b“.
So for this example to select input B to the output at Q, the binary input address would need to
be “a” = logic “1” and “b” = logic “0”. Thus we can show the selection of the data through the
multiplexer as a function of the data select bits as shown.
68
4:1 Multipplexer
Demultiplexers:-
1 : 2 demultiplexer
1 : 4 demultiplexer
1 : 16 demultiplexer
1 : 32 demultiplexer
Block diagram:-
69
The truth table for a 1-to-2 demultiplexer is
70
Unit - IV
71
Sequential Circuits:-
The combinational circuit does not use any memory. Hence the
previous state of input does not have any effect on the present state of the circuit. But sequential
circuit has memory so output can vary based on input. This type of circuits uses previous input,
output, clock and a memory element.
Block Diagram:-
Flip-Flop:-
Flip flop is a sequential circuit which generally samples its inputs and
changes its outputs only at particular instants of time and not continuously. Flip flop is said to be
edge sensitive or edge triggered rather than being level triggered like latches.
72
Edge Triggerd Flip-Flop:-
The S-R, J-K and D inputs are called synchronous inputs because data on these inputs are
transferred to the flip-flop's output only on the triggering edge of the clock pulse. On the other
hand, the direct set (SET) and clear (CLR) inputs are called asynchronous inputs, as they are
inputs that affect the state of the flip-flop independent of the clock. For the synchronous
operations to work properly, these asynchronous inputs must both be kept LOW.
The term pulse-triggered means that data are entered into the flip-flop
on the rising edge of the clock pulse, but the output does not reflect the input state until the
falling edge of the clock pulse. As this kind of flip-flops are sensitive to any change of the input
levels during the clock pulse is still HIGH, the inputs must be set up prior to the clock pulse's
rising edge and must not be changed before the falling edge. Otherwise, ambiguous results will
happen. The three basic types of pulse-triggered flip-flops are S-R, J-K and D. Their logic
symbols are shown below. Notice that they do not have the dynamic input indicator at the clock
input but have postponed output symbols at the outputs.
73
S-R Flip Flop:-
It is basically S-R latch using NAND gates with an additional enable input.
It is also called as level triggered SR-FF. For this, circuit in output will take place if and only if
the enable input (E) is made active. In short this circuit will operate as an S-R latch if E = 1 but
there is no change in the output if E = 0.
Block Diagram:-
Circuit Diagram:-
Truth Table:-
74
Operation:-
Delay Flip Flop or D Flip Flop is the simple gated S-R latch with a
NAND inverter connected between S and R inputs. It has only one input. The input data is
appearing at the output after some time. Due to this data delay between i/p and o/p, it is called
delay flip flop. S and R will be the complements of each other due to NAND inverter. Hence S =
R = 0 or S = R = 1, these input condition will never appear. This problem is avoid by SR = 00
and SR = 1 conditions.
Block Diagram:-
75
Circuit Diagram:-
Truth Table:-
Operations:-
76
J-K Flip Flop:-
This simple JK flip Flop is the most widely used of all the flip-flop designs and
is considered to be a universal flip-flop circuit. The two inputs labelled “J” and “K” are not
shortened abbreviated letters of other words, such as “S” for Set and “R” for Reset, but are
themselves autonomous letters chosen by its inventor Jack Kilby to distinguish the flip-flop
design from other types.
The sequential operation of the JK flip flop is exactly the same as for the
previous SR flip-flop with the same “Set” and “Reset” inputs. The difference this time is that the
“JK flip flop” has no invalid or forbidden input states of the SR Latch even when S and R are
both at logic “1”.
The JK flip flop is basically a gated SR flip-flop with the addition of a clock
input circuitry that prevents the illegal or invalid output condition that can occur when both
inputs S and R are equal to logic level “1”. Due to this additional clocked input, a JK flip-flop
has four possible input combinations, “logic 1”, “logic 0”, “no change” and “toggle”. The
symbol for a JK flip flop is similar to that of an SR Bistable Latch as seen in the previous tutorial
except for the addition of a clock input.
77
Here is the same information in truth-table form
Circuit Diagram:-
78
Truth Table:-
Operations:-
79
output from the Master slave.
Clock = 1 − Master active, slave inactive. Therefore outputs of
the master become Q1 = 1 and Q1 bar = 0. That means S = 1 and
R =0.
80
Unit - V
81
Shift Register:-
The Shift Register is another type of sequential logic circuit that can be
used for the storage or the transfer of binary data. This sequential device loads the data present
on its inputs and then moves or “shifts” it to its output once every clock cycle, hence the name
Shift Register.
A shift register basically consists of several single bit “D-Type Data Latches”, one for each data
bit, either a logic “0” or a “1”, connected together in a serial type daisy-chain arrangement so
that the output from one data latch becomes the input of the next latch and so on.
Data bits may be fed in or out of a shift register serially, that is one after the other from either the
left or the right direction, or all together at the same time in a parallel configuration.
The number of individual data latches required to make up a single Shift Register device is
usually determined by the number of bits to be stored with the most common being 8-bits (one
byte) wide constructed from eight individual data latches.
Shift Registers are used for data storage or for the movement of data and are therefore commonly
used inside calculators or computers to store data such as two binary numbers before they are
added together, or to convert the data from either a serial to parallel or parallel to serial format.
The individual data latches that make up a single shift register are all driven by a common clock
( Clk ) signal making them synchronous devices.
Shift register IC’s are generally provided with a clear or reset connection so that they can be
“SET” or “RESET” as required. Generally, shift registers operate in one of four different modes
with the basic movement of data through a shift register being:
Serial-in to Parallel-out (SIPO) - the register is loaded with serial data, one bit at a time,
with the stored data being available at the output in parallel form.
Serial-in to Serial-out (SISO) - the data is shifted serially “IN” and “OUT” of the
register, one bit at a time in either a left or right direction under clock control.
Parallel-in to Serial-out (PISO) - the parallel data is loaded into the register
simultaneously and is shifted out of the register serially one bit at a time under clock
control.
Parallel-in to Parallel-out (PIPO) - the parallel data is loaded simultaneously into the
register, and transferred together to their respective outputs by the same clock pulse.
82
Serial In − Serial Out (SISO) Shift Register:-
The shift register, which allows serial input and produces serial output is
known as Serial In – Serial Out (SISO) shift register. The block diagram of 3-bit SISO shift
register is shown in the following figure.
This block diagram consists of three D flip-flops, which are cascaded. That means,
output of one D flip-flop is connected as the input of next D flip-flop. All these flip-flops are
synchronous with each other since, the same clock signal is applied to each one. In this shift
register, we can send the bits serially from the input of left most D flip-flop. Hence, this input is
also called as serial input. For every positive edge triggering of clock signal, the data shifts from
one stage to the next. So, we can receive the bits serially from the output of right most D flip-
flop. Hence, this output is also called as serial output.
The shift register, which allows serial input and produces parallel output is
known as Serial In – Parallel Out (SIPO) shift register. The block diagram of 3-bit SIPO shift
register is shown in the following figure.
83
This circuit consists of three D flip-flops, which are cascaded. That means, output of
one D flip-flop is connected as the input of next D flip-flop. All these flip-flops are synchronous
with each other since, the same clock signal is applied to each one.In this shift register, we can
send the bits serially from the input of left most D flip-flop. Hence, this input is also called as
serial input. For every positive edge triggering of clock signal, the data shifts from one stage to
the next. In this case, we can access the outputs of each D flip-flop in parallel. So, we will get
parallel outputs from this shift register.
The shift register, which allows parallel input and produces serial output is
known as Parallel In − Serial Out (PISO) shift register. The block diagram of 3-bit PISO shift
register is shown in the following figure.
84
Parallel In - Parallel Out (PIPO) Shift Register:-
The shift register, which allows parallel input and produces parallel output is
known as Parallel In − Parallel Out (PIPO) shift register. The block diagram of 3-bit PIPO shift
register is shown in the following figure.
This circuit consists of three D flip-flops, which are cascaded. That means,
output of one D flip-flop is connected as the input of next D flip-flop. All these flip-flops are
synchronous with each other since, the same clock signal is applied to each one. In this shift
register, we can apply the parallel inputs to each D flip-flop by making Preset Enable to 1. We
can apply the parallel inputs through preset or clear. These two are asynchronous inputs. That
means, the flip-flops produce the corresponding outputs, based on the values of asynchronous
inputs. In this case, the effect of outputs is independent of clock transition. So, we will get the
parallel outputs from each D flip-flop.
85
Bi-directional Shift Registers:-
Here a set of NAND gates are configured as OR gates to select data inputs from the right or left
adjacent bistables, as selected by the LEFT/RIGHT control line.
Counters:-
Counter is a device which stores (and sometimes displays) the number of times a
particular event or process has occurred, often in relationship to a clock signal. Counters are used
in digital electronics for counting purpose, they can count specific event happening in the circuit.
For example, in UP counter a counter increases count for every rising edge of clock. Not only
counting, a counter can follow the certain sequence based on our design like any random
sequence 0,1,3,2… .They can also be designed with the help of flip flops.
1. Asynchronous counter
2. Synchronous counter
86
Asynchronous Counter:-
In asynchronous counter we don’t use universal clock, only first flip flop is
driven by main clock and the clock input of rest of the following counters is driven by output of
previous flip flops. We can understand it by following diagram-
87
Synchronous Counter:-
88
From circuit diagram we see that Q0 bit gives response to each falling edge
of clock while Q1 is dependent on Q0, Q2 is dependent on Q1 and Q0 , Q3 is dependent on
Q2,Q1 and Q0.
Depending on the way in which the counting progresses, the synchronous or asynchronous
counters are classified as follows −
Up counters
Down counters
Up/Down counters
UP/DOWN Counter:-
Up counter and down counter is combined together to obtain an UP/DOWN counter. A mode
control (M) input is also provided to select either up or down mode. A combinational circuit is
required to be designed and used between each pair of flip-flop in order to achieve the up/down
operation.
In the UP/DOWN ripple counter all the FFs operate in the toggle mode. So either T flip-flops or
JK flip-flops are to be used. The LSB flip-flop receives clock directly. But the clock to every
other FF is obtained from (Q = Q bar) output of the previous FF.
UP counting mode (M=0) − The Q output of the preceding FF is connected to the clock
of the next stage if up counting is to be achieved. For this mode, the mode select input M
is at logic 0 (M=0).
DOWN counting mode (M=1) − If M = 1, then the Q bar output of the preceding FF is
connected to the next FF. This will operate the counter in the counting mode.
89
Decade Counters:-
A decade counter counts ten different states and then reset to its initial states. A simple
decade counter will count from 0 to 9 but we can also make the decade counters which can go
through any ten states between 0 to 15(for 4 bit counter).
We see from circuit diagram that we have used nand gate for Q3 and Q1 and feeding this to clear
input line because binary representation of 10 is-1010
And we see Q3 and Q1 are 1 here, if we give NAND of these two bits to clear input then counter
will be clear at 10 and again start from beginning.
Important point: Number of flip flops used in counter are always greater than equal to (log2 n)
where n=number of states in counter.
90