Unit 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 74

NUMBER SYSTEM

Number System

In a digital system, the system can understand only the optional number system. In these
systems, digits symbols are used to represent different values, depending on the index from
which it settled in the number system.

In simple terms, for representing the information, we use the number system in the digital
system.

The digit value in the number system is calculated using:


1. The digit
2. The index, where the digit is present in the number.
3. Finally, the base numbers, the total number of digits available in the number system.
Note: When the number system represents a digit from 0-9, the base of the number will be 10.

Types of Number System

In the digital computer, there are various types of number systems used for representing
information.
1. Binary Number System
2. Decimal Number System
3. Hexadecimal Number System
4. Octal Number System

1 CHARAN’S DEGREE COLLEGE


Binary Number System

Generally, a binary number system is used in the digital computers. In this number system, it
carries only two digits, either 0 or 1. There are two types of electronic pulses present in a binary
number system. The first one is the absence of an electronic pulse representing '0'and second
one is the presence of electronic pulse representing '1'. Each digit is known as a bit. A four-bit
collection (1101) is known as a nibble, and a collection of eight bits (11001010) is known as a
byte. The location of a digit in a binary number represents a specific power of the base (2) of
the number system.

Characteristics:
1. It holds only two values, i.e., either 0 or 1.
2. It is also known as the base 2 number system.
3. The position of a digit represents the 0 power of the base (2). Example: 20
4. The position of the last digit represents the x power of the base (2). Example: 2x, where
x represents the last position, i.e., 1

Examples:

(10100)2, (11011)2, (11001)2, (000101)2, (011010)2.

Decimal Number System

The decimal numbers are used in our day to day life. The decimal number system contains ten
digits from 0 to 9(base 10). Here, the successive place value or position, left to the decimal
point holds units, tens, hundreds, thousands, and so on.

The position in the decimal number system specifies the power of the base (10). The 0 is the
minimum value of the digit, and 9 is the maximum value of the digit. For example, the decimal
number 2541 consist of the digit 1 in the unit position, 4 in the tens position, 5 in the hundreds
position, and 2 in the thousand positions and the value will be written as:
(2×1000) + (5×100) + (4×10) + (1×1)
(2×103) + (5×102) + (4×101) + (1×100)
2000 + 500 + 40 + 1

2 CHARAN’S DEGREE COLLEGE


2541

Octal Number System

The octal number system has base 8(means it has only eight digits from 0 to 7). There are only
eight possible digit values to represent a number. With the help of only three bits, an octal
number is represented. Each set of bits has a distinct value between 0 and 7.

Below, we have described certain characteristics of the octal number system:

Characteristics:
1. An octal number system carries eight digits starting from 0, 1, 2, 3, 4, 5, 6, and 7.
2. It is also known as the base 8 number system.
3. The position of a digit represents the 0 power of the base(8). Example: 80

Number Octal Number

0 000

1 001

2 010

3 011

4 100

5 101

6 110

7 111

4. The position of the last digit represents the x power of the base(8). Example: 8x, where
x represents the last position, i.e., 1

Examples:

(273)8, (5644)8, (0.5365)8, (1123)8, (1223)8.

Hexadecimal Number System

It is another technique to represent the number in the digital system called the hexadecimal
number system. The number system has a base of 16 means there are total 16 symbols(0, 1,
2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) used for representing a number. The single-bit
representation of decimal values10, 11, 12, 13, 14, and 15 are represented by A, B, C, D, E,
and F. Only 4 bits are required for representing a number in a hexadecimal number. Each set

3 CHARAN’S DEGREE COLLEGE


of bits has a distinct value between 0 and 15. There are the following characteristics of the octal
number system:

Characteristics:
1. It has ten digits from 0 to 9 and 6 letters from A to F.
2. The letters from A to F defines numbers from 10 to 15.
3. It is also known as the base 16number system.
4. In hexadecimal number, the position of a digit represents the 0 power of the base(16).
Example: 160
5. In hexadecimal number, the position of the last digit represents the x power of the
base(16). Example: 16x, where x represents the last position, i.e., 1
Binary Number Hexadecimal Number

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F

4 CHARAN’S DEGREE COLLEGE


Examples:

(FAC2)16, (564)16, (0ABD5)16, (1123)16, (11F3)16.


Number Base Conversion

In our previous section, we learned different types of number systems such as binary, decimal,
octal, and hexadecimal. In this part of the tutorial, we will learn how we can change a number
from one number system to another number system.

As, we have four types of number systems so each one can be converted into the remaining
three systems. There are the following conversions possible in Number System
1. Binary to other Number Systems.
2. Decimal to other Number Systems.
3. Octal to other Number Systems.
4. Hexadecimal to other Number Systems.

Binary to other Number Systems

There are three conversions possible for binary number, i.e., binary to decimal, binary to octal,
and binary to hexadecimal. The conversion process of a binary number to decimal differs from
the remaining others. Let's take a detailed discussion on Binary Number System conversion.

Binary to Decimal Conversion

The process of converting binary to decimal is quite simple. The process starts from
multiplying the bits of binary number with its corresponding positional weights. And lastly, we
add all those products.

5 CHARAN’S DEGREE COLLEGE


Let's take an example to understand how the conversion is done from binary to decimal.

Example 1: (10110.001)2

We multiplied each bit of (10110.001)2 with its respective positional weight, and last we add
the products of all the bits with its weight.

(10110.001)2=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+
(0×2-1)+(0×2-2)+(1×2-3)
(10110.001)2=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+
(0×1⁄2)+(0×1⁄4)+(1×1⁄8)
(10110.001)2=16+0+4+2+0+0+0+0.125
(10110.001)2=(22.125 )10

Binary to Octal Conversion

The base numbers of binary and octal are 2 and 8, respectively. In a binary number, the pair of
three bits is equal to one octal digit. There are only two steps to convert a binary number into
an octal number which are as follows:
1. In the first step, we have to make the pairs of three bits on both sides of the binary point.
If there will be one or two bits left in a pair of three bits pair, we add the required
number of zeros on extreme sides.
2. In the second step, we write the octal digits corresponding to each pair.

Example 1: (111110101011.0011)2

1. Firstly, we make pairs of three bits on both sides of the binary point.

111 110 101 011.001 1

On the right side of the binary point, the last pair has only one bit. To make it a complete pair
of three bits, we added two zeros on the extreme side.

111 110 101 011.001 100

2. Then, we wrote the octal digits, which correspond to each pair.

(111110101011.0011)2= (7653.14)8

Binary to Hexadecimal Conversion

The base numbers of binary and hexadecimal are 2 and 16, respectively. In a binary number,
the pair of four bits is equal to one hexadecimal digit. There are also only two steps to convert
a binary number into a hexadecimal number which are as follows:
1. In the first step, we have to make the pairs of four bits on both sides of the binary point.
If there will be one, two, or three bits left in a pair of four bits pair, we add the required
number of zeros on extreme sides.
6 CHARAN’S DEGREE COLLEGE
2. In the second step, we write the hexadecimal digits corresponding to each pair.

7 CHARAN’S DEGREE COLLEGE


Example 1: (10110101011.0011)2

1. Firstly, we make pairs of four bits on both sides of the binary point.

111 1010 1011.0011

On the left side of the binary point, the first pair has three bits. To make it a complete pair of
four bits, add one zero on the extreme side.

0111 1010 1011.0011

2. Then, we write the hexadecimal digits, which correspond to each pair.

(011110101011.0011)2=(7AB.3)16

Decimal to other Number System

The decimal number can be an integer or floating-point integer. When the decimal number is
a floating-point integer, then we convert both part (integer and fractional) of the decimal
number in the isolated form(individually). There are the following steps that are used to convert
the decimal number into a similar number of any base 'r'.
1. In the first step, we perform the division operation on integer and successive part with
base 'r'. We will list down all the remainders till the quotient is zero. Then we find out
the remainders in reverse order for getting the integer part of the equivalent number of
base 'r'. In this, the least and most significant digits are denoted by the first and the last
remainders.
2. In the next step, the multiplication operation is done with base 'r' of the fractional and
successive fraction. The carries are noted until the result is zero or when the required
number of the equivalent digit is obtained. For getting the fractional part of the
equivalent number of base 'r', the normal sequence of carrying is considered.

Decimal to Binary Conversion

For converting decimal to binary, there are two steps required to perform, which are as follows:
1. In the first step, we perform the division operation on the integer and the successive
quotient with the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient with the
base of binary(2).

8 CHARAN’S DEGREE COLLEGE


CO – NUMBER SYSTEM

Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 2.
Operation Quotient Remainder

152/2 76 0 (LSB)

76/2 38 0

38/2 19 0

19/2 9 1

9/2 4 1

4/2 2 0

2/2 1 0

1/2 0 1(MSB)

(152)10=(10011000)2

Step 2:

Now, perform the multiplication of 0.25 and successive fraction with base 2.

Operation Result

0.25×2 0.50

0.50×2 0

(0.25)10=(.01)2

Decimal to Octal Conversion

For converting decimal to octal, there are two steps required to perform, which are as follows:
1. In the first step, we perform the division operation on the integer and the successive
quotient with the base of octal(8).
2. Next, we perform the multiplication on the integer and the successive quotient with the
base of octal(8).

8 CHARAN’S DEGREE COLLEGE


CO – NUMBER SYSTEM

Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 8.
Operation Quotient Remainder

152/8 19 0

19/8 2 3

2/8 0 2

(152)10=(230)8

Step 2:

Now perform the multiplication of 0.25 and successive fraction with base 8.
Operation Result carry

0.25×8 0 2

(0.25)10=(2)8

So, the octal number of the decimal number 152.25 is 230.2

Decimal to hexadecimal conversion

For converting decimal to hexadecimal, there are two steps required to perform, which are as
follows:
1. In the first step, we perform the division operation on the integer and the successive
quotient with the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient with the
base of hexadecimal (16).

9 CHARAN’S DEGREE COLLEGE


CO – NUMBER SYSTEM

Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 8.
Operation Quotient Remainder

152/16 9 8

9/16 0 9

(152)10=(98)16

Step 2:

Now perform the multiplication of 0.25 and successive fraction with base 16.

Operation Result carry

0.25×16 0 4

(0.25)10=(4)16

So, the hexadecimal number of the decimal number 152.25 is 230.4.

Octal to other Number System

Like binary and decimal, the octal number can also be converted into other number systems.
The process of converting octal to decimal differs from the remaining one. Let's start
understanding how conversion is done.

Octal to Decimal Conversion

The process of converting octal to decimal is the same as binary to decimal. The process starts
from multiplying the digits of octal numbers with its corresponding positional weights. And
lastly, we add all those products.

10 CHARAN’S DEGREE COLLEGE


Let's take an example to understand how the conversion is done from octal to decimal.

Example 1: (152.25)8

Step 1:

We multiply each digit of 152.25 with its respective positional weight, and last we add the
products of all the bits with its weight.

(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=64+40+2+(2×1⁄8)+(5×1⁄64)
(152.25)8=64+40+2+0.25+0.078125
(152.25)8=106.328125

So, the decimal number of the octal number 152.25 is 106.328125

Octal to Binary Conversion

The process of converting octal to binary is the reverse process of binary to octal. We write the
three bits binary code of each octal number digit.

Example 1: (152.25)8

We write the three-bit binary digit for 1, 5, 2, and 5.

(152.25)8=(001101010.010101)2

So, the binary number of the octal number 152.25 is (001101010.010101)2

Octal to hexadecimal conversion

For converting octal to hexadecimal, there are two steps required to perform, which are as
follows:
1. In the first step, we will find the binary equivalent of number 25.
2. Next, we have to make the pairs of four bits on both sides of the binary point. If there
will be one, two, or three bits left in a pair of four bits pair, we add the required number
of zeros on extreme sides and write the hexadecimal digits corresponding to each pair.

Example 1: (152.25)8

Step 1:

We write the three-bit binary digit for 1, 5, 2, and 5.

(152.25)8=(001101010.010101)2

So, the binary number of the octal number 152.25 is (001101010.010101)2

Step 2:

11 CHARAN’S DEGREE COLLEGE


1. Now, we make pairs of four bits on both sides of the binary point.

0 0110 1010.0101 01

On the left side of the binary point, the first pair has only one digit, and on the right side, the
last pair has only two-digit. To make them complete pairs of four bits, add zeros on extreme
sides.

0000 0110 1010.0101 0100

2. Now, we write the hexadecimal digits, which correspond to each pair.

(0000 0110 1010.0101 0100)2=(6A.54)16

Hexa-decimal to other Number System

Like binary, decimal, and octal, hexadecimal numbers can also be converted into other number
systems. The process of converting hexadecimal to decimal differs from the remaining one.
Let's start understanding how conversion is done.

Hexa-decimal to Decimal Conversion

The process of converting hexadecimal to decimal is the same as binary to decimal. The process
starts from multiplying the digits of hexadecimal numbers with its corresponding positional
weights. And lastly, we add all those products.

Let's take an example to understand how the conversion is done from hexadecimal to decimal.

Example 1: (152A.25)16

Step 1:

We multiply each digit of 152A.25 with its respective positional weight, and last we add the
products of all the bits with its weight.

(152A.25)16=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
(152A.25)16=(1×4096)+(5×256)+(2×16)+(10×1)+(2×16-1)+(5×16-2)
(152A.25)16=4096+1280+32+10+(2×1⁄16)+(5×1⁄256)
(152A.25)16=5418+0.125+0.125
(152A.25)16=5418.14453125

So, the decimal number of the hexadecimal number 152A.25 is 5418.14453125

Hexadecimal to Binary Conversion

The process of converting hexadecimal to binary is the reverse process of binary to


hexadecimal. We write the four bits binary code of each hexadecimal number digit.

Example 1: (152A.25)16

12 CHARAN’S DEGREE COLLEGE


We write the four-bit binary digit for 1, 5, A, 2, and 5.

(152A.25)16=(0001 0101 0010 1010.0010 0101)2

So, the binary number of the hexadecimal number 152.25 is (1010100101010.00100101)2

Hexadecimal to Octal Conversion

For converting hexadecimal to octal, there are two steps required to perform, which are as
follows:
1. In the first step, we will find the binary equivalent of the hexadecimal number.
2. Next, we have to make the pairs of three bits on both sides of the binary point. If there
will be one or two bits left in a pair of three bits pair, we add the required number of
zeros on extreme sides and write the octal digits corresponding to each pair.

Example 1: (152A.25)16

Step 1:

We write the four-bit binary digit for 1, 5, 2, A, and 5.

(152A.25)16=(0001 0101 0010 1010.0010 0101)2

So, the binary number of hexadecimal number 152A.25 is (0011010101010.010101)2

Step 2:

3. Then, we make pairs of three bits on both sides of the binary point.

001 010 100 101 010.001 001 010

4. Then, we write the octal digit, which corresponds to each pair.

(001010100101010.001001010)2=(12452.112)8

So, the octal number of the hexadecimal number 152A.25 is 12452.112

Number Representation in Binary


There are three types of representations for signed binary numbers

• Sign-Magnitude form
• 1’s complement form
• 2’s complement form
Representation of a positive number in all these 3 forms is same. But, only the representation
of negative number will differ in each form.

13 CHARAN’S DEGREE COLLEGE


Example
Consider the positive decimal number +108. The binary equivalent of magnitude of this
number is 1101100. These 7 bits represent the magnitude of the number 108. Since it is
positive number, consider the sign bit as zero, which is placed on left most side of magnitude.
+108+10810 = 01101100011011002
Therefore, the signed binary representation of positive decimal number +108 is
𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎. So, the same representation is valid in sign-magnitude form, 1’s complement
form and 2’s complement form for positive decimal number +108.

Sign-Magnitude form
In sign-magnitude form, the MSB is used for representing sign of the number and the
remaining bits represent the magnitude of the number. So, just include sign bit at the left most
side of unsigned binary number. This representation is similar to the signed decimal numbers
representation.
Example
Consider the negative decimal number -108. The magnitude of this number is 108. We know
the unsigned binary representation of 108 is 1101100. It is having 7 bits. All these bits
represent the magnitude.
Since the given number is negative, consider the sign bit as one, which is placed on left most
side of magnitude.
−108−10810 = 11101100111011002
Therefore, the sign-magnitude representation of -108 is 11101100.

1’s complement form


The 1’s complement of a number is obtained by complementing all the bits of signed binary
number. So, 1’s complement of positive number gives a negative number. Similarly, 1’s
complement of negative number gives a positive number.
That means, if you perform two times 1’s complement of a binary number including sign bit,
then you will get the original signed binary number.
Example
Consider the negative decimal number -108. The magnitude of this number is 108. We know
the signed binary representation of 108 is 01101100.
It is having 8 bits. The MSB of this number is zero, which indicates positive number.
Complement of zero is one and vice-versa. So, replace zeros by ones and ones by zeros in
order to get the negative number.
−108−10810 = 10010011100100112
Therefore, the 1’s complement of 10810810 is 10010011100100112.

2’s complement form


The 2’s complement of a binary number is obtained by adding one to the 1’s complement of
signed binary number. So, 2’s complement of positive number gives a negative number.
Similarly, 2’s complement of negative number gives a positive number.

14 CHARAN’S DEGREE COLLEGE


That means, if you perform two times 2’s complement of a binary number including sign bit,
then you will get the original signed binary number.
Example
Consider the negative decimal number -108.
We know the 1’s complement of (108)10 is (10010011)2
2’s compliment of 10810810 = 1’s compliment of 10810810 + 1.
= 10010011 + 1
= 10010100
Therefore, the 2’s complement of 10810810 is 10010100100101002.

9’s complement:

The 9’s complement of a binary number can be obtained by subtracting each digit of the
number from 9.

Example: find the 9’s complement of number 1267.

9’s complement : 9999

-1267
Ans: 8732

10’s complement:
The 10’s complement of a number can be obtained by subtracting each digit of the number
from 9 and then adding to 1 to the least significant digit of the result.
Example : find the 10’ s complement of number 2456
9’s complement : 9999

-2456
Ans: 7543
Add 1 +1
10’s complement 7544

15 CHARAN’S DEGREE COLLEGE


Binary Arithmetic:
Binary numbers are added, subtracted, just like decimal numbers.
Binary arithmetic is essential part of all the digital computers and many other digital system.

Binary Addition
It is a key for binary subtraction, multiplication, division. There are four rules of binary
addition.

In fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is written in the given
column and a carry of 1 over to the next column.

Example − Addition

There are three different cases possible when we add two binary numbers using 2's
complement, which is as follows:

Case 1: Addition of the positive number with a negative number when the positive
number has a greater magnitude.

Initially find the 2's complement of the given negative number. Sum up with the given positive
number. If we get the end-around carry 1 then the number will be a positive number and the
carry bit will be discarded and remaining bits are the final result.

Example: 1101 and -1001


1. First, find the 2's complement of the negative number 1001. So, for finding 2's
complement, change all 0 to 1 and all 1 to 0 or find the 1's complement of the number
1001. The 1's complement of the number 1001 is 0110, and add 1 to the LSB of the
result 0110. So the 2's complement of number 1001 is 0110+1=0111
2. Add both the numbers, i.e., 1101 and 0111;
1101+0111=1 0100
3. By adding both numbers, we get the end-around carry 1. We discard the end-around
carry. So, the addition of both numbers is 0100.

16 CHARAN’S DEGREE COLLEGE


Case 2: Adding of the positive value with a negative value when the negative number has
a higher magnitude.

Initially, add a positive value with the 2's complement value of the negative number. Here, no
end-around carry is found. So, we take the 2's complement of the result to get the final result.

Note: the resultant is a negative value.

Example: 1101 and -1110


1. First, find the 2's complement of the negative number 1110. So, for finding 2's
complement, add 1 to the LSB of its 1's complement value 0001. 0001+1=0010
2. Add both the numbers, i.e., 1101 and 0010;
1101+0010= 1111
3. Find the 2's complement of the result 1110 that is the final result. So, the 2's complement
of the result 1110 is 0001, and add a negative sign before the number so that we can
identify that it is a negative number.

Case 3: Addition of two negative numbers

In this case, first, find the 2's complement of both the negative numbers, and then we will add
both these complement numbers. In this case, we will always get the end-around carry, which
will be added to the LSB, and forgetting the final result, we will take the2's complement of the
result.

Note : the result is a negative value.

Example: -1101 and -1110 in five-bit register


1. Firstly find the 2's complement of the negative numbers 01101 and 01110. So, for
finding 2's complement, we add 1 to the LSB of the 1's complement of these numbers.
2's complement of the number 01110 is 10010, and 01101 is 10011.
2. We add both the complement numbers, i.e., 10001 and 10010; 10010+10011=
1 00101
3. By adding both numbers, we get the end-around carry 1. This carry is discarded and the
final result is the 2.s complement of the result 00101. So, the 2's complement of the
result 00101 is 11011, and we add a negative sign before the number so that we can
identify that it is a negative number.

Binary Subtraction
Subtraction and Borrow, these two words will be used very frequently for the binary
subtraction. There are four rules of binary subtraction.

17 CHARAN’S DEGREE COLLEGE


Example − Subtraction

Subtraction using 1's complement

These are the following steps to subtract two binary numbers using 1's complement
o In the first step, find the 1's complement of the subtrahend.
o Next, add the complement number with the minuend.
o If got a carry, add the carry to its LSB. Else take 1's complement of the result which
will be negative
Note: the subtrahend value always get subtracted from minuend.

Example 1: 10101 - 00111

We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So,

10101+11000 =1 01101.

In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e.,
01101+1=01110, which is the answer.

Example 2: 10101 - 10111

We take 1's complement of subtrahend 10111, which comes out 01000. Now, add both of the
numbers. So,

10101+01000 =11101.

In the above result, we didn't get the carry bit. So calculate the 1's complement of the result,
i.e., 00010, which is the negative number and the final answer.

18 CHARAN’S DEGREE COLLEGE


The operation is carried out by means of the following steps:

(i) At first, 2’s complement of the subtrahend is found.

(ii) Then it is added to the minuend.

(iii) If the final carry over of the sum is 1, it is dropped and the result is positive.

(iv) If there is no carry over, the two’s complement of the sum will be the result and it is
negative.

The following examples on subtraction by 2’s complement will make the procedure clear:

Evaluate:

(i) 110110 - 10110

Solution:

The numbers of bits in the subtrahend is 5 while that of minuend is 6. We make the number of
bits in the subtrahend equal to that of minuend by taking a `0’ in the sixth place of the
subtrahend.
Now, 2’s complement of 010110 is (101101 + 1) i.e.101010. Adding this with the minuend.

1 1 0 1 1 0 Minuend

1 0 1 0 1 0 2’s complement of subtrahend

Carry over 1 1 0 0 0 0 0 Result of addition

After dropping the carry over we get the result of subtraction to be 100000.

(ii) 10110 – 11010

Solution:

2’s complement of 11010 is (00101 + 1) i.e. 00110. Hence


Minued - 1 0 1 1 0

2’s complement of subtrahend - 0 0 1 1 0

Result of addition - 1 1 1 0 0

As there is no carry over, the result of subtraction is negative and is obtained by writing the 2’s
complement of 11100 i.e.(00011 + 1) or 00100.

Hence the difference is – 100.

19 CHARAN’S DEGREE COLLEGE


(iii) 1010.11 – 1001.01

Solution:

2’s complement of 1001.01 is 0110.11. Hence


Minued - 1 0 1 0 . 1 1

2’s complement of subtrahend - 0 1 1 0 . 1 1

Carry over 1 0 0 0 1 . 1 0

After dropping the carry over we get the result of subtraction as 1.10.

(iv) 10100.01 – 11011.10

Solution:

2’s complement of 11011.10 is 00100.10. Hence


Minued - 1 0 1 0 0 . 0 1

2’s complement of subtrahend - 0 1 1 0 0 . 1 0

Result of addition - 1 1 0 0 0 . 1 1

As there is no carry over the result of subtraction is negative and is obtained by writing the 2’s
complement of 11000.11.

Hence the required result is – 00111.01.

20 CHARAN’S DEGREE COLLEGE


Subtraction using 2’s complement arithmetic:

21 CHARAN’S DEGREE COLLEGE


22 CHARAN’S DEGREE COLLEGE
23 CHARAN’S DEGREE COLLEGE
And also, when we are adding 4-bit binary numbers. If we get exceeding than 4-bit number as
solution that is also termed to overflow.

24 CHARAN’S DEGREE COLLEGE


Advantages of Binary Code
Following is the list of advantages that binary code offers.
• Binary codes are suitable for the computer applications.
• Binary codes are suitable for the digital communications.
• Binary codes make the analysis and designing of digital circuits if we use the binary
codes.
• Since only 0 & 1 are being used, implementation becomes easy.

Classification of binary codes


The codes are broadly categorized into following four categories.

• Weighted Codes
• Non-Weighted Codes
• Binary Coded Decimal Code
• Alphanumeric Codes
• Error Detecting Codes
• Error Correcting Codes

Weighted Codes
Weighted binary codes are those binary codes which obey the positional weight principle.
Each position of the number represents a specific weight. Several systems of the codes are
used to express the decimal digits 0 through 9. In these codes each decimal digit is represented
by a group of four bits.

25 CHARAN’S DEGREE COLLEGE


Non-Weighted Codes
In this type of binary codes, the positional weights are not assigned. The examples of non-
weighted codes are Excess-3 code and Gray code.

Excess-3 code
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express
decimal numbers. The Excess-3 code words are derived from the 8421 BCD code words
adding (0011)2 or (3)10 to each code word in 8421. The excess-3 codes are obtained as follows

Example

Gray Code
It is the non-weighted code and it is not arithmetic codes. That means there are no specific
weights assigned to the bit position. It has a very special feature that, only one bit will change
each time the decimal number is incremented as shown in fig. As only one bit changes at a
time, the gray code is called as a unit distance code. The gray code is a cyclic code. Gray code
cannot be used for arithmetic operation.

26 CHARAN’S DEGREE COLLEGE


CO - DIGITAL LOGICS

Application of Gray code


• Gray code is popularly used in the shaft position encoders.
• A shaft position encoder produces a code word which represents the angular
positionof the shaft.

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. 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.

Advantages of BCD Codes

• It is very similar to decimal system.


• We need to remember binary equivalent of decimal numbers 0 to 9 only.

Disadvantages of BCD Codes


• The addition and subtraction of BCD have different rules.
• The BCD arithmetic is little more complicated.
• BCD needs more number of bits than binary to represent the decimal number.
So BCDis less efficient than binary.
1 CHARAN’S DEGREE COLLEGE
CO - DIGITAL LOGICS

Digital Computers
A Digital computer can be considered as a digital system that performs various computational tasks.

The first electronic digital computer was developed in the late 1940s and was used primarily for

numerical computations.

By convention, the digital computers use the binary number system, which has two digits: 0 and 1.

A binary digit is called a bit.

A computer system is subdivided into two functional entities: Hardware and Software.

The hardware consists of all the electronic components and electromechanical devices that comprise
the physical entity of the device.

The software of the computer consists of the instructions and data that the computer manipulates to
perform various data-processing tasks.

2 CHARAN’S DEGREE COLLEGE


CO - DIGITAL LOGICS

o The Central Processing Unit (CPU) contains an arithmetic and logic unit for manipulating data, a
number of registers for storing data, and a control circuit for fetching and executing instructions.
o The memory unit of a digital computer contains storage for instructions and data.
o The Random Access Memory (RAM) for real-time processing of the data.
o The Input-Output devices for generating inputs from the user and displaying the final results to
the user.
o The Input-Output devices connected to the computer include the keyboard, mouse, terminals,
magnetic disk drives, and other communication devices.

Digital Logics Circuits:

Computer Organization and Architecture Tutorial provides in-depth knowledge of internal working,
structuring, and implementation of a computer system.

Whereas, Organization defines the way the system is structured so that all those catalogued tools can be used
properly.

Computer Architecture vs Computer Organisation:

Computer Architecture Computer Organization

Computer Architecture is concerned with the Computer Organization is concerned with


way hardware components are connected the structure and behaviour of a computer
together to form a computer system. system as seen by the user.
It acts as the interface between hardware and It deals with the components of a
software. connection in a system.

Computer Architecture helps us to understand Computer Organization tells us how exactly


the functionalities of a system. all the units in the system are arranged and
interconnected.

A programmer can view architecture in terms Whereas Organization expresses the


of instructions, addressing modes and realization of architecture.
registers.

While designing a computer system An organization is done on the basis of


architecture is considered first. architecture.

3 CHARAN’S DEGREE COLLEGE


CO - DIGITAL LOGICS

Computer Architecture deals with high-level Computer Organization deals with low-
design issues. level design issues.

Architecture involves Logic (Instruction sets, Organization involves Physical


Addressing modes, Data types, Cache Components (Circuit design, Adders,
optimization) Signals, Peripherals)

4 CHARAN’S DEGREE COLLEGE


CO - DIGITAL LOGICS

Functional Units of Digital System:

• A computer organization describes the functions and design of the various units of a digital system.
• A general-purpose computer system is the best-known example of a digital system. Other examples
include telephone switching exchanges, digital voltmeters, digital counters, electronic calculators and
digital displays.
• Computer architecture deals with the specification of the instruction set and the hardware units that
implement the instructions.
• Computer hardware consists of electronic circuits, displays, magnetic and optic storage media and also
the communication facilities.
• Functional units are a part of a CPU that performs the operations and calculations called for by the
computer program.
• Functional units of a computer system are parts of the CPU (Central Processing Unit) that performs
the operations and calculations called for by the computer program. A computer consists of five main
components namely, Input unit, Central Processing Unit, Memory unit Arithmetic & logical unit,
Control unit and an Output unit.

Input Unit

• Input units are used by the computer to read the data. The most commonly used input devices are
keyboards, mouse, joysticks, trackballs, microphones, etc.
• However, the most well-known input device is a keyboard. Whenever a key is pressed, the
corresponding letter or digit is automatically translated into its corresponding binary code and
transmitted over a cable to either the memory or the processor.

5 CHARAN’S DEGREE COLLEGE


CO - DIGITAL LOGICS

Central Processing Unit

• Central processing unit commonly known as CPU can be referred as an electronic circuitry within a
computer that carries out the instructions given by a computer program by performing the basic
arithmetic, logical, control and input/output (I/O) operations specified by the instructions.

Memory Unit

• The Memory unit can be referred to as the storage area in which programs are kept which are running,
and that contains data needed by the running programs.
• The Memory unit can be categorized in two ways namely, primary memory and secondary memory.
• It enables a processor to access running execution applications and services that are temporarily stored
in a specific memory location.
• Primary storage is the fastest memory that operates at electronic speeds. Primary memory contains a
large number of semiconductor storage cells, capable of storing a bit of information. The word length
of a computer is between 16-64 bits.
• It is also known as the volatile form of memory, means when the computer is shut down, anything
contained in RAM is lost.
• Cache memory is also a kind of memory which is used to fetch the data very soon. They are highly
coupled with the processor.
• The most common examples of primary memory are RAM and ROM.
• Secondary memory is used when a large amount of data and programs have to be stored for a long-
term basis.
• It is also known as the Non-volatile memory form of memory, means the data is stored permanently
irrespective of shut down.
• The most common examples of secondary memory are magnetic disks, magnetic tapes, and optical
disks.

Arithmetic and Logical unit


• Most of all the arithmetic and logical operations of a computer are executed in the ALU (Arithmetic
and Logical Unit) of the processor. It performs arithmetic operations like addition, subtraction,
multiplication, division and also the logical operations like AND, OR, NOT operations.

Control unit

• The control unit is a component of a computer's central processing unit that coordinates the operation
of the processor. It tells the computer's memory, arithmetic/logic unit and input and output devices
how to respond to a program's instructions.
• The control unit is also known as the nerve center of a computer system.
• Let's us consider an example of addition of two operands by the instruction given as Add LOCA, RO.
This instruction adds the memory location LOCA to the operand in the register RO and places the sum
in the register RO. This instruction internally performs several steps.

3 CHARAN’S DEGREE COLLEGE


Output Unit:

• The primary function of the output unit is to send the processed results to the user. Output devices
display information in a way that the user can understand.
• Output devices are pieces of equipment that are used to generate information or any other response
processed by the computer. These devices display information that has been held or generated within
a computer.
• The most common example of an output device is a monitor.

Digital Computers:

A Digital computer can be considered as a digital system that performs various computational tasks.

The first electronic digital computer was developed in the late 1940s and was used primarily for numerical
computations.

By convention, the digital computers use the binary number system, which has two digits: 0 and 1. A binary
digit is called a bit.

A computer system is subdivided into two functional entities: Hardware and Software.

The hardware consists of all the electronic components and electromechanical devices that comprise the
physical entity of the device.

The software of the computer consists of the instructions and data that the computer manipulates to perform
various data-processing tasks.

• The Central Processing Unit (CPU) contains an arithmetic and logic unit for manipulating data, a
number of registers for storing data, and a control circuit for fetching and executing instructions.
• The memory unit of a digital computer contains storage for instructions and data.
• The Random-Access Memory (RAM) for real-time processing of the data.
CHARAN’S DEGREE COLLEGE
• The Input-Output devices for generating inputs from the user and displaying the final results to the
user.
• The Input-Output devices connected to the computer include the keyboard, mouse, terminals, magnetic
disk drives, and other communication devices.

Logic Gates:

• The logic gates are the main structural part of a digital system.
• Logic Gates are a block of hardware that produces signals of binary 1 or 0 when input logic
requirements are satisfied.
• Each gate has a distinct graphic symbol, and its operation can be described by means of algebraic
expressions.
• The seven basic logic gates include: AND, OR, XOR, NOT, NAND, NOR, and XNOR.
• The relationship between the input-output binary variables for each gate can be represented in tabular
form by a truth table.
• Each gate has one or two binary input variables designated by A and B and one binary output variable
designated by x.

AND Gate:

The AND gate is an electronic circuit which gives a high output only if all its inputs are high. The AND
operation is represented by a dot (.) sign.

OR Gate:

The OR gate is an electronic circuit which gives a high output if one or more of its inputs are high. The
operation performed by an OR gate is represented by a plus (+) sign.

CHARAN’S DEGREE COLLEGE


NOT gate:

The NOT gate is an electronic circuit which produces an inverted version of the input at its output. It is also
known as an Inverter.

NAND gate:

The NOT-AND (NAND) gate which is equal to an AND gate followed by a NOT gate. The NAND gate gives
a high output if any of the inputs are low. The NAND gate is represented by a AND gate with a small circle
on the output. The small circle represents inversion.

NOR gate:

The NOT-OR (NOR) gate which is equal to an OR gate followed by a NOT gate. The NOR gate gives a low
output if any of the inputs are high. The NOR gate is represented by an OR gate with a small circle on the
output. The small circle represents inversion.

CHARAN’S DEGREE COLLEGE


Exclusive-OR/ XOR GATE:

The 'Exclusive-OR' gate is a circuit which will give a high output if one of its inputs is high but not both of
them. The XOR operation is represented by an encircled plus sign.

Exclusive – NOR /Equivalence gate:

The 'Exclusive-NOR' gate is a circuit that does the inverse operation to the XOR gate. It will give a low output
if one of its inputs is high but not both of them. The small circle represents inversion.

CHARAN’S DEGREE COLLEGE


Canonical and Standard Form

Canonical Form – 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 :

• minterm for each combination of the variables that produces a 1 in the function and then taking the AND
of all those terms.
• maxterm for each combination of the variables that produces a 0 in the function and then taking the OR
of all those terms.

Truth table representing minterm and maxterm –

CHARAN’S DEGREE COLLEGE


From the above table it is clear that minterm is expressed in product format and maxterm is expressed in sum
format.

Boolean Algebra:

Boolean algebra can be considered as an algebra that deals with binary variables and logic operations. Boolean
algebraic variables are designated by letters such as A, B, x, and y. The basic operations performed are AND,
OR, and complement.

The Boolean algebraic functions are mostly expressed with binary variables, logic operation symbols,
parentheses, and equal sign. For a given value of variables, the Boolean function can be either 1 or 0. For
instance, consider the Boolean function:

F = x + y'z

The logic diagram for the Boolean function F = x + y'z can be represented as:

CHARAN’S DEGREE COLLEGE


• The Boolean function F = x + y'z is transformed from an algebraic expression into a logic diagram
composed of AND, OR, and inverter gates.
• Inverter at input 'y' generates its complement y'.
• There is an AND gate for the term y'z, and an OR gate is used to combine the two terms (x and y'z).
• The variables of the function are taken to be the inputs of the circuit, and the variable symbol of the
function is taken as the output of the circuit.
• The truth table for the Boolean function F = x + y'z can be represented as:

Examples of Boolean Algebra Simplifications using logic gates:

In this section, we will look at some of the examples of Boolean algebra simplification using Logic gates.

1. F1 = xyz'

2. F2 = x + y'z

CHARAN’S DEGREE COLLEGE


3. F3 = xy' + x'z

4. F4 = x'y'z + x'yz + xy'

Truth tables for F1= xyz', F2= x+y'z, F3= xy'+x'z and F4= x'y'z+x'yz+xy'

x y z F1 F2 F3 F4

0 0 0 0 0 0 0

0 0 1 0 1 1 1

0 1 0 0 0 0 0

0 1 1 0 0 1 1

1 0 0 0 1 1 1

1 0 1 0 1 1 1

1 1 0 1 1 0 0

CHARAN’S DEGREE COLLEGE


1 1 1 0 1 0 0

Laws of Boolean Algebra:

The basic Laws of Boolean Algebra can be stated as follows:

De Morgan's Law is also known as De Morgan's theorem, works depending on the concept of Duality. Duality
states that interchanging the operators and variables in a function, such as replacing 0 with 1 and 1 with 0,
AND operator with OR operator and OR operator with AND operator.

De Morgan stated 2 theorems, which will help us in solving the algebraic problems in digital electronics. The
De Morgan's statements are:

1. "The negation of a conjunction is the disjunction of the negations", which means that the complement
of the product of 2 variables is equal to the sum of the compliments of individual variables. For
example, (A.B)' = A' + B'.

CHARAN’S DEGREE COLLEGE


(A.B)' = A' + B'. hence proved

2. "The negation of disjunction is the conjunction of the negations", which means that complement of the
sum of two variables is equal to the product of the complement of each variable. For example, (A +
B)' = A'B'.

(A + B)' = A'B'. Hence proved

Simplification using Boolean Algebra:

Let us consider an example of a Boolean function: AB+A (B+C) + B (B+C)

The logic diagram for the Boolean function AB+A (B+C) + B (B+C) can be represented as:

We will simplify this Boolean function on the basis of rules given by Boolean algebra.

AB + A (B+C) + B (B+C)

AB + AB + AC + BB + BC {Distributive law; A (B+C) = AB+AC, B (B+C) = BB+BC}

CHARAN’S DEGREE COLLEGE


AB + AB + AC + B + BC {Idempotent law; BB = B}

AB + AC + B + BC {Idempotent law; AB+AB = AB}

AB + AC +B {Absorption law; B+BC = B}

B + AC {Absorption law; AB+B = B}

Hence, the simplified Boolean function will be B + AC.

The logic diagram for Boolean function B + AC can be represented as:

NOTE: The Boolean Algebra problems what we solved in the class, and also the problems
what u havesolved will be included.

Map Simplification:

The Map method involves a simple, straightforward procedure for simplifying Boolean expressions.

Map simplification may be regarded as a pictorial arrangement of the truth table which allows an easy
interpretation for choosing the minimum number of terms needed to express the function algebraically. The
map method is also known as Karnaugh map or K-map.

Each combination of the variables in a truth table is called a mid-term.

There are four min-terms in a two-variable map. Therefore, the map consists of four squares, one for each
min-term. The 0's and 1's marked for each row, and each column designates the values of variable x and y,
respectively.

CHARAN’S DEGREE COLLEGE


Two-variable map:

Representation of functions in the two-variable map:

Three Variable Map:

There are eight min-terms in a three-variable map. Therefore, the map consists of eight squares.

Three variable map:

CHARAN’S DEGREE COLLEGE


• The map was drawn in part (b) in the above image is marked with numbers in each row and each
column to show the relationship between the squares and the three variables.
• Any two adjacent squares in the map differ by only one variable, which is primed in one square
and unprimed in the other. For example, m5 and m7 lie in the two adjacent squares. Variable y is
primed in m5 and unprimed in m7, whereas the other two variables are the same in both the squares.
• From the postulates of Boolean algebra, it follows that the sum of two min-terms in adjacent
squares can be simplified to a single AND term consisting of only two literals. For example,
consider the sum of two adjacent squares say m5 and m7: m5+m7
= xy'z+xyz= xz(y'+y)= xz.

Examples of Boolean algebra simplifications using the map method:

1. F(x,y,z) = Σ (2,3,4,5)

First, 1 is marked in each min-term that represents the function. Hence, 010, 011, 100, 101 are marked with
1's.

Subsequently, we have to find possible adjacent squares. These are indicated in the map by two rectangles,
each enclosing two 1's.

The upper right rectangle represents the area enclosed by x'y.

CHARAN’S DEGREE COLLEGE


The lower left rectangle represents the product term xy'.

The sum of these two terms gives the simplified expression:

F= x'y+ xy'

Algebraically verification:

m0+m2 = x'y'z'+ x'yz'= x'z'(y'+y) = x'z'

m4+m6 = xy'z' + xyz'= xz' + (y'+y) = xz'

2. F(x,y,z) = Σ(3,4,6,7)

As you can see, there are four squares marked with 1's, one for each min-term of the function.

The other two adjacent squares are combined in the third column to give a two-literal term yz.

The remaining two squares with 1's are shown in the above diagram with their values enclosed in half
rectangles. When these two half rectangles are combined, it yields two literal term xz'.

The simplified function becomes F= yz+xz'.

combinational circuit:

A combinational circuit comprises of logic gates whose outputs at any time are determined directly from the
present combination of inputs without any regard to previous inputs.

CHARAN’S DEGREE COLLEGE


A combinational circuit performs a specific information-processing operation fully specified logically by a set
of Boolean functions.

The basic components of a combinational circuit are: input variables, logic gates, and output variables.

The 'n' input variables come from an external source whereas the 'm' output variables go to an external
destination. In many applications, the source or destination are storage registers.

Design procedure of a combinational circuit.

The design procedure of a combinational circuit involves the following steps:

1. The problem is stated.


2. The total number of available input variables and required output variables is determined.
3. The input and output variables are allocated with letter symbols.
4. The exact truth table that defines the required relationships between inputs and outputs is derived.
5. The simplified Boolean function is obtained from each output.
6. The logic diagram is drawn.

The combinational circuit that performs the addition of two bits is called a half adder and the one that performs
the addition of three bits (two significant bits and a previous carry) is a full adder.

Half - Adder

A Half-adder circuit needs two binary inputs and two binary outputs. The input variable shows the augend and
addend bits whereas the output variable produces the sum and carry. We can understand the function of ahalf-
adder by formulating a truth table. The truth table for a half-adder is:

o 'x' and 'y' are the two inputs, and S (Sum) and C (Carry) are the two outputs.
o The Carry output is '0' unless both the inputs are 1.
o 'S' represents the least significant bit of the sum.
CHARAN’S DEGREE COLLEGE
The simplified sum of products (SOP) expressions is:

S = x'y+xy', C = xy

The logic diagram for a half-adder circuit can be represented as:

Full - Adder

This circuit needs three binary inputs and two binary outputs. The truth table for a full-adder is:

o Two of the input variable 'x' and 'y', represent the two significant bits to be added.
o The third input variable 'z', represents the carry from the previous lower significant position.
o The outputs are designated by the symbol 'S' for sum and 'C' for carry.
o The eight rows under the input variables designate all possible combinations of 0's, and 1's that these
variables may have.
o The input-output logical relationship of the full-adder circuit may be expressed in two Boolean
functions, one for each output variable.
o Each output Boolean function can be simplified by using a unique map method.

Maps for a full-adder:

CHARAN’S DEGREE COLLEGE


The logic diagram for a full-adder circuit can be represented as:

S-R Flip-flop/Basic Flip-Flop

Flip flops are an application of logic gates. A flip-flop circuit can remain in a binary state indefinitely (as long
as power is delivered to the circuit) until directed by an input signal to switch states.

S-R flip-flop stands for SET-RESET flip-flops.

The SET-RESET flip-flop consists of two NOR gates and also two NAND gates.

These flip-flops are also called S-R Latch.

The design of these flip flops also includes two inputs, called the SET [S] and RESET [R]. There are also two
outputs, Q and Q'.

CHARAN’S DEGREE COLLEGE


Clocked S-R Flip-Flop

The operation of a basic flip-flop can be modified by providing an additional control input that determines
when the state of the circuit is to be changed.

The limitation with a S-R flip-flop using NOR and NAND gate is the invalid state. This problem can be
overcome by using a stable SR flip-flop that can change outputs when certain invalid states are met, regardless
of the condition of either the Set or the Reset inputs.

CHARAN’S DEGREE COLLEGE


A clock pulse is given to the inputs of the AND Gate. If the value of the clock pulse is '0', the outputs of both
the AND Gates remain '0'.

D Flip-Flop

D flip-flop is a slight modification of clocked SR flip-flop.

From the above figure, you can see that the D input is connected to the S input and the complement of the D
input is connected to the R input.

When the value of CP is '1' (HIGH), the flip-flop moves to the SET state if it is '0' (LOW), the flip-flop
switches to the CLEAR state.

CHARAN’S DEGREE COLLEGE


J-K Flip-Flop

J-K flip-flop can be considered as a modification of the S-R flip-flop.

The main difference is that the intermediate state is more refined and precise than that of an S-R flip-flop.

The characteristics of inputs 'J' and 'K' is same as the 'S' and 'R' inputs of the S-R flip-flop.

J stands for SET, and 'K' stands for CLEAR.

When both the inputs J and K have a HIGH state, the flip-flop switches to the complement state, so, for a
value of Q = 1, it switches to Q=0, and for a value of Q = 0, it switches to Q=1.

CHARAN’S DEGREE COLLEGE


T Flip-Flop

T flip-flop is a much simpler version of the J-K flip-flop.

Both the J and K inputs are connected and are also called as a single input J-K Flip-flop.

Triggering of Flip-Flops

The state of the flip-flop is changed by a momentary change in the input signal. This momentary change is
known as Trigger, and the transition it causes is said to triggering the flip-flop.

Pulses trigger clocked flip-flops.

A pulse start from the initial value of '0', goes momentarily to '1', and after a short while, returns to its initial
'0' value.

A clock pulse is either positive or negative.

A positive clock source remains at '0' during the interval between pulses and goes to 1 during the occurrence
of a pulse.

CHARAN’S DEGREE COLLEGE


The pulse goes through two signal transition: from '0' to '1' and return from '1' to '0'.

Definition of clock pulse transition:

The positive transition is defined as a positive edge and the negative transition as a negative edge.

Note: The characteristics table and the Excitation table for all the
flip flops.Refer to notes which I gave in the class.

Master Slave JK flip flop:


Race Around Condition in JK Flip-flop – For J-K flip-flop, if J=K=1, and if clk=1 for a long period of time,
then Q output will toggle as long as CLK is high, which makes the output of the flip-flop unstable or uncertain.
This problem is called race around condition in J-K flip-flop. This problem (Race Around Condition) can be
avoided by ensuring that the clock input is at logic “1” only for a very short time. This introduced the concept
of Master Slave JK flip flop.

Master Slave JK flip flop –


The Master-Slave Flip-Flop is basically a combination of two JK flip-flops connected together in a series
configuration. Out of these, one acts as the “master” and the other as a “slave”. The output from the master
flip flop is connected to the two inputs of the slave flip flop whose output is fed back to inputs of the master
flip flop.

CHARAN’S DEGREE COLLEGE


In addition to these two flip-flops, the circuit also includes an inverter. The inverter is connected
to clock pulse in such a way that the inverted clock pulse is given to the slave flip-flop. In other
words if CP=0 for a master flip-flop, then CP=1 for a slave flip-flop and if CP=1 for master flip flop
then it becomes 0 for slave flipflop.

Working of a master slave flip flop –


1. When the clock pulse goes to 1, the slave is isolated; J and K inputs may affect the
state of thesystem. The slave flip-flop is isolated until the CP goes to 0. When the
CP goes back to 0, information is passed from the master flip-flop to the slave and
output is obtained.
2. Firstly the master flip flop is positive level triggered and the slave flip flop is
negative leveltriggered, so the master responds before the slave.
3. If J=0 and K=1, the high Q’ output of the master goes to the K input of the slave
and the clockforces the slave to reset, thus the slave copies the master.
4. If J=1 and K=0, the high Q output of the master goes to the J input of the
slave and theNegative transition of the clock sets the slave, copying the
master.
5. If J=1 and K=1, it toggles on the positive transition of the clock and thus the slave
toggles onthe negative transition of the clock.
6. If J=0 and K=0, the flip flop is disabled and Q remains unchanged.

Integrated Circuit
An integrated circuit is electronic circuit or device that has electronic components on a small
semiconductor chip. It has functionality of logic AND or amplifying of a signal. These are mainly
two types of circuits: Digital or Analog. Analog ICs handle continuous signals such as audio signals
and Digital ICs handle discrete signals such as binary values.

There are two main types of integrated circuits: digital ICs or analog ICs. These types of ICs are
discussed in detail below.

CHARAN’S DEGREE COLLEGE


Analog IC

In this type of ICs, the input and output both signals are continuous. The output signal level depends
upon the input signal level and the output signal level is a linear function of input signal level. Linear
ICs or analog ICs are most commonly used as audio frequency amplifier and radio frequency amplifier.
Op amps, voltage regulators, comparators and timers are also well-known examples of linear ICs or
analog ICs.
Digital IC
The logic Gates, such as AND gate, OR gate, NAND gate, XOR gate, flip flops, counters;
microprocessors are some well-known examples of digital ICs. These ICs operate with binary data
such as either 0 or 1. Normally in digital circuit, 0 indicates 0 V and one indicate +5 V. Digital ICs are
commonly used in many electronics projects, and are often available as added components to the top
Arduino starter kits.
The main components of an IC are transistors. These transistors may be bipolar or field effect depending upon

the applications of ICs.

As the technology is improving day by day, the number of transistors incorporated in a single IC chip
is also increasing. Depending upon the number of transistors incorporated in a single chip, the ICs are
categorized in five groups. Namely,

Small Scale Integration (SSI) where the number of transistors incorporated in a


i)
single IC chip is up to 100.

Medium Scale Integration (MSI) where the number of transistors incorporated


ii)
in a single IC chip is from 100 to 1000.

CHARAN’S DEGREE COLLEGE


Large Scale Integration (LSI) where the number of transistors incorporated in a
iii)
single IC chip is from 1000 to 20,000.

Very Large Scale Integration (VLSI) where the number of transistors


iv)
incorporated in a single IC chip is from 20,000 to 10,00,000.

Ultra Large Scale Integration (ULSI) where the number of transistors


v)
incorporated in a single IC chip is from 10,00,000 to 1,00,00,000.

Digital logic families:

1. Transistor-Transistor Logic (TTL)


2. Resistor-Transistor Logic (RTL)
3. Direct Coupled Transistor Logic (DCTL)
4. Diode Transistor Logic (DTL)
5. High Threshold Logic(HTL)
6. Integrated Injection Logic (IIL or I 2 L)

Flip flops can be used to store a single bit of binary data (1or 0). However, in order to store multiple bits
of data, we need multiple flip flops. N flip flops are to be connected in an order to store n bits of data.
A Register is a device which is used to store such information. It is a group of flip flops connected in
series used to store multiple bits of data.

The information stored within these registers can be transferred with the help of shift registers. Shift
Register is a group of flip flops used to store multiple bits of data. The bits stored in such registers can
be made to move within the registers and in/out of the registers by applying clock pulses. An n-bit shift
register can be formed by connecting n flip-flops where each flip flop stores a single bit of data.
The registers which will shift the bits to left are called “Shift left registers”.
The registers which will shift the bits to right are called “Shift right registers”.

Shift registers are basically of 4 types. These are:


1. Serial In Serial Out shift register
2. Serial In parallel Out shift register
3. Parallel In Serial Out shift register
4. Parallel In parallel Out shift register

Serial-In Serial-Out Shift Register (SISO) –

The shift register, which allows serial input (one bit after the other through a single data line) and
produces a serial output is known as Serial-In Serial-Out shift register. Since there is only one output,

CHARAN’S DEGREE COLLEGE


the data leaves the shift register one bit at a time in a serial pattern, thus the name Serial-In Serial-Out
Shift Register.
The logic circuit given below shows a serial-in serial-out shift register. The circuit consists of four D
flip-flops which are connected in a serial manner. All these flip-flops are synchronous with each other
since the same clock signal is applied to each flip flop.

The above circuit is an example of shift right register, taking the serial data input from the left side of the
flip flop. The main use of a SISO is to act as a delay element.

Serial-In Parallel-Out shift Register (SIPO) –

The shift register, which allows serial input (one bit after the other through a single data line) and
produces a parallel output is known as Serial-In Parallel-Out shift register.
The logic circuit given below shows a serial-in-parallel-out shift register. The circuit consists of four D
flip-flops which are connected. The clear (CLR) signal is connected in addition to the clock signal to all
the 4 flip flops in order to RESET them. The output of the first flip flop is connected to the input of the
next flip flop and so on. All these flip-flops are synchronous with each other since the same clock signal
is applied to each flip flop.

The above circuit is an example of shift right register, taking the serial data input from the left side of the
flip flop and producing a parallel output. They are used in communication lines where demultiplexing of

CHARAN’S DEGREE COLLEGE


a data line into several parallel lines is required because the main use of the SIPO register is to convert
serial data into parallel data.

Parallel-In Serial-Out Shift Register (PISO) –

The shift register, which allows parallel input (data is given separately to each flip flop and in a
simultaneous manner) and produces a serial output is known as Parallel-In Serial-Out shift register.
The logic circuit given below shows a parallel-in-serial-out shift register. The circuit consists of four D
flip-flops which are connected. The clock input is directly connected to all the flip flops but the input
data is connected individually to each flip flop through a multiplexer at the input of every flip flop. The
output of the previous flip flop and parallel data input are connected to the input of the MUX and the
output of MUX is connected to the next flip flop. All these flip-flops are synchronous with each other
since the same clock signal is applied to each flip flop.

A Parallel in Serial out (PISO) shift register us used to convert parallel data to serial data.

Parallel-In Parallel-Out Shift Register (PIPO) –

The shift register, which allows parallel input (data is given separately to each flip flop and in a
simultaneous manner) and also produces a parallel output is known as Parallel-In parallel-Out shift
register.
The logic circuit given below shows a parallel-in-parallel-out shift register. The circuit consists of four
D flip-flops which are connected. The clear (CLR) signal and clock signals are connected to all the 4 flip
flops. In this type of register, there are no interconnections between the individual flip-flops since no
serial shifting of the data is required. Data is given as input separately for each flip flop and in the same
way, output also collected individually from each flip flop.

CHARAN’S DEGREE COLLEGE


A Parallel in Parallel out (PIPO) shift register is used as a temporary storage device and like SISO Shift
register it acts as a delay element.

Bidirectional Shift Register –

If we shift a binary number to the left by one position, it is equivalent to multiplying the number by 2
and if we shift a binary number to the right by one position, it is equivalent to dividing the number by 2.
To perform these operations we need a register which can shift the data in either direction.
Bidirectional shift registers are the registers which are capable of shifting the data either right or left
depending on the mode selected. If the mode selected is 1(high), the data will be shifted towards the right
direction and if the mode selected is 0(low), the data will be shifted towards the left direction.

Universal Shift register:


A register that can store the data and /shifts the data towards the right and left along with the parallel
load capability is known as a universal shift register. It can be used to perform input/output operations
in both serial and parallel modes.

CHARAN’S DEGREE COLLEGE


Multiplexer

A multiplexer is a combinational circuit that has 2n input lines and a single output line. Simply, the
multiplexer is a multi-input and single-output combinational circuit. The binary information is received
from the input lines and directed to the output line. On the basis of the values of the selection lines,
one of these data inputs will be connected to the output.

Unlike encoder and decoder, there are n selection lines and 2n input lines. So, there is a total of
2N possible combinations of inputs. A multiplexer is also treated as Mux.

There are various types of the multiplexer which are as follows:

2×1 Multiplexer:

In 2×1 multiplexer, there are only two inputs, i.e., A0 and A1, 1 selection line, i.e., S0 and single outputs,
i.e., Y. On the basis of the combination of inputs which are present at the selection line S0, one of these
2 inputs will be connected to the output. The block diagram and the truth table of the 2×1 multiplexer
are given below.

CHARAN’S DEGREE COLLEGE


Block Diagram:

Truth Table:

The logical expression of the term Y is as follows:

Y=S0'.A0+S0.A1

Logical circuit of the above expression is given below:

4×1 Multiplexer:

In the 4×1 multiplexer, there is a total of four inputs, i.e., A0, A1, A2, and A3, 2 selection lines, i.e.,
S0 and S1 and single output, i.e., Y. On the basis of the combination of inputs that are present at the

CHARAN’S DEGREE COLLEGE


selection lines S0 and S1, one of these 4 inputs are connected to the output. The block diagram and the
truth table of the 4×1 multiplexer are given below.

Block Diagram:

Truth Table:

The logical expression of the term Y is as follows:

Y=S1' S0' A0+S1' S0 A1+S1 S0' A2+S1 S0 A3

Logical circuit of the above expression is given below:

CHARAN’S DEGREE COLLEGE


8 to 1 Multiplexer

In the 8 to 1 multiplexer, there are total eight inputs, i.e., A0, A1, A2, A3, A4, A5, A6, and A7, 3 selection
lines, i.e., S0, S1and S2 and single output, i.e., Y. On the basis of the combination of inputs that are
present at the selection lines S0, S1, and S2, one of these 8 inputs are connected to the output. The block
diagram and the truth table of the 8×1 multiplexer are given below.

CHARAN’S DEGREE COLLEGE


Block Diagram:

Truth Table:

The logical expression of the term Y is as follows:

Y=S0'.S1'.S2'.A0+S0.S1'.S2'.A1+S0'.S1.S2'.A2+S0.S1.S2'.A3+S0'.S1'.S2 A4+S0.S1'.S2 A5+S0'.S1.S2 .A6+S0.


S1.S3.A7

CHARAN’S DEGREE COLLEGE


Logical circuit of the above expression is given below:

De-multiplexer

A De-multiplexer is a combinational circuit that has only 1 input line and 2N output lines. Simply, the
multiplexer is a single-input and multi-output combinational circuit. The information is received from
the single input lines and directed to the output line. On the basis of the values of the selection lines,
the input will be connected to one of these outputs. De-multiplexer is opposite to the multiplexer.

Unlike encoder and decoder, there are n selection lines and 2n outputs. So, there is a total of 2n possible
combinations of inputs. De-multiplexer is also treated as De-mux.

There are various types of De-multiplexer which are as follows:

CHARAN’S DEGREE COLLEGE


1×2 De-multiplexer:

In the 1 to 2 De-multiplexer, there are only two outputs, i.e., Y0, and Y1, 1 selection lines, i.e., S0, and
single input, i.e., A. On the basis of the selection value, the input will be connected to one of the
outputs. The block diagram and the truth table of the 1×2 multiplexer are given below.

Block Diagram:

Truth Table:

The logical expression of the term Y is as follows:

Y0=S0'.A
Y1=S0.A

Logical circuit of the above expressions is given below:

CHARAN’S DEGREE COLLEGE


1×4 De-multiplexer:

In 1 to 4 De-multiplexer, there are total of four outputs, i.e., Y0, Y1, Y2, and Y3, 2 selection lines, i.e.,
S0 and S1 and single input, i.e., A. On the basis of the combination of inputs which are present at the
selection lines S0 and S1, the input be connected to one of the outputs. The block diagram and the truth
table of the 1×4 multiplexer are given below.

Block Diagram:

Truth Table:

CHARAN’S DEGREE COLLEGE


The logical expression of the term Y is as follows:

Y0=S1' S0' A
y1=S1' S0 A
y2=S1 S0' A
y3=S1 S0 A

Logical circuit of the above expressions is given below:

1×8 De-multiplexer

In 1 to 8 De-multiplexer, there are total of eight outputs, i.e., Y0, Y1, Y2, Y3, Y4, Y5, Y6, and Y7, 3
selection lines, i.e., S0, S1and S2 and single input, i.e., A. On the basis of the combination of inputs
which are present at the selection lines S0, S1 and S2, the input will be connected to one of these outputs.
The block diagram and the truth table of the 1×8 de-multiplexer are given below.

CHARAN’S DEGREE COLLEGE


Block Diagram:

Truth Table:

The logical expression of the term Y is as follows:

Y0=S0'.S1'.S2'.A
Y1=S0.S1'.S2'.A
Y2=S0'.S1.S2'.A
Y3=S0.S1.S2'.A
Y4=S0'.S1'.S2 A
Y5=S0.S1'.S2 A
Y6=S0'.S1.S2 A
Y7=S0.S1.S3.A

CHARAN’S DEGREE COLLEGE


Logical circuit of the above expressions is given below:

1. Encoders –
An encoder is a combinational circuit that converts binary information in the form of a 2 N input
lines into N output lines, which represent N bit code for the input. For simple encoders, it is
assumed that only one input line is active at a time.
As an example, let’s consider Octal to Binary encoder. As shown in the following figure, an octal-
to-binary encoder takes 8 input lines and generates 3 output lines.

CHARAN’S DEGREE COLLEGE


Truth Table –
D7 D6 D5 D4 D3 D2 D1 D0 X Y Z

0 0 0 0 0 0 0 1 0 0 0

0 0 0 0 0 0 1 0 0 0 1

0 0 0 0 0 1 0 0 0 1 0

0 0 0 0 1 0 0 0 0 1 1

0 0 0 1 0 0 0 0 1 0 0

0 0 1 0 0 0 0 0 1 0 1

0 1 0 0 0 0 0 0 1 1 0

1 0 0 0 0 0 0 0 1 1 1

As seen from the truth table, the output is 000 when D0 is active; 001 when D1 is active; 010 when
D2 is active and so on.
Implementation –
From the truth table, the output line Z is active when the input octal digit is 1, 3, 5 or 7. Similarly,
Y is 1 when input octal digit is 2, 3, 6 or 7 and X is 1 for input octal digits 4, 5, 6 or 7. Hence, the
Boolean functions would be:

X = D4 + D5 + D6 + D7
Y = D2 +D3 + D6 + D7
Z = D1 + D3 + D5 + D7
Hence, the encoder can be realised with OR gates as follows:

CHARAN’S DEGREE COLLEGE


One limitation of this encoder is that only one input can be active at any given time. If more than
one inputs are active, then the output is undefined. For example, if D6 and D3 are both active,
then, our output would be 111 which is the output for D7. To overcome this, we use Priority
Encoders.
Another ambiguity arises when all inputs are 0. In this case, encoder outputs 000 which actually is
the output for D0 active. In order to avoid this, an extra bit can be added to the output, called the
valid bit which is 0 when all inputs are 0 and 1 otherwise.

CHARAN’S DEGREE COLLEGE

You might also like