AppI - I.1 I.2 I.3 I.4 I.5 I.6 I.7 I.8 I.9 I.10 I.11 I.12...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
I.1 Introduction I-2 I.2 Basic Techniques of Integer Arithmetic I-2 I.3 Floating Point I-13 I.4 Floating-Point Multiplication I-17 I.5 Floating-Point Addition I-21 I.6 Division and Remainder I-27 I.7 More on Floating-Point Arithmetic I-32 I.8 Speeding Up Integer Addition I-37 I.9 Speeding Up Integer Multiplication and Division I-44 I.10 Putting It All Together I-58 I.11 Fallacies and Pitfalls I-62 I.12 Historical Perspective and References I-62 Exercises I-68
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
I Computer Arithmetic by David Goldberg Xerox Palo Alto Research Center The Fast drives out the Slow even if the Fast is wrong. W. Kahan
Background image of page 2
I-2 n Appendix I Computer Arithmetic Although computer arithmetic is sometimes viewed as a specialized part of CPU design, it is a very important part. This was brought home for Intel in 1994 when their Pentium chip was discovered to have a bug in the divide algorithm. This Foating-point Faw resulted in a Furry of bad publicity for Intel and also cost them a lot of money. Intel took a $300 million write-off to cover the cost of replacing the buggy chips. In this appendix we will study some basic Foating-point algorithms, includ- ing the division algorithm used on the Pentium. Although a tremendous variety of algorithms have been proposed for use in Foating-point accelerators, actual implementations are usually based on re±nements and variations of the few basic algorithms presented here. In addition to choosing algorithms for addition, sub- traction, multiplication, and division, the computer architect must make other choices. What precisions should be implemented? How should exceptions be handled? This appendix will give you the background for making these and other decisions. Our discussion of Foating point will focus almost exclusively on the IEEE Foating-point standard (IEEE 754) because of its rapidly increasing acceptance. Although Foating-point arithmetic involves manipulating exponents and shifting fractions, the bulk of the time in Foating-point operations is spent operating on fractions using integer algorithms (but not necessarily sharing the hardware that implements integer instructions). Thus, after our discussion of Foating point, we will take a more detailed look at integer algorithms. Some good references on computer arithmetic, in order from least to most detailed, are Chapter 3 of Patterson and Hennessy [2004]; Chapter 7 of Hama- cher, Vranesic, and Zaky [1984]; Gosling [1980]; and Scott [1985]. Readers who have studied computer arithmetic before will ±nd most of this sec- tion to be review. Ripple-Carry Addition Adders are usually implemented by combining multiple copies of simple com- ponents. The natural components for addition are half adders and full adders . The half adder takes two bits a and b as input and produces a sum bit s and a carry bit c out as output. Mathematically, s = ( a + b ) mod 2 , and c out = ( a + b )/ 2 , where is the Foor function. As logic equations, s = ab + a b and c out = ab , where ab means a b and a + b means a b . The half adder is also called a (2,2) adder, since it takes two inputs and produces two outputs. The full adder
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 03/23/2011.

Page1 / 74

AppI - I.1 I.2 I.3 I.4 I.5 I.6 I.7 I.8 I.9 I.10 I.11 I.12...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online