SlideShare a Scribd company logo
1 of 17
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

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

index of all of the financial accounts in a company's general ledger. In shor...
index of all of the financial accounts in a company's general ledger. In shor...index of all of the financial accounts in a company's general ledger. In shor...
index of all of the financial accounts in a company's general ledger. In shor...mayurjagdale4
 
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...Asst.prof M.Gokilavani
 
Computer Architecture refers to those attributes of a system that have a dire...
Computer Architecture refers to those attributes of a system that have a dire...Computer Architecture refers to those attributes of a system that have a dire...
Computer Architecture refers to those attributes of a system that have a dire...mayurjagdale4
 
2 article azojete vol 9 9 16
2 article azojete vol 9 9 162 article azojete vol 9 9 16
2 article azojete vol 9 9 16Oyeniyi Samuel
 
CS304PC:Computer Organization and Architecture session 18 floating point rese...
CS304PC:Computer Organization and Architecture session 18 floating point rese...CS304PC:Computer Organization and Architecture session 18 floating point rese...
CS304PC:Computer Organization and Architecture session 18 floating point rese...Asst.prof M.Gokilavani
 
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...Asst.prof M.Gokilavani
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...michaelaaron25322
 
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptxJEEVANANTHAMG6
 
Computer arithmetics (computer organisation & arithmetics) ppt
Computer arithmetics (computer organisation & arithmetics) pptComputer arithmetics (computer organisation & arithmetics) ppt
Computer arithmetics (computer organisation & arithmetics) pptSuryaKumarSahani
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4Dr.YNM
 
18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptxtakix43466
 
Combinational and sequential logic
Combinational and sequential logicCombinational and sequential logic
Combinational and sequential logicDeepak John
 
Computer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionComputer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionSuryaKumarSahani
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsArti Parab Academics
 
Computer Architechture and microprocesssors
Computer Architechture and microprocesssors Computer Architechture and microprocesssors
Computer Architechture and microprocesssors JaykumarPatil10
 

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

index of all of the financial accounts in a company's general ledger. In shor...
index of all of the financial accounts in a company's general ledger. In shor...index of all of the financial accounts in a company's general ledger. In shor...
index of all of the financial accounts in a company's general ledger. In shor...
 
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
CS304PC:Computer Organization and Architecture Session 23 Decimal Arithmetic ...
 
Computer Architecture refers to those attributes of a system that have a dire...
Computer Architecture refers to those attributes of a system that have a dire...Computer Architecture refers to those attributes of a system that have a dire...
Computer Architecture refers to those attributes of a system that have a dire...
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Ch 2.pptx
Ch 2.pptxCh 2.pptx
Ch 2.pptx
 
2 article azojete vol 9 9 16
2 article azojete vol 9 9 162 article azojete vol 9 9 16
2 article azojete vol 9 9 16
 
CS304PC:Computer Organization and Architecture session 18 floating point rese...
CS304PC:Computer Organization and Architecture session 18 floating point rese...CS304PC:Computer Organization and Architecture session 18 floating point rese...
CS304PC:Computer Organization and Architecture session 18 floating point rese...
 
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift log...
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
 
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
1. Arithmetic Operations - Addition and subtraction of signed numbers.pptx
 
Computer arithmetics (computer organisation & arithmetics) ppt
Computer arithmetics (computer organisation & arithmetics) pptComputer arithmetics (computer organisation & arithmetics) ppt
Computer arithmetics (computer organisation & arithmetics) ppt
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx
 
Combinational and sequential logic
Combinational and sequential logicCombinational and sequential logic
Combinational and sequential logic
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
computer arithmatic
computer arithmaticcomputer arithmatic
computer arithmatic
 
Computer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionComputer arithmetics coa project pdf version
Computer arithmetics coa project pdf version
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
 
Computer Architechture and microprocesssors
Computer Architechture and microprocesssors Computer Architechture and microprocesssors
Computer Architechture and microprocesssors
 

More from Asst.prof M.Gokilavani

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfAsst.prof M.Gokilavani
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesAsst.prof M.Gokilavani
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAsst.prof M.Gokilavani
 
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAsst.prof M.Gokilavani
 

More from Asst.prof M.Gokilavani (20)

CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptxAI3391 Artificial Intelligence Session 25 Horn clause.pptx
AI3391 Artificial Intelligence Session 25 Horn clause.pptx
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 

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!!!