Docsity

Number Representation - Computer Arithmetic - Lecture Slides, Slides of Computer Science

Toggle sidebar
bg1
Part I
Number Representation
Number Representation
Numbers and Arithmetic
Representing Signed Numbers
Redundant Number Systems
Residue Number Systems
Addition / Subtraction
Basic Addition and Counting
Carry-Lookahead Adders
Variations in Fast Adders
Multioperand Addition
Multiplication
Basic Multiplication Schemes
High-Radix Multipliers
Tree and Array Multipliers
Variations in Multipliers
Division
Basic Division Schemes
High-Radix Dividers
Variations in Dividers
Division by Convergence
Real Arithmetic
Floating-Point Reperesentations
Floating-Point Operations
Errors and Error Control
Precise and Certifiable Arithmetic
Function Evaluation
Square-Rooting Methods
The CORDIC Algorithms
Variations in Function Evaluation
Arithmetic by Table Lookup
Implementation Topics
High-Throughput Arithmetic
Low-Power Arithmetic
Fault-Tolerant Arithmetic
Past, Present, and Future
Parts Chapters
I.
II.
III.
IV.
V.
VI.
VII.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
25.
26.
27.
28.
21.
22.
23.
24.
17.
18.
19.
20.
13.
14.
15.
16.
Elementary Operations
28. Reconfigurable Arithmetic
Appendix: Past, Present, and Future
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59

Partial preview of the text

Download Number Representation - Computer Arithmetic - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Part I

Number Representation

Number Representation

Numbers and ArithmeticRepresenting Signed Numbers Redundant Number SystemsResidue Number Systems

Addition / Subtraction

Basic Addition and CountingCarry-Look ahead Adders Variations in Fast AddersMultioperand Addition

Multiplication

Basic Multiplication SchemesHigh-Radix Multipliers Tree and Array MultipliersVariations in Multipliers

Division

Basic Division SchemesHigh-Radix Dividers Variations in DividersDivision by Convergence

Real Arithmetic

Floating-Point ReperesentationsFloating-Point Operations Errors and Error ControlPrecise and Certifiable Arithmetic

Function Evaluation

Square-Rooting MethodsThe CORDIC Algorithms Variations in Function EvaluationArithmetic by Table Lookup

Implementation Topics

High-Throughput ArithmeticLow-Power Arithmetic Fault-Tolerant ArithmeticPast, Present, and Future

Parts Chapters I.

II.

III.

IV.

V.

VI.

VII.

1.2. 3.4. 5.6. 7.8.

10.9. 11.12.

25.26. 27.28.

21.22. 23.24.

17.18. 19.20.

13.14. Elementary Operations 15.16.

  1. Reconfigurable Arithmetic Appendix: Past, Present, and Future

I Background and Motivation

Topics in This Part

Chapter 1 Numbers and Arithmetic

Chapter 2 Representing Signed Numbers

Chapter 3 Redundant Number Systems

Chapter 4 Residue Number Systems

Number representation arguably the most important topic:

  • Effects on system compatibility and ease of arithmetic
  • 2โ€™s-complement, redundant, residue number systems
  • Limits of fast arithmetic
  • Floating-point numbers to be covered in Chapter 17

1 Numbers and Arithmetic

Chapter Goals

Define scope and provide motivation

Set the framework for the rest of the book

Review positional fixed-point numbers

Chapter Highlights

What goes on inside your calculator?

Ways of encoding numbers in k bits

Radices and digit sets: conventional, exotic

Conversion from one system to another

Dot notation: a useful visualization tool

Numbers and Arithmetic: Topics

Topics in This Chapter

1.1 What is Computer Arithmetic?

1.2 Motivating Examples

1.3 Numbers and Their Encodings

1.4 Fixed-Radix Positional Number Systems

1.5 Number Radix Conversion

1.6 Classes of Number Representations

Top Ten Intel Slogans for the Pentium

Humor, circa 1995 (in the wake of the floating-point division bug)

  • 9.999 997 325 Itโ€™s a FLAW, dammit, not a bug
  • 8.999 916 336 Itโ€™s close enough, we say so
  • 7.999 941 461 Nearly 300 correct opcodes
  • 6.999 983 153 You donโ€™t need to know whatโ€™s inside
  • 5.999 983 513 Redefining the PC โ€“โ€“ and math as well
  • 4.999 999 902 We fixed it, really
  • 3.999 824 591 Division considered harmful
  • 2.999 152 361 Why do you think itโ€™s called โ€œfloatingโ€ point?
  • 1.999 910 351 Weโ€™re looking for a few good flaws
  • 0.999 999 999 The errata inside

Aspects of, and Topics in, Computer Arithmetic

Fig. 1.1 The scope of computer arithmetic.

Hardware (our focus in this book) Software โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“ โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“ Design of efficient digital circuits for Numerical methods for solving primitive and other arithmetic operations systems of linear equations, such as +, โ€“ , ๏‚ด, ๏‚ธ, ๏ƒ–, log, sin, and cos partial differential eqโ€™ns, and so on

Issues: Algorithms Issues: Algorithms Error analysis Error analysis Speed/cost trade-offs Computational complexity Hardware implementation Programming Testing, verification Testing, verification

General-purpose Special-purpose โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“ โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“โ€“ Flexible data paths Tailored to application Fast primitive areas such as: operations like Digital filtering +, โ€“ , ๏‚ด, ๏‚ธ, ๏ƒ– Image processing Benchmarking Radar tracking

Finite Precision Can Lead to Disaster

Example: Failure of Patriot Missile (1991 Feb. 25)

Source http://www.ima.umn.edu/~arnold/disasters/disasters.html

American Patriot Missile battery in Dharan, Saudi Arabia, failed to intercept incoming Iraqi Scud missile

The Scud struck an American Army barracks, killing 28

Cause, per GAO/IMTEC-92-26 report: โ€œsoftware problemโ€ (inaccurate calculation of the time since boot)

Problem specifics:

Time in tenths of second as measured by the systemโ€™s internal clock was multiplied by 1/10 to get the time in seconds

Internal registers were 24 bits wide

1/10 = 0.0001 1001 1001 1001 1001 100 (chopped to 24 b)

Error โ‰ˆ 0.1100 1100 ๏‚ด 2 โ€“^23 โ‰ˆ 9.5 ๏‚ด 10 โ€“^8

Error in 100-hr operation period

โ‰ˆ 9.5 ๏‚ด 10 โ€“^8 ๏‚ด 100 ๏‚ด 60 ๏‚ด 60 ๏‚ด 10 = 0.34 s

Distance traveled by Scud = (0.34 s) ๏‚ด (1676 m/s) โ‰ˆ 570 m

Inadequate Range Can Lead to Disaster

Example: Explosion of Ariane Rocket (1996 June 4)

Source http://www.ima.umn.edu/~arnold/disasters/disasters.html

Unmanned Ariane 5 rocket of the European Space Agency veered off its flight path, broke up, and exploded only 30 s after lift-off (altitude of 3700 m)

The $500 million rocket (with cargo) was on its first voyage after a decade of development costing $7 billion

Cause: โ€œsoftware error in the inertial reference systemโ€

Problem specifics:

A 64 bit floating point number relating to the horizontal velocity of the rocket was being converted to a 16 bit signed integer

An SRI* software exception arose during conversion because the 64-bit floating point number had a value greater than what could be represented by a 16-bit signed integer (max 32 767)

*SRI = Systรจme de Rรฉfรฉrence Inertielle or Inertial Reference System

Encoding Numbers in 4 Bits

Fig. 1.2 Some of the possible ways of assigning 16 distinct codes to represent numbers. Small triangles denote the radix point locations.

  • 16 - 14 - 12 - 10 - 8 - 6 - 4 - 2 0 2 4 6 8 10 12 14 16

Unsigned integers Signed-magnitude

3 + 1 fixed-point, xxx.x

Signed fraction, ๏‚ฑ.xxx

2โ€™s-compl. fraction, x.xxx

2 + 2 floating-point, s ๏‚ด 2 e in [-2, 1], s in [0, 3]

2 + 2 logarithmic (log = xx.xx)

๏‚ฑ

๏‚ฑ

Number format

log x

e e s

1.4 Fixed-Radix Positional Number Systems

( xk โ€“ 1 xk โ€“ 2... x 1 x 0. x โ€“ 1 x โ€“ 2... x โ€“ l ) r = xi r i

One can generalize to: Arbitrary radix (not necessarily integer, positive, constant) Arbitrary digit set, usually {โ€“a, โ€“ a+1,... , bโ€“1, b} = [โ€“a, b]

Example 1.1. Balanced ternary number system: Radix r = 3, digit set = [โ€“1, 1]

Example 1.2. Negative-radix number systems: Radix โ€“ r , r ๏‚ณ 2, digit set = [0, r โ€“ 1] The special case with radix โ€“ 2 and digit set [0, 1] is known as the negabinary number system

๏ƒฅ

๏€ฝ-

k 1

i l

1.5 Number Radix Conversion

Radix conversion, using arithmetic in the old radix r

Convenient when converting from r = 10

u = w. v

= ( xk โ€“ 1 xk โ€“ 2... x 1 x 0. x โ€“ 1 x โ€“ 2... x โ€“ l ) r Old

= ( XK โ€“ 1 XK โ€“ 2... X 1 X 0. X โ€“ 1 X โ€“ 2... Xโ€“ L ) R New

Radix conversion, using arithmetic in the new radix R

Convenient when converting to R = 10

Whole part Fractional part

Example: (31)eight = (25)ten 31 Oct. = 25 Dec. Halloween = Xmas

Radix Conversion: Old-Radix Arithmetic

Converting whole part w : (105)ten = (?)five

Repeatedly divide by five Quotient Remainder

Therefore, (105)ten = (410)five

Converting fractional part v : (105.486)ten = (410.?)five

Repeatedly multiply by five Whole Part Fraction

Therefore, (105.486)ten ๏€ (410.22033)five

Hornerโ€™s Rule for Fractions

Converting fractional part v : (0.22033)five = (?)ten

**(((((3 / 5) + 3) / 5 + 0) / 5 + 2) / 5 + 2) / 5 |-----| : : : : 0.6 : : : : |-----------| : : : 3.6 : : : |---------------------| : : 0.72 : : |-------------------------------| : 2.144 : |-----------------------------------------|

|-----------------------------------------------| 0.**

Hornerโ€™s

rule or

formula

Fig. 1.3 Hornerโ€™s rule used to convert (0.220 33)five to decimal.

1.6 Classes of Number Representations

Integers (fixed-point), unsigned: Chapter 1

Integers (fixed-point), signed Signed-magnitude, biased, complement: Chapter 2 Signed-digit, including carry/borrow-save: Chapter 3 (but the key point of Chapter 3 is using redundancy for faster arithmetic, not how to represent signed values) Residue number system: Chapter 4 (again, the key to Chapter 4 is use of parallelism for faster arithmetic, not how to represent signed values)

Real numbers, floating-point: Chapter 17 Part V deals with real arithmetic

Real numbers, exact: Chapter 20 Continued-fraction, slash,...

For the most part you need:

  • 2โ€™s complement numbers
  • Carry-save representation
  • IEEE floating-point format

However, knowing the rest of the material (including RNS) provides you with more options when designing custom and special-purpose hardware systems