Digital Logic for CSE Students
Digital Logic for CSE Students
2 M VEDAVYAS
S NO. TOPIC NAME PAGE NO.1 LINK
5. UNIT-5 141 Click here
5.1 COUNTERS 141
DIFFERENCE BETWEEN SYNCHRONOUS AND ASYN-
5.2 142
CHRONOUS COUNTERS
5.3 THREE-BIT ASYNCHRONOUS UP COUNTER 143
5.4 THREE-BIT ASYNCHRONOUS DOWN COUNTER 144
5.5 THREE-BIT ASYNCHRONOUS UP/DOWN COUNTER 145
5.6 MOD-6 UP COUNTER 146
5.7 MOD-6 DOWN COUNTER 147
5.8 RANDOM COUNTER 148
5.9 TWO-BIT SYNCHRONOUS UP COUNTER 149
5.10 TWO-BIT SYNCHRONOUS DOWN COUNTER 151
5.11 TWO-BIT SYNCHRONOUS UP-DOWN COUNTER 152
5.12 SELF-STARTING COUNTER 154
5.13 FREE RUNNING COUNTER 155
5.14 SHIFT COUNTERS 155
3 M VEDAVYAS
UNIT-1
INTRODUCTION
DIGITAL : Computeralizing something is called digitalization.
LOGIC : Useful to work something.
DESIGN : Design means structure. In design phase we are going to pictorially draw the actual
representation of the requirement.
Examples :
1. In any kind of software industry, first the client give requirements then we are going to analyse
them and moves to design phase accordingly.
2. In olden days, for 64 GB of memory the size of chip was large (10cmx10cm) and computer size is
also very vast. Now a days size of the same 64 GB of memory is 1cmx1cm.
3. In olden days, there are two switches for ON and OFF. But now a days there is only one switch for
ON/OFF this is the advantage of design.
4. For calculator we require any programming language like Java, C etc along with a hardware
component (Mother board). Motherboard is responsible for processing of the data. Internally the
hardware process the data and stores it in the form of 0s and 1s [Binary language].
The base 2 number system is also known as the Binary number system in which only two binary digits
exist, i.e., 0 and 1. Specifically, the usual base-2 is a radix of 2.
For example : (1010)2 , 0b11 are binary numbers.
Here the values inside the brackets must be less than the radix i.e., 2.
For example : (1023)2 is not a binary number.
The decimal number system has a base of 10 because it uses ten digits from 0 to 9.
In the decimal number system, the positions successive to the left of the decimal point represent units,
tens, hundreds, thousands and so on.
For Example : (905)10 is a decimal number.
In the octal number system, the base is 8 and it uses numbers from 0 to 7 to represent numbers.
For Example : (765)8 , 011 are octal numbers.
1 M VEDAVYAS
4. Hexadecimal Number System (Base 16 Number System)
In the hexadecimal system, numbers are written or represented with base 16.
In the hexadecimal system, the numbers are first represented just like in the decimal system, i.e. from
0 to 9 and 10 to 15.
To avoid ambiguity we represent 10 as ’A’, 11 as ’B’, 12 as ’C’, 13 as ’D’, 14 as ’E’, 15 as ’F’.
Here the values inside the brackets must be less than 16.
For Example : (1F7)16 , 0X11 are Hexadecimal numbers.
General form to convert any number system into decimal number system is (xyz) n => (x*n2 +y*n1 +z*n0 )10
Examples :
1. (11)2 => (1*21 +1*20 )10 => (3)10 [converting binary to decimal number system]
2. (11)8 => (1*81 +1*80 )10 => (9)10 [converting octal to decimal number system]
3. (11)10 => (11)10
4. (11)16 => (1*161 +1*160 )10 => (17)10 [converting hexadecimal to decimal system]
Note :
General form to convert fractional number into decimal number system is (xy.z)n => (x*n1 +y*n0 +z*n−1 )10
Example : (11.11)2 => (1*21 +1*20 +1*2−1 +1*2−2 )10 => (3.75)10
2 M VEDAVYAS
Decimal to Octal Number :
To convert decimal to octal number we have to divide the given decimal number by 8 such that base
10 changes to base 8.
Example : (128)10 = (200)8
For integer part, the answer is 101 and fractional part is to be calculated as follows :
Now, we need to write all the values in the table from top to bottom
Therefore the binary number for (5.28)10 is (101.0100)2
3. Converting Octal number system into Binary number system :
Method-1 :
We can convert the octal number into decimal and then convert the decimal number into its equivalent
binary number.
Example : Converting (756)8 to decimal first then into binary.
(756)8 => (7*82 +5*81 +6*80 )10 => (494)10
Example :
1. Convert (756)8 into a binary number.
Now with the help of the table, we can write as follows :
For 7 Binary number is 111
For 5 Binary number is 101
For 6 Binary number is 110
Therefore (756)8 = (111101110)2
2. Convert (111110)2 into octal number.
Separate the given number with 3 digits each as follows :
|111|110
As we know that octal number for 111 is 7 and for 110 is 6.
Therfore (111110)2 = (76)8
We can convert the Hexadecimal number into decimal and then convert the decimal number into its
equivalent binary number.
Example : Converting (756)16 to decimal first then into binary.
(756)1 6 => (7*162 +5*161 +6*160 )10 => (1878)10
Method-2 :
We can also use the Hexadecimal number table to convert a number with base 16 to a number with
base 2.
Using this table we can also convert a binary number to a hexadecimal number.
4 M VEDAVYAS
HEXA DECIMAL BINARY NUMBER
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10(A) 1010
11(B) 1011
12(C) 1100
13(D) 1101
14(E) 1110
15(F) 1111
Examples :
1. Convert FDA6 to an equivalent binary number.
Now with the help of the table, we can write as follows :
For F Binary number is 1111
For D Binary number is 1101
For A Binary number is 1010
For 6 Binary number is 0110
Therefore (FDA6)16 = (1111110110100110)2
2. Convert (101000101011)2 into hexadecimal number.
Separate the given number with 4 digits each as follows :
|1010|0010|1011
As we know that hexa decimal number for 1010 is A(10) and for 0010 is 2 and for 1011 is B(11).
Therfore (101000101011)2 = (A2B)16
5 M VEDAVYAS
1.3 PROBLEM SOLVING -For Video
1. What is the value of (11)2 +(22)3 +(33)4 in base-6 format ?
Solution :
First of all, we need to convert (11)2 +(22)3 +(33)4 into decimal number system.
(11)2 => (1*21 +1*20 )10 => (3)10
(22)3 => (2*31 +2*30 )10 => (8)10
(33)4 => (3*41 +3*40 )10 => (15)10
That implies, (3)10 + (8)10 +(15)10 => (26)10
Now converting (26)10 into base-6 format.
X Y XY
1 30 30
2 15 30
3 10 30
5 6 30
6 5 30
10 3 30
15 2 30
30 1 30
But we know that, In y-number system the values must be less than y in it.
Also that if x=5 ,y=6 then (58)6 is not possible [Since 8 >6].
So we can remove the values from the table in which x greater than y as shown below.
X Y XY
1 30 30
2 15 30
3 10 30
Therefore the above table shows the possible values for x and y where (xy=30).
Thus the possible conversions for (123)5 in (x8)y , format are as follows :
(123)5 =(18)30
(123)5 =(28)15
(123)5 =(38)10
6 M VEDAVYAS
3. If 38+43 = 80 then find out the number system in which it is correct ?
Solution :
Let us assume that given is in some b-number system.
Now convert it in to decimal number system.
=> (3*b1 +8*b0 ) + (4*b1 +3*b0 ) = (8*b1 +0*b0 )
=> (3b+8)+(4b+3) = 8b
∴ The number system, b=11
√
4. If 22 = 6 then find out the number system in which it is correct ?
Solution :
Let us assume that given is in some k-number system.
√
Given that 22 = 6 => 22=62 => 22=6 x 6
Now convert it in to decimal number system.
=> (2*k1 +2*k0 ) = (6*k0 )(6*k0 )
=> (2k+2) = (6)(6)
=> (2k+2) = 36
=> 2k = 34
∴ The number system, k=17
X Y XY
1 35 35
5 7 35
7 5 35
35 1 35
But we know that, In y-number system the values must be less than y in it.
So we can remove the values from the table in which x greater than y as shown below.
X Y XY
1 35 35
5 7 35
Therefore the above table shows the possible values for x and y where (xy=35).
Thus the possible conversions for (42)9 in (x3)y format are as follows :
(42)9 =(13)35
(42)9 =(53)7
7 M VEDAVYAS
6. Solve (2.3)4 +(1.2)4 =(y)4
Solution :
First of all we need to convert (2.3)4 +(1.2)4 =(y)4 into decimal number system.
=> (2x40 +3*4−1 )+(1*40 +2*4−1 ) = (2.75)10 + (1.5)10 = (4.25)10
Now, converting (4.25)10 in to base-4 system.
=> Integer part (4)10 = (10)4 and fractional part is (0.25)10 = (10)4
10. Find the minimum of digits are required to represent (32 digit)10 in binary system ?
Solution :
The maximum possible number for (32 digit)10 is (9 9 9.....9 9)10 [32 times of 9]
Let us assume 32-digit number as k-digit number and decimal number system as b-number system.
8 M VEDAVYAS
=> xn -1 >= bk -1
=> xn >= bk
=> n >= klogx b
Substituting k and b values
=> n >= 32log2 10
∴ The minimum of digits required to represent (32 digit)10 in binary system, n >=107
11. Find the minimum number of bits required to represent (516)7 in base-4 system ?
Solution
Converting (516)7 into decimal number system
=> (5*72 +1*71 +6*70 ) = (5*49)+(7)+6 = (258)10
Now xn -1 >= 258
=> xn >= 259
=> n >= log4 259
∴ n >= 5
12. In a number system, there is a range of numbers from -3 to 3 and they can be represented
as C,B,A,0,1,2,3. Express (102)10 in the given number system ?
Solution
In given number system there are 7 values from -3 to 3 which are represented as C,B,A,0,1,2,3.
Now convert (102)10 to get the values from range -3 to 3 only as follows :
1. Unsigned Numbers :
All Positive numbers and zero are Unsigned numbers because we don’t mention sign(+) before positive
numbers every time.
A Signed number has both positive and negative numbers along with the value zero.
Ex : -5,-7, +5, 0
All the negative signed numbers are to be stored in the form of their complements in the system.
We have different type of approaches to represent the signed data in the system.
9 M VEDAVYAS
REPRESENTATION OF SIGNED DATA :
To represent signed data the following approaches and will be used :
1. Sign Magnitude Representation
2. Complementary of system.
1. SIGN MAGNITUDE REPRESENTATION -For Video
Signed Magnitude Representation uses the Most Significant Bit (MSB) as the sign bit.
The MSB is the leftmost bit in a binary number, so in the binary number 101101, 1 is the MSB.
In Signed Magnitude Representation, the sign of the number is interpreted as follows :
0 means Positive(+)
1 means Negative(-)
We can determine whether a given number is negative or non negative simply by testing the most
significant bit(MSB).
Example : 5 = 101 ; 0101 = +5 and 1101 = -5
Drawbacks :
1. They are two representations of 0
00000000 = + (0)10
10000000 = - (0)10
To test if a number is 0 or not, the CPU will need to see whether it is 00000000 or 10000000.
2. It is not convenient for the system to perform arithmetic operations like addition and subtraction.
Example : Adding the numbers (-4) and (+2)
1100 -> (-4) First Number
+ 0010 ->(+2) Second Number
——–
1110 -> (-2) Sum
——–
Here, system has given wrong answer of -6 = 1110, instead of giving correct answer of -2 = 1010.
3. Thus, there is a need of designing the different kind of circuits for performing the arithmetic operations.
10 M VEDAVYAS
Binary system complements :
As the binary system has base r = 2. So the two types of complements for the binary system are 2’s
complement and 1’s complement.
1’s complement :
– The 1’s complement of a number is found by changing all 1’s to 0’s and all 0’s to 1’s.
– This is called as taking complement or 1’s complement.
Example of 1’s Complement is as follows.
10101 => 01010
2’s complement
– The 2’s complement of binary number is obtained by adding 1 to the Least Significant Bit (LSB)
of 1’s complement of the number.
– 2’s complement = 1’s complement + 1
Example of 2’s Complement is as follows.
10101 => 01010 +1 => 01011
11 M VEDAVYAS
2. Subtract (84)10 from (6)10 .
Given First number be (6)10 and second number be (84)10 .
As (84)10 contains two bits modify (6)10 as (06)10
Now finding 9’s complement of (84)10
=> 99 - 84 = 15
Adding the complement of second number to the given first number.
=> 06 + 15 =21
Here we didn’t get an extra bit (carry) so we need to find complement of (21)10 and add negative
number to the result.
=> 99 - 21 =78
∴ (84)10 - (6)10 = -(78)10 .
12 M VEDAVYAS
b’s complement procedure :
1. Find out the b’s complement of the number hich contains negative sign.
2. Add the complement of second number to the given first number.
3. If the result(x-y) generates a carry then discard it completely.
4. If the result(x-y) doesn’t generates a carry then find the complement of result and add negative symbol
to the result.
Examples :
1. Find the value of (84)10 - (6)10 .
Given First number be (84)10 and second number be (6)10 .
As (84)10 contains two bits modify (6)10 as (06)10
Now finding 10’s complement of (06)10
=> 99 - 06 =93+1 = 94
Adding the complement of second number to the given first number.
=> 84 + 94 =178
Here we got an extra bit (carry) as 1 so discard it.
∴ (84)10 - (6)10 = (78)10 .
13 M VEDAVYAS
BINARY WITH MSB UNSIGNED SIGNED 1’s COMPLEMENT 2’s COMPLEMENT
000 0 000 (0) 0 0
001 1 001 (1) 1 1
010 2 010 (2) 2 2
011 3 011 (3) 3 3
100 4 100 (-0) -3 -4
101 5 101(-1) -2 -3
110 6 110(-2) -1 -2
111 7 111(-3) -0 -1
Note :
1. The maximum possible numbers for 3-bit Unsigned number system is 2n -1.
2. The range of 3-bit Unsigned number system is 0 to 2n -1.
3. The range of 3-bit Signed number system in sign magnitude representation is 0 to 2n−1 -1 and 0 to
-(2n−1 -1).
4. The range of 3-bit Signed number system in 1’s complement is -(2n−1 -1) to 2n−1 -1
5. The range of 3-bit Signed number system in 2’s complement is -2n−1 to 2n−1 -1
2. How many number of minimum bits are required to represent (15)10 in 2’s complement ?
Solution :
As we know that the range of Signed number system in 2’s complement is -2n−1 and 2n−1 -1
As (15)10 > 0 and < 2n−1 -1
=> 2n−1 -1 > 15
=> 2n−1 > 16
=> n >= 5
∴ The minimum no.of bits are required to represent (-15)10 in 2’s complement is greater than or
equal to 5 bits.
3. How many number of minimum bits are required to represent (-15)10 in 2’s complement.
Solution :
As we know that the range of Signed number system in 2’s complement is -2n−1 and 2n−1 -1
As (-15)10 < 0 and > -2n−1
=> -15 >= -2n−1
=> 2n−1 >= 15
Let n = 5
=> 25−1 >= 15
=> 24 >= 15
∴ The minimum no.of bits are required to represent (-15)10 in 2’s complement is 5 bits.
14 M VEDAVYAS
Note : -For Video
1. When we are trying to add two negative numbers, if a carry generates then there exists an overflow
[needs space for extra bits to store data].
Example : Adding -62 and -45
2’s complement of (-62) is 1000010 and 2’s complement of (-45) is 1010011[1010010 + 1]
By adding 1000010(7 bits) and 1010011(7 bits) we will get 10010101 (8 bits) i.e., carry generated.
=> 10010101 = 1*(-2)7 +0*(2)6 + 0*(2)5 +1*(2)4 + 0*(2)3 + 1*(2)2 + 0*(2)1 + 1*(2)0
=> -128 + 16 + 4 +1
=> -(107)
2. When we are trying to add one positive and one negative numbers, if a carry generates then when
don’t consider the overflow [needs space for extra bits to store data].
Example : Adding +62 and -45
2’s complement of (+62) is 0111110 and 2’s complement of (-45) is 1010011[1010010 + 1]
By adding 1000010(7 bits) and 1010011(7 bits) we will get 10010001 (8 bits) i.e., carry generated.
Here we don’t consider left most 1(carry) in 10010001. We will treat it as 0010001.
=> 0010001 = 0*(-2)6 + 0*(2)5 +1*(2)4 + 0*(2)3 + 1*(2)2 + 0*(2)1 + 1*(2)0
=> 16 + 1
=> +(17)
3. When we are trying to add two positive numbers, we will consider the overflow whether the carry
generates or not.
Example : Adding +62 and +45
2’s complement of (+62) is 0111110 and 2’s complement of (+45) is 0101101
By adding 1000010(7 bits) and 1010011(7 bits) we will get 1101011 (8 bits) i.e., carry generated.
=> 1101011 = 1*(-2)6 + 1*(2)5 +0*(2)4 + 1*(2)3 + 0*(2)2 + 1*(2)1 + 1*(2)0
Since we are getting result as -(21) we need to add a carry (0) before 1101011 to get correct result
=> 1101011 = 0*(-2)7 +1*(2)6 + 1*(2)5 +0*(2)4 + 1*(2)3 + 0*(2)2 + 1*(2)1 + 1*(2)0
=> 64 + 32 + 8 + 2 +1
=> +(107)
The digital data is represented, stored and transmitted as group of binary bits. This group is also
called as binary code.
15 M VEDAVYAS
CLASSIFICATION OF BINARY CODES :
1. WEIGHTED CODE :
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 to 9.
In these codes each decimal digit is represented by a group of four bits.
8421 Code : -For Video
This is also called as Binary Coded Decimal (BCD) code.
In this code each decimal digit is represented by a 4-bit binary number.
BCD is a way to express each of the decimal digits with a binary code.
Generally, In the BCD, with four bits we can represent sixteen numbers (0000 to 1111). But in BCD
code only first ten of these are used (0000 to 1001).
The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.
BCD is a sequential code because if we add 1 to existing value then we will get the next value.
DECIMAL BCD VALUE
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
We represent 10 in BCD as 0001 0000, 11 as 0001 0001, 12 as 0001 0010 and so on...
16 M VEDAVYAS
3321 code : -For Video
It is also a sequential code because if we add 1 to existing value then we will get next value.
Excess - 3 - code is also known as self-complementing code which means 1’s complement of an
excess - 3 number is the excess - 3 code for the 9’s complement of the corresponding decimal number.
The excess-3 codes are obtained as follows :
ADD
Decimal Number 8421 BCD 0011
Excess-3
17 M VEDAVYAS
Gray Code : -For Video
It is the non-weighted code. That means there are no specific weights assigned to the bit position.
The gray code is Non sequential code.
It has a very special feature that, only one bit will change each time the decimal number is incremented
as shown below.
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 and it is a Reflexive code.
DECIMAL Gray Code
0 000
1 001
2 011
3 010
4 101
5 111
6 101
7 100
B4 ⊕ B3 ⊕ B2 ⊕ B1 ⊕ B0
1 1 1 0 1
1 0 0 1 1
G4 G3 G2 G1 G0
Note : The generalized formula to find nth gray code for given binary code is bn = an+1 ⊕ an
18 M VEDAVYAS
2. The 2nd bit of the binary number is the same as the 1st bit of the binary number when the 2nd bit of
the Gray code is 0; otherwise, the 2nd bit is altered bit of the 1st bit of binary number. It means if
the 1st bit of the binary is 1, then the 2nd bit is 0, and if it is 0, then the 2nd bit be 1.
3. The 2nd step continues for all the bits of the binary number.
G4 G3 G2 G1 G0
1 0 0 1 1
⊕ ⊕ ⊕ ⊕
1 1 1 0 1
B4 B3 B2 B1 G0
3. To obtain the corrected result/sum, add 6 (0110) to the 4-bit invalid sum. If a carry is generated when
6 is added, then propagate and add this carry to the next 4-bit group. This step is done to skip the
six illegal BCD codes (i.e. 1010, 1011, 1100, 1101, 1110, and 1111).
Examples :
19 M VEDAVYAS
EXCESS-3 ADDITION -For Video
1. We have to convert the numbers (which are to be added) into excess 3 forms by adding 0011 with each
of the four bit groups them or simply increasing them by 3.
2. Now the two numbers are added using the basic laws of binary addition, there is no exception for this
method.
3. Now which of the four groups have produced a carry we have to add 0011 with them and subtract
0011 from the groups which have not produced a carry during the addition.
4. The result which we have obtained after this operation is in Excess 3 form and this is our desired
result.
Examples :
1. Perform addition 984 + 599 in Excess-3.
Solution :
Excess 3 code for 984 : 1100 1011 0111
Excess 3 code for 599 : 1000 1100 1100
Addition : 10100 10111 10011
Remaining bits except carry : 10100 0111 0011
Carry : 1 1
Addition : 10101 1000 0011
If carry generated then add 3 otherwise subtract 3 : +0011 +0011 +0011
Result : 10010 1011 0110
Excess 3 value : 18 11 6
Decimal value : 15 8 3
∴ So final answer of Excess 3 addition is 1583
Problems :
1. Represent (756)10 in BCD, 3321, EXCESS-3 and Normal Binary systems ?
Solution :
BCD : 0111 0101 0110
3321 : 1101 1010 1100
EXCESS-3 : 1010 1000 1001
BINARY : 101 111 0100
20 M VEDAVYAS
BCD SUBTRACTION -For Video
It is necessary to add this carry to the result. (this is called an end-around carry).
When larger number is subtracted from smaller one, there is no carry, and the result is in 9’s Comple-
ment form and negative.
Procedure is as follows :
1. Find the 9’s complement of a negative number.
2. Add two numbers using BCD addition.
3. If carry is generated add carry to the result otherwise find the 9’s complement of the result and
add negative sign to it.
The BCD Subtraction using 10’s Complement can be used to perform subtraction by adding the minu-
end[First number] to the 10’s Complement of the subtrahend[Second number] and dropping[discarding]
the carry.
Procedure is as follows :
1. Find the 10’s complement of a negative number.
2. Add two numbers using BCD addition.
3. If carry is not generated find the 10’s Complement of the result.
21 M VEDAVYAS
Let us see the following examples.
22 M VEDAVYAS
9’s complement of 62 is
99 - 62 = 37
Add 33 and 37 using Excess 3 addition
Excess 3 code for 33 : 0110 0110
Excess 3 code for 37 : 0110 1010
Addition : 1100 10000
Remaining bits except carry : 1100 0000
Carry : 1
Addition : 0111 0000
if carry, add 3 else substract 3 : -0011 +0011
Result : 1010 0011
Decimal value : 10 3
Excess 3 value : 7 0
9’s complement of 70 is 99 -70 = 29 and add negative sign to it i.e., -29
So final answer of Excess 3 Subtraction is -29.
23 M VEDAVYAS
1.8 ERROR DETECTION AND ERROR CORRECTION -For Video
Error :
Error is a condition when the receiver’s information does not match the sender’s information. That
means a 0 bit may change to 1 or a 1 bit may change to 0.
Types of Errors :
1. Single-Bit Error :
A single-bit error refers to a type of data transmission error that occurs when one bit (i.e., a single
binary digit) of a transmitted data unit is altered during transmission, resulting in an incorrect or
corrupted data unit.
Sent
.
1 0 1 1 0 0 1 1
Transmission
1 0 1 1 0 1 1 1
Received
2. Multiple-Bit Error :
A multiple-bit error is an error type that arises when more than one bit in a data transmission is
affected. Although multiple-bit errors are relatively rare when compared to single-bit errors, they can
still occur, particularly in high-noise or high-interference digital environments.
Sent
.
1 0 1 1 0 0 1 1
Transmission
1 0 1 0 0 1 1 1
Received
3. Burst Error :
When several consecutive bits are flipped mistakenly in digital transmission, it creates a burst error.
This error causes a sequence of consecutive incorrect values.
Sent
.
1 0 1 1 0 0 1 1
Transmission
1 1 0 0 0 1 1 1
Received
24 M VEDAVYAS
Error Detection Methods :
To detect errors, a common technique is to introduce redundancy bits that provide additional infor-
mation. Various techniques for error detection include:
1. Single Parity Check
2. Two-dimensional Parity Check
3. Checksum
4. Cyclic Redundancy Check (CRC)
It is a simple error detection method that involves adding an extra bit to a data transmission.
It works as:
1 is added to the block if it contains an odd number of 1’s, and
0 is added if it contains an even number of 1’s.
One extra bit is sent along with the original bits to make number of 1’s either even in case of even
parity, or odd in case of odd parity.
The sender while creating a frame counts the number of 1’s in it. For example, if even parity
is used and number of 1’s is even then one bit with value 0 is added. This way number of 1’s
remains even.If the number of 1’s is odd, to make it even a bit with value 1 is added.
SENDER
Odd Even
10011 Reject Data Parity Accept Data
DrawBack :
When more than one bits are erroneous, then it is very hard for the receiver to detect the error.
So it won’t be work for more than 1 bit.
2. Two-dimensional Parity Check :
Two-dimensional Parity check bits are calculated for each row, which is equivalent to a simple
parity check bit. Parity check bits are also calculated for all columns, then both are sent along
with the data. At the receiving end, these are compared with the parity bits calculated on the
received data.
Original Data
10011001 11100010 00100100 10000100
10011001 0
11100010 0
Row
00100100 0 Parities
Column 10000100 0
Parities 11011011 0
25 M VEDAVYAS
3. Checksum :
Checksum error detection is a method used to identify errors in transmitted data. The process
involves dividing the data into equally sized segments and using a 1’s complement to calculate
the sum of these segments.
The calculated sum is then sent along with the data to the receiver. At the receiver’s end, the
same process is repeated and if all zeroes are obtained in the sum, it means that the data is
correct.
Original Data
10011001 11100010 00100100 10000100
m=8,k=4
SENDER RECIEVER
10011001 10011001
11100010 11100010
1 01111011 1 01111011
1 1
01111100 01111100
00100100 00100100
10100000 10100000
10000100 10000100
1 00100100 1 00100100
1 1
SUM:00100101 00100101
CHECKSUM:11011010 11011010
SUM:11111111
COMPLEMENT:00000000
Conclusion:Accept Data
DrawBack :
If one or more bits of a segment are damaged and the corresponding bit or bits of opposite value
in a second segment are also damaged.
Error Correction :
For correcting the errors, one has to know the exact position of the error. For example, If we
want to calculate a single-bit error, the error correction code will determine which one of seven
bits is in error. To achieve this, we have to add some additional redundant bits.
For Example, In 4-bits binary number system there will be 16 possible patterns as follows :
Decimal value Binary value
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
26 M VEDAVYAS
If we observe the table properly, Here we need 1 bit of distance between 2 single bit errors i.e.,
0000 and 0001. So, we need 2 bits of distance between 2 valid patterns of 1 bit errors i.e., 0000
and 0001.
As well as we need 3 bits of distance between 2 valid patterns of 2 bit errors i.e., 0000 and 0011.
As well as we need (t+1) bits of distance between 2 valid patterns of t bit errors.
1.9 HAMMING CODES -For Video
Hamming code is a set of error-correction codes that can be used to detect and correct the errors that
can occur when the data is moved or stored from the sender to the receiver.
The number of redundant bits can be calculated using the following formula:
2r >= m + r + 1
or
2p >= m + p + 1
where, p (or) r = redundant bit, m = data bit.
Suppose the number of data bits is 7, then the number of redundant bits can be calculated using: =
24 >= 7 + 4 + 1 Thus, the number of redundant bits= 4 Parity bits.
1. Write the bit positions starting from 1 in binary form (1, 10, 11, 100, etc).
2. All the bit positions that are a power of 2 are marked as parity bits (1, 2, 4, 8, etc).
4. Position 1 - Check 1 bit, then skip 1 bit, check 1 bit and then skip 1 bit and so on..
(Ex - 1,3,5,7,11, etc.)
Position 2 - Check 2 bits, then skip 2 bits, check 2 bits, then skip 2 bits.
(Ex - 2,3,6,7,10,11,14,15, etc.)
Position 4 - Check 4 bits, then skip 4 bits, check 4 bits, then skip 4 bits.
(Ex - 4, 5, 6, 7, 12, 13, 14, 15, etc.)
Position 8 - Check 8 bits, then skip 8 bits, check 8 bits, then skip 8 bits.
(Ex - 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31).
5. Since we check for even parity set a parity bit to 1 if the total number of ones in the positions it checks
is odd.
6. Set a parity bit to 0 if the total number of ones in the positions it checks is even.
Examples :
1. Encode a binary word 11001 into the even parity hamming code.
Given, number of data bits, n =5.
To find the number of redundant bits,
Let us try P=4.
24 >= 5 + 4 + 1
The equation is satisfied and so 4 redundant bits are selected.
So, total code bit = n+P = 9
27 M VEDAVYAS
The redundant bits are placed at bit positions 1, 2, 4 and 8.
Now Construct the bit location table.
Bit Location 9 8 7 6 5 4 3 2 1
Bit designation D9 P8 D7 D6 D5 P4 D3 P2 P1
Binary representation 1001 1000 0111 0110 0101 0100 0011 0010 0001
Information bits 1 1 0 0 1
Parity bits 1 1 0 1
2. Let us assume the even parity hamming code from the above example (111001101) is
transmitted and the received code is (110001101). Now from the received code, let us
detect and correct the error.
To detect the error, let us construct the bit location table.
Bit Location 9 8 7 6 5 4 3 2 1
Bit designation D9 P8 D7 D6 D5 P4 D3 P2 P1
Binary representation 1001 1000 0111 0110 0101 0100 0011 0010 0001
Received code 1 1 0 0 0 1 1 0 1
28 M VEDAVYAS
Logic gates are found in nearly every digital gadget we use on a regular basis. Logic gates are used in
the architecture of our telephones, laptops, tablets, and memory devices.
The way in which you are arranging the logic gates to get the efficient output is called Logic Design.
Types of Logic Gates :
1. BASIC GATES :
1. AND :
Truth Table
A B Y=A.B
0 0 0
0 1 0
1 0 0
1 1 1
2. OR :
A
A+B
B
Truth Table
A B Y=A+B
0 0 0
0 1 1
1 0 1
1 1 1
3. NOT :
Truth Table
A A
0 1
1 0
UNIVERSAL GATES
1. NOR :
A NOR gate, sometimes known as a “NOT-OR” gate, consists of an OR gate followed by a NOT
gate.
This gate’s output is 1 only when all of its inputs are 0. Alternatively, when all of the inputs are
low, the output is high.
The Boolean statement for the NOR gate is Y=(A+B)’ if there are two inputs A and B.
A
(A + B)
B
Truth Table
A B Y=(A + B)
0 0 1
0 1 0
1 0 0
1 1 0
2. NAND :
A NAND gate, sometimes known as a ‘NOT-AND’ gate, is essentially a Not gate followed by an
AND gate.
This gate’s output is 0 only if none of the inputs is 0. Alternatively, when all of the inputs are
not high and at least one is low, the output is high.
If there are two inputs A and B, the Boolean expression for the NAND gate is Y=(A.B)’
A
(A.B)
B
Truth Table
A B Y=A.B
0 0 1
0 1 1
1 0 1
1 1 0
30 M VEDAVYAS
SPECIAL GATES
1. XOR :
The Exclusive-OR or ‘Ex-OR’ gate is a digital logic gate that accepts more than two inputs but
gives only one output.
If any of the inputs is ‘High’, the output of the XOR Gate is ‘High’. If both inputs are ‘High’,
the output is ‘Low’. If both inputs are ‘Low’, the output is ‘Low’.
The Boolean equation for the XOR gate is Y=A’.B+A.B’ if there are two inputs A and B.
A
A⊕B
B
Truth Table
L
A B Y=A B
0 0 0
0 1 1
1 0 1
1 1 0
2. XNOR :
The Exclusive-NOR or ‘EX-NOR’ gate is a digital logic gate that accepts more than two inputs
but only one output.
If both inputs are ‘High’, the output of the XNOR Gate is ‘High’. If both inputs are ‘Low’, the
output is ‘High’. If one of the inputs is ‘Low’, the output is ‘Low’. If there are two inputs A and
B, then the XNOR gate’s Boolean equation is: Y=A.B+A’B’.
A
A⊙B
B
Truth Table
J
A B Y=A B
0 0 1
0 1 0
1 0 0
1 1 1
BOOLEAN ALGEBRA : -For Video
Boolean algebra is a type of logical algebra in which symbols represent logic levels.
Used to analyze and simplify the circuit diagrams.
The digits(or symbols) 1 and 0 are related to the logic levels in this algebra.
At any time, a digital device will be in one of these two binary situations[1 or 0].
x , x̄ are called Boolean Literals.
+, -, . are called boolean operators.
31 M VEDAVYAS
1.11 ALGEBRAIC PROPERTIES -For Video
1. Annulment law - When the variable is AND with 0, it will give the result 0, and when the variable
is OR with 1, it will give the result 1, i.e.,
A.0 = 0
A+1=1
2. Identity law – When the variable is in AND with 1 and OR with 0, the variable remains the same,
i.e.,
A.1 = A
A+0=A
3. Idempotent law – When the variable is AND and OR with itself, the variable remains same or
unchanged, i.e.,
A.A=A
A+A=A
4. Complement Law - When the variable is AND and OR with its complement, it will give the result
0 and 1 respectively.
A.A’=0
A+A’=1
5. Double Negation Law - This law states that, when the variable comes with two negations, the
symbol gets removed and the original variable is obtained.
((A)’)’ = A
6. Commutative Law - This law states that no matter in which order we use the variables. It means
that the order of variables doesn’t matter in this law.
A.B = B.A
A+B = B+A
7. Associative Law- This law states that the operation can be performed in any order when the variables
priority is of same as ’*’ and ’/’.
(A.B).C = A.(B.C)
(A+B)+C = A+(B+C)
8. Distributive Law - This law allows us to open up of brackets. Simply, we can open the brackets in
the Boolean expressions.
A+(B.C) = (A+B).(A+C)
A.(B+C) = (A.B)+(A.C)
9. Absorption Law - This law allows us for absorbing the similar variables.
B+(B.A) = B
B.(B+A) = B
10. De Morgan’s Law - The operation of an OR and AND logic circuit will remain same if we invert all
the inputs, change operators from AND to OR and OR to AND, and invert the output.
(A.B)’ = A’+B’
(A+B)’ = A’.B’
11. Consesus -
xy + x̄z + yz = xy + x̄z
proof :
=> xy + x̄z + yz (x+x̄)
=> xy +x̄z +xyz + x̄yz
=> xy(1+z)+x̄z(1+y)
=> xy + x̄z
32 M VEDAVYAS
Designing Logic circuit :
f(A,B,C)=AB+BC+CA
A
B AB
AB+BC
BC
C
AB+BC+AC
AC
Switching Expressions :
33 M VEDAVYAS
1.12 CANONICAL REPRESENTATION FOR SWITCHING OF
EXPRESSIONS -For Video
In Boolean algebra,Boolean function can be expressed as Canonical Disjunctive Normal Form known
as minterm and some are expressed as Canonical Conjunctive Normal Form known as maxterm .
In Minterm, we look for the functions where the output results in “1” while in Maxterm we look for
function where the output results in “0”.
We perform Sum of minterm also known as Sum of products (SOP) .
We perform Product of Maxterm also known as Product of sum (POS).
Boolean functions expressed as a sum of minterms or product of maxterms are said to be in canonical
form.
Standard Form :
A Boolean variable can be expressed in either true form or complemented form. In standard form
Boolean function will contain all the variables in either true form or complemented form while in
canonical number of variables depends on the output of SOP or POS.
A Boolean function can be expressed algebraically from a given truth table by forming a :
i. minterm for each combination of the variables that produces a 1 in the function and then taking the
OR of all those terms.
ii. maxterm for each combination of the variables that produces a 0 in the function and then taking
the AND of all those terms.
From the above table it is clear that minterm is expressed in product format and maxterm is expressed
in sum format.
Sum of minterms – The minterms whose sum defines the Boolean function are those which give the
1’s of the function in a truth table. Since the function can be either 1 or 0 for each minterm, and since
there are 2n minterms, one can calculate all the functions that can be formed with n variables to be
(2(2n )).
Note :
Complementary for x’.y’ = (x̄.ȳ)
¯ = x̄
¯ + ȳ¯ = x+y
P
2. F(A, B, C) = Pm(1, 4, 5, 6, 7)
F’(A, B, C) = m(0, 2, 3) = m0 + m2 + m3
Now, if we take the complement of F’ by DeMorgan’s theorem, we obtain F in a different form :
F = (m0 + m2 + m3)’
= m0’m2’m3’
= M0*M2*M3
= πM(0, 2, 3)
2. f(x,y)=x(x+y)
=> (x+y.y’)(x+y)
=> (x+y)(x+y’)(x+y)
=> (x+y)(x+y’)
=> πM(0,1)
P
=> m(2,3)
=> xy’ + xy
35 M VEDAVYAS
1.13 REALIZATION OF LOGIC GATES USING UNIVERSAL
GATES -For Video
In Boolean Algebra, the NAND and NOR gates are called universal gates because any digital circuit
can be implemented by using any one of these two i.e. any logic gate can be created using NAND or
NOR gates only.
x y xy
x xy 0 0 0
xy 0 1 0
y
1 0 0
1 1 1
2. Using NOR Gates : The AND gate can be implemented by using two NOR gates in the below
fashion :
x x̄ x y xy
0 0 0
xy 0 1 0
1 0 0
y ȳ 1 1 1
1. Using NAND Gates : The OR gate can be implemented using the NAND gate as below:
x x̄ x y x+y
0 0 0
x+y 0 1 1
1 0 1
y ȳ 1 1 1
2. Using NOR Gates : The OR gate can be implemented using the NOR gate as below:
36 M VEDAVYAS
x y xy
x x+y 0 0 0
x+y 0 1 1
y
1 0 1
1 1 1
x x x
x̄
0 1
x 1 0
2. Using NOR Gate : The NOT gate can be implemented using the NOR gate as below:
x x x̄
x̄
0 1
x 1 0
1. Using NAND Gate : The XOR gate can be implemented using the NAND gate as below:
x
x.xy x y x⊕y
x
0 0 0
xy x⊕y 0 1 1
1 0 1
y 1 1 0
y.xy
y
2. Using NOR Gate : The XOR gate can be implemented using the NOR gate as below:
x
x x+x+y x y x⊕y
x⊙y 0 0 0
x+y x⊕y 0 1 1
1 0 1
y 1 1 0
y+x+y
y
37 M VEDAVYAS
5. Implementation of XNOR Gate using Universal gates.
1. Using NAND Gate : The XNOR gate can be implemented using the NAND gate as below:
x
x.xy x y x⊙y
x
x⊕y 0 0 1
xy x⊙y 0 1 0
1 0 0
y 1 1 1
y.xy
y
2. Using NOR Gate : The XNOR gate can be implemented using the NOR gate as below:
x
x x+x+y x y x⊙y
0 0 1
x+y x⊙y 0 1 0
1 0 0
y 1 1 1
y+x+y
y
1. NAND Gate using NOR : The NAND gate can be implemented using the NOR gate as below:
x x x y x.y
x̄ + ȳ 0 0 1
x.y 0 1 1
1 0 1
y y 1 1 0
2. NOR Gate using NAND : The NOR gate can be implemented using the NAND gate as below:
x x x y x+y
x̄.ȳ 0 0 1
x+y 0 1 0
1 0 0
y y 1 1 0
38 M VEDAVYAS
Note :
1. For XNOR 5 NAND gates are required to represent through NAND gates.
2. For XNOR 4 NOR gates are required to represent through NOR gates.
3. For XOR 4 NAND gates are required to represent through NAND gates.
4. For XOR 5 NOR gates are required to represent through NOR gates.
3. Now replace every normal gates by the gates we made using only NAND gate.
4. Draw the final circuit using only NAND gates.
Example for NAND-NAND and NOR-NOR realization : f(x,y,z) = x +ȳz
NAND-NAND
x x̄
y ȳ x̄.(ȳ.z)= x + ȳ.z
ȳ.z
z
NOR-NOR
x
x + ȳ
ȳ
y x + ȳ + x + z = x + ȳ.z
x+z
z
39 M VEDAVYAS
XOR USING UNIVERSAL GATES
XOR using NAND gate :
x
x.xy x y x⊕y
x
0 0 0
xy x⊕y 0 1 1
1 0 1
y 1 1 0
y.xy
y
x
x x+x+y x y x⊕y
x⊙y 0 0 0
x+y x⊕y 0 1 1
1 0 1
y 1 1 0
y+x+y
y
40 M VEDAVYAS
Derivation :
F = AB + A B
A Ā
Ā + B̄
B B̄ F = Ā + B̄ + A + B
A+B
F = AB + A B + AA +BB
F = ( A + B) (A + B)
Taking complement on both sides, we get:
F = (A + B)(A + B)
Using de Morgan’s Law, we get:
F = (A + B) + (A + B)
Once again taking complement on both sides, we get:
F = (A + B) + (A + B)
Hence, this Boolean expression is equivalent to the output of the XOR gate and it can be
implemented using NOR gates only.
41 M VEDAVYAS
UNIT-2
We explore four logic gates in two-level logic implementation: AND Gate, OR Gate, NAND Gate, and
NOR Gate.
There are a total of 16 two-level logic combinations if we choose one of these four gates at the first
level and one at the second level.
Each two-level combination implements a separate logic function. These 16 combinations are divided
into two categories.
1. Degenerative form of logic gate Combination
2. Non-Degenerative form of logic gate Combination.
The 16 possibilities are shown below:
Degenarative Forms Non-Degenerative Forms
AND-AND AND-OR
OR-OR OR-AND
AND-NAND NAND-NAND
OR-NOR NOR-NOR
NAND-NOR AND-NOR
NOR-NAND NAND-AND
NAND-OR OR-NAND
NOR-AND NOR-OR
1. AND-AND implementation :
Because the entire function results in an AND function of all the inputs, this AND-AND gate
combination is a degenerate form.
The outputs of first-level logic gates: F1=AB and F2=CD. These outputs are applied as inputs
of the second level, so the output of the second level is F=F1F2, which means F=ABCD.
42 M VEDAVYAS
A
F 1 = A.B
B
F = ABCD
C
F 2 = C.D
D
2. OR-OR implementation :
The outputs of first-level logic gates: F1=A+B and F2=C+D. These outputs are applied as inputs
of the second level, so the output of the second level is F=(F1+F2) which means F=(A+B+C+D).
A
F1 = A + B
F =A+B+C +D
C
F2 = C + D
3. AND-NAND implementation :
AND gates are present in the first level of this logic implementation, while NAND gates are
present in the second level.
A
F1
B
C
F2
D
The outputs of first-level logic gates: F1=AB and F2=CD. These outputs are applied as inputs
of the second level, so the output of the second level is F= (F1F2)’ which means F=(ABCD)’.
4. OR-NOR implementation :
OR-NOR combination of gates results in NOR logic function. And this degenerate form can be
used for the NOR function with multiple inputs.
A
F1
B
C
F2
D
43 M VEDAVYAS
The outputs of first-level logic gates: F1=A+B and F2=C+D. These outputs are applied as inputs
of the second level, so the output of the second level is F=(F1+F2)’ which means F=(A+B+C+D)’.
5. NAND-NOR implementation :
The outputs of first level logic gates:F1=(AB) ‘ and F2=(CD)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1+F2)’ which means
F=((AB)’+(CD)’)’.
A
F1
B
C
F2
D
6. NOR-NAND implementation :
The outputs of first level logic gates: F1=(A+B)‘ and F2=(C+D)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1.F2)’ which means
F=((A+B)’(C+D)’)’.
A
F1
B
C
F2
D
7. NAND-OR implementation :
The outputs of first level logic gates: F1=(AB)‘ and F2=(CD)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1+F2) which means
F=((AB)’+(CD)’)=(ABCD)’.
A
F1
B
C
F2
D
8. NOR-AND implementation :
The outputs of first level logic gates: F1=(A+B)‘ and F2=(C+D)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1.F2) which means
F=((A+B)’(C+D)’)=(A+B+C+D)’.
44 M VEDAVYAS
A
F1
B
C
F2
D
A non-degenerative form occurs when the output of a two-level logic realization cannot be achieved
using a single logic gate.
Non-degenerate forms are two-level logic combinations that implement the Sum of Product form or
the Product of Sum form.
1. AND-OR implementation :
The first level gate in a While-OR combination is an AND gate, and the second level gate is
an OR gate. As shown in the diagram below, this combination implements the Sum of Product
(SOP) form.
A
F1
B
C
F2
D
The outputs of first-level logic gates: F1=AB and F2=CD. These outputs are applied as inputs
of the second level, so the output of the second level is F=(F1+F2) which means F=(AB+CD).
2. OR-AND implementation :
The first level gate in an OR-AND combination is an OR gate, and the second level gate is an
AND gate. The Product of Sum form is implemented with an OR-AND combination.
A
F1
B
C
F2
D
The outputs of first-level logic gates:F1=(A+B) and F2=(C+D). These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1.F2) which means
F=(A+B)(C+D).
3. NAND-NAND implementation :
NAND is a universal gate, and its NAND-NAND combination, like the AND-OR combination, is
used to produce the Sum of Product form.
45 M VEDAVYAS
A
F1
B
C
F2
D
The outputs of first-level logic gates:F1=(AB)’ and F2=(CD)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1.F2)’ which means
F=(AB)+(CD).
4. NOR-NOR implementation :
NOR is also a universal gate and its NOR-NOR combination can be used to implement the
Product of Sum form.
A
F1
B
C
F2
D
The outputs of first-level logic gates: F1=(A+B)’ and F2=(C+D)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1+F2)’ which means
F=((A+B)’+(C+D)’)’=(A+B)(C+D).
5. AND-NOR implementation :
The outputs of first-level logic gates: F1=(AB) and F2=(CD). These outputs are applied as inputs
of the second level, so the output of the second level is F=(F1+F2)’ which means F=(AB+CD)’.
A
F1
B
C
F2
D
6. NAND-AND implementation :
The outputs of first-level logic gates:F1=(AB)’ and F2=(CD)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1F2) which means
F=(AB)’(CD)’=(AB+CD)’.
46 M VEDAVYAS
A
F1
B
C
F2
D
7. OR-NAND implementation :
The outputs of first-level logic gates: F1=(A+B) and F2=(C+D). These outputs are applied as in-
puts of the second level, so the output of the second level isF=(F1F2)’ which means F=[(A+B)(C+D)]’.
A
F1
B
C
F2
D
8. NOR-OR implementation :
The outputs of first-level logic gates: F1=(A+B)’ and F2=(C+D)’. These outputs are applied
as inputs of the second level, so the output of the second level is F=(F1+F2), which means
F=(A+B)’+(C+D)’=[(A+B)(C+D)]’.
A
F1
B
C
F2
D
47 M VEDAVYAS
Example-2 : Solve and design the circuit for the function f(a,b,c,d) = abcd + abcd + abcd +
abcd + abcd + abcd + abcd.
Solution :
=> abc(d+d) + abcd + acd(b+b) + acd(b + b)
=> abc + abcd + acd + acd
=> abc + abcd + ac
=> a(bc + c) + abcd
=> a(b+c)(c+c) +abcd
=> ac + ab + abcd
=> ac + a(b + bcd )
=> ac + a (b+b)(b+cd)
=> ac + a(b+b)(b+cd)
=> ac + ab + acd
=> ac + acd + ab
=> a(c + cd )+ ab
=> a(c+d)(c+c) + ab
=> a(c+d) + ab
=> ab +ac +ad
Thus the given function requires three 2-input AND gates and two 2-input OR gates.
Circuit Diagram
a
ab
b
ab + ac
ac
c
f (a, b, c, d)
ad
48 M VEDAVYAS
2- Variable K-Map : -For Video
Two variable K Map is drawn for a boolean expression consisting of two variables.
The number of cells present in two variable K Map = 2 = 4 cells. 2
0 1
0
0 1
1
2 3
00 01 11 10
0
0 1 3 2
1
4 5 7 6
Four variable K Map is drawn for a boolean expression consisting of four variables.
The number of cells present in four variable K Map = 2 4
= 16 cells.
49 M VEDAVYAS
00 01 11 10
00
0 1 3 2
01
4 5 7 6
11
12 13 15 14
10
8 9 11 10
2. Identify minterms or maxterms as given in problem and fill the K Map with 0’s and 1’s according
to its function.
Rule-1 :
We can either group 0’s with 0’s or 1’s with 1’s but we can not group 0’s and 1’s together.
X representing don’t care can be grouped with 0’s as well as 1’s.
Rule-2 :
Groups may overlap each other.
Rule-3 :
We can only create a group whose number of cells can be represented in the power of 2.
In other words, a group can only contain 2 n
i.e. 1, 2, 4, 8, 16 and so on number of cells.
00 01 11 10 00 01 11 10
0 1 1 1 1 0 1 1 1 1
0 1 3 2 0 1 3 2
1 1 1 1
4 5 7 6 4 5 7 6
Incorrect correct
50 M VEDAVYAS
Rule-4 :
Groups can be only either horizontal or vertical.
We can not create groups of diagonal or any other shape.
Rule-5 :
Each group should be as large as possible.
These groups are called as sub cubes.
00 01 11 10 00 01 11 10
0 1 1 1 1 0 1 1 1 1
0 1 3 2 0 1 3 2
1 1 1 1 1 1 1 1
4 5 7 6 4 5 7 6
Incorrect correct
Rule-6 :
Opposite grouping and corner grouping are allowed.
The example of opposite grouping is shown illustrated in Rule-05.
The example of corner grouping is shown below.
00 01 11 10 00 01 11 10
00 1 1 00 1 1
0 1 3 2 0 1 3 2
01 01
4 5 7 6 4 5 7 6
11 11
12 13 15 14 12 13 15 14
10 1 1 10 1 1
8 9 11 10 8 9 11 10
Incorrect correct
51 M VEDAVYAS
Rule-7 :
2. Each and every size of minterm is depends on size of sub cube i.e., 2m cells -> m-n literals.
PROBLEMS :
1. Minimize the following boolean P function
F(A, B, C, D) = m(0, 1, 2, 5, 7, 8, 9, 10, 13, 15)
Solution :
Since the given boolean expression has 4 variables, so we draw a 4 x 4 K Map.
We fill the cells of K Map in accordance with the given boolean function.
CD
00 01 11 10
00 1 1 1
0 1 3 2
01 1 1
4 5 7 6
AB
11 1 1
12 13 15 14
10 1 1 1
8 9 11 10
Now, F(A, B, C, D) = (A’B + AB)(C’D + CD) + (A’B’ + A’B + AB + AB’)C’D + (A’B’ + AB’)(C’D’
+ CD’)
= BD + C’D + B’D’
52 M VEDAVYAS
BC
00 01 11 10
0 1 1 X 0
0 1 3 2
A
1 0 X 1 1
4 5 7 6
BC
00 01 11 10
0 X 1 0 1
0 1 3 2
A
1 X 1 1 X
4 5 7 6
Note :
The “Don’t Care” conditions allow us to replace the empty cell of a K-Map to form a grouping
of the variables which is larger than that of forming groups without don’t care.
While forming groups of cells, we can consider a “Don’t Care” cell as 1 or 0 or we can also ignore
that cell.
53 M VEDAVYAS
BC
00 01 11 10
0 1 1 X 0
0 1 3 2
A
1 X X 1 1
4 5 7 6
CD
00 01 11 10
00 1 1 1 0
0 1 3 2
01 0 1 1 0
4 5 7 6
AB
11 0 1 1 0
12 13 15 14
10 1 1 1 0
8 9 11 10
54 M VEDAVYAS
6. Minimize the following boolean P function P
F(A, B, C, D) = m(1, 3, 4, 6, 8, 9, 11, 13, 15) + d(0, 2, 14)
Solution :
Since the given boolean expression has 4 variables, so we draw a 4 x 4 K Map.
We fill the cells of K Map in accordance with the given boolean function.
CD
00 01 11 10
00 X 1 1 X
0 1 3 2
01 1 0 0 1
4 5 7 6
AB
11 0 1 1 X
12 13 15 14
10 1 1 1 0
8 9 11 10
CD
00 01 11 10
00 1 0 0 1
0 1 3 2
01 0 X 0 0
4 5 7 6
AB
11 0 0 X 1
12 13 15 14
10 1 0 0 1
8 9 11 10
55 M VEDAVYAS
= ACD’ + B’D’
CD
00 01 11 10
00 1
0 1 3 2
01 1 1 1
4 5 7 6
AB
11 1 1 1
12 13 15 14
10 1
8 9 11 10
56 M VEDAVYAS
YZ
00 01 11 10
00 1 1
0 1 3 2
01 1 1
4 5 7 6
WX
11 1 1
12 13 15 14
10 1 1
8 9 11 10
Prime Implicants :
A group of squares or rectangles made up of a bunch of adjacent minterms which is allowed by the
definition of K-Map are called prime implicants(PI) i.e. all possible groups formed in K-Map.
Simply, it is an implicant which is not a sub part of other implicant.
00 01 11 10
0 1 1
0 1 3 2
1 1 1
4 5 7 6
57 M VEDAVYAS
00 01 11 10
0 1 1
0 1 3 2
1 1 1
4 5 7 6
The prime implicants for which each of its minterm is covered by some essential prime implicant are
redundant prime implicants(RPI). This prime implicant never appears in the final solution.
00 01 11 10
0 1 1
0 1 3 2
1 1 1
4 5 7 6
The prime implicants for which are neither essential nor redundant prime implicants are called selective
prime implicants(SPI). These are also known as non-essential prime implicants. They may appear in
some solution or may not appear in some solution.
00 01 11 10
0 1 1
0 1 3 2
1 1 1
4 5 7 6
58 M VEDAVYAS
Examples :
P
1. F = (1, 5, 6, 7, 11, 12, 13, 15), find number of implicant, PI, EPI, RPI and SPI.
00 01 11 10
00 1
0 1 3 2
01 1 1 1
4 5 7 6
11 1 1 1
12 13 15 14
10 1
8 9 11 10
P
2. F = m(0, 1, 5, 8, 12, 13), find number of implicant, PI, EPI, RPI and SPI.
Expression : A’B’C’+ C’DB + C’D’A
00 01 11 10
00 1 1
0 1 3 2
01 1
4 5 7 6
11 1 1
12 13 15 14
10 1
8 9 11 10
No. of Implicants = 6
No. of Prime Implicants(PI) = 6
No. of Essential Prime Implicants(EPI) = 3
No. of Redundant Prime Implicants(RPI) = 3
No. of Selective Prime Implicants(SPI) = 6
59 M VEDAVYAS
P
3. F = m(0, 1, 5, 7, 15, 14, 10), find number of implicant, PI, EPI, RPI and SPI.
00 01 11 10
00 1 1
0 1 3 2
01 1 1
4 5 7 6
11 1 1
12 13 15 14
10 1
8 9 11 10
No. of Implicants = 7
No. of Prime Implicants(PI) = 6
No. of Essential Prime Implicants(EPI) = 2
No. of Redundant Prime Implicants(RPI) = 2
No. of Selective Prime Implicants(SPI) = 4
It allows a smaller map to handle large number of variables. This is done by writing output in terms
of input.
A VEM can be used to plot more than ‘n’ variables using an ‘n’ variable K-map.
Consider a function F(A,B,C) = (0,1,2,5)
A B C F
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 0
60 M VEDAVYAS
A B C F F in terms of c
0 0 0 1 1
0 0 1 1
0 1 0 1 C’
0 1 1 0
1 0 0 0 C
1 0 1 1
1 1 0 0 0
1 1 1 0
A B F
0 0 1
0 1 C’
1 0 C
1 1 0
0 1
0 1 C
0 1
A
1 C 0
2 3
Write all the variables(original and complimented forms are treated as two different variables) in the
map as 0, leave 0’s, minterms and don’t cares as it is and obtain the SOP expression.
(a) Select one variable and make all occurrences of that variable as 1, write minterms (1’s) as don’t
cares, leave 0’s and don’t cares as it is. Now, obtain the SOP expression.
(b) Multiply the obtained SOP expression with the concerned variable.
Repeat step 2 for all the variables in the k-map. SOP of VEM is obtained by ORing all the obtained
SOP expressions.
Example : Let’s apply the above procedure on a sample VEM (X is used to represent don’t care)
AB
00 01 11 10
0 0 0 D D
0 1 3 2
C
1 1 1 D D
4 5 7 6
61 M VEDAVYAS
Step 1 : Write all the variables as 0 (D and D’ are considered as two different variables), leave
minterms, 0’s and don’t cares as it is and obtain the SOP expression.
AB
00 01 11 10
0 0 0 0 0
0 1 3 2
C
1 1 1 0 0
4 5 7 6
Step-2 : (a) Replace all occurrences of D with 1, all occurrences of D’ with 0 and all 1’s with don’t
care. Leave 0’s and don’t cares as it is.
AB
00 01 11 10
0 0 0 1 1
0 1 3 2
C
1 X X 0 0
4 5 7 6
AB
00 01 11 10
0 0 0 0 0
0 1 3 2
C
1 X X 1 1
4 5 7 6
62 M VEDAVYAS
Step 4 : SOP of VEM is obtained by ORing all the obtained SOP expressions. Therefore, the SOP
expression for the given VEM is:A’C + AC’D + CD’
1. Combinational Circuits :
A combinational circuit consists of input variables and output variables. Since these circuits are not
dependent upon previous input to generate any output, so they are combinational logic circuits. A
combinational circuit can have an n number of inputs and m number of outputs.
In combinational circuits, the output at any time is a direct function of the applied external inputs.
These circuits are developed using AND, OR, NOT, NAND and NOR logic gates. These logic gates
are building blocks of combinational circuits.
Examples :
1. Arithmetic circuit 2. Converting one code to another code
3. Encoders & Decoders 4. Multiplexers and Demultiplexers
2. Sequential circuits
A sequential circuit is specified by a time sequence of inputs, outputs and internal states. The output
of a sequential circuit depends not only on the combination of present inputs but also on the previous
outputs. Unlike combinational circuits, sequential circuits include memory elements with combinational
circuits.
Combinational Circuit
Memory Element
63 M VEDAVYAS
2.6 ARITHMETIC CIRCUITS
ADDERS :
Addition is one of the most basic operations performed by different electronic devices like computers,
calculators, etc.
The electronic circuit that performs the addition of two or more numbers, more specifically binary
numbers, is called as adder.
1.Half Adder : -For Video
A combinational logic circuit which is designed to add two binary digits is called as a half adder.
The half adder provides the output along with a carry value. The half adder circuit is designed by
connecting an EX-OR gate and one AND gate. It has two input terminals and two output terminals
for sum and carry.
The block diagram and circuit diagram of a half adder are shown below :
A
A Sum Sum
Half B
Adder
B Carry
Carry
Block Diagram
Circuit Diagram
From the logic circuit diagram of half adder, it is clear that A and B are the two input bits, S is the
output i.e., sum and C is the output i.e., carry bit.
In the case of a half adder, the output of the EX-OR gate is the sum of two bits and the output of the
AND gate is the carry. Although, the carry obtained in one addition will not be forwarded in the next
addition because of this it is known as half adder.
Truth Table :
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
K-Map :
B B
0 1 0 1
0 1 0
0 1 0 1
A A
1 1 1 1
2 3 2 3
Sum S =A⊕B Carry C = AB
64 M VEDAVYAS
Characteristic Equations of Half-Adder :
The characteristic equations of half adder, i.e., equations of sum (S) and carry (C) are obtained
according to the rules of binary addition.
The sum (S) of the half-adder is the XOR of A and B. Thus, Sum, S = ALB = AB’+ A’B
The carry (C) of the half-adder is the AND of A and B. Therefore, Carry, C = AB.
Thus, a full adder circuit adds three binary digits, where two are the inputs and one is the carry
forwarded from the previous addition.
The block diagram and circuit diagram of the full adder are shown in Figure :
A
B Sum
Cin
A
Sum
Full
B
Adder
Carry Carry
Cin
Hence, the circuit of the full adder consists of one EX-OR gate, three AND gates and one OR gate
Full adder takes three inputs namely A, B, and C . Where, A and B are the two binary digits, and
in
Cin is the carry bit from the previous stage of binary addition.
The sum output of the full adder is obtained by XOR-ing the bits A, B, and C in . While the carry
output bit (Cout ) is obtained using AND and OR operations.
TruthTable :
A B Cin Sum Cout
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
65 M VEDAVYAS
K-Map :
BC BC
00 01 11 10 00 01 11 10
0 1 1 0 1
0 1 3 2 0 1 3 2
A A
1 1 1 1 1 1 1
4 5 7 6 4 5 7 6
SUM S Carry C
B 3 A3 B 2 A2 B 1 A1 B 0 A0
S3 S2 S1 S0
The input carry to the binary adder is C 0 and the output carry is C4 . The S outputs of the full-adders
create the needed sum bits.
An n-bit binary adder is needed n full-adders.
The output carries from each full-adder is linked to the input carry of the next-high-order full-adder.
66 M VEDAVYAS
Draw Backs :
In Ripple Carry Adder, Each full adder has to wait for its carry-in from its previous stage full adder.
Thus, nth full adder has to wait until all (n-1) full adders have completed their operations.
This causes a delay and makes ripple carry adder extremely slow.
The situation becomes worst when the value of n becomes very large.
To overcome this disadvantage, Carry Look Ahead Adder comes into play.
P0 P1 P2 C0
Gi = Ai .Bi
P3 P2 P1 G0
P1 P2 G0
P1 P0 C0
P3 P2 G1
Pi =Ai ⊕Bi
P2 G1
P1 G0
P3 G2
P0 C0
G3
G2
G1
G0
B3 A3 B2 A2 B1 A1 B0 A 0
C3 C2 C1 C0
C4 S3 S2 S1 S0
The carry-in of any stage full adder depends only on the following two parameters :
1. Bits being added in the previous stages
2. Carry-in provided in the beginning
Disadvantages :
1. It involves complex hardware.
2. It is costlier since it involves complex hardware.
3. It gets more complicated as the number of bits increases.
67 M VEDAVYAS
Example :
Consider two 4-bit binary numbers A3A2A1A0 and B3B2B1B0 are to be added.
Mathematically, the two numbers will be added as-
C4 C3 C2 C1 C0
A3 A2 A1 A0
+ B3 B2 B1 B0
S4 S3 S2 S1 S0
Now, Clearly, C , C
1 2 and C3 are intermediate carry bits.
So, let’s remove C1 , C2 and C3 from RHS of every equation.
Substituting (1) in (2), we get C2 in terms of C0 .
Then, substituting (2) in (3), we get C3 in terms of C0 and so on.
Finally, we have the following equations-
C1 = C0 P0 + G0
C2 =C0 P0 P1 + G0 P1 + G1
C3 = C0 P0 P1 P2 + G0 P1 P2 + G1 P2 + G2
C4 =C0 P0 P1 P2 P3 + G0 P1 P2 P3 + G1 P2 P3 + G2 P3 + G3
These equations show that the carry-in of any stage full adder depends only on
1. Bits being added in the previous stages
2. Carry bit which was provided in the beginning
Note :
1. The following formula is used to calculate number of gates required for evaluating all carry bits :
For a n-bit carry look ahead adder to evaluate all the carry bits, it requires,
Number of AND gates = n(n+1)/2
Number of OR gates = n
68 M VEDAVYAS
SUBTRACTORS : -For Video
A Subtractor is a combinational logic circuit that can perform the subtraction of two number (binary
numbers) and produce the difference between them.
1. Half Subtractor :
It is a combinational logic circuit that have two inputs and two outputs (i.e. difference and borrow).
The half subtractor produces the difference between the two binary bits at the input and also produces
a borrow output.
In the subtraction (A-B), A is called as Minuend bit and B is called as Subtrahend bit.
The block diagram and logic circuit diagram of the half subtractor is shown in Figure:
A
A Dif f erence Dif f erence
Half B
Subtractor
B Borrow
Borrow
Block Diagram
Circuit Diagram
Hence, from the logic circuit diagram, it is clear that a half subtractor can be realized using an XOR
gate together with a NOT gate and an AND gate.
In the half subtractor as shown in figure-1, A and B are the inputs, d and b are the outputs. Where,
d indicates the difference and b indicates the borrow output.
The borrow output(b) is the signal that tells the next stage that a 1 has been borrowed.
Truth Table :
A B difference(d) Borrow(b)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
K-Map :
B B
0 1 0 1
0 1 0 1
0 1 0 1
A A
1 1 1
2 3 2 3
Difference D Borrow B
69 M VEDAVYAS
Characteristic Equations of Half-Subtractor :
The characteristic equations of the half subtractor, i.e. equations of the difference bit (d) and the
output borrow bit(b) are obtained by following the rules of binary subtraction.
The difference bit(d)L of the half subtractor is given by XORing the two inputs A and B. Therefore,
Difference, D = A B = A’B + AB’
The borrow (b) of the half subtractor is the AND of A’ (complement of A) and B. Therefore, Borrow
b = A’B.
2. Full Subtractor :
A full-subtractor is a combinational circuit that has three inputs A, B, b
in and two outputs d and b.
Where, A is the minuend, B is subtrahend, bin is borrow produced by the previous stage, d is the
difference output and b is the borrow output.
A
B
A Dif f erence
Bin
Dif f erence
Full
B
Subtractor
Borrow
Bin Borrow
Truth Table :
A B bin 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 :
BC BC
00 01 11 10 00 01 11 10
0 1 1 0 1 1 1
0 1 3 2 0 1 3 2
A A
1 1 1 1 1
4 5 7 6 4 5 7 6
Difference D Borrow B
70 M VEDAVYAS
Characteristic Equations of Half-Substractor :
The characteristic equations of the full substractor, i.e. equations of the difference (d) and borrow
output (b) are obtained by following the rules of binary subtraction.
A Binary Adder-Subtractor is capable of both the addition and subtraction of binary numbers in one
circuit itself.
Let’s consider two 4-bit binary numbers A and B as inputs to the Digital Circuit for the operation
with digits
A0 A1 A2 A3 for A
B0 B1 B2 B3 for B
B3 B2 B1 B0
A3 A2 A1 A0
B3′ B2′ B1′ B0′
C4 S3 S2 S1 S0
The circuit consists of 4 full adders since we are performing operations on 4-bit numbers.
There is a control line K that holds a binary value of either 0 or 1 which determines that the operation
is carried out is addition or subtraction.
Assume that we have two 3-bit numbers, i.e., X=100 and Y=011, and feed them in Full-Adder as an
input.
X2 = 1 X1 = 0 X0 = 0
Y2 = 0 Y1 = 1 Y0 = 1
For K=0: L
Y0 K =Y0 and Cin =K=0
So, from first Full-Adder
S0 = X0 +Y0 +Cin
S0 = 0+1+0
S0 =1
C0 =0
Similarly,
S1 = X1 +Y1 +C0
S1 = 0+1+0
71 M VEDAVYAS
S1 =1 and C1 =0
Similarly,
S2 = X2 +Y2 +C1
S2 = 1+0+0
S2 =1 and C2 =0
Thus,
X= 100 =4
Y = 011 = 3
Sum = 0111 = 7
For K=1 L
Y0 K=Y0 ’ and Cin =k=1
So,
S0 = X0 +Y0 ’+Cin
S0 = 0+0+1
S0 =1 and C0=0
Similarly,
S1 = X1 +Y1 ’+C0
S1 = 0+0+0
S1 =0 and C1 =0
Similarly,
S2 = X2 +Y2 ’+C1
S2 = 1+1+0
S2 =0 and C2 =0
Thus,
X = 010 = 4
Y = 011 = 3
Difference = 001 = 1
72 M VEDAVYAS
REGISTER SHIFT METHOD :
In the flowchart, initially, AC and Qn + 1 bits are set to 0, and the SC is a sequence counter that
represents the total bits set n, which is equal to the number of bits in the multiplier. There are BR
that represent the multiplicand bits, and QR represents the multiplier bits.
After that, we encountered two bits of the multiplier as Qn and Qn + 1, where Qn represents the last
bit of QR, and Qn + 1 represents the incremented bit of Qn by 1.
Suppose two bits of the multiplier is equal to 10; it means that we have to subtract the multiplier from
the partial product in the accumulator AC and then perform the arithmetic shift operation (ashr).
73 M VEDAVYAS
If the two of the multipliers equal to 01, it means we need to perform the addition of the multiplicand
to the partial product in accumulator AC and then perform the arithmetic shift operation (ashr),
including Qn + 1.
The arithmetic shift operation is used in Booth’s algorithm to shift AC and QR bits to the right by
one and remains the sign bit in AC unchanged. And the sequence counter is continuously decremented
till the computational loop is repeated, equal to the number of bits (n).
Example :
A numerical example of booth’s algorithm is shown below for n = 4. It shows the step by step multi-
plication of -5 and -7.
BR = -5 = 1011,
BR’ = 0100, <– 1’s Complement (change the values 0 to 1 and 1 to 0)
BR’+1 = 0101 <– 2’s Complement (add 1 to the Binary value obtained after 1’s complement)
QR = -7 = 1001 <– 2’s Complement of 0111 (7 = 0111 in Binary)
The explanation of first step is as follows: Qn+1
AC = 0000, QR = 1001, Qn+1 = 0, SC = 4
Qn Qn+1 = 10
So, we do AC + (BR)’+1, which gives AC = 0101
On right shifting AC and QR, we get
AC = 0010, QR = 1100 and Qn+1 = 1
Operation AC QR Qn+1 SC
0000 1001 0 4
AC + BR’ + 1 0101 1001 0
ASHR 0010 1100 1 3
AC + BR 1101 1100 1
ASHR 1110 1110 0 2
ASHR 1111 0111 0 1
AC + BR’ + 1 0100 0111 0
ASHR 0010 0011 1 0
74 M VEDAVYAS
Product is calculated as follows:
Product = AC QR
Product = 0010 0011 = 35
S1 S0
00 01 11 10
00
0 1 3 2
01
4 5 7 6
S3 S2
11 1 1 1 1
12 13 15 14
10 1 1
8 9 11 10
K-Map for BCD Adder
75 M VEDAVYAS
The block diagram of BCD adder is as follows :
a0 a1 a2 a3 b3 b2 b1 b0
C4
4-Bit Binary Adder
S3 S2 S1 S0
0 1 1 0
4-Bit Binary Adder
C8 r3 r2 r1 r0
As shown in the Figure , the two BCD numbers, together with input carry, are first added in the top
4-bit binary adder to produce a binary sum.
When the output carry is equal to zero (i.e. when sum <= 9 and Cout = 0) nothing (zero) is added
to the binary sum. When it is equal to one (i.e. when sum > 9 or Cout = 1), binary 0110 is added to
the binary sum through the bottom 4-bit binary adder.
The output carry generated from the bottom binary adder can be ignored, since it supplies information
already available at the output-carry terminal.
76 M VEDAVYAS
To find the corresponding digital circuit, we will use the K-Map technique for each of the Excess-3
code bits as output with all of the bits of the BCD number as input.
CD CD
00 01 11 10 00 01 11 10
00 0 0 0 0 00 0 1 1 1
0 1 3 2 0 1 3 2
01 0 1 1 1 01 1 0 0 0
4 5 7 6 4 5 7 6
AB AB
11 X X X X 11 X X X X
12 13 15 14 12 13 15 14
10 1 1 X X 10 0 1 X X
8 9 11 10 8 9 11 10
K-Map for w K-Map for x
CD CD
00 01 11 10 00 01 11 10
00 1 0 1 0 00 1 0 0 1
0 1 3 2 0 1 3 2
01 1 0 1 0 01 1 0 0 1
4 5 7 6 4 5 7 6
AB AB
11 X X X X 11 X X X X
12 13 15 14 12 13 15 14
10 1 0 X X 10 1 0 X X
8 9 11 10 8 9 11 10
K-Map for y K-Map for z
77 M VEDAVYAS
Corresponding minimized Boolean expressions for Excess-3 code bits are
w=A + BC + BD
x= B’C + B’D + BC’D’
y= CD + C’D’
z= D’
The corresponding digital circuit is as follows :
A B C D
B C D
Let A, B, C, and D be the bits representing the binary numbers, where D is the LSB and A is the
MSB.
Let w, x, y, and z be the bits representing the excess code of the binary numbers, where z is the LSB
and w is the MSB.
The truth table for the conversion is given below. The X’s mark is don’t care condition.
78 M VEDAVYAS
K-Map for D, C, B, A are as follows respectively :
yz yz
00 01 11 10 00 01 11 10
00 X X 0 X 00 X X 0 X
0 1 3 2 0 1 3 2
01 0 0 0 0 01 0 0 1 0
wx 4 5 7 6 wx 4 5 7 6
11 1 X X X 11 0 X X X
12 13 15 14 12 13 15 14
10 0 0 1 0 10 1 1 0 1
8 9 11 10 8 9 11 10
K-Map for A K-Map for B
yz yz
00 01 11 10 00 01 11 10
00 X X 0 X 00 X X 0 X
0 1 3 2 0 1 3 2
01 0 1 0 1 01 1 0 0 1
wx 4 5 7 6 wx 4 5 7 6
11 0 X X X 11 1 X X X
12 13 15 14 12 13 15 14
10 0 1 0 1 10 1 0 0 1
8 9 11 10 8 9 11 10
K-Map for C K-Map for D
79 M VEDAVYAS
2.8 COMPARATOR -For Video
Comparator is a combinational circuit that compares two digital or binary numbers in order to find
out whether one binary number is equal, less than, or greater than the other binary number.
We logically design a circuit for which we will have two inputs one for A and the other for B and
have three output terminals, one for A > B condition, one for A = B condition, and one for A < B
condition.
A A=B
N bit
Comparator A>B
B A<B
Block Diagram of Comparator Circuit
There are different ways to implement a magnitude comparator, such as using a combination of XOR,
AND and OR gates, or by using a cascaded arrangement of full adders.
1-Bit Comparator :
From the above truth table logical expressions for each output can be expressed as follows.
A>B : AB’
A<B : A’B
A=B : A’B’ + AB
By using these Boolean expressions, we can implement a logic circuit for this comparator as given
below.
80 M VEDAVYAS
A=B
A
A>B
B A<B
2-Bit Comparator :
A comparator used to compare two binary numbers each of two bits is called a 2-bit Magnitude
comparator.
It consists of four inputs and three outputs to generate less than, equal to, and greater than between
two binary numbers.
The truth table for a 2-bit comparator is given below.
A1 A0 B1 B0 A<B A=B A>B
0 0 0 0 0 1 0
0 0 0 1 1 0 0
0 0 1 0 1 0 0
0 0 1 1 1 0 0
0 1 0 0 0 0 1
0 1 0 1 0 1 0
0 1 1 0 1 0 0
0 1 1 1 1 0 0
1 0 0 0 0 0 1
1 0 0 1 0 0 1
1 0 1 0 0 1 0
1 0 1 1 1 0 0
1 1 0 0 0 0 1
1 1 0 1 0 0 1
1 1 1 0 0 0 1
1 1 1 1 0 1 0
From the K-maps logical expressions for each output can be expressed as follows.
A>B:A1 B1 ’ + A0 B1 ’B0 ’ + A1 A0 B0 ’
81 M VEDAVYAS
By using these Boolean expressions, we can implement a logic circuit for this comparator as given
below.
A1 A0 B1 B0
A1 A0 B1 B0
A=B
A>B
A<B
4-Bit Comparator :
A comparator used to compare two binary numbers each of four bits is called a 4-bit magnitude
comparator.
It consists of eight inputs each for two four-bit numbers and three outputs to generate less than, equal
to, and greater than between two binary numbers.
In a 4-bit comparator, the condition of A>B can be possible in the following four cases.
1. If A3 = 1 and B3 = 0
2. If A3 = B3 and A2 = 1 and B2 = 0
3. If A3 = B3 , A2 = B2 and A1 = 1 and B1 = 0
4. If A3 = B3 , A2 = B2 , A1 = B1 and A0 = 1 and B0 = 0
Similarly, the condition for A<B can be possible in the following four cases.
1. If A3 = 0 and B3 = 1
2. If A3 = B3 and A2 = 0 and B2 = 1
3. If A3 = B3 , A2 = B2 and A1 = 0 and B1 = 1
4. If A3 = B3 , A2 = B2 , A1 = B1 and A0 = 0 and B0 = 1
The condition of A=B is possible only when all the individual bits of one number exactly coincide with
the corresponding bits of another number.
82 M VEDAVYAS
The circuit diagram is as follows :
A3 A2 A1 A0 B3 B2 B1 B0
A3 A2 A1 A0 B3 B2 B1 B0
A=B
A>B
A3 ⊙B3
A<B
A3 ⊙B3
A2 ⊙B2
A3 ⊙B3
A2 ⊙B2
A1 ⊙B1
Cascading Comparator :
Comparator performing the comparison operation to more than four bits by cascading two or more
4-bit comparators is called a cascading comparator.
When two comparators are to be cascaded, the outputs of the lower-order comparator are connected
to the corresponding inputs of the higher-order comparator.
83 M VEDAVYAS
Convertion of Binary to Gray code :
Let b , b , b , b
0 1 2 3 be the bits representing the binary numbers, where b0 is the LSB and b3 is the MSB
and Let g0 , g1 , g2 , g3 be the bits representing the gray code of the binary numbers, where g0 is the
LSB and g3 is the MSB.
To find the corresponding digital circuit, we will use the K-Map technique for each of the gray code
bits as output with all of the binary bits as input.
K-map for g , g , g
0 1 2 and g3 are as follows respectively :
b0 b1 b 0 b1
00 01 11 10 00 01 11 10
00 1 1 00 1 1
0 1 3 2 0 1 3 2
01 1 1 01 1 1
4 5 7 6 4 5 7 6
b2 b3 b2 b3
11 1 1 11 1 1
12 13 15 14 12 13 15 14
10 1 1 10 1 1
8 9 11 10 8 9 11 10
K-Map for g0 K-Map for g1
84 M VEDAVYAS
b0 b1 b0 b1
00 01 11 10 00 01 11 10
00 00
0 1 3 2 0 1 3 2
01 1 1 1 1 01
4 5 7 6 4 5 7 6
b2 b3 b 2 b3
11 11 1 1 1 1
12 13 15 14 12 13 15 14
10 1 1 1 1 10 1 1 1 1
8 9 11 10 8 9 11 10
K-Map for g2 K-Map for g3
G1
B1
G2
B2
G3
B3
Let g , g , g , g
0 1 2 3 be the bits representing the gray code of the binary numbers, where g0 is the LSB
and g3 is the MSB and Let b0 , b1 , b2 , b3 be the bits representing the binary numbers, where b0 is the
LSB and b3 is the MSB.
To find the corresponding digital circuit, we will use the K-Map technique for each of the binary code
bits as output with all of the gray bits as input.
K-map for b , b , b
0 1 2 and b3 are as follows respectively :
g0 g1 g0 g1
00 01 11 10 00 01 11 10
00 1 1 00 1 1
0 1 3 2 0 1 3 2
01 1 1 01 1 1
g2 g3 4 5 7 6 g2 g3 4 5 7 6
11 1 1 11 1 1
12 13 15 14 12 13 15 14
10 1 1 10 1 1
8 9 11 10 8 9 11 10
K-Map for b0 K-Map for b1
g0 g1 g0 g1
00 01 11 10 00 01 11 10
00 00
0 1 3 2 0 1 3 2
01 1 1 1 1 01
g2 g3 4 5 7 6 g2 g3 4 5 7 6
11 11 1 1 1 1
12 13 15 14 12 13 15 14
10 1 1 1 1 10 1 1 1 1
8 9 11 10 8 9 11 10
K-Map for b2 K-Map for b3
86 M VEDAVYAS
Corresponding minimized boolean
L expressions
L L for gray code bits are as follows :
b0 = g0 g1 g2 g3
L L
b1 = g0 g1 g2
L
b2 = g0 g1
b3 = g3
B1
G1
B2
G2
B3
G3
BCD 7-Segment
A B C D a b c d e f g
0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
0 0 1 0 1 1 0 1 0 1 1
0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
0 1 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 0 0
1 0 0 0 1 1 1 1 1 1 1
1 0 0 1 1 1 1 1 0 1 1
To find the corresponding digital circuit, we will use the K-Map technique for each of the 7-segment’s
bits as output with all of the bcd bits as input.
K-map for a, b, c, d, e, f and g are as follows respectively :
87 M VEDAVYAS
Corresponding minimized boolean expressions for 7-segment code bits are as follows :
88 M VEDAVYAS
2.9 NOISE MARGINS -For Video
The circuit’s ability to tolerate noise signals is referred to as the noise immunity, a quantitative measure
of which is called noise margin.
The noise margins defined above are referred to as dc noise margins. Strictly speaking, the noise is
generally thought of as an a.c. signal with amplitude and pulse width.
VNH = HIGH-state noise margin
VNL = LOW-state noise margin
VIL = LOW-state input voltage
VIH = HIGH-state input voltage
VOL = LOW-state output voltage
VOH = HIGh-state output voltage
Where,
VNH = VOH -VIH
VNL = VIL – VOL
Manufacturers specify voltage limits to represent the logical 0 or 1. These limits are not the same at
the input and output sides.
For example, a particular gate A may output a voltage of 4.8V when it is supposed to output a HIGH
but, at its input side, it can take a voltage of 3V as HIGH.
In this way, if any noise should corrupt the signal, there is some margin for error.
89 M VEDAVYAS
UNIT-3
From Truth table, The logical expression of the term Y is as follows: Y=S̄A +SA 0 1
Y
A1
90 M VEDAVYAS
4x1 Multiplexer :
4x1 Multiplexer has four data inputs I , I , I & I , two selection lines S
3 2 1 0 1 & S0 and one output Y.
The block diagram of 4x1 Multiplexer is shown in the following figure.
I3
I2 4x1
Y
I1 MUX
I0
S1 S0
One of these 4 inputs will be connected to the output based on the combination of inputs present at
these two selection lines.
Truth table of 4x1 Multiplexer is shown below.
Select lines Output
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I3
From ¯Truth table, we can directly write the Boolean function for output, Y as Y = S¯ 1 S¯0 I0 + S¯1 S0 I1
+ S1 S0 I2 + S1 S2 I3
The circuit diagram of 4x1 multiplexer is shown in the following figure.
91 M VEDAVYAS
8x1 Multiplexer :
In the 8 to 1 multiplexer, there are total eight inputs, i.e., I , I , I , I , I , I , I , and I , 3 selection
0 1 2 3 4 5 6 7
lines, i.e., S0 , S1 and S2 and single output, i.e., Y.
On the basis of the combination of inputs that are present at the selection lines S , S 0 1 and S2 one of
these 8 inputs are connected to the output.
S2 S1 S0
92 M VEDAVYAS
8 Ö1 multiplexer using 4Ö1 and 2Ö1 multiplexer :
For getting 8 data inputs, we need two 4Ö1 multiplexers. The 4Ö1 multiplexer produces one output.
So, in order to get the final output, we need a 2Ö1 multiplexer.
The block diagram of 8Ö1 multiplexer using 4Ö1 and 2Ö1 multiplexer is given below.
I7
I6 4x1
I5 MUX
I4
2x1
S1 S0 Y
MUX
I3
I2 4x1
I1 MUX S2
I0
16x1 Multiplexer :
S3 S2 S1 S0
93 M VEDAVYAS
Truth table of 16x1 Multiplexer is shown below.
Inputs Output
S2 S2 S1 S0 Y
0 0 0 0 I0
0 0 0 1 I1
0 0 1 0 I2
0 0 1 1 I3
0 1 0 0 I4
0 1 0 1 I5
0 1 1 0 I6
0 1 1 1 I7
1 0 0 0 I8
1 0 0 1 I9
1 0 1 0 I10
1 0 1 1 I11
1 1 0 0 I12
1 1 0 1 I13
1 1 1 0 I14
1 1 1 1 I15
We can implement 16x1 Multiplexer using 8x1 Multiplexers and 2x1 Multiplexer.
We require two 8x1 Multiplexers in first stage in order to get the 16 data inputs.
Since, each 8x1
Multiplexer produces one output, we require a 2x1 Multiplexer in second stage by considering the
outputs of first stage as inputs and to produce the final output.
I15
I14
I13
I12
8x1
I11
MUX
I10
I9
I8
S2 S1 S0
2x1
Y
MUX
S2 S1 S0
I7
I6
I5
8x1
I4
MUX S3
I3
I2
I1
I0
94 M VEDAVYAS
Functionally Completeness :
Multiplexer can act as universal combinational circuit. All the standard logic gates can be implemented
with multiplexers.
1
I0 x f
2x1
f 0 1
0 MUX
I1 1 0
x y f
0
I0 0 0 0
2x1 0
y f 0 1 0
I1 MUX
1 0 0
y
1 1 1
x y f
y
I0 0 0 0
2x1 y
f 0 1 1
1 MUX
I1 1 0 1
1
1 1 1
x y f
1 1
I0 I0 0 0 1
2x1 2x1 1
f 0 1 1
0 MUX MUX
I1 I1 1 0 1
y
1 1 0
y x
95 M VEDAVYAS
5. Implementation of NOR gate using 2x1 Mux :
x y f
1
I0 I0 0 0 1
2x1 2x1 y
f 0 1 0
0 MUX 0 MUX
I1 I1 1 0 0
0
1 1 0
y x
x y f
1 y
I0 I0 0 0 0
2x1 2x1 y
f 0 1 1
0 MUX MUX
I1 I1 1 0 1
y
1 1 0
y x
x y f
1
I0 I0 0 0 1
2x1 2x1 y
y f 0 1 0
0 MUX MUX
I1 I1 1 0 0
y
1 1 1
y x
Using 4 x 1 Multiplexer :
Here, X and Y represent the two inputs and S and C represents the two outputs of the Half Adder.
Truth table for sum & carry as follows :
S1 S0 Z S1 S0 Z
0 0 0 0 0 0
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
96 M VEDAVYAS
Logic diagram of a Half Adder :
0 I0
1 I1 4x1
Sum
1 I2 MUX
0 I3
S1 S0
0 I0
0 I1 4x1
Carry
0 I2 MUX
1 I3
To implement the logic diagram of a Half Adder we need two multiplexers the first multiplexer produces
sum output and the second MUX generates the carry output of the Half Adder. X and Y are the two
selection inputs to both multiplexers to select a particular input.
Using 2 x 1 Multiplexer :
Here we will implement the logic diagram of a Half Adder using two 2 x 1 multiplexers. The first
multiplexer will be used to find the S output while the second multiplexer will be used to generate the
C output of Half Adder.
The general output equation of a 2 x 1 multiplexer is as follows:
Z = I0 S0 ’ + I1 S0
S0 0 2x1
Sum
S¯0 1 MUX
S1
0 0 2x1
Carry
S0 1 MUX
97 M VEDAVYAS
FULL ADDER :
Using 8 x 1 Multiplexer :
The Boolean functions of sum and Pcarry outputs are
S (X, Y, Z) = m(1, 2, 4, 7)
P
C (X, Y, Z) = m(3, 5, 6, 7)
S2 S1 S0
0 000
0 001
0 010
1 011 8x1 Carry
0 100 MUX
1 101
1 110
1 111
Using 4 x 1 Multiplexer :
Truth table for sum & carry as follows :
S2 S1 S0 Sum Carry
0 0 0 0 0
S0 0
0 0 1 1 0
0 1 0 1 0
S0 ’ S0
0 1 1 0 1
1 0 0 1 0
S0 ’ S0
1 0 1 0 1
1 1 0 0 1
S0 1
1 1 1 1 1
98 M VEDAVYAS
Logic diagram of a Full Adder :
S0 I0
S0 I1 4x1
Sum
S0 I2 MUX
S0 I3
S2 S1
0 I0
S0 I1 4x1
Carry
S0 I2 MUX
1 I3
HALF SUBTRACTOR
USING 4x1 MUX :
The Boolean functions of sub andPborrow outputs are
S (X, Y) = m(1, 2)
P
B (X, Y) = m(1)
Logic diagram :
y 0 2x1
Dif f erence
ȳ 1 MUX
y 0 2x1
Borrow
0 1 MUX
99 M VEDAVYAS
Using 2 x 1 Multiplexer :
Here we will implement the logic diagram of a Half Substractor using two 2 X 1 multiplexers.
The Boolean functions of sub andPborrow outputs are
S (X, Y) = m(1, 2)
P
B (X, Y) = m(1)
Logic diagram:
y 0 2x1
Dif f erence
ȳ 1 MUX
y 0 2x1
Borrow
0 1 MUX
FULL SUBTRACTOR :
Using 8 x 1 Multiplexer :
The Boolean functions of sum and Pcarry outputs are
S (X, Y, Z) = m(1, 2, 4, 7)
P
B (X, Y, Z) = m(1, 2, 3, 7)
100 M VEDAVYAS
Logic diagram :
0 000
1 001
1 010
0 011 8x1 Dif f erence
1 100 MUX
0 101
0 110
1 111
S2 S1 S0
0 000
1 001
1 010
1 011 8x1 Borrow
0 100 MUX
0 101
0 110
1 111
Using 4 x 1 Multiplexer :
Truth table for sub & borrow as follows :
S2 S1 S0 Sub Borrow
0 0 0 0 0
S0 S0
0 0 1 1 1
0 1 0 1 1
S0 ’ 1
0 1 1 0 1
1 0 0 1 0
S0 ’ 0
1 0 1 0 0
1 1 0 0 0
S0 S0
1 1 1 1 1
Logic diagram :
S0 I0
S0 I1 4x1
Dif f erence
S0 I2 MUX
S0 I3
S2 S1
S0 I0
1 I1 4x1
Borrow
0 I2 MUX
S0 I3
101 M VEDAVYAS
Problems :
P
1. Implement the boolean expression F(A, B, C) = m(2, 3, 6, 7) using a multiplexer.
Solution :
There are 3 variables in the given expression, hence 2n = 23 = 8 : 1 multiplexer. So, the mux
has 8 input lines, 3 selection lines and one output.
The inputs, corresponding to the minterms (2, 3, 6, 7) are connected to logic 1 and the remaining
terms to logic 0(grounded). The given input variables are connected as three selection lines.
0 000
0 001
1 010
1 011
8x1
0 100 F
MUX
0 101
1 110
1 111
A B C
P
2. Implement the boolean expression F(A, B, C) = m(0, 1, 3, 5, 7) using a multiplexer.
Solution :
There are 3 variables and hence 8 : 1 multiplexr is used to solve the expression. The three input
variables(A, B, C) are connected as three selection lines.
The inputs, corresponding to the minterms (0, 1, 3, 5, 7) are connected to logic 1 and the
remaining terms to the logic 0(grounded).
1 000
1 001
0 010
1 011
8x1
0 100 F
MUX
1 101
0 110
1 111
A B C
P
3. Implement the boolean expression F(A, B, C) = m(0, 2, 5, 6) using 4 : 1 multiplexer.
Solution :
In the given boolean expression, there are 3 variables. We should use 23 : 1 = 8 : 1 multiplexer.
But as per the question, it is to be implemented with 4 : 1 mux.
For 4 : 1 multiplexer, there should be 2 selection lines. So from the given 3 variables, the 2
least significant variables(B, C) are used as selection line inputs.
102 M VEDAVYAS
The minterms given in the boolean expression is circled and analyzed. After analyzing, the
input values of 4 : 1 mux is obtained as A, A, 1, 0.
Thus the circuit can be drawn as follows.
0 D3
1 D2
4x1
F
D1 MUX
A
A D0
B C
P
4. Implement F(A, B, C, D) = m(0, 1, 5, 6, 8, 10, 12, 15) using 8 : 1 multiplexer.
Solution :
In the given boolean expression, there are 4 variables. We should use 24 : 1 = 16 : 1 multiplexer.
But as per the question, it is to be implemented with 8 : 1 mux.
For 8 : 1 multiplexer, there should be 3 selection lines. So from the given 4 variables, the
3 least significant variables(B, C, D) are used as selection line inputs.
The 8 inputs are derived using the implementation table shown below
1 D0
A D1
A D2
0 D3
8x1
A D4 F
D5 MUX
A
A D6
A D7
B C D
103 M VEDAVYAS
Note : -For Video
Pz k
1. The no.of Nx1 mux required to convert Mx1 mux is k=1 ⌈M/N ⌉ where z = ⌈logN M⌉
Example : If M=32 and N=4 then
=> z = ⌈log4 32⌉ = 3
P3
=> k=1 ⌈32/4k ⌉ = 32/4 + 32/ 42 + 32/ 43
= 8 + 2+ 1
= 11 [4x1 Mux are required]
2. The no.of levels required to convert Nx1 mux into Mx1 mux is k ≥ ⌈logN M⌉
Example : 8x1 Mux to 2x1 Mux
=> k ≥ ⌈logN M⌉
=> k ≥ ⌈log2 8⌉
=> 3 ⌈log2 2⌉ = 3 levels
The input will be connected to one of these outputs based on the values of selection lines.
Since there are ‘n’ selection lines, there will be 2 possible combinations of zeros and ones. So, each
n
A 1-to-2 demultiplexer consists of one input line, two output lines and one select line.
0 Y0
1x2
D
DEMUX
1 Y1
104 M VEDAVYAS
Circuit Diagram :
Y1
D
Y0
Y3
1x4 Y2
I
DEMUX Y1
Y0
S1 S0
From the above Truth table, we can directly write the Boolean functions for each output as
Y3=S1 S0 I
Y2=S1 S0 ’I
Y1=S1 ’S0 I
Y0=S1 ’S0 ’I
Y3
I
Y2
I
Y1
I
Y0
I
105 M VEDAVYAS
1x8 De-Multiplexer :
we require two 1x4 De-Multiplexers in second stage in order to get the final eight outputs.
Since, the number of inputs in second stage is two, we require 1x2 DeMultiplexer in first stage so that
the outputs of first stage will be the inputs of second stage.
The Truth table of 1x8 De-Multiplexer is shown below.
s2 s1 s0 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
0 0 0 0 0 0 0 0 0 0 I
0 0 1 0 0 0 0 0 0 I 0
0 1 0 0 0 0 0 0 I 0 0
0 1 1 0 0 0 0 I 0 0 0
1 0 0 0 0 0 I 0 0 0 0
1 0 1 0 0 I 0 0 0 0 0
1 1 0 0 I 0 0 0 0 0 0
1 1 1 I 0 0 0 0 0 0 0
S2 S1 S0
ADDERS
Half Adder : -For Video
The Boolean functions of sum andP carry outputs are
S (X, Y) = m(1, 2)
P
C (X, Y) = m(3)
106 M VEDAVYAS
Block Diagram :
00
01
1x4
I Sum
DEMUX
10
11
Carry
S1 S0
FULL ADDER :
S2 S1 S0
107 M VEDAVYAS
SUBSTRACTORS
Half Substractor :
Block Diagram :
00
Borrow
01
1x4
I Dif f erence
DEMUX
10
11
S1 S0
FULL SUBTRACTOR
The Boolean functions of sub and Borrow
P outputs are
S (X, Y, Z) = m(1, 2, 4, 7)
P
B (X, Y, Z) = m(1, 2, 3, 7)
108 M VEDAVYAS
Logic diagram :
000
001 Dif f erence
010
1x8 011
I
DEMUX 100
101
110 Borrow
111
S2 S1 S0
One of these outputs will be active High based on the combination of inputs present, when the decoder
is enabled.
That means decoder detects a particular code. The outputs of the decoder are nothing but the min
terms of ‘n’ input variables lines, when it is enabled.
2 to 4 DECODER : -For Video
2 to 4 Decoder has two inputs A & A and four outputs Y , Y , Y
1 0 3 2 1 & Y0 .
The block diagram of 2 to 4 decoder is as follows :
Y0
A1
2x4 Y1
A0 Decoder Y2
E Y3
From Truth table, we can write the Boolean functions for each output as
Y3 =E.A1 .A0
Y2 =E.A1 .A0 ’
Y1 =E.A1 ’.A0
Y0 =E.A1 ’.A0 ’
109 M VEDAVYAS
The circuit diagram of 2 to 4 decoder is shown below :
A1 A0
A1 A0
Y3
Y2
Y1
Y0
110 M VEDAVYAS
Y5 =A0 .A1 ’.A2
Y6 =A0 ’.A1 .A2
Y7 =A0 .A1 .A2
Y7
Y6
Y5
Y4
Y3
Y2
Y1
Y0
m2 = 16
111 M VEDAVYAS
E Y15
A2 Y14
3x8 Y13
A1 Y12
Decoder Y11
Y10
A0 Y9
Y8
A2 Y7
Y6
A1 3x8 Y5
Y4
A0 Decoder Y3
Y2
Y1
A3 E Y0
—
The truth table is as follows :
112 M VEDAVYAS
Logical circuit of the above expressions is as follows :
A0 A1 A2 A3
A0 A1 A2 A3
Y15
Y14
Y13
Y12
Y11
Y10
Y9
Y8
Y7
Y6
Y5
Y4
Y3
Y2
Y1
Y0
Block Diagram :
00
S1 2x4 01
Sum
S0 Decoder
10
11
Carry
113 M VEDAVYAS
Full Adder :
SUBTRACTORS
Half Subtractor :
114 M VEDAVYAS
Block Diagram :
00
Borrow
S1 01
2x4
Dif f erence
Decoder
S0 10
11
Full Subtractor :
Logic diagram :
000
S2 001 Dif f erence
010
3x8 011
S1
Decoder 100
101
S0 110 Borrow
111
2. Conversions
3. Parity Checker
4. ROM matrix
5. Address Decoding
115 M VEDAVYAS
Parity Checker :
A parity decoder or parity generator is used to add an extra bit at the end of the signal or single byte.
For example, you are transferring 3 bits of data so one more bit is added to the data making it 4 bits.
The extra bit that is added is used for error checking. When data is received at the receiver end then
the parity bit is checked for error detection.
Two main types of parity decoder are explained below:-
1. Even parity decoder
Y0
x Y1
Y2
Y3
y 3x8
Y4
Decoder
Y5
Y6
z
Y7
116 M VEDAVYAS
3.4 ENCODERS -For Video
An Encoder is a combinational circuit that performs the reverse operation of Decoder. It has maximum
of 2n input lines and ‘n’ output lines.
It will produce a binary code equivalent to the input, which is active High. Therefore, the encoder
encodes 2n input lines with ‘n’ bits.
It is optional to represent the enable signal in encoders.
4 to 2 Encoder :
4 to 2 Encoder has four inputs Y , Y , Y & Y and two outputs A
3 2 1 0 1 & A0 .
The block diagram of 4 to 2 Encoder is as follows :
Y3
A1
Y2
4 to 2
Encoder
Y1 A0
Y0
From Truth table, we can write the Boolean functions for each output as
A1 =Y3 +Y2
A0 =Y3 +Y1
A0
Y1
117 M VEDAVYAS
Octal to Binary Encoder :
Octal to binary Encoder has eight inputs, Y 7 to Y0 and three outputs A2 , A1 & A0 . Octal to binary
encoder is nothing but 8 to 3 encoder.
From Truth table, we can write the Boolean functions for each output as
A2 =Y7 +Y6 +Y5 +Y4
A1 =Y7 +Y6 +Y3 +Y2
A0 =Y7 +Y5 +Y3 +Y1 o
118 M VEDAVYAS
Decimal to BCD Encoder :
The Octal to Binary Encoder is also known as 10 to 4 line Encoder.
In 10 to 4 line encoder, there are total of ten inputs, i.e., Y , Y , Y , Y , Y , Y , Y , Y , Y , and Y
0 1 2 3 4 5 6 7 8 9
and four outputs, i.e., A0 , A1 , A2 , and A3 .
In 10-input lines, one input-line is set to true at a time to get the respective BCD code in the output
side.
The block diagram decimal to BCD encoder is given below.
Y9
Y8
Y7 A3
Y6 Decimal to
Y5 A2
Y4 BCD
Y3 Encoder A1
Y2
Y1 A0
Y0
119 M VEDAVYAS
3.5 PRIORITY ENCODER -For Video
A 4 to 2 priority encoder has four inputs Y , Y , Y & Y and two outputs A & A .
3 2 1 0 1 0
Here, the input, Y has the highest priority, whereas the input, Y has the lowest priority.
3 0
In this case, even if more than one input is ‘1’ at the same time, the output will be the binary code
corresponding to the input, which is having higher priority.
We considered one more output, V in order to know, whether the code available at outputs is valid or
not.
Note :
1. If at least one input of the encoder is ‘1’, then the code available at outputs is a valid one. In this
case, the output, V will be equal to 1.
2. If all the inputs of encoder are ‘0’, then the code available at outputs is not a valid one. In this
case, the output, V will be equal to 0.
Use 4 variable K-maps for getting simplified expressions for each output.
120 M VEDAVYAS
3.6 IC 74X148 -For Video
The main difference between this IC and the “generic” priority encoder of Figure 5 is that its inputs
and outputs are active low.
It has an enable input, EI L, that must be asserted for any of its outputs to be asserted.
The 74x148 is a commercially available, MSI 8-input priority encoder.
Logic symbol for the 74x148 8-input priority encoder and its Truth Table :
Logic diagram for the 74x148 8-input priority encoder, including pin numbers for a standard 16-pin
dual in-line package
121 M VEDAVYAS
UNIT-4
Unlike combinational circuits, which only depend on the current input values to produce outputs,
sequential circuits depend on both the current inputs and the previous state stored in memory elements.
Sequential circuits are commonly used in digital systems to implement state machines, timers, counters,
and memory elements.
The memory elements in sequential circuits can be implemented using flip-flops, which are circuits that
store binary values and maintain their state even when the inputs change.
Combinational Circuit
Memory Element
Previous output is nothing but the present state. Therefore, sequential circuits contain combinational
circuits along with memory storage elements.
Some sequential circuits may not contain combinational circuits, but only memory elements.
122 M VEDAVYAS
4.3 TYPES OF SEQUENTIAL CIRCUITS -For Video
There are two types of Sequential circuits.
1. Asynchronous sequential circuits
2. Synchronous sequential circuits
In the above figure, square wave is considered as clock signal. This signal stays at logic High 5V for
some time and stays at logic Low 0V for equal amount of time.
This pattern repeats with some time period. In this case, the time period will be equal to either twice
of ON time or twice of OFF time.
We can represent the clock signal as train of pulses, when ON time and OFF time are not same. This
clock signal is shown in the following figure.
123 M VEDAVYAS
In the figure, train of pulses is considered as clock signal. This signal stays at logic High 5V for some
time and stays at logic Low 0V for some other time.
This pattern repeats with some time period. In this case, the time period will be equal to sum of ON
time and OFF time.
The reciprocal of the time period of clock signal is known as the frequency of the clock signal.
All sequential circuits are operated with clock signal. So, the frequency at which the sequential circuits
can be operated accordingly the clock signal frequency has to be chosen.
Types of Triggering :
Following are the two possible types of triggering that are used in sequential circuits.
1. Level triggering
2. Edge triggering
1. Level triggering :
There are two levels, namely logic High and logic Low in clock signal.
Following are the two types of level triggering.
1. Positive level triggering
2. Negative level triggering
If the sequential circuit is operated with the clock signal when it is in Logic High, then that type of
triggering is known as Positive level triggering. It is highlighted in below figure.
If the sequential circuit is operated with the clock signal when it is in Logic Low, then that type of
triggering is known as Negative level triggering .
2. Edge triggering :
There are two types of transitions that occur in clock signal. That means, the clock signal transitions
either from Logic Low to Logic High or Logic High to Logic Low.
Following are the two types of edge triggering based on the transitions of clock signal.
1. Positive edge triggering
2. Negative edge triggering
If the sequential circuit is operated with the clock signal that is transitioning from Logic Low to Logic
High, then that type of triggering is known as Positive edge triggering.
It is also called as rising edge triggering. It is shown below.
124 M VEDAVYAS
If the sequential circuit is operated with the clock signal that is transitioning from Logic High to Logic
Low, then that type of triggering is known as Negative edge triggering.
Latches operate with enable signal, which is level sensitive. Whereas, flip-flops are edge sensitive.
They are made of logic gates. One latch or flip-flop can store a 1-bit of information.
The simplest sequential circuit or storage element is a bistable element, which is constructed with
two inverters connected sequentially in a loop as shown below. It has no inputs and two outputs labeled
Q and Q’.
Since the circuit has no inputs, we cannot change the values of Q and Q’. Assume that Q = 0 when we
switch on the power. Since Q is also the input to the bottom inverter, Q’, therefore, Q’ is a 1. 1 going
to the input of the top inverter will produce a 0 at the output Q, which is what we started off with.
Similarly, if we start the circuit with Q = 1, we will get Q’ = 0, and again we get a stable situation.
Bistable element can be also implemented by using NOR and NAND gates.
1.LATCHES
Latches are digital circuits that store a single bit of information and hold its value until it is updated
by new input signals.
A latch is an example of a bistable multivibrator, that is, a device with exactly two stable states.
These states are high-output and low-output.
125 M VEDAVYAS
They are used in digital systems as temporary storage elements to store binary information.
Latches can be implemented using various digital logic gates, such as AND, OR, NOT, NAND, and
NOR gates.
There are basically four main types of latches and flip-flops: SR, D, JK, and T.
2.FLIPFLOPS
The flip-flops are basically the circuits that maintain a certain state unless and until directed by the
input for changing that state. We can construct a basic flip-flop using four-NOR and four-NAND
gates.
Flip flop is popularly known as the basic digital memory circuit. It has its two states as logic 1(High)
and logic 0(low) states.
A flip flop is a sequential circuit which consist of single binary state of information or data. The digital
circuit is a flip flop which has two outputs and are of opposite states. It is also known as a Bistable
Multivibrator.
The flip-flops are of the following types:
1. S-R Flip Flop
2. J-K Flip Flop
3. T Flip Flop
4. D Flip Flop
Construction of SR Latch/Fliflop :
There are following two methods for constructing a SR flip flop
1. By using NOR latch
2. By using NAND latch
1.By using NOR gates :
R
Qn
+veLevel
T riggering
Qn
S
Synchronous SR Latch
126 M VEDAVYAS
2.By using NAND gates :
S
Qn
+veLevel
T riggering
Qn
R
Synchronous SR Latch
Asynchronous SR-Flipflop :
1.By using NOR gates :
R
Qn
Qn
S
Asynchronous SR Latch
Qn
R
Asynchronous SR Latch
127 M VEDAVYAS
Truth table for SR latch/Flip Flop
S R Qn(Present State) Qn+1(Next State) States and Conditions
0 0 0 0
Latch State condition S = R = 0
0 0 1 1
0 1 0 0
Reset State condition S =0, R=1
0 1 1 0
1 0 0 1
Set State condition S =1, R =0
1 0 1 1
1 1 0 ϕ
Undefined State condition S = R = 1
1 1 1 ϕ
Characteristic Equation :
Function table :
S R Qn+1
0 0 Qn
0 1 0
1 0 1
1 1 ϕ
CIRCUIT DIAGRAM :
S
Qn+1
R
R
Qn
128 M VEDAVYAS
Advantages :
1. Simplicity : The SR flip-flop is a simple and easy-to-understand circuit.
2. Speed : The SR flip-flop is relatively fast, which makes it suitable for use in high-speed digital
systems.
3. Low power consumption : The SR flip-flop consumes very little power, which makes it suitable
for use in battery-powered devices.
4. Bi-stable operation : The SR flip-flop can be set and reset, making it a bi-stable circuit that
can hold a state indefinitely until it is changed by an input signal.
Dis-Advantages :
1. Race condition : The SR flip-flop is susceptible to race conditions, which occur when the output
state changes unpredictably due to variations in the timing of input signals.
2. Invalid states : If both the set and reset inputs are activated at the same time, the SR flip-
flop can enter an invalid state where both outputs are high or both are low. This can lead to
unpredictable behavior in digital systems.
3. Limited scalability : The SR flip-flop can be difficult to scale up to more complex digital
systems, as it can lead to increased complexity and the potential for errors.
Jack Kilby flip-flop(JK Flipflop) is very prominent as it is very versatile and can be used as a basic
memory element.
The JK flip flop work in the same way as the SR flip flop work. The JK flip flop has ’J’ and ’K’ flip
flop instead of ’S’ and ’R’.
The only difference between JK flip flop and SR flip flop is that when both inputs of SR flip flop is set
to 1, the circuit produces the invalid states as outputs, but in case of JK flip flop, there are no invalid
states even if both ’J’ and ’K’ flip flops are set to 1.
Construction of JK Latch/Fliflop :
There are following two methods for constructing a JK flip flop
1. By using NOR latch
2. By using NAND latch
129 M VEDAVYAS
K
Qn
+veLevel
T riggering
Qn
J
Synchronous JK Latch
J
Qn
+veEdge
T riggering
Qn
K
Synchronous JK Flipflop
KQn
00 01 11 10
0 1
0 1 3 2
J
1 1 1 1
4 5 7 6
JQ’n +K’Qn
130 M VEDAVYAS
Circuit Diagram :
JQn
J
Qn
Qn+1
K
K
KQn
Excitation table :
Qn Qn+1 J K
0 0 0 ϕ
0 1 1 ϕ
1 0 ϕ 1
1 1 ϕ 0
Function table :
J K Qn+1
0 0 Qn
0 1 0
1 0 1
1 1 Q’n
Drawbacks :
1. Complexity : Compared to other types of flipflops(D,T, SR), JK flipflop requires additional logic
gates to implement which consumes extra memory resources and increases complexity to operate.
2. Propagation Delay : This is the major problem present in JK-FF. Propagation delay results a
timing delay in certain application which are time-flow sensitive.
3. Race Problem : This issue arises when the clock input’s timing pulse isn’t given enough time to turn
“Off” before the output Q’s state is altered.
The problem of the race-around condition does not exist in the flip-flops where the inputs do not
change during the presence of clock pulse. But, in the case of JK flip-flops, the inputs change during
the clock pulse due to the feedback path present between inputs and outputs. Hence, in JK flip-flops,
the race around condition is a major problem.
The problem of race-around condition and the uncertainty of output can be avoided by increasing the
delay of the flip-flops. For that, the delay of the flip-flops must be greater than the duration of the
clock signal, i.e. δt > T. In another way, the duration of the applied clock signal (T) must be reduced
to make it less than the delay of the flip-flops (δt).
However, the increase in the delay of the flip-flops is not a good practice because it decreases the speed
of the system. On the other hand, it is also quite difficult to decrease the duration of the clock pulse
(T) beyond the delay of the flip-flops (δt). This is because, the delay of the JK flip-flops (δt) is of the
order of nanoseconds.
Hence, the most practical way to solve the problem of race-around condition in JK flip-flops is to use
the JK flip-flops in the Master and Slave Mode. In the master-slave mode of JK flip-flops, two JK
flip-flops are cascaded.
131 M VEDAVYAS
4.8 MASTER SLAVE FLIPFLOP -For Video
In ”JK Flip Flop”, when both the inputs and CLK set to 1 for a long time, then Q output toggle
until the CLK is 1. Thus, the uncertain or unreliable output produces. This problem is referred to as
a race-round condition in JK flip-flop and avoided by ensuring that the CLK set to 1 only for a very
short time.
The master-slave flip flop is constructed by combining two JK flip flops. These flip flops are connected
in a series configuration. In these two flip flops, the 1st flip flop work as ”master”, called the master
flip flop, and the 2nd work as a ”slave”, called slave flip flop.
The master-slave flip flop is designed in such a way that the output of the ”master” flip flop is passed
to both the inputs of the ”slave” flip flop. The output of the ”slave” flip flop is passed to inputs of the
master flip flop.
In ”master-slave flip flop”, apart from these two flip flops, an inverter or NOT gate is also used. For
passing the inverted clock pulse to the ”slave” flip flop, the inverter is connected to the clock’s pulse.
In simple words, when CP set to false for ”master”, then CP is set to true for ”slave”, and when CP
set to true for ”master”, then CP is set to false for ”slave”.
S J Q J Q
+veLevel −veLevel
R K Q K Q
Working :
When the clock pulse is true, the slave flip flop will be in the isolated state, and the system’s state
may be affected by the J and K inputs. The ”slave” remains isolated until the CP is 1.
When the CP set to 0, the master flip-flop passes the information to the slave flip flop to obtain the
output.
The master flip flop responds first from the slave because the master flip flop is the positive level
trigger, and the slave flip flop is the negative level trigger.
The output Q’=1 of the master flip flop is passed to the slave flip flop as an input K when the input J
set to 0 and K set to 1. The clock forces the slave flip flop to work as reset, and then the slave copies
the master flip flop.
When J=1, and K=0, the output Q=1 is passed to the J input of the slave. The clock’s negative
transition sets the slave and copies the master.
The master flip flop toggles on the clock’s positive transition when the inputs J and K set to 1. At
that time, the slave flip flop toggles on the clock’s negative transition.
The flip flop will be disabled, and Q remains unchanged when both the inputs of the JK flip flop set to 0.
132 M VEDAVYAS
Timing Diagram of a Master Flip Flop :
When the clock pulse set to 1, the output of the master flip flop will be one until the clock input
remains 0.
When the clock pulse becomes high again, then the master’s output is 0, which will be set to 1 when
the clock becomes one again.
The master flip flop is operational when the clock pulse is 1. The slave’s output remains 0 until the
clock is not set to 0 because the slave flip flop is not operational.
The slave flip flop is operational when the clock pulse is 0. The output of the master remains one until
the clock is not set to 0 again.
Toggling occurs during the entire process because the output changes once in the cycle.
133 M VEDAVYAS
T-FlipFlop using NOR gates :
T
Qn
Qn
Synchronous T Flipflop
Qn
Synchronous T Flipflop
Characteristic table :
T Qn Qn+1
0 0 0
0 1 1
1 0 1
1 1 0
Excitation table :
Qn Qn+1 T
0 0 0
0 1 1
1 0 1
1 1 0
Function table :
T Qn+1
0 Qn
1 Q’n
134 M VEDAVYAS
4.10 D-FLIPFLOP -For Video
The D flip flop is the most important flip flop from other clocked types. It ensures that at the same
time, both the inputs, i.e., S and R, are never equal to 1.
The Delay flip-flop is designed using a gated SR flip-flop with an inverter connected between the inputs
allowing for a single input D(Data).
This single data input, which is labeled as ”D” used in place of the ”Set” input and for the comple-
mentary ”Reset” input, the inverter is used.
Thus, the level-sensitive D-type or D flip flop is constructed from a level-sensitive SR flip flop.
D-FlipFlop using NOR gates :
Qn
Qn
D
Synchronous D Latch
Qn
Qn
D
Synchronous D Latch
Characteristic table :
D Qn Qn+1
0 0 0
0 1 0
1 0 1
1 1 1
135 M VEDAVYAS
Excitation table :
Qn Qn+1 T
0 0 0
0 1 1
1 0 0
1 1 1
Function table :
D Qn+1
0 0
1 1
3. Get the simplified expressions for each excitation input. If necessary, use Kmaps for simplifying.
4. Draw the circuit diagram of desired flip-flop according to the simplified expressions using given flip-flop
and necessary logic gates.
136 M VEDAVYAS
We know that SR flip-flop has two inputs S & R. So, write down the excitation values of SR flip-flop
for each combination of present state and next state values.
The following table shows the characteristic table of D flip-flop along with the excitation inputs of SR
flip-flop.
D flip-flop input Present State Next State SR flip-flop inputs
D Qn Qn+1 S R
0 0 0 0 x
0 1 0 0 1
1 0 1 1 0
1 1 1 x 0
So, we got S = D & R = D’ after simplifying. The k-maps & circuit diagram of D flip-flop are shown
below.
This circuit consists of SR flip-flop and an inverter. This inverter produces an output, which is com-
plement of input, D. So, the overall circuit has single input, D and two outputs Qn & Qn+1
137 M VEDAVYAS
From the above table, we can directly write the Boolean function of D as below.
D=T⊕Q(n)
So, we require a two input Exclusive-OR gate along with D flip-flop. The circuit diagram of T flip-flop
is shown below.
This circuit consists of D flip-flop and an Exclusive-OR gate. This Exclusive-OR gate produces an
output, which is Ex-OR of T and Qn . So, the overall circuit has single input, T and two outputs Qn
& Qn+1 . Hence, it is a T flip-flop.
Here, the given flip-flop is JK flip-flop and the desired flip-flop is T flip-flop. Therefore, consider the
following characteristic table of T flip-flop.
We know that JK flip-flop has two inputs J & K. So, write down the excitation values of JK flip-flop
for each combination of present state and next state values.
The following table shows the characteristic table of T flip-flop along with the excitation inputs of JK
flip-flop.
We got, J = T & K = T after simplifying. The k-maps & circuit diagram of T flip-flop are shown
below.
138 M VEDAVYAS
This circuit consists of JK flip-flop only.It doesn’t require any other gates. Just connect the same
input T to both J & K. So, the overall circuit has single input, T and two outputs Qn & Qn+1 . Hence,
it is a T flip-flop.
Here, the given flip-flop is T flip-flop and the desired flip-flop is D flip-flop. Therefore, consider the
characteristic table of D flip-flop and write down the excitation values of T flip-flop for each combination
of present state and next state values.
The following table shows the characteristic table of D flip-flop.
D flip-flop input Present State Next State
D Qn Qn+1
0 0 0
0 1 0
1 0 1
1 1 1
Write down the excitation values of T flip-flop for each combination of present state and next state
values.
The following table shows the characteristic table of D flip-flop along with the excitation input of T
flip-flop.
From the above table, we can directly write the Boolean function of D as below.
T=D⊕Q(n)
139 M VEDAVYAS
The circuit diagram of D flip-flop is shown below.
This circuit consists of T flip-flop and an Exclusive-OR gate. This Exclusive-OR gate produces an
output, which is Ex-OR of D and Qt. So, the overall circuit has single input, D and two outputs Qn
& Qn+1 . Hence, it is a D flip-flop.
(0,0),(0,1) (0,0),(1,0)
(1,0),(1,1)
0 1
(1,1),(0,1)
2. T FlipFlop :
0 0
1
0 1
3. D FlipFlop :
0 1
1
0 1
140 M VEDAVYAS
UNIT-5
Types of Counters :
The Counters in digital electronics are broadly classified into two main categories :
1. Asynchronous Counters :
The asynchronous counter is also called as Ripple counter and is made up of a series of flip-flops.
If the flip-flops do not receive the same clock signal, the counter is referred to as asynchronous.
Only the first flip-flop receives a clock signal from the system clock. The remaining flip-flops
receive the clock signal from the previous stage flip-output.
The timing diagram clearly shows that Q 1 changes as soon as the rising edge of the clock pulse is
encountered, Q2 changes when the rising edge of Q1 is encountered (because Q1 is like the clock
pulse for the second flip-flop), and so on.
A ripple counter is a cascaded configuration of flip-flops in which the output of one flip-flop drives
the clock input of the flip-flop after it.
2. Synchronous Counters :
The synchronous counter is a counter also known as the parallel counter, operation is fast if we
compare it with asynchronous counters.
The synchronous counter has a single global clock that drives each flip-flop, allowing output to
change in parallel.
The synchronous counter can operate at higher frequencies, In the synchronous counter, all of the
flip flops clock inputs use the same source and produce the output at the same time.
The synchronous counter produces fewer errors than the asynchronous counter.
141 M VEDAVYAS
Note :
Modulus Counters, or simply MOD counters, are defined based on the number of states that the
that counts from 00 to 11 in binary, that is 0 to 3 in decimal, has a modulus value of 4 ( 00 01
counter will sequence through before returning back to its original value. For example, a 2-bit counter
10 11, and return back to 00 ) so would therefore be called a modulo-4, or mod-4 counter. Note
that it has taken four clock pulses to get from 00 to 11.
A ’Mod-2 N
’ counter will require ’N’ number of flip-flops connected together to count a single data bit
while providing 2n different output states, (n is the number of bits). Note that ’N’ is always a whole
integer value.
Synchronous Asynchronous
All flip flips are triggered simultaneously by same clock. Flip-flops are activated with different clocks.
Operate more quickly than asynchronized counters. These operate more slowly than synchronous.
There are no decoding issues using Synchronous Counter. Asynchronous Counter produces decoding errors.
Another name is Parallel Counter Serial Counter is another name for this.
Due to growing no.of states, creating is difficult Designing & implementing is relatively simple.
Examples are Johnson and Ring counters. Ripple UP and DOWN counters are two examples.
Advantages of Counters :
1. Counting
2. Time Measurement
4. Frequency division
142 M VEDAVYAS
5.3 THREE-BIT ASYNCHRONOUS UP COUNTER -For Video
It needs 3 flipflops and it is mod-8 up counter.
Values are from 0 to 7. [2 -1]
3
CLK QA QB QC
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
6 1 1 0
7 1 1 1
0 1 2 3 4 5 6 7
143 M VEDAVYAS
5.4 THREE-BIT ASYNCHRONOUS DOWN COUNTER -For Video
It needs 3 flipflops and it is mod-8 down counter.
Values are from 7 to 0. [2 -1]
3
CLK QA QB QC
0 1 1 1
1 1 1 0
2 1 0 1
3 1 0 0
4 0 1 1
5 0 1 0
6 0 0 1
7 0 0 0
7 6 5 4 3 2 1 0
144 M VEDAVYAS
5.5 THREE-BIT ASYNCHRONOUS UP/DOWN COUNTER -For Video
Up/Down counter is the combination of both the counters in which we can perform up or down counting
by changing the Mode control input.
145 M VEDAVYAS
2. Case 2 – When M=1, then M’ =0.
(a) Put this in Y= M’Q + MQ’= Q’. So Q’ is acting as clock for next FFs.
(b) Therefore, the counter will act as Down counter. Explanation of Down counter –
i. The 1st FF is connected to logic 1. Therefore, it will toggle for every falling edge.
ii. The 2nd FF input is connected to Q’0 .Therefore it changes its state when Q’1 = 1 and there
is falling edge of clock.
iii. Similarly, 3rd FF is connected to Q’1 . Therefore, it changes its state when Q’2 = 1 and there
is falling edge of clock.
iv. By this we can generate counting states of down counter.
v. After every 8th falling edge the counter is again reaching to state 111.
vi. Therefore, it is also known as divide by 8 circuit or mod 8 counter.
The value of n is found to be 3. That is the number of flip-flops, n = 3. Hence the 6 counter states
are 000, 001, 010, 011, 100, 101.
The above truth table for Mod-6 counter is implemented in a Karnaugh map to get the reset logic
function.
The logic circuit diagram for mod-6 asynchronous/ripple counter is drawn as below.
146 M VEDAVYAS
It is drawn with 3 flip-flops. Since it is an asynchronous counter, the clock pulse is given only to the
first flip-flop. For the other flip-flops, the output of the previous flip-flop is given as the clock pulse for
the next flip-flop.
The expression obtained from the K-map is drawn using combinational circuits. The output Y is given
as RESET for all the flip-flops.
State Diagram :
0 1 2 3 4 5
The above truth table for Mod-6 counter is implemented in a Karnaugh map to get the reset logic
function.
The logic circuit diagram for mod-6 asynchronous/ripple counter is drawn as below.
It is drawn with 3 flip-flops. Since it is an asynchronous counter, the clock pulse is given only to the
first flip-flop. For the other flip-flops, the output of the previous flip-flop is given as the clock pulse for
the next flip-flop.
147 M VEDAVYAS
The expression obtained from the K-map is drawn using combinational circuits. The output Y is given
as SET for all the flip-flops.
State Diagram :
7 6 5 4 3 2
148 M VEDAVYAS
Q1N = Q̄1 where Q’0 : 0 => 1 (or) Q0 : 1 => 0
Q2N = Q̄2 where Q1 : 0 => 1
State Diagram :
0 1 6 7 4 5 2 3
These are the following steps to design the 2-bit synchronous up counter using T-FlipFlop.
Step-1 : To design a synchronous up counter first we need how many flipflops are required. Here we
require 2 T-flipflops.
Qn Qn+1 T
0 0 0
0 1 1
1 0 1
1 1 0
Step-3 : Draw the state diagram for 2-bit synchronous up counter as follows.
00 01 10 11
Q2 Q1 Q2N Q1N T2 T1
0 0 0 1 0 1
0 1 1 0 1 1
1 0 1 1 0 1
1 1 0 0 1 1
149 M VEDAVYAS
Step-5 : After making the excitation table next we need to obtain k-map for the design of the counter.
So for T1 and T2 we got 1 and Q1 respectively.
Q1 Q1
0 1 0 1
0 1 1 0 1
Q2
0 1 Q2
0 1
1 1 1 1 1
2 3 2 3
Step-6 : Lastly according to the equation got from K-map create the design for 2 bit synchronous up
counter.
Using JK-FlipFlop :
These are the following steps to design the 2-bit synchronous up counter using JK-FlipFlop.
Step-1 : To design a synchronous up counter first we need how many flipflops are required. Here we
require 2 JK-flipflops.
Qn Qn+1 J K
0 0 0 ϕ
0 1 1 ϕ
1 0 ϕ 1
1 1 ϕ 0
Step-3 : Draw the state diagram for 2-bit synchronous up counter as follows.
00 01 10 11
Q2 Q1 Q2N Q1N J2 K2 J1 K1
0 0 0 1 0 ϕ 1 ϕ
0 1 1 0 1 ϕ ϕ 1
1 0 1 1 ϕ 0 1 ϕ
1 1 0 0 ϕ 1 ϕ 1
150 M VEDAVYAS
Step-5 : After making the excitation table next we need to obtain k-map for the design of the counter.
Q1 Q1
0 1 0 1
0 0 1 0 ϕ ϕ
Q2
0 1 Q2
0 1
1 ϕ ϕ 1 0 1
2 3 2 3
Q1 Q1
0 1 0 1
0 1 ϕ 0 ϕ 1
Q2
0 1 Q2
0 1
1 1 ϕ 1 ϕ 1
2 3 2 3
Step-6 : Lastly according to the equation got from K-map create the design for 2 bit synchronous up
counter.
These are the following steps to design the 2-bit synchronous down counter using T-FlipFlop.
Step-1 : To design a synchronous down counter first we need how many flipflops are required. Here
we require 2 T-flipflops.
Qn Qn+1 T
0 0 0
0 1 1
1 0 1
1 1 0
Step-3 : Draw the state diagram for 2-bit synchronous down counter as follows.
151 M VEDAVYAS
11 10 01 00
Q2 Q1 Q2N Q1N T2 T1
0 0 1 1 1 1
0 1 0 0 0 1
1 0 0 1 1 1
1 1 1 0 0 1
Step-5 : After making the excitation table next we need to obtain k-map for the design of the counter.
So for T1 and T2 we got 1 and Q’1 respectively.
Q1
0 1
0 1
Q2
0 1
1 1
2 3
Step-6 : Lastly according to the equation got from K-map create the design for 2 bit synchronous
down counter.
– These are the following steps to design the 2-bit synchronous Up-down counter using T-FlipFlop.
Step-1 : To design a synchronous up counter first we need how many flipflops are required. Here
we require 2 T-flipflops.
152 M VEDAVYAS
Step-2 : Draw the excitation table for the T-flipflop.
Qn Qn+1 T
0 0 0
0 1 1
1 0 1
1 1 0
Step-3 : Draw the state diagram for 2-bit synchronous up counter as follows.
00 01 10 11
Step-4 : Draw the state diagram for 2-bit synchronous down counter as follows.
11 10 01 00
M Q2 Q1 Q2N Q1N T2 T1
0 0 0 0 1 0 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 0 0 1 1
1 0 0 1 1 1 1
1 0 1 0 0 0 1
1 1 0 0 1 1 1
1 1 1 1 0 0 1
Step-5 : After making the excitation table next we need to obtain k-map for the design of the
counter. So for T1 and T2 we got 1 and Q1 respectively.
Q2 Q1
00 01 11 10
0 1 1
0 1 3 2
M
1 1 1
4 5 7 6
153 M VEDAVYAS
Q2 Q1
00 01 11 10
0 1 1 1 1
0 1 3 2
M
1 1 1 1 1
4 5 7 6
Step-6 : Lastly according to the equation got from K-map create the design for 2 bit synchronous
up counter.
It is known that all counters generate a sort of sequence of numbers (with each flip-flop representing
one bit in a number).
Now if the longest loop in the sequence (or the main loop) can be traversed from any state, only then
is the counter said to be self-starting.
Self-starting counters are made so that “trap” states can be avoided. A trap state is a state that is
accessed due to some error in the operation of the counter.
Self-starting counters are made with certain modifications in the circuit so that if the counter goes into
a trap state, it can automatically move out of it and come back into the main counting loop.
Examples :
1. In this example, the subsequence 001->010->011->100 forms the main counting loop. However, it can
be seen that the main counting loop can be reached irrespective of the state we choose to start in.
Hence this counter is self-starting.
154 M VEDAVYAS
5.13 FREE RUNNING COUNTER -For Video
A counter is said to be free-running if it contains all possible states in the counter loop.
The longest loop in the sequence of numbers generated by the counter is said to be the main counting
loop.
If the main counting loop extends and covers all the states, only then is the counter said to be free-
running. In other words, the main counting loop should cover the entire sequence.
Free-running counters are counters which operate without needing any external interference at any
point in time.
If at least one point lies outside the main counting loop then some sort of extra effort is needed to
force it to come back to the main loop.
Examples :
1. In this example, the main counting loop is the entire sequence – it covers all the states in the sequence.
Hence it is a free-running counter.
00 01 10 11
Note : Every free running is self starting but not vice versa.
00 01 10 11
156 M VEDAVYAS
State diagram for Mod-3 Ring counter is as follows :
101
157 M VEDAVYAS
Johnson Counter [Mod-6] : -For Video
Here Q2N =D2 =Q1 , Q1N =D1 =Q0 and Q0N =D0 =Q’2
010 101
158 M VEDAVYAS