SlideShare uma empresa Scribd logo
1 de 85
Binary Arithmetic
BinaryArithmetic
• Binary arithmetic is essential part of all the digital
computers and many other digital system.
• Binary arithmetic is used in digital systems mainly
because the numbers (decimal and floating-point
numbers) are stored in binary format in most
computer systems.
• All arithmetic operations such as addition,
subtraction, multiplication, and division are done
in binary representation of numbers.
Binary Addition
 The steps used for a computer to complete
addition are usually greater than a human, but
their processing speed is far superior.
RULES
 0 + 0 = 0
 0 + 1 = 1
 1 + 0 = 1
 1 + 1 = 0 (With 1 to carry)
 1 + 1 + 1 = 1 (With 1 to carry)
Binary Addition
EXAMPLE
1 0 0 1
1 0 1 1
+
Binary Addition
EXAMPLE
1 0 01 1
1 0 1 1
0
+
Binary Addition
EXAMPLE
1 01 01 1
1 0 1 1
0 0
+
Binary Addition
EXAMPLE
1 01 01 1
1 0 1 1
1 0 0
+
Binary Addition
EXAMPLE
11 01 01 1
1 0 1 1
0 1 0 0
+
Binary Addition
EXAMPLE
11 01 01 1
1 0 1 1
1 0 1 0 0
+
Binary Addition
CHECK THE ANSWER
9
11
20
+
Activity 1
Perform the following additions in binary.
 10110 + 4010 =
 32010 + 1810 =
 7610 + 27110 =
Binary Subtraction
Binary Subtraction
 Computers have trouble performing
subtractions so the following rule should be
employed:
“X – X is the same as
X + -X”
 This is where two’s complement is used.
Binary Subtraction
RULES
2. Convert the number to binary.
3. Perform two’s complement on the second
number.
4. Add both numbers together.
Binary Subtraction
EXAMPLE 1
Convert 12 - 8 using two’s complement.
3. Convert to binary
12 = 000011002

8 = 000010002
Perform one’s complement on the 810
000010002
111101112
Binary Subtraction
EXAMPLE 1
2. Perform two’s complement.
1 1 1 1 0 1 1 12
0 0 0 0 0 0 0 12
1 1 1 1 1 0 0 02
6. Add the two numbers together.
= 1 0 0 0 0 0 1 0 02 (Ignore insignificant bits)
+
Binary Subtraction
EXAMPLE 2
What happens if the first number is larger than
the second?
Try 610 - 1010
Binary Subtraction
EXAMPLE 2
2. Convert to binary
6 = 000001102

10 = 000010102
Perform one’s complement on the 1010
000010102
111101012
Binary Subtraction
EXAMPLE 2
2. Perform two’s complement.
1 1 1 1 0 1 0 12
2
= 1 1 1 1 0 1 1 02
0 0 0 0 0 0 0 1+
Binary Subtraction
EXAMPLE 2
2. Add the two numbers together.
0 0 0 0 0 1 1 02
1 1 1 1 0 1 1 02
1
= 1 1 1 1 1 0 02 (Ends with a negative bit)
+
Binary Subtraction
EXAMPLE 2
2. Perform one’s complement on the result
1 1 1 1 1 1 0 02
0 0 0 0 0 0 1 12
5. Add 1 to the result.
0 0 0 0 0 0 1 12
0 0 0 0 0 0 0 12
= 0 0 0 0 0 1 0 02
+
Binary Subtraction
EXAMPLE 2
2. We then add the sign bit back.
0 0 0 0 0 1 0 02
= 1 0 0 0 0 1 0 02
Activity
2
Perform the following subtractions.
3. 22 - 8 =
4. 76 - 11 =
5. 6 - 44 =
Binary Multiplication
 Multiplication follows the general principal of
shift and add.
 The rules include:




0 * 0 = 0
0 * 1 = 0
1 * 0 = 0
1 * 1 = 1
Binary Multiplication
EXAMPLE 1
Complete 15 * 5 in binary.
3. Convert to binary
15 = 000011112
5 = 000001012
6. Ignore any insignificant zeros.
000011112
000001012
x
Binary Multiplication
EXAMPLE 1
2. Multiply the first number.
1 1 1 12
1 0 1 2
1 1 1 1
7. Now this is where the shift and takes place.
x
1111 x 1 = 1111
Binary Multiplication
EXAMPLE 1
2. Shift one place to the left and multiple the
second digit.
1 1 1 12
1 0 1 2
1 1 1 1
0 0 0 0 0
x
1111 x 0 = 0000
Shift One Place
Binary Multiplication
EXAMPLE 1
2. Shift one place to the left and multiple the
third digit.
1 1 1 12
1 0 1 2
1 1 1 1
0 0 0 0 0
1 1 1 1 0 0
x
1111 x 1 = 1111
Shift One Place
Binary Multiplication
EXAMPLE 1
2. Add the total of all the steps.
1 1 1 1
0 0 0 0 0
1 1 1 1 0 0
1 0 0 1 0 1 1
8. Convert back to decimal to check.
+
Activity
3
Calculate the following using binary
multiplication shift and add.




12 * 3 = 1 0 0 1 0 02
13 * 5 = 1 0 0 0 0 0 12
97 * 20 = 1 1 1 1 0 0 1 0 1 0 02
121 * 67 = 1 1 1 1 1 1 0 1 0 1 0 1 12
Binary Division
 Division in binary is similar to long division in
decimal.
 It uses what is called a shift and subtract
method.
Binary Division
EXAMPLE 1
Complete 575 / 25 using long division.
2.
0
25 575
Take the first digit of 575 (5) and see if 25
will go into it.
If it can not put a zero above and take the
next number.
02  How many times does 25 go into 57?
2. 25 575
TWICE
Binary Division
02  How much is left over?
2. 25 575  57 – (25 * 2) = 7
50
7
02
 Drop down the next value
2. 25 575
50
75
Binary Division
023  Divide 75 by 25
2. 25 575  Result = 3
50
75
023
 Check for remainder
 75 – (3 * 25) = 0
 FINISH!
2. 25 575
50
75
75
0
Binary Division
 Complete the following:
 25/5
Step 1: Convert both numbers to binary.
25 = 1 1 0 0 1
5 = 1 0 1
Step 2: Place the numbers accordingly:
1 0 1 1 1 0 0 1
Binary Division
Step 3: Determine if 1 0 1 (5) will fit into the
first bit of dividend.
1 0 1 1
1 0 1(5) will not fit into 1(1)
Step 4: Place a zero above the first bit and try
the next bit.
1 1 0 0
Binary Division
1 1 0 0
Step 5: Determine if 1 0 1 (5) will fit into the
next two bits of dividend.
0
1 0 1 1
1 0 1(5) will not fit into 1 1(3)
Step 6: Place a zero above the second bit and
try the next bit.
Binary Division
• Step 7: Determine if 1 0 1 (5) will fit into the
next three bits of dividend.
• 0 0
• 1 0 1 1
• 1 0 1(5) will fit into 1 1 0(6)
• Step 8: Place a one above the third bit and
times it by the divisor (1 0 1)
1 1 0 0
Binary Division
1 0 1 0 1
1 1 0
1 0 1
A subtraction should take place, however you
cannot subtract in binary. Therefore, the two’s
complement of the 2nd number must be found and
the two numbers added together to get a result.
Step 9: The multiplication of the divisor should be
placed under the THREE bits you have used.
0 0 1
Binary Division
0 1
1 1 0
0 1 1
0 0 1
Step 10: The two’s complement of 1 0 1 is 0 1 1
0 0 1
1 0 1
+
Binary Division
0 1
1 1 0
0 1 1
0 0 1 0
Step 11: Determine if 1 0 1 will fit into the remainder
0 0 1. The answer is no so you must bring down the
next number.
0 0 1
1 0 1
+
Binary Division
0 1
1 1 0
0 1 1
0 0 1 0 1
1 0 1
+
Step 12: 1 01 does not fit into 0 0 1 0. Therefore, a
zero is placed above the last bit. And the next number
is used.
0 0 1 0
Binary Division
0 1
1 1 0
0 1 1
0 0 0
1 0 1
+
0 0 1 0 1
+
0 1 1
Step 13: 1 0 1 does fit into 1 0 1 so therefore, a one is
placed above the final number and the process of shift
and add must be continued.
0 0 1 0 1
Binary Division
Step 14: The final answer is 1 0 1 (5) remainder zero.
Activity
4
 Complete the following divisions:
 340 / 20
 580 / 17
Activity
5
 40/4
 36/7
Subtraction using 1’s And 2’s
Complement
Subtraction by 2’s Complement
• The operation is carried out by means of the following
steps:
• At first, 2’s complement of the subtrahend is found.
• Then it is added to the minuend.
• If the final carry over of the sum is 1, it is dropped and
the result is positive.
• If there is no carry over, the two’s complement of the
sum will be the result and it is negative.
Octal Arithmetic
• Octal rules are similar to the decimal or binary arithmetic.
• This number system is normally used to enter long strings of
binary data into a digital system like a microcomputer.
• This makes the task of entering binary data in a
microcomputer easier.
• Arithmetic operations can be performed by converting the
octal numbers to binary numbers and then using the rules of
binary arithmetic.
Octal Addition
Octal Subtraction
Application of Octal Number System
Hexadecimal Arithmetic
• Hexadecimal rules are similar to the decimal,
octal or binary arithmetic.
• The information can be handled only in binary
form in a digital circuit and it Is easier to enter the
information using hexadecimal number system.
• Arithmetic operations can be performed by
converting the Hexadecimal numbers to binary
numbers and then using the rules of binary
arithmetic.
Hexadecimal Addition
Hexadecimal Subtraction
BCD Addition
BCD Subtraction
• Rules
– If EAC(end around carry)=1 then transfer true result of
adder 1
• If Cn=1, 0000 added in adder 2
• If cn =0, 1010 added in adder 2
– If EAC=0 then transfer 1’s compliment of result of adder
1
• If cn=1, 1010 added in adder 2
• If cn =0, 0000 added in adder 2
• If any carry generated in adder 2 discard it.
BCD Subtraction
Adder 2
BCD Subtraction
• (546) – (429) = (117)
• (429) – (546) = (-117)
Excess3 Addition Rules
Step 1
– Convert the numbers into excess 3 forms by adding 0011
Step 2
– Two numbers are added using the basic laws of binary addition
Step 3
– Now which of the four groups have produced a carry we have to
add 0011 with them and subtract 0011 from the groups which
have not produced a carry during the addition.
Step 4
– The result which we have obtained after this operation is in
Excess 3 form and this is our desired result
Excess 3 addition
Excess 3 Code Subtraction
• Step 1
Like the previous method both the numbers have to be converted
into excess 3 code
• Step 2
Following the basic methods of binary subtraction, subtraction is
done
• Step 3
Subtract ‘0011’ from each BCD four-bit group in the answer if the
subtraction operation of the relevant four-bit groups required a
borrow from the next higher adjacent four-bit group
• Step 4
Add ‘0011’ to the remaining four-bit groups, if any, in the result.
Excess 3 Subtraction

Mais conteúdo relacionado

Mais procurados

Integer Representation
Integer RepresentationInteger Representation
Integer Representation
gavhays
 
Computer number systems
Computer number systemsComputer number systems
Computer number systems
Revi Shahini
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
Bảo Hoang
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
gavhays
 

Mais procurados (20)

Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes Digital Electronics- Number systems & codes
Digital Electronics- Number systems & codes
 
Binary true ppt
Binary true pptBinary true ppt
Binary true ppt
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbers
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representation
 
Computer number systems
Computer number systemsComputer number systems
Computer number systems
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Complements of numbers
Complements of numbersComplements of numbers
Complements of numbers
 
Number System
Number SystemNumber System
Number System
 
Binary codes
Binary codesBinary codes
Binary codes
 
Number System
Number SystemNumber System
Number System
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 
Conversion of number system
Conversion of number systemConversion of number system
Conversion of number system
 

Semelhante a Binary Arithmetic

Alu1
Alu1Alu1

Semelhante a Binary Arithmetic (20)

binary arithmetic conversion.pptx
binary arithmetic conversion.pptxbinary arithmetic conversion.pptx
binary arithmetic conversion.pptx
 
Alu1
Alu1Alu1
Alu1
 
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
 
2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt2sComplementArithmetic1.ppt
2sComplementArithmetic1.ppt
 
2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt2sComplementArithmetic1 lecture slides ppt
2sComplementArithmetic1 lecture slides ppt
 
L3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptxL3 ARITHMETIC OPERATIONS.pptx
L3 ARITHMETIC OPERATIONS.pptx
 
3810-08.ppt
3810-08.ppt3810-08.ppt
3810-08.ppt
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
2s complement arithmetic
2s complement arithmetic2s complement arithmetic
2s complement arithmetic
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 
CA Unit ii
CA Unit iiCA Unit ii
CA Unit ii
 
ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS	  ARITHMETIC FOR COMPUTERS
ARITHMETIC FOR COMPUTERS
 
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notes
 
Lesson plan on data representation
Lesson plan on data representationLesson plan on data representation
Lesson plan on data representation
 
lect1.ppt
lect1.pptlect1.ppt
lect1.ppt
 
digital-electronics.pptx
digital-electronics.pptxdigital-electronics.pptx
digital-electronics.pptx
 

Mais de Meenakshi Paul

Introduction to Artificial Intelligences
Introduction to Artificial IntelligencesIntroduction to Artificial Intelligences
Introduction to Artificial Intelligences
Meenakshi Paul
 

Mais de Meenakshi Paul (20)

Introduction to Artificial Intelligences
Introduction to Artificial IntelligencesIntroduction to Artificial Intelligences
Introduction to Artificial Intelligences
 
19 Network Layer Protocols
19 Network Layer Protocols19 Network Layer Protocols
19 Network Layer Protocols
 
Other Wireless Networks
Other Wireless NetworksOther Wireless Networks
Other Wireless Networks
 
Wireless LANs
Wireless LANsWireless LANs
Wireless LANs
 
Wired LANs
Wired LANsWired LANs
Wired LANs
 
Codes
CodesCodes
Codes
 
Number System
Number SystemNumber System
Number System
 
Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Media Access Control (MAC Layer)
Media Access Control (MAC Layer)
 
Data Link Control
Data Link ControlData Link Control
Data Link Control
 
Introduction to the Data Link Layer
Introduction to the Data Link LayerIntroduction to the Data Link Layer
Introduction to the Data Link Layer
 
Switching
SwitchingSwitching
Switching
 
Transmission Media
Transmission MediaTransmission Media
Transmission Media
 
Bandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum SpreadingBandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum Spreading
 
IP classes
IP classesIP classes
IP classes
 
Theory building
Theory buildingTheory building
Theory building
 
Information Systems and Knowledge Management
 Information Systems and Knowledge Management Information Systems and Knowledge Management
Information Systems and Knowledge Management
 
Ch01 The Role of Business Research
Ch01 The Role of Business ResearchCh01 The Role of Business Research
Ch01 The Role of Business Research
 
05 analog transmission
05 analog transmission05 analog transmission
05 analog transmission
 
04 digital transmission
04 digital transmission04 digital transmission
04 digital transmission
 
03 Introduction to Physical layer
03  Introduction to Physical layer03  Introduction to Physical layer
03 Introduction to Physical layer
 

Último

Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Último (20)

Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 

Binary Arithmetic

  • 2. BinaryArithmetic • Binary arithmetic is essential part of all the digital computers and many other digital system. • Binary arithmetic is used in digital systems mainly because the numbers (decimal and floating-point numbers) are stored in binary format in most computer systems. • All arithmetic operations such as addition, subtraction, multiplication, and division are done in binary representation of numbers.
  • 3. Binary Addition  The steps used for a computer to complete addition are usually greater than a human, but their processing speed is far superior. RULES  0 + 0 = 0  0 + 1 = 1  1 + 0 = 1  1 + 1 = 0 (With 1 to carry)  1 + 1 + 1 = 1 (With 1 to carry)
  • 5. Binary Addition EXAMPLE 1 0 01 1 1 0 1 1 0 +
  • 6. Binary Addition EXAMPLE 1 01 01 1 1 0 1 1 0 0 +
  • 7. Binary Addition EXAMPLE 1 01 01 1 1 0 1 1 1 0 0 +
  • 8. Binary Addition EXAMPLE 11 01 01 1 1 0 1 1 0 1 0 0 +
  • 9. Binary Addition EXAMPLE 11 01 01 1 1 0 1 1 1 0 1 0 0 +
  • 10. Binary Addition CHECK THE ANSWER 9 11 20 +
  • 11. Activity 1 Perform the following additions in binary.  10110 + 4010 =  32010 + 1810 =  7610 + 27110 =
  • 13. Binary Subtraction  Computers have trouble performing subtractions so the following rule should be employed: “X – X is the same as X + -X”  This is where two’s complement is used.
  • 14. Binary Subtraction RULES 2. Convert the number to binary. 3. Perform two’s complement on the second number. 4. Add both numbers together.
  • 15. Binary Subtraction EXAMPLE 1 Convert 12 - 8 using two’s complement. 3. Convert to binary 12 = 000011002  8 = 000010002 Perform one’s complement on the 810 000010002 111101112
  • 16. Binary Subtraction EXAMPLE 1 2. Perform two’s complement. 1 1 1 1 0 1 1 12 0 0 0 0 0 0 0 12 1 1 1 1 1 0 0 02 6. Add the two numbers together. = 1 0 0 0 0 0 1 0 02 (Ignore insignificant bits) +
  • 17. Binary Subtraction EXAMPLE 2 What happens if the first number is larger than the second? Try 610 - 1010
  • 18. Binary Subtraction EXAMPLE 2 2. Convert to binary 6 = 000001102  10 = 000010102 Perform one’s complement on the 1010 000010102 111101012
  • 19. Binary Subtraction EXAMPLE 2 2. Perform two’s complement. 1 1 1 1 0 1 0 12 2 = 1 1 1 1 0 1 1 02 0 0 0 0 0 0 0 1+
  • 20. Binary Subtraction EXAMPLE 2 2. Add the two numbers together. 0 0 0 0 0 1 1 02 1 1 1 1 0 1 1 02 1 = 1 1 1 1 1 0 02 (Ends with a negative bit) +
  • 21. Binary Subtraction EXAMPLE 2 2. Perform one’s complement on the result 1 1 1 1 1 1 0 02 0 0 0 0 0 0 1 12 5. Add 1 to the result. 0 0 0 0 0 0 1 12 0 0 0 0 0 0 0 12 = 0 0 0 0 0 1 0 02 +
  • 22. Binary Subtraction EXAMPLE 2 2. We then add the sign bit back. 0 0 0 0 0 1 0 02 = 1 0 0 0 0 1 0 02
  • 23. Activity 2 Perform the following subtractions. 3. 22 - 8 = 4. 76 - 11 = 5. 6 - 44 =
  • 24. Binary Multiplication  Multiplication follows the general principal of shift and add.  The rules include:     0 * 0 = 0 0 * 1 = 0 1 * 0 = 0 1 * 1 = 1
  • 25. Binary Multiplication EXAMPLE 1 Complete 15 * 5 in binary. 3. Convert to binary 15 = 000011112 5 = 000001012 6. Ignore any insignificant zeros. 000011112 000001012 x
  • 26. Binary Multiplication EXAMPLE 1 2. Multiply the first number. 1 1 1 12 1 0 1 2 1 1 1 1 7. Now this is where the shift and takes place. x 1111 x 1 = 1111
  • 27. Binary Multiplication EXAMPLE 1 2. Shift one place to the left and multiple the second digit. 1 1 1 12 1 0 1 2 1 1 1 1 0 0 0 0 0 x 1111 x 0 = 0000 Shift One Place
  • 28. Binary Multiplication EXAMPLE 1 2. Shift one place to the left and multiple the third digit. 1 1 1 12 1 0 1 2 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 x 1111 x 1 = 1111 Shift One Place
  • 29. Binary Multiplication EXAMPLE 1 2. Add the total of all the steps. 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 1 1 8. Convert back to decimal to check. +
  • 30. Activity 3 Calculate the following using binary multiplication shift and add.     12 * 3 = 1 0 0 1 0 02 13 * 5 = 1 0 0 0 0 0 12 97 * 20 = 1 1 1 1 0 0 1 0 1 0 02 121 * 67 = 1 1 1 1 1 1 0 1 0 1 0 1 12
  • 31. Binary Division  Division in binary is similar to long division in decimal.  It uses what is called a shift and subtract method.
  • 32. Binary Division EXAMPLE 1 Complete 575 / 25 using long division. 2. 0 25 575 Take the first digit of 575 (5) and see if 25 will go into it. If it can not put a zero above and take the next number. 02  How many times does 25 go into 57? 2. 25 575 TWICE
  • 33. Binary Division 02  How much is left over? 2. 25 575  57 – (25 * 2) = 7 50 7 02  Drop down the next value 2. 25 575 50 75
  • 34. Binary Division 023  Divide 75 by 25 2. 25 575  Result = 3 50 75 023  Check for remainder  75 – (3 * 25) = 0  FINISH! 2. 25 575 50 75 75 0
  • 35. Binary Division  Complete the following:  25/5 Step 1: Convert both numbers to binary. 25 = 1 1 0 0 1 5 = 1 0 1 Step 2: Place the numbers accordingly: 1 0 1 1 1 0 0 1
  • 36. Binary Division Step 3: Determine if 1 0 1 (5) will fit into the first bit of dividend. 1 0 1 1 1 0 1(5) will not fit into 1(1) Step 4: Place a zero above the first bit and try the next bit. 1 1 0 0
  • 37. Binary Division 1 1 0 0 Step 5: Determine if 1 0 1 (5) will fit into the next two bits of dividend. 0 1 0 1 1 1 0 1(5) will not fit into 1 1(3) Step 6: Place a zero above the second bit and try the next bit.
  • 38. Binary Division • Step 7: Determine if 1 0 1 (5) will fit into the next three bits of dividend. • 0 0 • 1 0 1 1 • 1 0 1(5) will fit into 1 1 0(6) • Step 8: Place a one above the third bit and times it by the divisor (1 0 1) 1 1 0 0
  • 39. Binary Division 1 0 1 0 1 1 1 0 1 0 1 A subtraction should take place, however you cannot subtract in binary. Therefore, the two’s complement of the 2nd number must be found and the two numbers added together to get a result. Step 9: The multiplication of the divisor should be placed under the THREE bits you have used. 0 0 1
  • 40. Binary Division 0 1 1 1 0 0 1 1 0 0 1 Step 10: The two’s complement of 1 0 1 is 0 1 1 0 0 1 1 0 1 +
  • 41. Binary Division 0 1 1 1 0 0 1 1 0 0 1 0 Step 11: Determine if 1 0 1 will fit into the remainder 0 0 1. The answer is no so you must bring down the next number. 0 0 1 1 0 1 +
  • 42. Binary Division 0 1 1 1 0 0 1 1 0 0 1 0 1 1 0 1 + Step 12: 1 01 does not fit into 0 0 1 0. Therefore, a zero is placed above the last bit. And the next number is used. 0 0 1 0
  • 43. Binary Division 0 1 1 1 0 0 1 1 0 0 0 1 0 1 + 0 0 1 0 1 + 0 1 1 Step 13: 1 0 1 does fit into 1 0 1 so therefore, a one is placed above the final number and the process of shift and add must be continued. 0 0 1 0 1
  • 44. Binary Division Step 14: The final answer is 1 0 1 (5) remainder zero.
  • 45. Activity 4  Complete the following divisions:  340 / 20  580 / 17
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57. Subtraction using 1’s And 2’s Complement
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64. Subtraction by 2’s Complement • The operation is carried out by means of the following steps: • At first, 2’s complement of the subtrahend is found. • Then it is added to the minuend. • If the final carry over of the sum is 1, it is dropped and the result is positive. • If there is no carry over, the two’s complement of the sum will be the result and it is negative.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69. Octal Arithmetic • Octal rules are similar to the decimal or binary arithmetic. • This number system is normally used to enter long strings of binary data into a digital system like a microcomputer. • This makes the task of entering binary data in a microcomputer easier. • Arithmetic operations can be performed by converting the octal numbers to binary numbers and then using the rules of binary arithmetic.
  • 72. Application of Octal Number System
  • 73. Hexadecimal Arithmetic • Hexadecimal rules are similar to the decimal, octal or binary arithmetic. • The information can be handled only in binary form in a digital circuit and it Is easier to enter the information using hexadecimal number system. • Arithmetic operations can be performed by converting the Hexadecimal numbers to binary numbers and then using the rules of binary arithmetic.
  • 76.
  • 77.
  • 79. BCD Subtraction • Rules – If EAC(end around carry)=1 then transfer true result of adder 1 • If Cn=1, 0000 added in adder 2 • If cn =0, 1010 added in adder 2 – If EAC=0 then transfer 1’s compliment of result of adder 1 • If cn=1, 1010 added in adder 2 • If cn =0, 0000 added in adder 2 • If any carry generated in adder 2 discard it.
  • 81. BCD Subtraction • (546) – (429) = (117) • (429) – (546) = (-117)
  • 82. Excess3 Addition Rules Step 1 – Convert the numbers into excess 3 forms by adding 0011 Step 2 – Two numbers are added using the basic laws of binary addition Step 3 – Now which of the four groups have produced a carry we have to add 0011 with them and subtract 0011 from the groups which have not produced a carry during the addition. Step 4 – The result which we have obtained after this operation is in Excess 3 form and this is our desired result
  • 84. Excess 3 Code Subtraction • Step 1 Like the previous method both the numbers have to be converted into excess 3 code • Step 2 Following the basic methods of binary subtraction, subtraction is done • Step 3 Subtract ‘0011’ from each BCD four-bit group in the answer if the subtraction operation of the relevant four-bit groups required a borrow from the next higher adjacent four-bit group • Step 4 Add ‘0011’ to the remaining four-bit groups, if any, in the result.