SlideShare a Scribd company logo
ADDITION & SUBTRACTION
Mr. C.KARTHIKEYAN,
ASSISTANT PROFESSOR,
ECE , RMKCET
ADDITION & SUBTRACTION
Un Signed Arithmetic Signed Arithmetic
add
addi
sub
The MIPS recognizes or ignores overflow by two kinds of arithmetic instructions
addu
addui
subu
cause exceptions on overflow
do not cause exceptions on overflow
OVER FLOW?
No Over Flow Over Flow
Overflow occurs when the result from an operation cannot be represented with the available hardware
Operation Operand A Operand B
A + B > 0 < 0
A + B < 0 > 0
A – B > 0 > 0
A – B < 0 < 0
Eg: (+10) + (-6) = +4
(-10) + (+6) = -4
Eg: (+10) - (+6) = +4
(-10) - (-6) = -4
OVER FLOW?
Over Flow
Overflow occurs when the result from an operation cannot be represented with the available hardware
Addition
10000
+10 01010
+6 00110 (+)
Over Flow
10111
-5 1011
-4 1100 (+)
Over Flow
OVER FLOW?
Over Flow
Overflow occurs when the result from an operation cannot be represented with the available hardware
Subtraction
11100
+6 00110
-10 10110 (-)
Over Flow
0110
-6 1010
+4 0100 (-)
Over Flow
EXAMPLE
Assume 185 and 122 are unsigned 8-bit decimal integers. Calculate 185 – 122.
Is there over flow, under flow, or neither?
10111001
01111010 (-)
185
122
1
1
0
1 1
1
010
1
0 1
10
1
1
110
1
0
Neither Over Flow nor Under Flow
Operation Operand A Operand B
A + B > 0 < 0
A + B < 0 > 0
A – B > 0 > 0
A – B < 0 < 0
Computer Organization and Design by David A Patterson – Page no. 237
Condition for No Over Flow
EXAMPLE
Assume 185 and 122 are signed 8-bit decimal integers stored in sign-magnitude
format. Calculate 185 + 122. Is there over flow, under flow, or neither?
10111001
01111010 +122 (+)
185
122
1
1
0
0
1
1
0
Neither Over Flow nor Under Flow
-57
1
1
1
1
10
Operation Operand A Operand B
A + B > 0 < 0
A + B < 0 > 0
A – B > 0 > 0
A – B < 0 < 0
Computer Organization and Design by David A Patterson – Page no. 237
Condition for No Over Flow
EXAMPLE
Assume 185 and 122 are signed 8-bit decimal integers stored in sign-magnitude
format. Calculate 185 - 122. Is there over flow, under flow, or neither?
10111001
01111010 +122 (-)
185
122
1
1
1
1
1
1
0 Over Flow
-57
0
Computer Organization and Design by David A Patterson – Page no. 237

More Related Content

Similar to 2. Addition and Subtraction.pptx

Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And Subtraction
Keyur Vadodariya
 
11. 8085 programming example iii
11. 8085 programming example iii11. 8085 programming example iii
11. 8085 programming example iii
sandip das
 
Data_Model_ofS4HANA_Finance_Data_1715175340.pdf
Data_Model_ofS4HANA_Finance_Data_1715175340.pdfData_Model_ofS4HANA_Finance_Data_1715175340.pdf
Data_Model_ofS4HANA_Finance_Data_1715175340.pdf
BenVictor9
 
Chp4_C++_Control Structures-Part2_Iteration.pptx
Chp4_C++_Control Structures-Part2_Iteration.pptxChp4_C++_Control Structures-Part2_Iteration.pptx
Chp4_C++_Control Structures-Part2_Iteration.pptx
ssuser10ed71
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
Edhole.com
 
c++ program using All data type and operators
c++ program using All data type and operators c++ program using All data type and operators
c++ program using All data type and operators
AMUDHAJAY
 
Arithmetic for computers which talks about
Arithmetic for computers which talks aboutArithmetic for computers which talks about
Arithmetic for computers which talks about
eem303ds
 
dd_sampleslides.ppt
dd_sampleslides.pptdd_sampleslides.ppt
dd_sampleslides.ppt
wafawafa52
 
HBASE Performane Test
HBASE Performane TestHBASE Performane Test
HBASE Performane Test
Louis liu
 
TC74VHCT04AFN PSpice Model (Free SPICE Model)
TC74VHCT04AFN PSpice Model  (Free SPICE Model)TC74VHCT04AFN PSpice Model  (Free SPICE Model)
TC74VHCT04AFN PSpice Model (Free SPICE Model)
Tsuyoshi Horigome
 
how computers do math from patterson and hennessey book
how computers do math from patterson and hennessey bookhow computers do math from patterson and hennessey book
how computers do math from patterson and hennessey book
eem303ds
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Katrina Little
 
Extrato
ExtratoExtrato
Chp5 pic microcontroller instruction set copy
Chp5 pic microcontroller instruction set   copyChp5 pic microcontroller instruction set   copy
Chp5 pic microcontroller instruction set copy
mkazree
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
warda aziz
 
Chapter 4 combinational_logic
Chapter 4 combinational_logicChapter 4 combinational_logic
Chapter 4 combinational_logic
Ch Farhan
 

Similar to 2. Addition and Subtraction.pptx (17)

Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And Subtraction
 
11. 8085 programming example iii
11. 8085 programming example iii11. 8085 programming example iii
11. 8085 programming example iii
 
Data_Model_ofS4HANA_Finance_Data_1715175340.pdf
Data_Model_ofS4HANA_Finance_Data_1715175340.pdfData_Model_ofS4HANA_Finance_Data_1715175340.pdf
Data_Model_ofS4HANA_Finance_Data_1715175340.pdf
 
Chp4_C++_Control Structures-Part2_Iteration.pptx
Chp4_C++_Control Structures-Part2_Iteration.pptxChp4_C++_Control Structures-Part2_Iteration.pptx
Chp4_C++_Control Structures-Part2_Iteration.pptx
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
 
c++ program using All data type and operators
c++ program using All data type and operators c++ program using All data type and operators
c++ program using All data type and operators
 
Arithmetic for computers which talks about
Arithmetic for computers which talks aboutArithmetic for computers which talks about
Arithmetic for computers which talks about
 
dd_sampleslides.ppt
dd_sampleslides.pptdd_sampleslides.ppt
dd_sampleslides.ppt
 
HBASE Performane Test
HBASE Performane TestHBASE Performane Test
HBASE Performane Test
 
TC74VHCT04AFN PSpice Model (Free SPICE Model)
TC74VHCT04AFN PSpice Model  (Free SPICE Model)TC74VHCT04AFN PSpice Model  (Free SPICE Model)
TC74VHCT04AFN PSpice Model (Free SPICE Model)
 
how computers do math from patterson and hennessey book
how computers do math from patterson and hennessey bookhow computers do math from patterson and hennessey book
how computers do math from patterson and hennessey book
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence CounterLab 9 D-Flip Flops: Shift Register and Sequence Counter
Lab 9 D-Flip Flops: Shift Register and Sequence Counter
 
Extrato
ExtratoExtrato
Extrato
 
Chp5 pic microcontroller instruction set copy
Chp5 pic microcontroller instruction set   copyChp5 pic microcontroller instruction set   copy
Chp5 pic microcontroller instruction set copy
 
Chapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registersChapter 5The proessor status and the FLAGS registers
Chapter 5The proessor status and the FLAGS registers
 
Chapter 4 combinational_logic
Chapter 4 combinational_logicChapter 4 combinational_logic
Chapter 4 combinational_logic
 

More from KarthikeyanC53

3. Virtual Memory.pptx
3. Virtual Memory.pptx3. Virtual Memory.pptx
3. Virtual Memory.pptx
KarthikeyanC53
 
2. Cache Mapping.pptx
2. Cache Mapping.pptx2. Cache Mapping.pptx
2. Cache Mapping.pptx
KarthikeyanC53
 
1. Introduction to Memory.pptx
1. Introduction to Memory.pptx1. Introduction to Memory.pptx
1. Introduction to Memory.pptx
KarthikeyanC53
 
6. ILP.pptx
6. ILP.pptx6. ILP.pptx
6. ILP.pptx
KarthikeyanC53
 
5. Exception.pptx
5. Exception.pptx5. Exception.pptx
5. Exception.pptx
KarthikeyanC53
 
4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx
KarthikeyanC53
 
3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx
KarthikeyanC53
 
2. Datapath Design with Control Unit.pptx
2. Datapath Design with Control Unit.pptx2. Datapath Design with Control Unit.pptx
2. Datapath Design with Control Unit.pptx
KarthikeyanC53
 
1. Introduction to Datapath Design.pptx
1. Introduction to Datapath Design.pptx1. Introduction to Datapath Design.pptx
1. Introduction to Datapath Design.pptx
KarthikeyanC53
 
Floating Point Multiplication.pptx
Floating Point Multiplication.pptxFloating Point Multiplication.pptx
Floating Point Multiplication.pptx
KarthikeyanC53
 
Floating Point Addition.pptx
Floating Point Addition.pptxFloating Point Addition.pptx
Floating Point Addition.pptx
KarthikeyanC53
 
Floating Point Represenataion.pptx
Floating Point Represenataion.pptxFloating Point Represenataion.pptx
Floating Point Represenataion.pptx
KarthikeyanC53
 
Refined Version of Division.pptx
Refined Version of Division.pptxRefined Version of Division.pptx
Refined Version of Division.pptx
KarthikeyanC53
 
Version 1 Division.pptx
Version 1 Division.pptxVersion 1 Division.pptx
Version 1 Division.pptx
KarthikeyanC53
 
BOOTH’s ALGORITHM Part 1.pptx
BOOTH’s ALGORITHM Part 1.pptxBOOTH’s ALGORITHM Part 1.pptx
BOOTH’s ALGORITHM Part 1.pptx
KarthikeyanC53
 
1. Introduction to Arithmetic.pptx
1. Introduction to Arithmetic.pptx1. Introduction to Arithmetic.pptx
1. Introduction to Arithmetic.pptx
KarthikeyanC53
 
6.Performance.pptx
6.Performance.pptx6.Performance.pptx
6.Performance.pptx
KarthikeyanC53
 
5. Addressing Modes.pptx
5. Addressing Modes.pptx5. Addressing Modes.pptx
5. Addressing Modes.pptx
KarthikeyanC53
 
4.Instruction Formats.pptx
4.Instruction Formats.pptx4.Instruction Formats.pptx
4.Instruction Formats.pptx
KarthikeyanC53
 
3. Instruction Set.pptx
3. Instruction Set.pptx3. Instruction Set.pptx
3. Instruction Set.pptx
KarthikeyanC53
 

More from KarthikeyanC53 (20)

3. Virtual Memory.pptx
3. Virtual Memory.pptx3. Virtual Memory.pptx
3. Virtual Memory.pptx
 
2. Cache Mapping.pptx
2. Cache Mapping.pptx2. Cache Mapping.pptx
2. Cache Mapping.pptx
 
1. Introduction to Memory.pptx
1. Introduction to Memory.pptx1. Introduction to Memory.pptx
1. Introduction to Memory.pptx
 
6. ILP.pptx
6. ILP.pptx6. ILP.pptx
6. ILP.pptx
 
5. Exception.pptx
5. Exception.pptx5. Exception.pptx
5. Exception.pptx
 
4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx4. Pipeline Hazards.pptx
4. Pipeline Hazards.pptx
 
3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx3. Implementation of Pipelining in Datapath.pptx
3. Implementation of Pipelining in Datapath.pptx
 
2. Datapath Design with Control Unit.pptx
2. Datapath Design with Control Unit.pptx2. Datapath Design with Control Unit.pptx
2. Datapath Design with Control Unit.pptx
 
1. Introduction to Datapath Design.pptx
1. Introduction to Datapath Design.pptx1. Introduction to Datapath Design.pptx
1. Introduction to Datapath Design.pptx
 
Floating Point Multiplication.pptx
Floating Point Multiplication.pptxFloating Point Multiplication.pptx
Floating Point Multiplication.pptx
 
Floating Point Addition.pptx
Floating Point Addition.pptxFloating Point Addition.pptx
Floating Point Addition.pptx
 
Floating Point Represenataion.pptx
Floating Point Represenataion.pptxFloating Point Represenataion.pptx
Floating Point Represenataion.pptx
 
Refined Version of Division.pptx
Refined Version of Division.pptxRefined Version of Division.pptx
Refined Version of Division.pptx
 
Version 1 Division.pptx
Version 1 Division.pptxVersion 1 Division.pptx
Version 1 Division.pptx
 
BOOTH’s ALGORITHM Part 1.pptx
BOOTH’s ALGORITHM Part 1.pptxBOOTH’s ALGORITHM Part 1.pptx
BOOTH’s ALGORITHM Part 1.pptx
 
1. Introduction to Arithmetic.pptx
1. Introduction to Arithmetic.pptx1. Introduction to Arithmetic.pptx
1. Introduction to Arithmetic.pptx
 
6.Performance.pptx
6.Performance.pptx6.Performance.pptx
6.Performance.pptx
 
5. Addressing Modes.pptx
5. Addressing Modes.pptx5. Addressing Modes.pptx
5. Addressing Modes.pptx
 
4.Instruction Formats.pptx
4.Instruction Formats.pptx4.Instruction Formats.pptx
4.Instruction Formats.pptx
 
3. Instruction Set.pptx
3. Instruction Set.pptx3. Instruction Set.pptx
3. Instruction Set.pptx
 

Recently uploaded

Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 

Recently uploaded (20)

Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 

2. Addition and Subtraction.pptx

  • 1. ADDITION & SUBTRACTION Mr. C.KARTHIKEYAN, ASSISTANT PROFESSOR, ECE , RMKCET
  • 2. ADDITION & SUBTRACTION Un Signed Arithmetic Signed Arithmetic add addi sub The MIPS recognizes or ignores overflow by two kinds of arithmetic instructions addu addui subu cause exceptions on overflow do not cause exceptions on overflow
  • 3. OVER FLOW? No Over Flow Over Flow Overflow occurs when the result from an operation cannot be represented with the available hardware Operation Operand A Operand B A + B > 0 < 0 A + B < 0 > 0 A – B > 0 > 0 A – B < 0 < 0 Eg: (+10) + (-6) = +4 (-10) + (+6) = -4 Eg: (+10) - (+6) = +4 (-10) - (-6) = -4
  • 4. OVER FLOW? Over Flow Overflow occurs when the result from an operation cannot be represented with the available hardware Addition 10000 +10 01010 +6 00110 (+) Over Flow 10111 -5 1011 -4 1100 (+) Over Flow
  • 5. OVER FLOW? Over Flow Overflow occurs when the result from an operation cannot be represented with the available hardware Subtraction 11100 +6 00110 -10 10110 (-) Over Flow 0110 -6 1010 +4 0100 (-) Over Flow
  • 6. EXAMPLE Assume 185 and 122 are unsigned 8-bit decimal integers. Calculate 185 – 122. Is there over flow, under flow, or neither? 10111001 01111010 (-) 185 122 1 1 0 1 1 1 010 1 0 1 10 1 1 110 1 0 Neither Over Flow nor Under Flow Operation Operand A Operand B A + B > 0 < 0 A + B < 0 > 0 A – B > 0 > 0 A – B < 0 < 0 Computer Organization and Design by David A Patterson – Page no. 237 Condition for No Over Flow
  • 7. EXAMPLE Assume 185 and 122 are signed 8-bit decimal integers stored in sign-magnitude format. Calculate 185 + 122. Is there over flow, under flow, or neither? 10111001 01111010 +122 (+) 185 122 1 1 0 0 1 1 0 Neither Over Flow nor Under Flow -57 1 1 1 1 10 Operation Operand A Operand B A + B > 0 < 0 A + B < 0 > 0 A – B > 0 > 0 A – B < 0 < 0 Computer Organization and Design by David A Patterson – Page no. 237 Condition for No Over Flow
  • 8. EXAMPLE Assume 185 and 122 are signed 8-bit decimal integers stored in sign-magnitude format. Calculate 185 - 122. Is there over flow, under flow, or neither? 10111001 01111010 +122 (-) 185 122 1 1 1 1 1 1 0 Over Flow -57 0 Computer Organization and Design by David A Patterson – Page no. 237