Introduction to Number System
Subject: Digital Logic Design Cource Code: EC201
Semester: III Unit: 1
Dr. Varun Kumar
varun kumar@[Link]
Indian Institute of Information Technology, Vadodara
International Campus Diu (IIITV-ICD)
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
1 / 11
Outlines
1 Introduction to Number System
2 Binary Number System
Binary to Decimal and Decimal to Binary Conversion
3 Binary Addition and Subtraction
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
2 / 11
Introduction to number system
⇒ Decimal system
⇒ A number system having base is 10
⇒ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
⇒ (359)10 → 3 × 102 + 5 × 101 + 9 × 100 ← Integer number
⇒ (321.25)10 → 3 × 102 + 2 × 101 + 1 × 100 + 2 × 10−1 + 5 × 10−2 ←
Non integer.
⇒ Octal system
⇒ A number system having base is 8
⇒ 0, 1, 2, 3, 4, 5, 6, 7
⇒ (abc)8
⇒ Binary system
⇒ A number system having base is 2
⇒ 0, 1
⇒ (abc)2
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
3 / 11
Continued–
⇒ Hexadecimal system
⇒ A number system having base is 16
⇒ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
⇒ (abc)16
Conversion of different number system
⇒ Octal to Decimal
Q (123)8 → (abc)10 ???
Ans 1 × 82 + 2 × 81 + 3 × 80 = (83)10
⇒ Decimal to Octal
Q (123)10 → (abc)8 ???
Ans 123 ÷ 8 → 3 (remainder)
15 ÷ 8 → 7 (remainder)
1 ÷ 8 → 1 (remainder)
a=1,b=7,c=3 or (123)10 → (173)8
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
4 / 11
Continued–
⇒ Binary to Decimal
Q (101011)2 → (abc)10 ???
Ans 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = (43)10
⇒ Decimal to Binary
Q (11)10 → (abc)2 ???
Ans 11 ÷ 2 → 1 (remainder)
5 ÷ 2 → 1 (remainder)
2 ÷ 2 → 0 (remainder)
1 ÷ 2 → 1 (remainder)
(11)10 → (1011)2 Bottom→ MSB
⇒ Octal to Binary
Q (173)8 → (abc)2 ??
Ans |{z}
001 |{z} 011 ↔ (173)8 → (001111011)2 or (1111011)2
111 |{z}
1 7 3
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
5 / 11
Continued–
⇒ Hexadecimal to Binary
Q (173A)16 → (abc)2 ??
Ans 0001
|{z } 0111
|{z } 0011 | {z} ↔ (173A)16 → (0001011100111010)2 or
|{z } 1010
1 7 3 A
(1011100111010)2
⇒ Hexadecimal to Octal
Q (173A)16 → (abc)8 ??
Ans Make a group of 3-bit in binary or multiple of 3.
⇒ Add or remove bits from MSB to make bit stream into the multiple of 3
⇒ |{z } 0111
0001 |{z } 0011 | {z} ↔ (173A)16 → (0001011100111010)2 →
|{z } 1010
1 7 3 A
Number of bits 16.
⇒ 0001 ≡ 001 ≡ 01 ≡ 1 or (1011100111010)2
⇒ |{z}
001 |{z}
011 |{z}
100 |{z} 010 ↔ (173A)16 → (13472)8
111 |{z}
1 3 4 7 2
⇒
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
6 / 11
Some popular relations
1 byte = 8 bit
1 nibble= 4 bit
1 byte= 2 nibble
Each hexadecimal number is denoted by 1 nibble.
1 Kb= 1024 bit
1 Mb= 1024 Kb or 220 bit
1 Gb= 1024 Mb or 220 Kb or 230 bit
1 Tb= 1024 Gb or 220 Mb or 230 Kb or 240 bit
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
7 / 11
Complements
⇒ 9’s complement
Q Find 9’s complement of 3465
Ans 9999-3465=6534
Q Find 9’s complement of 3465.023
Ans 999.999-3465.023=6534.976
⇒ 10’s complement
Q Find 10’s complement of 3465
Ans 10’s complement = 9’s complement+1
⇒ 1’s complement
Q Find 1’s complement of 101100
Ans 101100−→ 010011
⇒ 2’s complement
Q Find 2’s complement of 101100
Ans 2’s complement=1’s complement+1
1’s complement{101100}−→ 010011
2’s complement {101100}→ 010011+1=010100
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
8 / 11
Signed Vs unsigned numbers
⇒ Unsigned numbers → +Ve numbers
⇒ For n numbers of binary bits, the range of unsigned number is
0 ≤ M ≤ 2n − 1
⇒ Example n → 4
Lower unsigned number={0000}2 = {0}10
Upper unsigned number={1111}2 = {24 − 1 = 15}10
⇒ Signed numbers → Combination of +Ve and -Ve numbers
⇒ For n numbers of binary bits, the range of unsigned number is
−2n−1 ≤ M ≤ 2n−1 − 1
⇒ Example n → 4
Lower unsigned number={1000}2 = {−8}10
Upper unsigned number={0111}2 = {23 − 1 = 7}10
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
9 / 11
Binary addition and subtraction
⇒ Rules for binary addition are as follow
0+0=0
0+1=1
1+0=1
1+1=10 → 0 with a carry of 1.
Q Add the binary numbers 1101.101 and 111.011
Ans 1101.101
+111.011
————–
10101.000
⇒ Rules for binary addition are as follow
0-0=0, 1-1=0, 1-0=1
0-1=1 → with borrow of 1.
Q Subtract the binary numbers 1010.010 and 111.111
Ans 1010.010
-111.111
————–
0010.011
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
10 / 11
Example
1 Subtract 14 from 46 using 8 bit 2’s complement arithmetic.
2 Add -75 to +26 using the 8-bit 2’s complement arithmetic.
3 Represent -99 and -77.25 in 8-bit 1’s complement form.
4 Add -89.75 to +43.25 using 12-bit 1’s complement method.
5 Convert the following numbers with the given radix to decimal and
then to binary.
⇒ {4433}5
⇒ {1199}12
⇒ {5654}7
⇒ {1221}3
Subject: Digital Logic Design Semester:
Cource Code:
III Dr.EC201
Varun Kumar / Lecture-2 Unit: 1 Dr. Varun Kumarvarun kumar@diu
11 / 11