SlideShare a Scribd company logo
Binary Arithmetic Operations
Presented by
Dr. Shirshendu Roy
Homepage - https://digitalsystemdesign.in/
Course - Digital Electronics
Dr. Shirshendu Roy Binary Arithmetic Operations 1 / 13
Binary Addition
Value of a binary digit is either ’0’ or ’1’. Thus addition of two binary digits
can be greater than one bit. Addition of two binary bits is shown below.
0
0
0
0
+
0
1
1
0
+
1
0
1
0
+
1
1
0
1
+
Sum
Carry Sum
Carry
Sum
Carry
Sum
Carry
In binary addition, when both the digits are ’1’ then addition result is greater
than 1 bit. The extra bit is called as Carry. In this situation, Carry is
generated.
Dr. Shirshendu Roy Binary Arithmetic Operations 2 / 13
Addition of Three Bits
0
0
0
0
+
0
1
1
0
+
0
0
1
0
+
0
1
0
1
+
Sum
Carry Sum
Carry
Sum
Carry
Sum
Carry
0 0
1 1
1
0
1
0
+
1
1
0
1
+
1
0
0
1
+
1
1
1
1
+
Sum
Carry Sum
Carry
Sum
Carry
Sum
Carry
0 0
1 1
A
B
C
Dr. Shirshendu Roy Binary Arithmetic Operations 3 / 13
Binary Subtraction
Thus subtraction of two binary digits can not be greater than one bit. Sub-
traction of two binary bits is shown below.
0
0
0
0
1
1
-
1
0
1
1
1
0
Difference
1
Borrow
Difference
Difference Difference
-
0
Borrow
-
0
Borrow -
0
Borrow
In binary subtraction, bit ’1’ can not be subtracted from bit ’0’. Thus to do
this subtraction extra bit ’1’ is borrowed. The extra bit is called as Borrow.
Dr. Shirshendu Roy Binary Arithmetic Operations 4 / 13
Subtraction Operation for Three Bits (A − B − C)
0
0
0
-
0
1
1
-
0
0
1
-
0
1
0
-
0 0
1 1
1
0
1
-
1
1
0
-
1
0
0
-
1
1
1
-
0 0
1 1
1
Borrow
A
B
C
Difference Difference Difference
Difference
Difference
Difference
Difference
Difference
0
Borrow
1
Borrow
1
Borrow
1
Borrow
0
Borrow
0
Borrow
0
Borrow
Dr. Shirshendu Roy Binary Arithmetic Operations 5 / 13
Strategy for Subtraction Operation fo 3-bits
The subtraction operation for 3-bits is
A − B − C = A − (B + C)
First, B + C is evaluated and the result is subtracted from A. An example
is shown below
1
1
-
0
A
B
C
?
1
0
A
(B+C)
?
0
-
Subtraction
Not Possible
(A < (B + C))
1
0
A
(B+C) 0
-
1
Borrow
0
Difference
Dr. Shirshendu Roy Binary Arithmetic Operations 6 / 13
Addition/Subtraction using One’s Complement
There is no subtraction operation in One’s Complement Number System.
Only addition operation is carried out.
In the operation (X − Y ), X is added to −Y (represented in One’s Com-
plement Number System).
In this case, the result can be written like
X + (2n
− ulp) − Y = (2n
− ulp) + (X − Y ) (1)
where ulp = 20
= 1. This can be explained below with the value of n = 8
X + (256 − 1) − Y = 255 + (X − Y ) (2)
Example: X = 5, Y = 6 then find X − Y for n = 8.
In this case, the result is 28
− 1 + X − Y = 256 + 5 − 6 = 254.
Here, 254 is one’s complement representation of −1.
Dr. Shirshendu Roy Binary Arithmetic Operations 7 / 13
Addition/Subtraction Example in One’s Complement
0 0 1 1 0 1 1 0
1 1 0 1 0 1 1 1
+
0
1
0
1
1
0
0
0
0
1
1
1
0
1
1
1
(54)10
(−40)10
(13)10
A
B
Carry
Cout
0
1 1 0 0 1 0 0 1
0 0 1 0 1 0 0 0
+
0
1
0
0
0
1
1
1
1
0
0
0
1
0
0
0
(−54)10
(40)10
(−14)10
A
B
Carry
Sum
0
Cin Cin
Cout
0 0 1 1 0 1 1 0
+
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
(54)10
(94)10
A
B
Carry
Sum
Cout
0
1 1 0 0 1 0 0 1
+
1
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
(−54)10
(−14)90
A
B
Carry 0
Cin Cin
0 0 1 0 1 0 0 0 (40)10 1 1 0 1 0 1 1 1 (−40)10
1
+
0
1
1
1
0
0
0
0 (14)10
Sum
Cout
1
+
1
0
0
0
0
1
0
1 (−94)10
Sum
Initially Cin = 0. A correction step is required whenever Cout bit is ’1’. In
the correction step, this bit is added to the result at LSB position.
Dr. Shirshendu Roy Binary Arithmetic Operations 8 / 13
Addition/Subtraction using Two’s Complement
There is also no subtraction operation in Two’s Complement Number System.
Only addition operation is carried out.
In the operation (X − Y ), X is added to −Y (represented in Two’s Com-
plement Number System).
In this case, the result can be written like
X + 2n
− Y = 2n
+ (X − Y ) (3)
Example: X = 5, Y = 6 then find X − Y for n = 8.
In this case, the result is 28
+ X − Y = 256 + 5 − 6 = 255.
Here, 255 is two’s complement representation of −1.
Dr. Shirshendu Roy Binary Arithmetic Operations 9 / 13
Addition/Subtraction Example in Two’s Complement
0 0 1 1 0 1 1 0
1 1 0 1 1 0 0 0
+
0
0
1
1
1
0
0
0
0
1
0
0
1
1
1
1
(54)10
(−40)10
(14)10
A
B
Carry
Sum
Cout
0
1 1 0 0 1 0 1 0
0 0 1 0 1 0 0 0
+
0
0
1
0
0
1
1
1
1
0
0
0
1
0
0
0
(−54)10
(40)10
(−14)10
A
B
Carry
Sum
0
Cin Cin
Cout
0 0 1 1 0 1 1 0
+
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
(54)10
(94)10
A
B
Carry
Sum
Cout
0
1 1 0 0 1 0 1 0
+
0
0
1
0
0
0
1
0
1
1
0
0
1
1
0
1
(−54)10
(−14)90
A
B
Carry
Sum
0
Cin Cin
Cout
0 0 1 0 1 0 0 0 (40)10 1 1 0 1 1 0 0 0 (−40)10
Initially Cin = 0. Here, no correction step is required. Cout bit indicates only
overflow condition.
Dr. Shirshendu Roy Binary Arithmetic Operations 10 / 13
Binary Multiplication
Multiplication between two binary numbers A = A2A1A0 and B = B2B1B0
can be written as
S = A0 × (B2 × 22
+ B1 × 21
+ B0 × 20
) + A1 × (B2 × 22
+ B1 × 21
+
B0 × 20
) + A2 × (B2 × 22
+ B1 × 21
+ B0 × 20
) (4)
1 0 0 1 0 1
1 0 0 1
×
1 0 0 1 0 1
×
0
0
0
0
0
0
×
0
0
0
0
0
0
1 0 0 1 0 1 ×
×
×
×
0 0 1 1 0 1
1
0
1
0
(333)10
(37)10
(09)10
1 0 0 1 0 1
1 0 0 1
×
1 0 0 1 0 1
×
0
0
0
0
0
0
×
0
0
0
0
0
0
1 0 0 1 0 1 ×
×
×
×
0 0 1 1 0 1
1
0
1
0
(2.6015)10
(2.3125)10
(1.125)10
In binary multiplication, if A has n bits and B has m bits then the multipli-
cation result will have n + m + 1 bits.
If n bits and m bits are used to represent fractional part in A and B respec-
tively then m+n bits will be reserved for fractional part in the multiplication
result.
Dr. Shirshendu Roy Binary Arithmetic Operations 11 / 13
Binary Division
The basic equation of a division operation is
N = Q.D + R = Q3.23
.D + Q2.22
.D + Q1.21
.D + Q0.20
.D + R (5)
Here, N is the numerator, D is the denominator, Q is the quotient and R is
the residual. The division operation shown above is for 4-bit Quotient width.
1 1 0 0 1
1 0 1
1 0 1
1 0 1
−
1
0
0 0 1
1 0 1
−
0
0 0
0 0
1 1 1 0 1 0 0 0 0 0
1 1 0 0
1 0 1 0 0
1 1 0 0
1 0 0 0 0
1 1 0 0
1 1 0 0
0 1 0 0
1 0 0 1 1 0 1
Q
D
R
N
Dr. Shirshendu Roy Binary Arithmetic Operations 12 / 13
Thank You
Dr. Shirshendu Roy Binary Arithmetic Operations 13 / 13

More Related Content

What's hot

Number system
Number systemNumber system
Number system
Suraj Bora
 
Complements
ComplementsComplements
Complements
Sudheesh S Madhav
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
arunachalamr16
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
Arti Parab Academics
 
Presentation on Karnaugh Map
Presentation  on Karnaugh MapPresentation  on Karnaugh Map
Presentation on Karnaugh Map
Kawsar Ahmed
 
11 octal number system
11   octal number system11   octal number system
11 octal number system
Lee Chadwick
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
Imran Waris
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
Dr. Anita Goel
 
Data Representation
Data RepresentationData Representation
Data Representation
Dilum Bandara
 
Number System
Number SystemNumber System
Number System
Zahid Rajeel
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
student
 
Number System
Number SystemNumber System
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
Er. Nawaraj Bhandari
 
Binary codes
Binary codesBinary codes
Binary codes
GargiKhanna1
 
Boolean algebra & logic gates
Boolean algebra & logic gatesBoolean algebra & logic gates
Boolean algebra & logic gates
Prof. Dr. K. Adisesha
 
Binary codes
Binary codesBinary codes
Binary codes
ZareenRauf1
 
Division algorithm
Division algorithmDivision algorithm
Division algorithm
SnehalataAgasti
 
Bcd
BcdBcd
Number system
Number systemNumber system
Number system
Sajib
 
Logic gates ppt
Logic gates pptLogic gates ppt
Logic gates ppt
parassini
 

What's hot (20)

Number system
Number systemNumber system
Number system
 
Complements
ComplementsComplements
Complements
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
Presentation on Karnaugh Map
Presentation  on Karnaugh MapPresentation  on Karnaugh Map
Presentation on Karnaugh Map
 
11 octal number system
11   octal number system11   octal number system
11 octal number system
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Number System
Number SystemNumber System
Number System
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
 
Number System
Number SystemNumber System
Number System
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
 
Binary codes
Binary codesBinary codes
Binary codes
 
Boolean algebra & logic gates
Boolean algebra & logic gatesBoolean algebra & logic gates
Boolean algebra & logic gates
 
Binary codes
Binary codesBinary codes
Binary codes
 
Division algorithm
Division algorithmDivision algorithm
Division algorithm
 
Bcd
BcdBcd
Bcd
 
Number system
Number systemNumber system
Number system
 
Logic gates ppt
Logic gates pptLogic gates ppt
Logic gates ppt
 

Similar to Binary Arithmetic Operations

Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
renatus katundu
 
Chapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptxChapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptx
duttnikhil2403
 
chapter 3.pptx
chapter 3.pptxchapter 3.pptx
chapter 3.pptx
MohebMalik1
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
NUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptxNUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptx
OsenagaAirewele
 
2's complement
2's complement2's complement
2's complement
Arvenz Gavino
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
ashoksahu64
 
Chapter-3.ppt
Chapter-3.pptChapter-3.ppt
Chapter-3.ppt
TANJILURRAHMAN190901
 
Digital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdfDigital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdf
rahul143341
 
Lec20
Lec20Lec20
Binary Mathematics Classwork and Hw
Binary Mathematics Classwork and HwBinary Mathematics Classwork and Hw
Binary Mathematics Classwork and Hw
Joji Thompson
 
binary arithmetic conversion.pptx
binary arithmetic conversion.pptxbinary arithmetic conversion.pptx
binary arithmetic conversion.pptx
JayVadgama9
 
Arithmetic Logic
Arithmetic LogicArithmetic Logic
Arithmetic Logic
janani thirupathi
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
MUNAZARAZZAQELEA
 
Binary Number System and Codes
Binary Number System and CodesBinary Number System and Codes
Binary Number System and Codes
Digital System Design
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
Suganthi Vasanth Raj
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
ssuser52a19e
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
UtkirjonUbaydullaev1
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
RAJKUMARP63
 

Similar to Binary Arithmetic Operations (20)

Number system arithmetic
Number system arithmetic Number system arithmetic
Number system arithmetic
 
Chapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptxChapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptx
 
chapter 3.pptx
chapter 3.pptxchapter 3.pptx
chapter 3.pptx
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
NUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptxNUMBER BASE SYSTEM.pptx
NUMBER BASE SYSTEM.pptx
 
2's complement
2's complement2's complement
2's complement
 
unit-2_DL.pdf
unit-2_DL.pdfunit-2_DL.pdf
unit-2_DL.pdf
 
Chapter-3.ppt
Chapter-3.pptChapter-3.ppt
Chapter-3.ppt
 
Digital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdfDigital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdf
 
Lec20
Lec20Lec20
Lec20
 
Binary Mathematics Classwork and Hw
Binary Mathematics Classwork and HwBinary Mathematics Classwork and Hw
Binary Mathematics Classwork and Hw
 
binary arithmetic conversion.pptx
binary arithmetic conversion.pptxbinary arithmetic conversion.pptx
binary arithmetic conversion.pptx
 
Arithmetic Logic
Arithmetic LogicArithmetic Logic
Arithmetic Logic
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Binary Number System and Codes
Binary Number System and CodesBinary Number System and Codes
Binary Number System and Codes
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 
Review on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and HexadecimalReview on Number Systems: Decimal, Binary, and Hexadecimal
Review on Number Systems: Decimal, Binary, and Hexadecimal
 
ch3a-binary-numbers.ppt
ch3a-binary-numbers.pptch3a-binary-numbers.ppt
ch3a-binary-numbers.ppt
 

Recently uploaded

ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 

Recently uploaded (20)

ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 

Binary Arithmetic Operations

  • 1. Binary Arithmetic Operations Presented by Dr. Shirshendu Roy Homepage - https://digitalsystemdesign.in/ Course - Digital Electronics Dr. Shirshendu Roy Binary Arithmetic Operations 1 / 13
  • 2. Binary Addition Value of a binary digit is either ’0’ or ’1’. Thus addition of two binary digits can be greater than one bit. Addition of two binary bits is shown below. 0 0 0 0 + 0 1 1 0 + 1 0 1 0 + 1 1 0 1 + Sum Carry Sum Carry Sum Carry Sum Carry In binary addition, when both the digits are ’1’ then addition result is greater than 1 bit. The extra bit is called as Carry. In this situation, Carry is generated. Dr. Shirshendu Roy Binary Arithmetic Operations 2 / 13
  • 3. Addition of Three Bits 0 0 0 0 + 0 1 1 0 + 0 0 1 0 + 0 1 0 1 + Sum Carry Sum Carry Sum Carry Sum Carry 0 0 1 1 1 0 1 0 + 1 1 0 1 + 1 0 0 1 + 1 1 1 1 + Sum Carry Sum Carry Sum Carry Sum Carry 0 0 1 1 A B C Dr. Shirshendu Roy Binary Arithmetic Operations 3 / 13
  • 4. Binary Subtraction Thus subtraction of two binary digits can not be greater than one bit. Sub- traction of two binary bits is shown below. 0 0 0 0 1 1 - 1 0 1 1 1 0 Difference 1 Borrow Difference Difference Difference - 0 Borrow - 0 Borrow - 0 Borrow In binary subtraction, bit ’1’ can not be subtracted from bit ’0’. Thus to do this subtraction extra bit ’1’ is borrowed. The extra bit is called as Borrow. Dr. Shirshendu Roy Binary Arithmetic Operations 4 / 13
  • 5. Subtraction Operation for Three Bits (A − B − C) 0 0 0 - 0 1 1 - 0 0 1 - 0 1 0 - 0 0 1 1 1 0 1 - 1 1 0 - 1 0 0 - 1 1 1 - 0 0 1 1 1 Borrow A B C Difference Difference Difference Difference Difference Difference Difference Difference 0 Borrow 1 Borrow 1 Borrow 1 Borrow 0 Borrow 0 Borrow 0 Borrow Dr. Shirshendu Roy Binary Arithmetic Operations 5 / 13
  • 6. Strategy for Subtraction Operation fo 3-bits The subtraction operation for 3-bits is A − B − C = A − (B + C) First, B + C is evaluated and the result is subtracted from A. An example is shown below 1 1 - 0 A B C ? 1 0 A (B+C) ? 0 - Subtraction Not Possible (A < (B + C)) 1 0 A (B+C) 0 - 1 Borrow 0 Difference Dr. Shirshendu Roy Binary Arithmetic Operations 6 / 13
  • 7. Addition/Subtraction using One’s Complement There is no subtraction operation in One’s Complement Number System. Only addition operation is carried out. In the operation (X − Y ), X is added to −Y (represented in One’s Com- plement Number System). In this case, the result can be written like X + (2n − ulp) − Y = (2n − ulp) + (X − Y ) (1) where ulp = 20 = 1. This can be explained below with the value of n = 8 X + (256 − 1) − Y = 255 + (X − Y ) (2) Example: X = 5, Y = 6 then find X − Y for n = 8. In this case, the result is 28 − 1 + X − Y = 256 + 5 − 6 = 254. Here, 254 is one’s complement representation of −1. Dr. Shirshendu Roy Binary Arithmetic Operations 7 / 13
  • 8. Addition/Subtraction Example in One’s Complement 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 + 0 1 0 1 1 0 0 0 0 1 1 1 0 1 1 1 (54)10 (−40)10 (13)10 A B Carry Cout 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 + 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 0 (−54)10 (40)10 (−14)10 A B Carry Sum 0 Cin Cin Cout 0 0 1 1 0 1 1 0 + 0 0 1 1 1 0 0 1 0 0 0 0 0 0 1 0 (54)10 (94)10 A B Carry Sum Cout 0 1 1 0 0 1 0 0 1 + 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 (−54)10 (−14)90 A B Carry 0 Cin Cin 0 0 1 0 1 0 0 0 (40)10 1 1 0 1 0 1 1 1 (−40)10 1 + 0 1 1 1 0 0 0 0 (14)10 Sum Cout 1 + 1 0 0 0 0 1 0 1 (−94)10 Sum Initially Cin = 0. A correction step is required whenever Cout bit is ’1’. In the correction step, this bit is added to the result at LSB position. Dr. Shirshendu Roy Binary Arithmetic Operations 8 / 13
  • 9. Addition/Subtraction using Two’s Complement There is also no subtraction operation in Two’s Complement Number System. Only addition operation is carried out. In the operation (X − Y ), X is added to −Y (represented in Two’s Com- plement Number System). In this case, the result can be written like X + 2n − Y = 2n + (X − Y ) (3) Example: X = 5, Y = 6 then find X − Y for n = 8. In this case, the result is 28 + X − Y = 256 + 5 − 6 = 255. Here, 255 is two’s complement representation of −1. Dr. Shirshendu Roy Binary Arithmetic Operations 9 / 13
  • 10. Addition/Subtraction Example in Two’s Complement 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 0 + 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 1 (54)10 (−40)10 (14)10 A B Carry Sum Cout 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 + 0 0 1 0 0 1 1 1 1 0 0 0 1 0 0 0 (−54)10 (40)10 (−14)10 A B Carry Sum 0 Cin Cin Cout 0 0 1 1 0 1 1 0 + 0 0 1 1 1 0 0 1 0 0 0 0 0 0 1 0 (54)10 (94)10 A B Carry Sum Cout 0 1 1 0 0 1 0 1 0 + 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 1 (−54)10 (−14)90 A B Carry Sum 0 Cin Cin Cout 0 0 1 0 1 0 0 0 (40)10 1 1 0 1 1 0 0 0 (−40)10 Initially Cin = 0. Here, no correction step is required. Cout bit indicates only overflow condition. Dr. Shirshendu Roy Binary Arithmetic Operations 10 / 13
  • 11. Binary Multiplication Multiplication between two binary numbers A = A2A1A0 and B = B2B1B0 can be written as S = A0 × (B2 × 22 + B1 × 21 + B0 × 20 ) + A1 × (B2 × 22 + B1 × 21 + B0 × 20 ) + A2 × (B2 × 22 + B1 × 21 + B0 × 20 ) (4) 1 0 0 1 0 1 1 0 0 1 × 1 0 0 1 0 1 × 0 0 0 0 0 0 × 0 0 0 0 0 0 1 0 0 1 0 1 × × × × 0 0 1 1 0 1 1 0 1 0 (333)10 (37)10 (09)10 1 0 0 1 0 1 1 0 0 1 × 1 0 0 1 0 1 × 0 0 0 0 0 0 × 0 0 0 0 0 0 1 0 0 1 0 1 × × × × 0 0 1 1 0 1 1 0 1 0 (2.6015)10 (2.3125)10 (1.125)10 In binary multiplication, if A has n bits and B has m bits then the multipli- cation result will have n + m + 1 bits. If n bits and m bits are used to represent fractional part in A and B respec- tively then m+n bits will be reserved for fractional part in the multiplication result. Dr. Shirshendu Roy Binary Arithmetic Operations 11 / 13
  • 12. Binary Division The basic equation of a division operation is N = Q.D + R = Q3.23 .D + Q2.22 .D + Q1.21 .D + Q0.20 .D + R (5) Here, N is the numerator, D is the denominator, Q is the quotient and R is the residual. The division operation shown above is for 4-bit Quotient width. 1 1 0 0 1 1 0 1 1 0 1 1 0 1 − 1 0 0 0 1 1 0 1 − 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 Q D R N Dr. Shirshendu Roy Binary Arithmetic Operations 12 / 13
  • 13. Thank You Dr. Shirshendu Roy Binary Arithmetic Operations 13 / 13