SlideShare a Scribd company logo
CS304PC:Computer Organization
and Architecture (R18 II(I sem))
Department of computer science and engineering
(AI/ML)
Session 19
by
Asst.Prof.M.Gokilavani
VITS
2/13/2023 Department of CSE (AI/ML) 1
TEXTBOOK:
• 1. Computer System Architecture – M. Moris Mano, Third Edition,
Pearson/PHI.
REFERENCES:
• Computer Organization – Car Hamacher, Zvonks Vranesic, Safea
Zaky, Vth Edition, McGraw Hill.
• Computer Organization and Architecture – William Stallings Sixth
Edition, Pearson/PHI.
• Structured Computer Organization – Andrew S. Tanenbaum, 4th
Edition, PHI/Pearson.
2/13/2023 Department of CSE (AI/ML) 2
Unit III
Data Representation: Data types ,Complements, fixed point
Representations, Floating point representation.
Computer Arithmetic: Addition and subtraction,
multiplication Algorithms, Division Algorithms, Floating-point
Arithmetic operations, Decimal Arithmetic unit, Decimal
Arithmetic operations.
2/13/2023 Department of CSE (AI/ML) 3
Topics covered in session 19
2/13/2023 Department of CSE (AI/ML) 4
• Addition and subtraction
• Multiplication Algorithms
• Division Algorithms
• Floating-point Arithmetic operations
• Decimal Arithmetic unit
• Decimal Arithmetic operations.
Introduction
• Arithmetic instructions in digital computer manipulate data to produce
results for computational problems. The four basic arithmetic
operations are addition , subtraction, multiplication and division.
• The solution to any problem that is stated by a finite number of well-
defined procedural steps is called an algorithm.
• Various arithmetic algorithms and show the procedure for
implementing them in digital hardware.
• Types of data are
• Fixed point binary data in signed magnitude representation
• Fixed point binary data in signed 2’s complement
representation
• Floating point binary data
• Binary coded decimal (BCD) data
2/13/2023 Department of CSE (AI/ML) 5
Addition and Subtraction algorithm
• There are three ways of representing negative fixed-point binary
number:
• Signed-magnitude
• Signed 1’s complement
• Signed 2’s complement
• For floating point operation most computers use the signed-
magnitude representation.
2/13/2023 Department of CSE (AI/ML) 6
Addition and subtraction with signed-
magnitude data
• Addition and subtraction algorithm
• when the signs of A and B are identical (different), add the two
magnitude and attached the sign of A to the result.
• When the sign of A and B are different (identical, compare the
magnitude and subtract the smaller number from the larger.
• Choose the sign of the result to be same as A if A ˃ B or the
complement of the sign of A if A ˂ B.
• If the magnitude are equal, Subtract B from A and make the sign of
the result positive.
Note: The procedure for identical signs in addition algorithm is same as
for different sign in subtraction algorithm.
2/13/2023 Department of CSE (AI/ML) 7
2/13/2023 Department of CSE (AI/ML) 8
Hardware Implementation
• To implement the two-arithmetic operation with hardware, it is
necessary that the two numbers be stored in register.
• Let A and B be two register that holds the magnitude of the
numbers, and A1 and B1 be two flip-flop that holds the
corresponding signs.
• The result of the operation is transfer to third register.
• In hardware implementation,
• First, a parallel-adder is needed to perform the
microoperation A+B.
• Second a comparator circuit is needed to establish if A ˃
B, A = B, or A ˂ B.
• Third two parallel-subtractor circuits are needed to
perform the micro-operations A –B and B –A.
2/13/2023 Department of CSE (AI/ML) 9
2/13/2023 Department of CSE (AI/ML) 10
Working of Hardware Implementation
• It consists of register A and B and sign flip-flop A1 and B1.
• Subtraction is done by adding A and 2’s complement of B.
• The output carry is transferred to flip-flops E, where it can be
checked to determine to relative magnitude of the two
numbers.
• The add overflow flip-flop AVF holds the overflow bit when A
and B are added.
2/13/2023 Department of CSE (AI/ML) 11
Working of Hardware Implementation
Addition of A and B is done through the parallel adder (consists of full-
adder).
• The S (Sum) output of the adder is applied to the input of the A
register.
• The complementor (consists of ex-OR gates ) provides an output of
B or the complement of B depending on the state of the mode
control M.
• When M=0, the output of B is transferred to the adder, the input
carry is 0, and the output of the adder is equal to the sum A+B.
• When M=1, the 1’s complement of B is applied to the adder, the
input carry is 1 and output S=A+B+1.
2/13/2023 Department of CSE (AI/ML) 12
2/13/2023 Department of CSE (AI/ML) 13
Addition and Subtraction with 2’s complement data
• The leftmost bit of a binary number represent the sign bit :
• 0 for positive
• 1 for negative
• If the sign bit is 1, the entire number is represented in 2’s complement
form.
• The addition of two number is signed complement form consists of
adding the numbers with the sign bits treated the same as the order bits
of the number.
• A carry-out of the sign-bit position is discarded. The subtraction
consists of first taking 2’s complement of the subtrahend and then
adding it to be minuend.
• When overflow is detected when the output of the gate is equal to 1.
2/13/2023 Department of CSE (AI/ML) 14
2/13/2023 Department of CSE (AI/ML) 15
2/13/2023 Department of CSE (AI/ML) 16
Topics to be covered in next session 20
• Multiplication Algorithm
2/13/2023 Department of CSE (AI/ML) 17
Thank you!!!

More Related Content

PPTX
CS304PC:Computer Organization and Architecture session 20 Multiplication algo...
PDF
2.1COMPUTER ORG_ Computer Arithmetic.pdf
PPTX
Computer arithmetic
PPTX
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
PPTX
1.COMPUTER ARITHMETIC which is related to coa.pptx
PPTX
Computer organization algorithms like addition and subtraction and multiplica...
PPTX
CS304PC:Computer Organization and Architecture Session 20 Multiplication algo...
PPTX
CS304PC:Computer Organization and Architecture Session 17 Complements and fix...
CS304PC:Computer Organization and Architecture session 20 Multiplication algo...
2.1COMPUTER ORG_ Computer Arithmetic.pdf
Computer arithmetic
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
1.COMPUTER ARITHMETIC which is related to coa.pptx
Computer organization algorithms like addition and subtraction and multiplica...
CS304PC:Computer Organization and Architecture Session 20 Multiplication algo...
CS304PC:Computer Organization and Architecture Session 17 Complements and fix...

Similar to CS304PC:Computer Organization and Architecture Session 19 Addition and subtraction algorithm (20)

PPTX
Unit_3 OF COMPUTER ARCHITECTUREUnit.pptx
PPTX
CA UNIT II.pptx
PPT
ARITHMETIC LOGIC UNIT.ppt
PDF
Unit-8-Computer-Arithmetic.pdf
PPT
index of all of the financial accounts in a company's general ledger. In shor...
PPT
Computer Architecture refers to those attributes of a system that have a dire...
PPTX
COA(Unit_3.pptx)
PPT
Addition and subtraction with signed magnitude data (mano
PDF
Arithmetic Unit Addition Subtraction Multiplication and Division
PDF
N akkk4lmealkkk3eqklaflerkpwoerkwflskkes
PDF
Computer arithmetic
DOCX
Computer organization and architecture lab manual
PPTX
CS304PC:Computer Organization and Architecture Session 3 micro operations.pptx
PPTX
UNIT 3 COA PPT of syllabus JNTUH PPT.pptx
PPTX
Computer arithmetics (computer organisation & arithmetics) ppt
PPTX
UNIT-3 Complete PPT.pptx
PDF
Arithmatic Ch 10 (4).pdf
PDF
Week-6-Lecture-6-Arithmetic-processing-unit-implementation.pdf
PDF
Computer arithmetics coa project pdf version
PPT
Computer Arithmetic_Computer_Architecture.ppt
Unit_3 OF COMPUTER ARCHITECTUREUnit.pptx
CA UNIT II.pptx
ARITHMETIC LOGIC UNIT.ppt
Unit-8-Computer-Arithmetic.pdf
index of all of the financial accounts in a company's general ledger. In shor...
Computer Architecture refers to those attributes of a system that have a dire...
COA(Unit_3.pptx)
Addition and subtraction with signed magnitude data (mano
Arithmetic Unit Addition Subtraction Multiplication and Division
N akkk4lmealkkk3eqklaflerkpwoerkwflskkes
Computer arithmetic
Computer organization and architecture lab manual
CS304PC:Computer Organization and Architecture Session 3 micro operations.pptx
UNIT 3 COA PPT of syllabus JNTUH PPT.pptx
Computer arithmetics (computer organisation & arithmetics) ppt
UNIT-3 Complete PPT.pptx
Arithmatic Ch 10 (4).pdf
Week-6-Lecture-6-Arithmetic-processing-unit-implementation.pdf
Computer arithmetics coa project pdf version
Computer Arithmetic_Computer_Architecture.ppt
Ad

More from Guru Nanak Technical Institutions (20)

PPTX
22PCOAM21 Data Quality Session 3 Data Quality.pptx
PPTX
22PCOAM21 Session 1 Data Management.pptx
PPTX
22PCOAM21 Session 2 Understanding Data Source.pptx
PDF
III Year II Sem 22PCOAM21 Data Analytics Syllabus.pdf
PDF
22PCOAM16 _ML_Unit 3 Notes & Question bank
PDF
22PCOAM16 Machine Learning Unit V Full notes & QB
PDF
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
PDF
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
PPTX
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
PPTX
22PCOAM16 Unit 3 Session 22 Ensemble Learning .pptx
PPTX
22PCOAM16 Unit 3 Session 24 K means Algorithms.pptx
PPTX
22PCOAM16 ML Unit 3 Session 18 Learning with tree.pptx
PPTX
22PCOAM16 ML Unit 3 Session 21 Classification and Regression Trees .pptx
PPTX
22PCOAM16 ML Unit 3 Session 20 ID3 Algorithm and working.pptx
PPTX
22PCOAM16 ML Unit 3 Session 19 Constructing Decision Trees.pptx
PDF
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
PDF
22PCOAM16 _ML_ Unit 2 Full unit notes.pdf
PDF
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
PDF
22PCOAM16_MACHINE_LEARNING_UNIT_I_NOTES.pdf
PPTX
22PCOAM16 Unit 2 Session 17 Support vector Machine.pptx
22PCOAM21 Data Quality Session 3 Data Quality.pptx
22PCOAM21 Session 1 Data Management.pptx
22PCOAM21 Session 2 Understanding Data Source.pptx
III Year II Sem 22PCOAM21 Data Analytics Syllabus.pdf
22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 Machine Learning Unit V Full notes & QB
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 22 Ensemble Learning .pptx
22PCOAM16 Unit 3 Session 24 K means Algorithms.pptx
22PCOAM16 ML Unit 3 Session 18 Learning with tree.pptx
22PCOAM16 ML Unit 3 Session 21 Classification and Regression Trees .pptx
22PCOAM16 ML Unit 3 Session 20 ID3 Algorithm and working.pptx
22PCOAM16 ML Unit 3 Session 19 Constructing Decision Trees.pptx
22PCOAM16 ML UNIT 2 NOTES & QB QUESTION WITH ANSWERS
22PCOAM16 _ML_ Unit 2 Full unit notes.pdf
22PCOAM16_ML_Unit 1 notes & Question Bank with answers.pdf
22PCOAM16_MACHINE_LEARNING_UNIT_I_NOTES.pdf
22PCOAM16 Unit 2 Session 17 Support vector Machine.pptx
Ad

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
DOCX
573137875-Attendance-Management-System-original
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
Project quality management in manufacturing
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PPT on Performance Review to get promotions
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Sustainable Sites - Green Building Construction
Mechanical Engineering MATERIALS Selection
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
R24 SURVEYING LAB MANUAL for civil enggi
573137875-Attendance-Management-System-original
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Project quality management in manufacturing
CYBER-CRIMES AND SECURITY A guide to understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
OOP with Java - Java Introduction (Basics)
PPT on Performance Review to get promotions
Automation-in-Manufacturing-Chapter-Introduction.pdf
bas. eng. economics group 4 presentation 1.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Sustainable Sites - Green Building Construction

CS304PC:Computer Organization and Architecture Session 19 Addition and subtraction algorithm

  • 1. CS304PC:Computer Organization and Architecture (R18 II(I sem)) Department of computer science and engineering (AI/ML) Session 19 by Asst.Prof.M.Gokilavani VITS 2/13/2023 Department of CSE (AI/ML) 1
  • 2. TEXTBOOK: • 1. Computer System Architecture – M. Moris Mano, Third Edition, Pearson/PHI. REFERENCES: • Computer Organization – Car Hamacher, Zvonks Vranesic, Safea Zaky, Vth Edition, McGraw Hill. • Computer Organization and Architecture – William Stallings Sixth Edition, Pearson/PHI. • Structured Computer Organization – Andrew S. Tanenbaum, 4th Edition, PHI/Pearson. 2/13/2023 Department of CSE (AI/ML) 2
  • 3. Unit III Data Representation: Data types ,Complements, fixed point Representations, Floating point representation. Computer Arithmetic: Addition and subtraction, multiplication Algorithms, Division Algorithms, Floating-point Arithmetic operations, Decimal Arithmetic unit, Decimal Arithmetic operations. 2/13/2023 Department of CSE (AI/ML) 3
  • 4. Topics covered in session 19 2/13/2023 Department of CSE (AI/ML) 4 • Addition and subtraction • Multiplication Algorithms • Division Algorithms • Floating-point Arithmetic operations • Decimal Arithmetic unit • Decimal Arithmetic operations.
  • 5. Introduction • Arithmetic instructions in digital computer manipulate data to produce results for computational problems. The four basic arithmetic operations are addition , subtraction, multiplication and division. • The solution to any problem that is stated by a finite number of well- defined procedural steps is called an algorithm. • Various arithmetic algorithms and show the procedure for implementing them in digital hardware. • Types of data are • Fixed point binary data in signed magnitude representation • Fixed point binary data in signed 2’s complement representation • Floating point binary data • Binary coded decimal (BCD) data 2/13/2023 Department of CSE (AI/ML) 5
  • 6. Addition and Subtraction algorithm • There are three ways of representing negative fixed-point binary number: • Signed-magnitude • Signed 1’s complement • Signed 2’s complement • For floating point operation most computers use the signed- magnitude representation. 2/13/2023 Department of CSE (AI/ML) 6
  • 7. Addition and subtraction with signed- magnitude data • Addition and subtraction algorithm • when the signs of A and B are identical (different), add the two magnitude and attached the sign of A to the result. • When the sign of A and B are different (identical, compare the magnitude and subtract the smaller number from the larger. • Choose the sign of the result to be same as A if A ˃ B or the complement of the sign of A if A ˂ B. • If the magnitude are equal, Subtract B from A and make the sign of the result positive. Note: The procedure for identical signs in addition algorithm is same as for different sign in subtraction algorithm. 2/13/2023 Department of CSE (AI/ML) 7
  • 8. 2/13/2023 Department of CSE (AI/ML) 8
  • 9. Hardware Implementation • To implement the two-arithmetic operation with hardware, it is necessary that the two numbers be stored in register. • Let A and B be two register that holds the magnitude of the numbers, and A1 and B1 be two flip-flop that holds the corresponding signs. • The result of the operation is transfer to third register. • In hardware implementation, • First, a parallel-adder is needed to perform the microoperation A+B. • Second a comparator circuit is needed to establish if A ˃ B, A = B, or A ˂ B. • Third two parallel-subtractor circuits are needed to perform the micro-operations A –B and B –A. 2/13/2023 Department of CSE (AI/ML) 9
  • 10. 2/13/2023 Department of CSE (AI/ML) 10
  • 11. Working of Hardware Implementation • It consists of register A and B and sign flip-flop A1 and B1. • Subtraction is done by adding A and 2’s complement of B. • The output carry is transferred to flip-flops E, where it can be checked to determine to relative magnitude of the two numbers. • The add overflow flip-flop AVF holds the overflow bit when A and B are added. 2/13/2023 Department of CSE (AI/ML) 11
  • 12. Working of Hardware Implementation Addition of A and B is done through the parallel adder (consists of full- adder). • The S (Sum) output of the adder is applied to the input of the A register. • The complementor (consists of ex-OR gates ) provides an output of B or the complement of B depending on the state of the mode control M. • When M=0, the output of B is transferred to the adder, the input carry is 0, and the output of the adder is equal to the sum A+B. • When M=1, the 1’s complement of B is applied to the adder, the input carry is 1 and output S=A+B+1. 2/13/2023 Department of CSE (AI/ML) 12
  • 13. 2/13/2023 Department of CSE (AI/ML) 13
  • 14. Addition and Subtraction with 2’s complement data • The leftmost bit of a binary number represent the sign bit : • 0 for positive • 1 for negative • If the sign bit is 1, the entire number is represented in 2’s complement form. • The addition of two number is signed complement form consists of adding the numbers with the sign bits treated the same as the order bits of the number. • A carry-out of the sign-bit position is discarded. The subtraction consists of first taking 2’s complement of the subtrahend and then adding it to be minuend. • When overflow is detected when the output of the gate is equal to 1. 2/13/2023 Department of CSE (AI/ML) 14
  • 15. 2/13/2023 Department of CSE (AI/ML) 15
  • 16. 2/13/2023 Department of CSE (AI/ML) 16
  • 17. Topics to be covered in next session 20 • Multiplication Algorithm 2/13/2023 Department of CSE (AI/ML) 17 Thank you!!!