0% found this document useful (0 votes)
16 views35 pages

BIT102 SLM Library - SLM - Unit 02

Uploaded by

pavanmay227597
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views35 pages

BIT102 SLM Library - SLM - Unit 02

Uploaded by

pavanmay227597
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Digital Electronics Unit 2

Unit 2 Number Systems

Structure:
2.1 Introduction
Objectives
2.2 Number Systems
2.3 Types of Number Systems
Decimal number system
Binary number system
Octal number system
Hexadecimal number system
2.4 Conversion from One Number System to Other
Conversion from Binary, Octal, Hexadecimal to Decimal number,
and vice versa
Octal to binary conversion and Vice versa
Hexadecimal to binary conversion and Vice versa
Hexadecimal to Octal conversion and Vice versa
2.5 Binary Arithmetic Operations
2.6 Representation of Negative Numbers
2.7 Complement Arithmetic
2.8 Summary
2.9 Terminal Questions
2.10 Answers

2.1 Introduction
In the previous unit we studied a few of the basic concepts of digital
electronics like digital and analog signals, logic levels and digital waveforms,
logic systems, and logic operations. We also studied the concepts of
combinational and sequential logic functions. The study of number systems
is another important topic from the viewpoint of understanding how data are
represented before they are processed by any digital system including a
digital computer. In this unit we will discuss different types of number
systems commonly used to represent data. We start our discussion with the
decimal number system, then we will discuss different types of number
systems such as the binary, octal and hexadecimal, conversion of numbers
from one number system to other, binary arithmetic operations. We will also

Sikkim Manipal University B2072 Page No.: 23


Digital Electronics Unit 2

discuss representation of negative numbers and finally we will discuss


complement arithmetic.
Objectives:
After studying this unit, you should be able to:
 define number system
 list and explain the different types of number systems
 explain the conversion of number from one to another number systems
 perform binary arithmetic operations
 explain the different ways of representing negative numbers
 do arithmetic operations using 1’s and 2’s complements

2.2 Number Systems


The number system is a collection of number to represent different
quantities (or quantifiable information). For example, we use number system
to represent the number of students in a class. We do most of our
computations like addition, subtraction, multiplication, division in the number
systems. We normally perform all our calculations using the popular and
familiar number system called decimal number system.
In decimal number system we have ten different digits or symbols i.e. 0, 1, 2,
3, 4, 5, 6, 7, 8 and 9. The combination of these numbers gives quantifiable
values. To represent these values in the electronics world, there was a need
for the hardware which can represent any one number system. The
invention of transistor has triggered the engineers to make use of the binary
number system. The binary number system has only two values i.e., 0, 1.
We can represent these two values with the help of the transistor as it can
be operated easily for two states 0 and 1. So the transistor acts as a switch
and, is able to represent the binary number.
Digital computers compute or process everything in binary numbers system.
If it gives the output as string of binary digits (bits), we will not be able to
understand it. Since we are familiar with decimal numbers, we require the
value to be represented in the decimal systems. So there is a need for
interpretation. This means a conversion of one number system into the
other is required. So all decimal numbers are converted into the binary and
then computation is performed by computer and later is converted back into
the decimal system.

Sikkim Manipal University B2072 Page No.: 24


Digital Electronics Unit 2

We know that the computer can understand only binary; there is a need for
the conversion of alphabets and other special characters into the binary. In
this unit, we will discuss the different numbering system and their
conversion across the different numbering system.
Self-Assessment Questions
1. The number system is a collection of number to represent the
quantifiable information. (State true or false)
2. In decimal number system we have ten different digits 1, 2, 3, 4, 5, 6, 7,
8, 9 and 10. (State true or false)
3. A transistor acts as a _________ and, is able to represent the binary
number.

2.3 Types of Number Systems


There are four types of number system. They are
 Decimal Number System
 Binary Number System
 Octal Number System
 Hexadecimal Number System

2.3.1 Decimal Number System


Decimal number system is familiar to all of us and we have been using it
from the kindergarten. Now let us study this number system.
A decimal number system has ten different digits. They are 0, 1, 2, 3, 4, 5,
6, 7, 8 and 9. The base (or radix) of a number system is the number of
different digits (or symbols) available within that number system. For
example, in decimal number system there are ten different digits. Hence the
base (or radix) of decimal number system is 10. We represent the value of a
number with base. For example, consider the decimal number 25, we
represent this number as 2510, here the number 25 represent the quantity or
value and the number 10 represent the base of the decimal number system.
If base is not mentioned, then by default we consider that number as
decimal number. Note that we represent any higher number after 9 using
one or more combination of these ten digits only.
Some of the examples of decimal numbers are: 12,121.21, 100.10, 657.88,
234500 etc.

Sikkim Manipal University B2072 Page No.: 25


Digital Electronics Unit 2

Decimal number system has the characteristic of place value. Number value
changes depending on the position or place. For example, consider the
number 345. The place value of 3 is hundred, and it means three hundreds
which is equal to 300. The place value of 4 is ten and four tens means 40
and the place value of 5 is one (or unit) which is equal to 5. Adding
300+40+5 gives decimal number 345. Some of the examples of writing
decimal numbers in different ways are:
345, [345]10, 345.67, 568.1010, (1010.1010)10 etc.
A number may consist of either integer part or fractional part or both. So, a
decimal number may contain two parts like the value before dot and the
value after dot. The value before dot is an integer part and the value after
dot is a fractional value. Consider 367.867. The number 367 is integer value
or integer part and the number 867 is called fractional value or fractional
part. The Dot is called decimal point. This is represented as:

We can also represent the decimal number in powers of base of decimal


number system. Now let us see some of the examples to understand how
numbers are being represented in decimal number system in terms of
power of its base 10.
Example 2.1: How do you represent decimal number 456710?
This number is represented as

4 x 10 + 5 x 10 + 6 x 10 + 7 x 100
3 2 1

The number position always starts from Zero. Here if you observe
7 is in 0thposition it give value 7
6 is in 1st position it gives value 60
5 is in 2nd position it gives value 500
4 is in 3rd position it gives value 4000
Summing all together we get the value is 456710.

Sikkim Manipal University B2072 Page No.: 26


Digital Electronics Unit 2

From the above example 2.1, it is clear that the power is given to the base
10 starting from Zero and power assignment is from left to right as shown by
an arrow mark. But the assignment of power for fractional part of decimal
number starts from left to right with staring power value -1. The example 2.2
shown below illustrates this.
Example 2.2: How do you represent decimal number 4567.890110 ?
This number can be represented as
4 x 103 + 5 x 102 + 6 x 101 + 7 x 100 + 8 x 10-1 + 9 x 10-2 + 0 x 10-3 + 1 x 10-4
The number in position is given as:
The value before dot
7 is in 0th position it gives value 7
6 is in 1st position it gives value 60
5 is in 2nd position it gives value 500
4 is in 3rd position it gives value 4000
The value after dot
8 is in -1st position it give value 0.8
9 is in -2nd position it gives value 0.09
0 is in -3rd position it gives value 0.000
1 is in -4th position it gives value 0.0001
Summing all together we get the value 4567.890110
2.3.2 Binary number system
The word bi means two. So binary number system has only two digits or
symbols 0 and 1. The base of this number system is 2 because there are
only two digits. Numbers represented in this system are commonly called
binary numbers. The each digit 0 or 1 is called binary digit or bit. The digital
computer understands binary numbers. So this number system became
popular in computer world. The transistor can also represent the value ‘0’ by
off state and the value “1” by its on state.
Examples of binary numbers are: 1010, 10.1011, 1000.100, and
(1010.100)2 etc.
Note: If we do not write binary number in words before the numbers, or if
the base is not specified in the given number, then it will be considered as
decimal number by default. So we have to mention the given number as

Sikkim Manipal University B2072 Page No.: 27


Digital Electronics Unit 2

binary number in words or we have to write the binary number with its base
2 to mean the given number is a binary number.
Now let us see the method of representing binary number in decimal format.
Example 2.3: How to represent the binary value “1010” in decimal format?
(1010)2 = 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20
=1x8 + 0x4 +1x2 +0x1
= 8 + 0 + 2 + 0
= (10)10
This means the binary number 1010 is equal to the decimal number 10.

∴ (1010)2 =10 or 1010)2 = (10)10

Example 2.4: How do you represent the binary value 1010.101 in decimal
format?
(1010.101)2 = 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3
= 8 + 0 + 2 + 0 + 0.5 + 0.0 + 0.125
= 10.62510
∴ (1010.101)2 = 10.62510
Most Significant Bit (MSB) is one which has got the highest value in given
binary number and Least Significant Bit (LSB) is one which has the least
value. For example, consider the binary number 10101, the MSB and LSB
are labelled as:

Note that weights are assigned to base of binary number system starting
with zero from left to right.
Since 24 = 16, 23=8, 22=4 and 20=1, we can also represent the above
notations as:

Sikkim Manipal University B2072 Page No.: 28


Digital Electronics Unit 2

Therefore, (10101)2 = 1 x 24 + 0 x 23 + 1x 22 + 0 x 21 + 1 x 20
= 1 x16+ 0 x 8 + 1x 4 + 0 x 2 + 1 x 1
= 16+0+4+0+1
= ( 21)10
2.3.3 Octal Number System
In octal number system, there are eight different digits or symbols. They are
0,1,2,3,4,5,6 and 7. Since there are eight digits, the base (or radix) of the
octal number system is 8.
Some of the examples of octal number system are: (125)8, [647.76]8,
(101.101)8, 1016.108 etc.
Example 2.5: How do to represent the octal value “1760” in decimal format?
1760 = 1 x 83 + 7 x 82 + 6 x 81 + 0 x 80
= 512 + 448 + 48 + 0
∴ (1760)8 = (1008)10

Example 2.6: How do you represent the octal value 1760.154 in decimal
format?
1760.154 = 1 x 83 + 7 x 82 + 6 x 81 + 0 x 80 + 1 x 8-1 + 5 x 8-2 + 4 x 8-3
= 512 + 448 + 48 +0+0.125 + 0.078125 + 0.0078125
(1760.154)8 = (1008.2109375)10
2.3.4 Hexadecimal Number System
The base of Hexadecimal number system is 16, means there are sixteen
different symbols or digits. They are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
F.
Where A= (10)10, B = (11)10, C = (12)10 ,D =(13)10 ,E= (14)10 and F = (15)10
Some of the examples of hexadecimal numbers are: 1234, ABCD, ACD.14B,
BC5.67, (BCD.B6C) 16, (267.46)H etc.

Sikkim Manipal University B2072 Page No.: 29


Digital Electronics Unit 2

The advantage of the hexadecimal system is its easy conversion directly


from a 4-bit binary number.
Now let us see in the following examples the representation of hexadecimal
number in decimal number system.
Example 2.7: How to represent the Hexadecimal value “1A3F” in decimal
format?
1A3F = 1 x 163 + A x 162 + 3 x 161 + F x 160
= 1 x 163 + 10 x 162 + 3 x 161 + 15 x 160
= 1 x 4096 + 10 x 256 + 3 x 16 + 15 x 1
= 4096 + 2560 + 48 + 15
∴ (1A3F)16 = (6719)10

Example 2.8: How do you represent the hexadecimal value “1A3F.C0E” in


decimal format?
1A3F.C0E =1 x 163 + A x 162 + 3 x 161 + F x 160 + C x 16-1 + 0 x 16-2
+ E x 16-3
= 4096 + 2560 + 48 + 15+0.75 +0 + 0.0034179
= 6719.753417910
∴ (1A3F.C0E )16 = 6719.753417910

2.4 Conversion From One Number System to Other


In this section, we will introduce to you the conversion of numbers from one
number system to other.
2.4.1 Conversion from Binary, Octal, Hexadecimal to Decimal number,
and vice versa
To covert a given number in Binary, Octal, or Hexadecimal systems to
decimal number system, we simply multiply each digit of a given number by
their respective base of the number system and the base are assigned the
power which starts from 0 for integer part and -1 for fractional part, then do
the addition of all the product terms. The final sum will give the equivalent
decimal number. The following examples illustrate this method.

Sikkim Manipal University B2072 Page No.: 30


Digital Electronics Unit 2

Example 2.9: Covert the binary number 1101.10 into decimal number
Solution: (1101.10)2 = 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 + 1 x 2-1 + 0 x 2-2
= 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 + 1 x 0.5 + 0 x 0.25
= 8 + 4 + 0 + 1 + 0.5 + 0
= 13.510
∴ (1101.10)2 = 13.510

Example 2.10: Covert the octal number 237.12 into decimal number
Solution: 237. 12 = 2 x 82 + 3x 81 + 7 x 80 + 1 x 8-1 + 2 x 8-2
= 2 x64 + 3x 8 + 7 x 1 + 1 x 0.125 + 2 x 0.015625
= 128 + 24 + 7 + 0.125 + 0.03125
= (159.15625)10
∴ (237.12)8 = (159.15625)10
Example 2.11: Covert the Hexadecimal number 23B.21 into decimal
number.
Solution: (23B.21)16 = 2 x 162 +3 x 161 +B x160 + 2 x 16-1 +1x 16-2
= 2 x 256 +3 x 16 +11 x1 + 2 x 0.0625 +1x 0.0039
= 512 +48 + 11 + 0.125 + 0.0039
= 571.1289

∴ (23B.21)16 = (571.1289)10
Now let us look at the conversion of a given decimal number to other
number systems. Here we consider two cases.
Decimal Integer Conversion:
Here the given decimal number must be divided by the base of the other
number systems in order to convert decimal number (i.e. Integer part) to
other number system. For example, if we want to convert the decimal
number to binary number system, we must divide the decimal number by 2
repeatedly till our quotient becomes zero as shown in example 2.12. The
reminder moving from the bottom to top will be our binary number. The
process is similar for all other number systems.

Sikkim Manipal University B2072 Page No.: 31


Digital Electronics Unit 2

Example 2.12: How to convert 10010 into binary, octal and hexadecimal?

Decimal Fraction Conversion:


The fractional decimal number must be multiplied by the base of the other
number system to convert it into the other number systems as shown in
example 2.13. For example if we want convert decimal number into the
binary, fractional part of the decimal number has to be multiplied by 2
repeatedly till we will make the fractional part zero. If the fractional part goes
on and on, we can terminate in between when we get as much number of
digits as we want depending on the requirement.
Example 2.13: How to convert 0.26510 into binary, octal and hexadecimal?
For the fractional part, we follow the multiplication process as shown below.

Sikkim Manipal University B2072 Page No.: 32


Digital Electronics Unit 2

Now consider one more example,


Example 2.14: How to convert 100.26510 into binary, octal and
hexadecimal?
Let us take the integer part first and convert it to other number systems.

Now for the fractional part, we follow the multiplication process as shown
below.

Now considering both integer and fractional part, we put the answers as:
100.26510 = (1100100.0100)2 ; 100.26510 =(144.20753)8 ; and
100.26510 = (64.43D70)16

Sikkim Manipal University B2072 Page No.: 33


Digital Electronics Unit 2

2.4.2 Octal to Binary Conversion and vice versa


Before we convert a number from octal to binary and vice versa, we should
know the equivalent numbers for both the systems. The table 2.1 shows the
octal numbers with its equivalent binary numbers.
Table 2.1: Octal numbers with equivalent binary number formats

Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

From the table 2.1, it is clear that any octal digit can be represented by a
group of three binary digits (or Bits).
Octal to Binary Conversion:
To convert any given octal number to its equivalent binary number, simply
replace each octal digit by its equivalent three bit binary value.
Example 2.15: Convert 61358 into binary value
In this example, we replace each octal digit by its equivalent 3-bit binary
value as shown below to get our answer.
6 1 3 5 ← Octal Number
110 001 011 1012 ← Binary Number
Thus, (6135)8 = (110001011101)2
Example 2.16: Convert (6135.2478)8 into binary value
We will replace equivalent 3 bit binary value to represent the octal value.
6 1 3 5 . 2 4 7 ← Octal Number
110 001 011 101 . 010 100 111 ← Binary Number
∴ (6135.247)8 = ( 110001011101.010100111)2

Sikkim Manipal University B2072 Page No.: 34


Digital Electronics Unit 2

Binary to Octal Conversion:


To convert any given binary number to its equivalent octal number, simply
divide the given binary number into groups of three bits starting from left to
right for integer part and from right to left for fractional part and replace each
three bit binary group by its octal equivalent. If last group is not complete in
terms of three bits, then add dummy or extra zeros to left of the binary digit
for a integer part and add dummy zeros to right of the binary digit for a
fractional part to make it a group of three bits. The examples 2.17 and 2.18
illustrate this.
Example 2.17: Convert the binary number 110001011101.010100111 into
octal equivalent.

Thus, (110001011101.010100111) = ( 6135.247)8

Example 2.18: Convert the binary number 10001011101.01010011 into


octal equivalent.

Thus, (10001011101.01010011) = ( 2135.246)8


2.4.3 Hexadecimal to Binary Conversion and vice versa
To convert any hexadecimal number to binary and vice versa, refer the table
2.2 which shows the binary equivalent for the hexadecimal numbers. The
table 2.2 also gives the comparison of all the four number systems

Sikkim Manipal University B2072 Page No.: 35


Digital Electronics Unit 2

Table 2.2: Comparison of decimal values with other number formats

Decimal Binary Octal Hexadecimal


0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

From the table 2.2, it is clear that any hexadecimal digit can be represented
by a group of four binary digits (or Bits)
Hexadecimal to Binary Conversion:
To convert any given hexadecimal number to its equivalent binary number,
simply replace each hexadecimal digit by its equivalent four bit binary value.
Example 2.19: Convert 1A2C16 into Binary Value.
In this example, we replace each hexadecimal digit by its equivalent 4-bit
binary group as shown below to get our answer.

1 A 2 C ← Hexadecimal Number
0001 1010 0010 1100 ← Binary Number
∴ (1A2C)16 = (0001101000101100)2

Sikkim Manipal University B2072 Page No.: 36


Digital Electronics Unit 2

Example 2.20: Convert 1A2C.3B4D16 into Binary value.


In this example, we can replace all independent value into 4-bit binary
equivalent as shown below to get our answer irrespective of its position.
1 A 2 C . 3 B 4 D ← Hexadecimal
0001 1010 0010 1100 . 0011 1011 0100 1101 ← Binary
Binary to Hexadecimal Conversion:
To convert any given binary number to its equivalent hexadecimal number,
simply divide the given binary number into groups of four bits starting from
left to right for integer part and from right to left for fractional part and
replace each four bit binary group by its hexadecimal equivalent. If last
group is not complete in terms of four bits, then add dummy zeros to left of
the binary digit for a integer part and add dummy zeros to right of the binary
digit for a fractional part to make it a group of four bits. The examples 2.21
and 2.22 illustrate this.
Example 2.21: Convert (0001101000101100.0011101101001101)2 into
hexadecimal equivalent.

Example 2.22: Convert (1101000101100.001111110100110)2 into


hexadecimal equivalent.

2.4.4 Hexadecimal to Octal Conversion and vice versa


To convert any hexadecimal number to octal and vice versa, we refer to the
table 2.2 which shows the binary and octal equivalent for the hexadecimal
numbers.
Hexadecimal to octal conversion:
To convert any given hexadecimal number to its equivalent octal number,
first convert the given hexadecimal number to its equivalent binary number
and then convert this resulting binary number to its equivalent octal number.
The examples 2.23 and 2.24 illustrate this procedure.
Sikkim Manipal University B2072 Page No.: 37
Digital Electronics Unit 2

Example 2.23: Convert 1A2C16 into octal number.


In this example, we first convert the given hexadecimal number into binary
number as shown in step1 and then convert the resulting binary number into
octal number as shown in step 2 to get the final answer.
Step 1: Convert the hexadecimal number into binary number
1 A 2 C ← Hexadecimal Number
0001 1010 0010 1100 ← Binary Number
Step 2: Convert the binary number into octal number
000 001 101 000 101 100 ← Binary Number
0 1 5 0 5 4 ← Binary Number
Thus, 1A2C16 = (15054)8
Example 2.24: Convert 1A2C.3B4D16 into octal Value.
Step 1: Convert the hexadecimal number into binary number
1 A 2 C . 3 B 4 D ← Hexadecimal
0001 1010 0010 1100 . 0011 1011 0100 1101 ← Binary
Step 2: Convert the binary number to octal number
000 001 101 000 101 100 . 001 110 110 100 110 100 ← Binary
0 1 5 0 5 4 . 1 6 6 4 6 4 ← Octal Number
Thus, 1A2C.3B4D16 = (15054.166464)8
Octal to Hexadecimal Conversion:
To convert any given octal number into its equivalent hexadecimal number,
first convert the given octal number into its equivalent binary number and
then convert this resulting binary number into its equivalent hexadecimal
number.
The examples 2.25 and 2.26 illustrate this procedure.
Example 2.25: Convert (2504)8 into its equivalent hexadecimal number.
We first convert the given octal number into binary number as shown in
step1 and then convert the resulting binary number into hexadecimal
number as shown in step 2 to get the final answer.

Sikkim Manipal University B2072 Page No.: 38


Digital Electronics Unit 2

Step 1: Convert the octal number into binary number


2 5 0 4 ← Octal Number
010 101 000 100 ← Binary Number
Step 2: Convert the binary number into octal number
0101 0100 0100 ← Binary Number
5 4 4 ← Hexadecimal
Thus, (2504)8 = (544)16
Example 2.26: Convert (15054.166464)8 into hexadecimal number.
Step 1: Convert the octal number to binary number
1 5 0 5 4 . 1 6 6 4 6 4 ← Octal Number
001 101 000 101 100 . 001 110 110 100 110 100 ← Binary
Step 2: Convert the binary number into hexadecimal number
0001 1010 0010 1100 . 0011 1011 0100 1101 0000 ← Binary
1 A 2 C . 3 B 4 D 0 ← Hexadecimal
Thus, (15054.166464)8 = ( 1A2C.3B4D)16
Self-Assessment Questions
4. The base of a decimal number system is _____________.
5. The base of _____________ system is 2 because there are only two
digits.
6. The base of Hexadecimal number system is _____________.
7. The decimal equivalent of 144.20753)8 is ________________.
8. The hexadecimal value for (15054.166464)8 is ___________.

2.5 Binary Arithmetic Operations


There are four arithmetic operations that can be done on binary numbers.
They are:
1) Addition
2) Subtraction
3) Multiplication
4) Division

Sikkim Manipal University B2072 Page No.: 39


Digital Electronics Unit 2

Now let us discuss each of these operations in detail.


1) Binary addition:
Adding binary numbers is a very simple process, and it is almost similar to
regular decimal number addition. The difference is that here we add only
binary numbers whose base is 2. We have to remember the following rules
while performing binary addition.
Rules of binary addition:
1) 0 + 0 = 0 (read this as sum 0 with carry 0)
2) 1 + 0 = 1 (read this as sum 1 with carry 0)
3) 0 + 1 = 1 (read this as sum 1 with carry 0)
4) 1 + 1 = 10 (read this as sum 0 with carry 1)
5) 1 + 1 + 1 = 11 (read this as sum 1 with carry 1)
From the above rules it is clear that when we add two numbers, 1+0, we get
the sum as 1. Here no carry is generated. So we can say this as “sum 1 with
carry 0. Similary when we add 1+1, we get result as 10. This can be read as
sum 0 with carry 1”.
So when the sum in one column is a two-bit number, the least significant bit
(LSB) is retained and written as part of the total sum and the most
significant bit (MSB) is taken or carried to the next higher left column.
When we add three binary numbers like 1+1+1, we get the result as 11. We
can read this result as sum 0 (LSB) with carry 1(MSB). We can interpret this
as “when we add three 1’s in decimal numbers, we get the result 3”.
Similarly when we add three 1’s in binary we get the binary result 11 which
is equal to decimal 3. Note that the result 11 is not eleven but it is binary
three. This is because we are dealing with binary numbers not decimal
numbers.
You can understand the addition of three binary 1’s in the following manner.
You add first two bits as:

Sikkim Manipal University B2072 Page No.: 40


Digital Electronics Unit 2

Now add result 10 with the third bit as:

Note that we perform addition in column by column process. Now let us see
some examples for binary addition.
Example 2.27: Add 1010 and 10001.
1010
+ 10001
11011

Example 2.28: Perform the binary addition of 1011 and 1001.


1011
+ 10001
11100

Example 2.29: Perform the binary addition of 10110 and 10111.


10110
+ 10111
101101

2) Binary subtraction: Subtracting binary numbers is a very simple


process, and it is almost similar to regular decimal number subtraction. The
difference is that here we subtarct only binary numbers whose base is 2.
So here borrow means 10(binary two).
Rules of binary subtraction:
1) 0 - 0 = 0 (read this as “difference 0 with borrow 0 “)
2) 1 - 0 = 1 (read this as “difference 1 with borrow 0”)
3) 0 - 1 = 1 (read this as “difference 1 with borrow 1”)
4) 1 - 1 = 0 (read this as “difference 0 with borrow 0”)
We perform subtraction in column by column process. Note that when we
subtract 1 from 0, (i.e. 0-1), we require a borrow from next higher column.

Sikkim Manipal University B2072 Page No.: 41


Digital Electronics Unit 2

Note that 10-1=1 (i.e. difference 1 with borrow 0 ). This can also be written
as:

Note that the first number is called Minuend (the number that subtracts the
other number) and the second number (the number to be subtracted from
other number) is called subtrahend
Example 2.30: Perform the binary subtraction of 1011 from 1001.

Example 2.31: Perform (10101)2 – (1010)2.

3) Binary Multiplication: Binary multiplication process is same as decimal


multiplication except that we use binary numbers.
Rules of binary Multiplication:
1) 0 x 0 = 0
2) 0 x 1 = 0
3) 1 x 0 = 0
4) 1 x 1 = 1
Note that no carry or borrow bits involved in binary multiplication.
You can understand the binary multiplication by the following examples
Example 2.32: Multiply 00101001 × 00000110 = 11110110
0 0 1 0 1 0 0 1 = 41(in decimal )
× 1 1 0 = 6 (in decimal )
0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 1
0 0 1 0 1 0 0 1
0 0 1 1 1 1 0 1 1 0 = 246 (in decimal )

Sikkim Manipal University B2072 Page No.: 42


Digital Electronics Unit 2

Example 2.33: Multiply 00010111 × 00000011 = 01000101

0 0 0 1 0 1 1 1 = 23 (in decimal )
× 1 1 = 3 (in decimal )
1 1 1 1 1 carries
0 0 0 1 0 1 1 1
0 0 0 1 0 1 1 1
0 0 1 0 0 0 1 0 1 = 69 (in decimal )

You will come to know the decimal equivalent of binary numbers when you
perform number conversion.
Example 2.34: Multiply 1011.01 × 110.1 = 1001001.001

Note: Binary multiplication is the same as repeated binary addition.


For example: multiply 1000 × 11 = 11000. Now we can do this by adding
1000 three times (because multiplier= 11) to get the final result or product
as:
1 ← Carry
1 0 0 0 = 8(in decimal)
1 0 0 0 = 8(in decimal)
+ 1 0 0 0 = 8(in decimal)
1 1 0 0 0 = 24(base 10)

4) Binary Division
Binary division follows the same rule as that of decimal division. Now let us
study direct method of binary division. Consider the following examples.

Sikkim Manipal University B2072 Page No.: 43


Digital Electronics Unit 2

Example 2.35: 101010 ÷ 110 = 111

Example 2.36: Divide 110101 by 111

In the above example 2, the reminder has been neglected


Note: Binary division is the repeated process of subtraction, just as in case
of decimal division. Consider the following example 2.37.
Example 2.37: Perform 1100 ÷ 110 using repeated subtraction method.
1100
- 110
110
- 110
000

Since the subtraction is carried out two times, the result is 10.
Thus, 1100 ÷ 110 = 10

Sikkim Manipal University B2072 Page No.: 44


Digital Electronics Unit 2

2.6 Representation of Negative Numbers


We can represent negative numbers in the following ways
1) Signed magnitude
2) 1’s complement
3) 2’s complement
1) Signed Magnitude Representation:
The signed magnitude representation is one of the methods to represent the
negative and positive number in binary system. It is a regular binary
representation with addition of one more bit in the MSB side to represent
whether the number is negative or positive. The MSB “0” represent the
positive value and MSB “1” represent the negative value.
The range for this representation is: -( 2n-1 -1) to + (2n-1 -1).
The drawbacks of this representation are: It has both positive and negative
zero, and complex architecture required for computation.
The following are some of the examples which illustrate the sign magnitude
representation.
Example 2.38: Represent the number + 1010 in sign magnitude form.
+ 1010 ← Given Number
0 1010 ← Sign magnitude form
↑ ↑
Sign Bit Magnitude
In the above example, the MSB represents sign bit and the remaining bits
represent magnitude. Here MSB bit is 0, it means the number is negative.
The remaining bits 1010 represent magnitude. This magnitude 1010 is
equal to decimal number 10. So putting this sign magnitude representation
in decimal form as:
0 1010 = + 10.

Example 2.39: Represent the number - 10101 in sign magnitude form.


- 10101 ← Given Number
1 10101 ← Sign magnitude form

Sikkim Manipal University B2072 Page No.: 45


Digital Electronics Unit 2

Example 2.40: The number 10100 is in sign magnitude form. Determine


Whether the number is positive or negative?
The MSB in the number given is 1. It means it is a negative number. So we
have (10100)2 = (─ 4)10
Example 2.41: Represent the decimal number - 25 in binary sign magnitude
representation.
The magnitude of the given decimal number is 25. Converting this number
to binary, we get 11001. Also we note that Minus (-) sign is attached in the
given number. So we use binary 1 in to represent the negative sign.
Therefore, binary sign magnitude representation is 111001.
i.e.,
- 25 = 111001
Example 2.42: Write '-94' in sign-magnitude representation, using an 8-bit
register.
-94 = 11011110
Example 2.43: What is the largest positive number which can be
represented using 8-bit, in the sign-magnitude method of representation?
We know that range for sign magnitude representation is: -( 2n-1 -1) to +
(2n-1 -1).
Given n=8. Thus, +( 2n-1 -1)=+ ( 28-1 -1) =+( 27-1)=+(128-1)= +127.

i.e. +127 (01111111)

Note: Using 8-bit representation we can represent decimal numbers in the


range from −127 to +127 in the sign-bit magnitude format.
2) 1’s Complement:
In the 1’s complement format, the positive numbers remain unchanged. We
obtain the negative numbers by replacing all 1’s by 0’s and all 0’s by 1’s. i.e.
bits get complemented.
Suppose, for example, the given binary number is 10100. We can get 1’s
complement of this number by replacing all 0’s by 1’s and all 1’s by 0’s as
illustrated under:

Sikkim Manipal University B2072 Page No.: 46


Digital Electronics Unit 2

Therefore, 1’s complement of binary number 10100 is 01011.


Consider one more example: Represent +9 and -9 in 8 bit representation.
We can represent +9 as 00001001 in eight-bit notation, and −9 is obtained
by complementing 00001001 which is equal to as 11110110.
i.e. 11110110 = -9.
This means, first we get the binary representation for +9 which is equal to
00001001 and by complementing this binary number, we get the 11110110
which is equal to -9. The complete process is illustrated as below:

Example 2.44: Obtain 1’s complement of – 5


We get the binary representation for +5 which is equal to 0101. Then we get
1’s complement of 0101 which is equal to 1010. This 1010 is the 1’s
complement of -5. The process is illustrated as under:

Therefore, 1’s complement of -5 = 1010.


Example 2.45: Obtain 1’s complement of 10101011.

∴ 1’s complement of 10101011 = 01010100.


Example 2.46: Find the 1’s complement of 12 and -14

∴ 1’s complement of 12 = 01100

Sikkim Manipal University B2072 Page No.: 47


Digital Electronics Unit 2

Now to get 1’s complement of -14, we first get 1’s complement of +14. Then
we complement this binary number to get -14. This process is as below:

∴ 1’s complement of -14 = 10001.


Drawbacks of 1’s complement:
The drawbacks of 1’s complement representation are:
1. It has both positive and negative zero
2. Complex architecture is required for computation.
3) 2’s Complement:
The 2’s complement is obtained by the following procedure.
1. Obtain 1’s complement of the given number
2. Add 1 to the result (1’s complement) to get 2’s complement.
The range function for this representation is: - 2n-1 to + 2n-1 -1.
Note that in the 2’s complement format, the positive numbers remain
unchanged.
The table 2.3 shows the comparison of negative number using sign
magnitude, 1’s complement and 2’s complement methods.
Table 2.3: Comparisons of Negative Number Systems

Decimal Signed 1’s 2’s


Magnitude Complement Complement
-8 - - 1000
-7 1111 1000 1001
-6 1110 1001 1010
-5 1101 1010 1011
-4 1100 1011 1100
-3 1011 1100 1101
-2 1010 1101 1110
-1 1001 1110 1111
-0 1000 1111 -
+0 0000 0000 0000
+1 0001 0001 0001

Sikkim Manipal University B2072 Page No.: 48


Digital Electronics Unit 2

+2 0010 0010 0010


+3 0011 0011 0011
+4 0100 0100 0100
+5 0101 0101 0101
+6 0110 0110 0110
+7 0111 0111 0111

Now let us see some examples of obtaining 2’s complements.


Example 2.47: Find the 1’s complement of the binary number 1010011.
Step 1: Obtain 1’s complement of 1010011
1010011 ← Given Binary Number
0101100 ← 1’s complement of given binary number
Step 2: Add 1 to the 1’s complement of the given number
0101100 ← 1’s complement of given binary number
+ 1 ← Add 1

0101101 ← 2’s complement of given binary number

∴ 2’s complement of the given binary number 1010011 is 0101101


Example 2.48: Find the 1’s complement of the binary number 1100111
1100111 ← Given Binary Number

0011000 ← 1’s complement of given binary number


+ 1 ← Add 1

0011001 ← 2’s complement of given binary number

∴ 2’s complement of the given binary number 1100111 is 0011001.


Example 2.49: Find the 2’s complement of +7 and -7
Note that 2’s complement of any given positive number is the same as sign
magnitude representation of a given number.
+7 ← Given Number
0111 ← 2’s complement of +7.
∴ 2’s complement of +7 is 0111.

Sikkim Manipal University B2072 Page No.: 49


Digital Electronics Unit 2

We know that +7 is represented in binary number as: 0111. The 2’s


complement of this binary gives 2’s complement of -7. This is illustrated as
below:

0111 ← binary representation of +7


1000 ← 1’s complement of 0111
+ 1 ← Add 1

1001 ← 2’s complement of 0111= -7.

∴ 2’s complement of -7 is 1001.


The major advantage of 2's complement over 1's complement is that 2's
complement has only one value for zero. One's complement has a "positive"
zero and a "negative" zero which is the disadvantage of 1's complement.
Also note that there is no addition of end around carry in 2’s complement
method.
Self-Assessment Questions
9. The binary additions of 1 + 1 + 1 = ____________.
10. When we subtract 1 from 0, (i.e. 0-1), we require a borrow from the
next higher column. (State true or false)
11. In sign magnitude form, the number (10100)2 represents ___________
in decimal.= (─ 4)10
12. 1’s complement of Binary number 101010 is ___________________.
13. The 2’s complement of Binary number 00101 is _______________.
14. 2’s complement is not used to represent negative numbers. (State true
or false)

2.7 Complement Arithmetic


We can use circuits designed for binary addition to perform binary
subtraction. But it requires that we have to change subtraction problem into
an equivalent addition problem. We can perform these types of subtractions
by using 1’s and 2’s complement methods wherein we perform the
subtraction using addition. This is a powerful yet simple technique which
minimizes the hardware implementation of signed arithmetic operations.

Sikkim Manipal University B2072 Page No.: 50


Digital Electronics Unit 2

In any number system, complements are available. For example, in case of


decimal number system, we have two complements:
a) 10's complement or radix complement
b) 9's complement or diminished radix complement.
Similarly in case of binary number system, we have two types of
complements:
a) 2's complement or radix complement
b) 1's complement or diminished radix complement.
We have already studied the above complements. It is worth noting that the
use of the 1's complement in the binary system raises certain hardware
implementation difficulties. So signed arithmetic processes are invariably
performed using 2's complement notation.
Now let us study subtraction using 1’s and 2’s complements.
1’s complement Subtraction: The procedure for 1’s complement
subtraction is as follows.
1) Take the 1’s complement of the subtrahend.
2) Add the 1’s complement of the subtrahend to the minuhend.
3) If a carry is generated after addition, then the result is positive. This
carry is called end around carry. Remove this end around carry and
add it to the result to get the final answer( or final result)
4) If there is no carry generation after addition, then the result is negative
and it is in 1’s complement form. So get the 1’s complement of the
result and attach negative sign. This will give the final answer (or true
result).
Note that if the subtrahend is larger, there is no carry generation.
Example 2.50: Subtract (1001)2 from (1101)2 using the 1’s complement
method. Also show the direct subtraction and compare.

Sikkim Manipal University B2072 Page No.: 51


Digital Electronics Unit 2

Comparing both the direct and 1’s complement subtraction methods, we get
the same result. This means, we can do the subtraction by addition in 1’s
complement method.
Example 2.51: Subtract (1101)2 from (1001)2 using the 1’s complement
method. Also show the direct subtraction and compare.

Comparing both the direct and 1’s complement subtraction methods, we get
the same result.
Example 2.52: Compute Binary arithmetic operation for 19 – 5 using 1’s
complement.

2’s complement Subtraction: The procedure for 2’s complement


subtraction is as follows.
1) Take the 2’s complement of the subtrahend.
2) Add the 2’s complement of the subtrahend to the minuhend.
3) If there is a carry after addition, then the result is positive. Ignore or
discard this end around carry. The remaining bits give the final result.
4) If the there is no carry after addition, then the result is negative and it
is in 2’s complement form. So get the 2’s complement of the result and
attach negative sign. This will give the final result or final answer in
true form.
Note that if the subtrahend is larger, there is no carry generation.

Sikkim Manipal University B2072 Page No.: 52


Digital Electronics Unit 2

Example 2.53: Subtract (1001)2 from (1101)2 using the 2’s complement
method. Also show the direct subtraction and compare.

Comparing both the direct and 2’s complement subtraction methods, we get
the same result. This means, we can do the subtraction by addition in 2’s
complement method.
Example 2.54: Subtract (1101)2 from (1001)2 using the 2’s complement
method. Also show the direct subtraction and compare

Example 2.55: Compute binary arithmetic operation for 19 – 5 using 2’s


complement.

Sikkim Manipal University B2072 Page No.: 53


Digital Electronics Unit 2

Example 2.56: Perform the binary subtraction of 1000-10011 using 2’s


complement method. Also show the direct subtraction method.

Direct subtraction 2’s complement method

0 1 0 0 0 = 8 ←Minuend 1 0 0 1 1← Minuend
– 1 0 0 1 1 = - 19 ← Subtrahend +0 1 1 0 1← 2’s complement of
Subtrahend
0 1 0 1 1 =11 ← Final result 1 0 1 0 1 ← End around carry:
The result is positive.
∴ 0 1 1 1 0 ← Final result.

Self-Assessment Questions
15. In 1’s complement subtraction, we take the 1’s complement of the
minuend. (State true or false)
16. In 1’s complement subtraction, if there is a carry after addition, then the
result is ________________.
17. When we subtract (1101)2 from (1001)2 using 2’s complement method,
the result is in ______________ form.
18. 2’s complement subtraction of 10001- 1001= _______________.

2.8 Summary
Let us recapitulate the important concepts discussed in this unit:
 The number system is a collection of number to represent different
quantities.
 The most important types of number system are: Decimal, binary, octal,
and hexadecimal.
 The base (or radix) of a number system is the number of different digits
(or symbols) available within that number system.
 Binary number system has only two digits or symbols 0 and 1. So its
base is 2.
 Any given octal number can be converted to its equivalent hexadecimal
number by first converting the given octal number to its equivalent
binary number and then converting this resulting binary number to its
equivalent hexadecimal number.
Sikkim Manipal University B2072 Page No.: 54
Digital Electronics Unit 2

 When we subtract 1 from 0, (i.e. 0-1), we require a borrow from next


higher column.
 The negative number can be represented in sign magnitude, 1’s
complement and 2’s complement forms.
 2’s complement is obtained by complementing the binary digits i.e. bits
and then adding 1 to it.
 The major advantage of 2's complement over 1's complement is that 2's
complement has only one value for zero.

Glossary:
Number system: Collection of number to represent different quantities.
Base: Represent the number of different digits (or symbols) available within
that number system.
Binary number: Number that comprise of 0s and 1s.
End around carry: A carry generated in 1’s complement subtraction
method which indicates the result is positive.

2.9 Terminal Questions


1. What is a number system? Explain.
2. List and explain the types of number systems.
3. Explain the octal to binary conversion
4. Perform the following
(a) Convert decimal number 100 to binary number
(b) Convert the 61358 into its equivalent binary value
(c) Convert 1A2C.3B4D16 into octal equivalent.
5. Multiply (00101001)2 × (110) 2.
6. What are the methods of representing negative numbers? Explain.
7. Perform the following subtractions using 1’s and 2’s complement
methods.
(a) (1101)2 - (1001)2
(b) (10011)2 - (1101)2

Sikkim Manipal University B2072 Page No.: 55


Digital Electronics Unit 2

2.10 Answers
Self-Assessment Questions
1. True
2. False
3. Switch
4. 10
5. Binary number
6. 16
7. 100.26510
8. 1A2C.3B4D
9. (11)2
10. True
11. (─ 4)10
12. 010101
13. 11011
14. False
15. False
16. Positive
17. 2’s complement
18. 1000

Terminal Questions
1. The number system is a collection of number to represent different
quantities. Refer to section 2.2.
2. The types of number systems are: decimal, binary, octal and
hexadecimal. Refer to section 2.3 for more details.
3. To convert any given octal number to its equivalent binary number,
simply replace each octal digit by its equivalent three bit binary value.
Refer to section 2.4 for more details
4. (a) 100 =(1100100 )2
(b) (6135)8 = (110001011101)2
(c) 1A2C.3B4D16 = 1A2C.3B4D16 = (15054.166464)8
Refer to section 2.4 for more details.
5. 00101001 × 110 = 11110110. Refer to section 2.5.

Sikkim Manipal University B2072 Page No.: 56


Digital Electronics Unit 2

6. The methods of representing negative numbers are: sign magnitude


representation, 1’s complement method and 2’s complement method.
Refer to section 2.6.
7. (a) (1101)2 - (1001)2 =(0100)2
(b) (10011)2 - (1101)2 = (0110)2
Refer to section 2.7 for more details.

Sikkim Manipal University B2072 Page No.: 57

You might also like