Lecture Notes on Number Systems
for
Open Educational Resource
on
Basic Electronics (EC101)
by
Dr. Piyush Charan
Assistant Professor
Department of Electronics and Communication Engg.
Integral University, Lucknow
Introduction to Number Systems
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
2
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
3
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
4
Binary Number System
Base Radix = 2
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
5
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
6
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
7
Conversion Decimal to Binary
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
8
Conversion Decimal to Binary with
decimal points
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
9
Hexadecimal to Binary
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
10
Binary to Hexadecimal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
11
Decimal to Octal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
12
Decimal to Hexadecimal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
13
Decimal to Hexadecimal with
Decimal Point
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
14
Hexadecimal to Decimal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
15
Hexadecimal to Decimal with
Decimal Point
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
16
Octal to Decimal with Decimal
Point
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
17
Octal to Decimal with
Decimal Point
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
18
Binary to Octal with
floating point values
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
19
Octal to Binary with
floating point values
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
20
Hexadecimal to Octal
Conversion
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
21
Octal to Hexadecimal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
22
Octal to Hexadecimal
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
23
Octal(base=8)
Decimal to Octal
8 98 2
8 12 4
8 1 1
0
Octal number system has the
radix 8 and will have
numbers starting from
0 → 7
(98)10→ (142)8
January 1, 2021 24
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Octal(base=8)
Octal to Decimal
1 4 2
2 1 0
(142)8 →(98)10
1×8^2+4×8^1+2×8^0
=1×64+32+2
=98
January 1, 2021 25
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Binary to Octal
• 0→000
• 1→001
• 2→010
• 3→011
• 4→100
• 5→101
• 6→110
• 7→111
2 7 1
2 3 1
2 1 1
0
January 1, 2021 26
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Binary to Octal Conversion
• (100001110011)2→(4163)8
1 0 0 0 0 1 1 1 0 0 1 1
4 1 6 3
January 1, 2021 27
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Octal to Hexadecimal
• (4163)8 → (?)16
1 0 0 0 0 1 1 1 0 0 1 1
4 1 6 3
1 0 0 0 0 1 1 1 0 0 1 1
8 7 3
January 1, 2021 28
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
29
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
30
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
31
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
32
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
33
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
34
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
35
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
36
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
37
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
38
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
39
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
40
January 1, 2021
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
41
42
1. Complement Theory
2. 1’s and, 2’s complement operation
Number System Continued....
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
43
1.Complement Theory
Example 1 Get 1’s complement of 50
Complement Digits
50 = 110010

001101
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
44
1’s Complement Arithmetic
(ADD/SUB Method)
1. Read both the operands
2. Negative operand(s) (if any) is converted into 1’s complement form
3. Add both the numbers
4. If carry is generated (i.e. =1) then the resultant number is positive.
5. Add ONE to the output of setp4, to get the final answer.
6. If carry is not generated then the answer is Negative and available in 1’s complement form.
7. Convert output of step 6 into 1’s complement to get final answer.
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
45
1. 1’s Complement Theory
Example 1 : Subtract 1010 from 1111 using 1’s complement theory. (15-
10 Small negative)

1 0 1 0 0 1 0 1
1 1 1 1
0 1 0 1
+
1] 0 1 0 0
+ 0 0 0 1
0 1 0 1 =(5)
1’s complement
Carry “1” means the answer is positive .
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
46
1. 1’s Complement Theory
Example 2 : Subtract 1010 from 1000 using 1’s complement theory.
(Large negative 8-10)
1 0 1 0 0 1 0 1
1 0 0 0
0 1 0 1
+
0] 1 1 0 1
1’s complement
Carry “0” means the answer is negative and available in 1’s complement form.
1 1 0 1 0 0 1 0 = (2)
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
47
2’s Complement Arithmetic
1. How to get 2’s complement form
2. Arithmetic operation using 2’s complement theory
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
48
2’s Complement Arithmetic (How to get 2’s
complement form..?)
Example 1
Example 2
Complement Digits
Add 1
5 = 00000101
-5 = 11111011

11111010
+1
Complement Digits
Add 1
-13 = 11110011
13 = 00001101

00001100
+1
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
49
2’s Complement Arithmetic
(Method)
1. Read both the operands
2. Negative operand (if any) is converted into 2’s complement form
3. Add both the numbers (2’s complement of negative operand with the other one).
4. If carry is generated (i.e. =1) then the resultant number is positive and in original form
5. If carry is not generated(when we have negative operand) then the carry is assumed =0.
6. Carry zero means the resultant number is negative and in a 2’s complement form.
7. Convert the 2’s complement form into the original form.
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
POS + NEG → POS Answer
50
Take the 2’s complement of the negative number and use regular binary 8-bit
addition.
00001001
9
+ (-5)
4
⎯→
⎯
11111011
+
00000101

11111010
+1
11111011
2’s
Complement
Process
100000100
Last Bit = 1: Answer is Positive Disregard 9th Bit
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
POS + NEG → NEG Answer
51
Take the 2’s complement of the negative number and use regular 8-bit
binary addition.
11110111
(-9)
+ 5
-4
⎯→
⎯
00000101
+
00001001

11110110
+1
11110111
2’s
Complement
Process
011111100
Last Bit = 0: Answer is Negative . Discard the last bit
11111100

00000011
+1
00000100
To Check:
Perform 2’s
Complement
On Answer
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Verify the logic using following combinations:
1: (10) –(01)
2: (10) –(02)
3: (10) –(05)
4: (10) –(08)
5: (10) –(09)
6: (10) –(10)
7: (210) –(08)
8: (120) –(55)
9: (52) –(18)
January 1, 2021 52
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
A+B A B 2’s of B Addition Ans
A=10
B=-1
1 0 1 0
0 0 0 1 1 1 1 0
0 0 0 1
1 1 1 1
1 0 1 0
1 1 1 1 CY =1 So ans is +ve
1 1 0 0 1
+9
B=-2 0 0 1 0 1 1 0 1
0 0 0 1
1 1 1 0
1 0 1 0
1 1 1 0 CY =1 So ans is +ve
1 1 0 0 0
+8
B=-5 0 1 0 1 1 0 1 0
0 0 0 1
1 0 1 1
1 0 1 0
1 0 1 1
1 0 1 0 1 CY =1 So ans is +ve
+5
B=-8 1 0 0 0 0 1 1 1
0 0 0 1
1 0 0 0
1 0 1 0
1 0 0 0
1 0 0 1 0 CY =1 So ans is +ve
+2
B=-9 1 0 0 1 0 1 1 0
0 0 0 1
0 1 1 1
1 0 1 0
0 1 1 1
1 0 0 0 1 CY =1 So ans is +ve
+1
B=-10 1 0 1 0 0 1 0 1
0 0 0 1
0 1 1 0
1 0 1 0
0 1 1 0
1 0 0 0 0 CY =1 So ans is +ve
+0
2’s Complement Arithmetic (Examples)
January 1, 2021
53
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Example: Perform 2’s complement subtraction on 210-08
210 = 1 1 0 1 0 0 1 0 (Subtrahend)
8= 0 0 0 0 1 0 0 0 (Minuend)
2’s complement of 8 is = 1 1 1 1 1 0 0 0
Add both the numbers:
1 1 0 1 0 0 1 0
+1 1 1 1 1 0 0 0
1 1 1 0 0 1 0 1 0
Carry = 1 means and is positive +202
January 1, 2021 54
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
55
2’s Complement Arithmetic (Examples on varying
number of bits)
Example: Perform 2’s complement arithmetic for (30)-(50) using
1: 6-bit number system
2: 8-bit number system
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Example: Perform 2’s complement arithmetic for (30)-(50)
using:
(30)= 0 1 1 1 1 0
(-50)= 1 1 0 0 1 0 2’s complement 0 0 1 1 0 1
0 0 0 0 0 1
0 0 1 1 1 0
Add both the numbers
0 1 1 1 1 0
0 0 1 1 1 0
0 1 0 1 1 0 0
Carry =0 means number is negative and in 2’s compl form
(30)= 0 0 0 1 1 1 1 0
(-50)= 0 0 1 1 0 0 1 0 2’s complement 1 1 0 0 1 1 0 1
0 0 0 0 0 0 0 1
1 1 0 0 1 1 1 0
0 0 0 1 1 1 1 0
1 1 0 0 1 1 1 0
0 1 1 1 0 1 1 0 0
Carry =0 means number is negative and in 2’s compl form
0 1 0 0 1 1
0 0 0 0 0 1
0 1 0 1 0 0 = -20
0 0 0 1 0 0 1 1
0 0 0 0 0 0 0 1
0 0 0 1 0 1 0 0 = -20
Add both the numbers
1: 6-bit number system 2: 8-bit number system
January 1, 2021 56
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
BCD Numbers
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 57
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 58
1. Binary to decimal Conversion
2. BCD Addition
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 59
9’s & 10’s Complement
January 1, 2021 60
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Decimal(base 10) Addition
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 61
Octal (base 8) Addition
January 1, 2021 62
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Hexadecimal(base 16) Addition
January 1, 2021 63
Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
Hexadecimal Number System
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 64
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 65
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 66
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 67
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 68
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 69
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 70
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 71
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 72
Assignment Question
Q. Solve for x:
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 73
Assignment Solution
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 74
January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 75

Unit 4_Part 1_Number System

  • 1.
    Lecture Notes onNumber Systems for Open Educational Resource on Basic Electronics (EC101) by Dr. Piyush Charan Assistant Professor Department of Electronics and Communication Engg. Integral University, Lucknow
  • 2.
    Introduction to NumberSystems January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 2
  • 3.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 3
  • 4.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 4
  • 5.
    Binary Number System BaseRadix = 2 January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 5
  • 6.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 6
  • 7.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 7
  • 8.
    Conversion Decimal toBinary January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 8
  • 9.
    Conversion Decimal toBinary with decimal points January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 9
  • 10.
    Hexadecimal to Binary January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 10
  • 11.
    Binary to Hexadecimal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 11
  • 12.
    Decimal to Octal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 12
  • 13.
    Decimal to Hexadecimal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 13
  • 14.
    Decimal to Hexadecimalwith Decimal Point January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 14
  • 15.
    Hexadecimal to Decimal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 15
  • 16.
    Hexadecimal to Decimalwith Decimal Point January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 16
  • 17.
    Octal to Decimalwith Decimal Point January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 17
  • 18.
    Octal to Decimalwith Decimal Point January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 18
  • 19.
    Binary to Octalwith floating point values January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 19
  • 20.
    Octal to Binarywith floating point values January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 20
  • 21.
    Hexadecimal to Octal Conversion January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 21
  • 22.
    Octal to Hexadecimal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 22
  • 23.
    Octal to Hexadecimal January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 23
  • 24.
    Octal(base=8) Decimal to Octal 898 2 8 12 4 8 1 1 0 Octal number system has the radix 8 and will have numbers starting from 0 → 7 (98)10→ (142)8 January 1, 2021 24 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 25.
    Octal(base=8) Octal to Decimal 14 2 2 1 0 (142)8 →(98)10 1×8^2+4×8^1+2×8^0 =1×64+32+2 =98 January 1, 2021 25 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 26.
    Binary to Octal •0→000 • 1→001 • 2→010 • 3→011 • 4→100 • 5→101 • 6→110 • 7→111 2 7 1 2 3 1 2 1 1 0 January 1, 2021 26 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 27.
    Binary to OctalConversion • (100001110011)2→(4163)8 1 0 0 0 0 1 1 1 0 0 1 1 4 1 6 3 January 1, 2021 27 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 28.
    Octal to Hexadecimal •(4163)8 → (?)16 1 0 0 0 0 1 1 1 0 0 1 1 4 1 6 3 1 0 0 0 0 1 1 1 0 0 1 1 8 7 3 January 1, 2021 28 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 29.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 29
  • 30.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 30
  • 31.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 31
  • 32.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 32
  • 33.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 33
  • 34.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 34
  • 35.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 35
  • 36.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 36
  • 37.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 37
  • 38.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 38
  • 39.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 39
  • 40.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 40
  • 41.
    January 1, 2021 Dr.Piyush Charan, Dept. of ECE, Integral University, Lucknow 41
  • 42.
    42 1. Complement Theory 2.1’s and, 2’s complement operation Number System Continued.... January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 43.
    43 1.Complement Theory Example 1Get 1’s complement of 50 Complement Digits 50 = 110010  001101 January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 44.
    44 1’s Complement Arithmetic (ADD/SUBMethod) 1. Read both the operands 2. Negative operand(s) (if any) is converted into 1’s complement form 3. Add both the numbers 4. If carry is generated (i.e. =1) then the resultant number is positive. 5. Add ONE to the output of setp4, to get the final answer. 6. If carry is not generated then the answer is Negative and available in 1’s complement form. 7. Convert output of step 6 into 1’s complement to get final answer. January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 45.
    45 1. 1’s ComplementTheory Example 1 : Subtract 1010 from 1111 using 1’s complement theory. (15- 10 Small negative)  1 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1 + 1] 0 1 0 0 + 0 0 0 1 0 1 0 1 =(5) 1’s complement Carry “1” means the answer is positive . January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 46.
    46 1. 1’s ComplementTheory Example 2 : Subtract 1010 from 1000 using 1’s complement theory. (Large negative 8-10) 1 0 1 0 0 1 0 1 1 0 0 0 0 1 0 1 + 0] 1 1 0 1 1’s complement Carry “0” means the answer is negative and available in 1’s complement form. 1 1 0 1 0 0 1 0 = (2) January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 47.
    47 2’s Complement Arithmetic 1.How to get 2’s complement form 2. Arithmetic operation using 2’s complement theory January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 48.
    48 2’s Complement Arithmetic(How to get 2’s complement form..?) Example 1 Example 2 Complement Digits Add 1 5 = 00000101 -5 = 11111011  11111010 +1 Complement Digits Add 1 -13 = 11110011 13 = 00001101  00001100 +1 January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 49.
    49 2’s Complement Arithmetic (Method) 1.Read both the operands 2. Negative operand (if any) is converted into 2’s complement form 3. Add both the numbers (2’s complement of negative operand with the other one). 4. If carry is generated (i.e. =1) then the resultant number is positive and in original form 5. If carry is not generated(when we have negative operand) then the carry is assumed =0. 6. Carry zero means the resultant number is negative and in a 2’s complement form. 7. Convert the 2’s complement form into the original form. January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 50.
    POS + NEG→ POS Answer 50 Take the 2’s complement of the negative number and use regular binary 8-bit addition. 00001001 9 + (-5) 4 ⎯→ ⎯ 11111011 + 00000101  11111010 +1 11111011 2’s Complement Process 100000100 Last Bit = 1: Answer is Positive Disregard 9th Bit January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 51.
    POS + NEG→ NEG Answer 51 Take the 2’s complement of the negative number and use regular 8-bit binary addition. 11110111 (-9) + 5 -4 ⎯→ ⎯ 00000101 + 00001001  11110110 +1 11110111 2’s Complement Process 011111100 Last Bit = 0: Answer is Negative . Discard the last bit 11111100  00000011 +1 00000100 To Check: Perform 2’s Complement On Answer January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 52.
    Verify the logicusing following combinations: 1: (10) –(01) 2: (10) –(02) 3: (10) –(05) 4: (10) –(08) 5: (10) –(09) 6: (10) –(10) 7: (210) –(08) 8: (120) –(55) 9: (52) –(18) January 1, 2021 52 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 53.
    A+B A B2’s of B Addition Ans A=10 B=-1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 CY =1 So ans is +ve 1 1 0 0 1 +9 B=-2 0 0 1 0 1 1 0 1 0 0 0 1 1 1 1 0 1 0 1 0 1 1 1 0 CY =1 So ans is +ve 1 1 0 0 0 +8 B=-5 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 CY =1 So ans is +ve +5 B=-8 1 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 CY =1 So ans is +ve +2 B=-9 1 0 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 0 0 1 CY =1 So ans is +ve +1 B=-10 1 0 1 0 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 0 CY =1 So ans is +ve +0 2’s Complement Arithmetic (Examples) January 1, 2021 53 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 54.
    Example: Perform 2’scomplement subtraction on 210-08 210 = 1 1 0 1 0 0 1 0 (Subtrahend) 8= 0 0 0 0 1 0 0 0 (Minuend) 2’s complement of 8 is = 1 1 1 1 1 0 0 0 Add both the numbers: 1 1 0 1 0 0 1 0 +1 1 1 1 1 0 0 0 1 1 1 0 0 1 0 1 0 Carry = 1 means and is positive +202 January 1, 2021 54 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 55.
    55 2’s Complement Arithmetic(Examples on varying number of bits) Example: Perform 2’s complement arithmetic for (30)-(50) using 1: 6-bit number system 2: 8-bit number system January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 56.
    Example: Perform 2’scomplement arithmetic for (30)-(50) using: (30)= 0 1 1 1 1 0 (-50)= 1 1 0 0 1 0 2’s complement 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 Add both the numbers 0 1 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 0 0 Carry =0 means number is negative and in 2’s compl form (30)= 0 0 0 1 1 1 1 0 (-50)= 0 0 1 1 0 0 1 0 2’s complement 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 Carry =0 means number is negative and in 2’s compl form 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 0 0 = -20 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 = -20 Add both the numbers 1: 6-bit number system 2: 8-bit number system January 1, 2021 56 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 57.
    BCD Numbers January 1,2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 57
  • 58.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 58
  • 59.
    1. Binary todecimal Conversion 2. BCD Addition January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 59
  • 60.
    9’s & 10’sComplement January 1, 2021 60 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 61.
    Decimal(base 10) Addition January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 61
  • 62.
    Octal (base 8)Addition January 1, 2021 62 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 63.
    Hexadecimal(base 16) Addition January1, 2021 63 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 64.
    Hexadecimal Number System January1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 64
  • 65.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 65
  • 66.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 66
  • 67.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 67
  • 68.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 68
  • 69.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 69
  • 70.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 70
  • 71.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 71
  • 72.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 72
  • 73.
    Assignment Question Q. Solvefor x: January 1, 2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 73
  • 74.
    Assignment Solution January 1,2021 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 74
  • 75.
    January 1, 2021Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 75