Difference between revisions of "Overflow"

From Mill Computing Wiki
Jump to: navigation, search
(Created page with "When integer operations produce values that can't be contained within the bit width of the result, there are different strategies of how to deal with it. In all cases the C...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1:Line 1:
When integer operations produce values that can't be contained within the bit width of the result, there are different strategies of how to deal with it.
+
When integer operations produce values that can't be contained within the bit width of the result, there are different strategies of how to deal with it. Which one is used depends on the chosen operation.
  
 
In all cases the [[Condition_Code|condition codes]] are generated and can be queried with the dedicated ganged operations. What the overflow behavior does determine is the primary result that is produced.
 
In all cases the [[Condition_Code|condition codes]] are generated and can be queried with the dedicated ganged operations. What the overflow behavior does determine is the primary result that is produced.
  
1. modulo - normal silent overflow or underflow, also called wraparound
+
# modulo - normal silent overflow or underflow, also called wraparound
2. saturating - the highest of lowest representable value in the given with is the returned result
+
# saturating - the highest of lowest representable value in the given with is the returned result
3. excepting - the appropriate [[NaR]] is created as the result
+
# excepting - the appropriate [[NaR]] is created as the result
4. widening - here the scalar byte width is doubled and the full and exact result is the return value
+
# widening - here the scalar byte width is doubled, whether it is needed or not, and the full and exact result is the return value

Latest revision as of 23:50, 29 December 2014

When integer operations produce values that can't be contained within the bit width of the result, there are different strategies of how to deal with it. Which one is used depends on the chosen operation.

In all cases the condition codes are generated and can be queried with the dedicated ganged operations. What the overflow behavior does determine is the primary result that is produced.

  1. modulo - normal silent overflow or underflow, also called wraparound
  2. saturating - the highest of lowest representable value in the given with is the returned result
  3. excepting - the appropriate NaR is created as the result
  4. widening - here the scalar byte width is doubled, whether it is needed or not, and the full and exact result is the return value