Digital Circuit Design
18B11EC215
Lecture 2
Number System
1
Outline
■Types of Number System
■Positional Number System
■Conversions
2
Number Systems[1]
■ In digital technology, we use many number systems.
■ Decimal
■ Binary
■ Octal
■ Hexadecimal
■ These are also called Positional number systems.
3
Positional Notation[1]
■ Value of number is determined by multiplying each digit by a weight and then
summing.
■ The weight of each digit is a POWER of the BASE and is determined by position.
4
Example
■ A Decimal Number such as 1234
■ Represent a quantity equal to one thousand
■ Plus two hundred
■ Plus 3 tens
■ Plus 4 units
5
■ Thousands, hundreds etc. are the powers of 10 implied by the position of the
coefficients
To be more exact 1234 should be written as
1 * 103 + 2 * 102 + 3 * 101 + 4 * 100
■ In general, a number with decimal point is represented by a series of coefficients
as follows
……..a5a4a3a2a1a0 . a-1a-2a-3…….
■ The coefficient aj are one of the ten digits (0-9)
■ The subscript value j give the place value and hence power of 10 by which the
coefficient must be multiplied.
6
The decimal number system (base 10) you should be familiar with!
■ A digit in base 10 ranges from 0 to 9.
■ A digit in base 2 ranges from 0 to 1 (binary number system).
A digit in base 2 is also called a “bit”.
■ A digit in base 8 ranges from 0 to 7 (Octal number system).
■ A digit in Base 16 can range from 0 to 15. (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).
Use letters A-F to represent values 10 to 15. Base 16 is also called
Hexadecimal or just “Hex”.
■ A digit in base R can range from 0 to (R-1).
7
Representation :Base 10, Base 2, Base 16
953.7810 = 9 x 102 + 5 x 101 + 3 x 100 + 7 x 10-1 + 8 x 10-2
= 900 + 50 + 3 + .7 + .08 = 953.78
1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2
= 8 + 0 + 2 + 1 + 0.5 + 0.25
= 11.75
A2F16 = 10x162 + 2x161 + 15x160
= 10 x 256 + 2 x 16 + 15 x 1
= 2560 + 32 + 15 = 2607
8
Conversion of Any Base to Decimal[1]
Converting from ANY base to decimal is done by multiplying each
digit by its weight and then adding.
■ Binary to Decimal
1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2
= 8 + 0 + 2 + 1 + 0.5 + 0.25
= 11.75
■ Hex to Decimal
A2F16 = 10x162 + 2x161 + 15x160
= 10 x 256 + 2 x 16 + 15 x 1
= 2560 + 32 + 15 = 2607
9
Examples[2]
1. Convert (313.42)8 =(?)10
Ans :(203.531)10
2. Convert (3A.2F)16 =(?)10
Ans :(58.1836)10
10
Conversion of Decimal Integer To Any
Base[1,2]
■ Divide Number N by base R until quotient is 0.
■ Remainder at EACH step is a digit in base R, from Least Significant digit to Most
significant digit.
11
Conversion of Decimal Integer To ANY Base Example
■ Convert 53 to binary bottom to top
53/2 = 26, rem = 1 Least Significant Digit
26/2 = 13, rem = 0
13/2 = 6 , rem = 1
6 /2 = 3, rem = 0
3/2 = 1, rem = 1
1/2 = 0, rem = 1
Most Significant Digit
5310 = 1101012
= 1x25 + 1x24 + 0x23 + 1x22 + 0x21 + 1x20
= 32 + 16 + 0 + 4 + 0 + 1 = 53
12
Conversion of Decimal fraction To Any Base Example[1]
■ Decimal fraction to Binary
■ It is accomplished by a method similar to that used for integers.
■ Multiplication is used instead of division.
■ Integers are accumulated instead of remainders.
13
■ To Convert a decimal fraction to a number expressed in base r , a similar
procedure is used.
■ Multiplication by r instead of 2.
■ The coefficient found from the integers may range in values from 0 to r-1
instead of 0 and 1.
14
Example[3]
■ Convert (0.6875)10 into binary top to bottom
Integer Fraction Coefficient
0.6875 * 2 = 1 + 0.3750 a-1= 1
0.3750 * 2 = 0 + 0.7500 a-2= 0
0.7500 * 2 = 1 + 0.5000 a-3= 1
0.5000 * 2 = 1 + 0.0000 a-4= 1
Answer: (0.6875)10 = ( 0.a-1a-2a-3a-4)2= (0.1011)2
15
Example[1]
■ Convert (0.513)10 into octal.
Integer Fraction Coefficient
0.513 * 8 = 4 + 0.104 a-1= 4
0.104 * 8 = 0 + 0.832 a-2= 0
0.832 * 8 = 6 + 0.656 a-3= 6
0.656 * 8 = 5 + 0.248 a-4= 5
0.248 * 8 = 1 + 0.984 a-4= 1
0.984 * 8 = 7 + 0.872 a-4= 7
= ( 0.a-1a-2a-3a-4a-5a-6….) 8
Answer: (0.513)10
= ( 0.406517……)8 16
Example[2]
■ Convert (266.51)10 into octal.
Answer: (412.40)8
17
Direct conversion from binary to octal
■ Binary numbers can be converted into equivalent octal numbers by making
groups of three bits starting from LSB and moving towards MSB for integer part
of the number
■ Then replacing each group of three bits by its octal representation.
■ For fractional part, the groupings of three bits are made starting from the binary
point.
■ If last group does not have 3 bits, then pad with zeros
18
Octal equivalent of 3 bit binary Number
Octal Digits to binary:
08 = 0002
18 = 0012
28 = 0102
38 = 0112
48 = 1002
58 = 1012
68 = 1102
78 = 1112
19
Example
Convert (011001110001)2 into octal
Form the group of 3 bits starting from LSB and moving towards MSB
■
011 001 110 001
Write the octal equivalent of group of 3 bit binary number at their respective places
■
3161
■
(011001110001)2 = ( 3161 )8
■
20
Example
Convert (1001110001.100)2 into octal
Grouping of 3-bits (LSB To MSB) for integer part
■
■ from binary point for fractional part
001 001 110 001 . 100
Padded with a zeros
Write the octal equivalent of group of 3 bit binary number at their respective
places
( 001 001 110 001 . 100 )2 = ( 1 1 6 1 . 4 )8
21
Direct conversion from binary to Hexa
decimal
■ Binary numbers can be converted into equivalent Hex numbers by making
groups of four bits starting from LSB and moving towards MSB for integer part
of the number
■ Then replacing each group of four bits by its Hex representation.
■ For fractional part, the groupings of four bits are made starting from the binary
point.
■ If last group does not have 4 bits, then pad with zeros
22
Hex equivalent of 4 bit binary Number
Hex Digits to Hex Digits to binary
binary: (cont):
016 = 00002 916 = 10012
116 = 00012 A16 = 10102
216 = 00102 B16 = 10112
316 = 00112 C16 = 11002
416 = 01002 D16 = 11012
516 = 01012 E16 = 11102
616 = 01102 F16 = 11112
716 = 01112
816 = 10002
23
Example[2]
Convert (1111010010.10101)2 into hexadecimal
■ We can add extra zero’s to the left of the MSB and right of the
LSB of the number.
■ Grouping of 4-bits (LSB To MSB) for integer part.
■ Write the hexadecimal equivalent of group of 4 bit binary
numbers at their respective places.
■ Ans: (3D2.A8 )16
24
Example [2]
Find the value of y if (132)y=(10011101)2
Ans : Convert the given base -2 into base -10
(10011101)2 =(?)10
=(157)10
Now, (132)y =(157)10
2 1 0
1 x y +3 x y +2 x y =157
y2 +3y+2= 157
2 25
y + 3y-155=0
References
[1] M. Morris Mano and Michael D. Ciletti, “Digital Design with an Introduction to the
Verilog HDL,” 5th Edition, Pearson Education,2013.
[2] Reshu Gupta, Amit Gupta ,Atul Kumar Sharma “ Switching Theory(Digital
Electronics)”, Tech India Publication Series, Satya Prakashan, New Delhi.
[3] R. P. Jain, “Modern Digital Electronics,” 4th Edition, Tata McGraw-Hill Education,
2009.
26