Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu

Similar presentations


Presentation on theme: "CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu"— Presentation transcript:

1 CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
CSE 575 Computer Arithmetic Spring Mary Jane Irwin (

2 Student Presentations - April 29
1 9:45 Fast adders Matt & Ki-Yong 2 10:10 Array multipliers Jahan & Jaehyun 3 10:35 Divider Wei-Lun & Ing-Chao 11:00 BREAK 4 11:15 Log PE Swapna, Greg, Eric, & Theo 5 12:05 Nanosenor PE Aman

3 Number Representations
“Understanding different ways of representing numbers, including their relative cost-performance benefits and conversions between various representations, is an important prerequisite for designing efficient arithmetic algorithms or circuits.” Parhami

4 Review of Machine Representations
Positional - value of each symbol depends on its relative position Fixed radix, r - unit of each position is a constant multiple of the radix (base) Consecutive symbol (or digit) set, D, with at least r symbols Scale factor, s - implied radix point (integer, fraction, or mixed number) Precision, n=k+l - granularity of representation Range - number of distinct values from largest to smallest; depends on n, s, and r Advantages – simple and elegant algorithms for performing arithmetic Digit set consists of at least r consecutive, distinct, integer digits

5 Real Number Representations
Floating point (approximation) Exact arithmetic (continued fractions, fixed-slash and floating-slash number systems) Keep numbers as num/denom pairs Exact arithmetic (e.g., 2/3) Division is multiplication Interval arithmetic Logarithmic representation Essentially logarithmic representation is floating point with no significand field (other than the hidden 1)

6 Logarithmic Number System
Keep numbers as log2 |x| Fast, easy multiply and divide (just add and subtract) Large dynamic range, but low precision Hard addition and subtraction, conversion Positional - value of each symbol depends on its relative position Fixed radix, r - unit of each position is a constant multiple of the radix Consecutive symbol (or digit) set, D, with at least r symbols Scale factor, s - mixed number Advantages – simple and elegant algorithms for performing arithmetic Digit set consists of at least r consecutive, distinct, integer digits

7 Representing Logarithmic Numbers
Components – sign, exponent E X=  bE so E = logb |X| where is b is a constant (usually 2) and where E is usually a signed mixed number (or is scaled up by a constant factor if X < 1 so that E is always positive) Do scaling so don’t have negative logarithms (would be the case for numbers between 0 and 1) if want to represent numbers smaller than 1 Scaling means logarithm part biased by the logarithm of the constant If we forced E to be an integer (rather than mixed number) we could only represent powers of b! sign Fixed point exponent E Implied radix point

8 Conversion to Log Rep Given X an integer
X = 2K * (1 + F) where 0  F < 1 log2 |X| = K + log2 (1 + F)  K + F K is the number of bits between the left most 1 and the binary point F is the remaining bits excluding the leftmost one represented as a fraction e.g., X = = 7310 K = 6 = 1102; F = E = (2E = 70.55) only exact for powers-of-two values of X

9 Conversion from Log Rep
Given E = K + F then X = 2K * (1 + F) K is the integer part of E F is the fractional part of E e.g., E = K = 1102 = 6; F = X = 26 * ( ) = = 7310

10 Logarithmic Arithmetic
(SX, LX) = (sign(X), log2 |X|) Multiplication (SX, LX)  (SY, LY) = (SX  SY, LX + LY) Division (SX, LX) / (SY, LY) = (SX  SY, LX - LY) Addition/Subtraction (SX, LX)  (SY, LY) = (SZ, LZ)

11 Addition/Subtraction
Assuming X  Y  0 LZ = log (X  Y)  computed via table lookup = log (X(1  Y/X)) = LX + log (1  Y/X) log (Y/X) can be easily computed as  = - (LX - LY) So, given , log (1  Y/X) = log (1  log-1 ) which is obtained via a table lookup ROM (with  as the input) log (X + Y ) = LX + +() log (X - Y ) = LX + -() Binary input ROM too expensive – for 12 bit operands would be a 2 **24 table of 12 bit results!!

12 Indirect Log Add&Subtract
2u+1 addr bits LX (u-bits) u contentbits 2** ROM log (1  log-1 ) Subtractor LY (u-bits) () Need two tables - one holding log(1+log-1 of delta) for add; and one holding log(1-log-1 of delta) for subtract Adder u +1 bits LZ (u-bits)

13 Logarithmic ALU SX SZ SY Control add/subt LX Compare LY +,- ROM
LX>LY add/subt LX Compare LY +,- ROM mult/div Lm Assumes the use of scaling of all values by a multiplicative factor m, so that numbers between 0 and 1 are also represented with unsigned logarithms. So the log of the scale factor, m, (bias Lm) must be subtracted in multiplication and added in division. LZ

14 Other Arithmetic Topics
Residue (next lecture) Distributed arithmetic On-line or digit-pipelined arithmetic . . .

15 Key References Muller, Scherbyna, Tisserand, Semi-logarithmic Number Systems, IEEE Trans. on Computers, 47(2): , 1998. Noetzel, An interpolating memory unit for function evaluation, IEEE Trans. on Computers, 38(3): , 1989. Parhami, Computer Arithmetic, Oxford Univ. Press, 1999. Swartzlander, Alexopoulos, The Sign/Logarithm Number System, IEEE Trans. on Computers, 24(12): , 1975.


Download ppt "CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu"

Similar presentations


Ads by Google