Title: ECE 8053 Introduction to Computer Arithmetic
1ECE 8053 Introduction to Computer Arithmetic
(Website http//www.ece.msstate.edu/classes/ece80
53/fall_2003/)
Course Text Content Part 1 Number
Representation Part 2 Addition/Subtraction Part
3 Multiplication Part 4 Division Part 5 Real
Arithmetic (Floating-Point) Part 6 Function
Evaluation Part 7 Implementation Topics
2Course Learning Objectives
Computer Arithmetic students will be able to
... 1. explain the relative merits of number
systems used by arithmetic circuits including
both fixed- and floating-point number systems 2.
demonstrate the use of key acceleration
algorithms and hardware for addition/subtraction,
multiplication, and division, plus certain
functions 3. distinguish between the relative
theoretical merits of the different acceleration
schemes
3Course Learning Objectives(Continued)
4. identify the implementation limitations
constraining the speed of acceleration
schemes 5. evaluate, design, and optimize
arithmetic circuits for low-power 6. evaluate,
design, and optimize arithmetic circuits for
precision
4Course Learning Objectives(Continued)
7. design, simulate, and evaluate an arithmetic
circuit using appropriate references including
current journal and conference literature 8.
write a paper compatible with journal format
standards on an arithmetic design 9. make a
professional presentation with strong technical
content and audience interaction
5Importance of Computer Arithmetic
3.2 GHz Pentium has a clock cycle of 0.31 ns Can
one integer addition be done lt 0.31 ns in
execution stage of Pipeline?
What if you had to build a 32-bit adder ripple
carry and a gate delay was approximately 0.1 ns?
STEP 1 1101 1110 11011
-Note added from right to left. Why?
6Ripple-carry Structure
STEP 2 Design a circuit
x31
y31
x1
y1
x0
y0
c31
c2
c1
c00
c32
z31
z1
z0
Each box is a full-adder Implement it
7Full-Adder Implementation
xy
00
01
11
10
cin
0
0
1
0
1
1
1
0
1
0
xy
00
01
11
10
cin
0
0
0
1
0
1
0
1
1
1
cout cinx ciny x y
8Adder Circuit Analysis
STEP 3 Analysis
Critical Path is carry chain, 2 gate delays/bit 2
? 32 64 (64)(0.1ns) 6.4ns 6.4ns gtgt
0.31ns Must Use Faster Adder and/or Pipeline
More!!!!
9Number SystemsRoman Numeral System
Symbolic Digits
- RULES
- If symbol is repeated or lies to the right
of another higher-valued symbol, value is
additive - XX101020
- CXX1001010120
- If symbol is repeated or lies to the left of
a higher-valued symbol, value is subtractive - XXC - (1010) 100 80
- XLVIII -(10) 50 5 3 48
10Weighted Positional Number System
Example Arabic Number System (first used by
Chinese)
11Addition Paradigms
- right to left serial 1
147865
30921
178786
- right to left, parallel
147865
30921
177786
001000
178786
- random 461325 147865
30921 177786
001000 178786
12Binary Number System
- each xi?0,1 is a BInary digiT (BIT)
- magnitude of n is important
- sequence is a short-hand notation
- more precise definition is
- This is a radix-polynomial form
13Number System
- A Number System is defined if the following exist
- A digit set
- A radix or base value
- An addition operation
- A multiplication operation
- Example The binary number system
-
-
- Addition operator defined by addition table
- Multiplication operator defined by multiplication
table
14Number System Observations
- Cardinality of digit set (2) is equal to radix
value - Addition operator XOR, Multiplication is AND
- How many integers exist? Mathematically, there
are an infinite number, ? In computer, finite
range due to register length
smallest representable number
largest representable number
range of representable numbers-inclusive
(-exclusive interval bounds
- When ALU produces a result gtXmax or ltXmin,
incorrect result occurs - ALU should produce an error signal
15Example
- Assume 4-bit registers, unsigned binary numbers
Answer in register is 00112310
Overflow
16Machine Representations
- Most familiar number systems are
- nonredundant every value is uniquely
represented by a radix polynomial - weighted sequence of weights determines the
value of the n-tuple formed from the digit
set - positional wi depends only on position i
- conventional number systemswhere ß is a
constant. These are fixed-radix systems.
17Example
Since octal is fixed-radix and positional,we can
rewrite this value using shorthand notation
Note the importance of the use of 0 to serve as
a coefficient of the weight value w282
18Fixed-Radix Systems
Register of length n can represent a number with
a fractional part and an integral part
k number of integral digits m number of
fractional digits n k m
radix point
A programmer can use an implied radix point in
any position
19Scaling Factors
Fixed point arithmetic can utilize scaling
factors to adjust radix point position
a scaling factor
no correction
must divide by a
must multiply by a
20Unit in the Last Position (ulp)
- Given w0r-m and n, the position of the radix
point is determined
- Simpler to disregard position of the radix point
in fixed point by using unit in least
(significant) position ulp -
- For fractions
- For integers
ulp 1
Example
98.67510
1 ulp 1?10-30.001
1 ulp is the smallest amount a fixed point number
may increase or decrease
21Radix Conversion
Given a number in old radix r, conversion to the
new radix R representation - can be
accomplished doing the arithmetic in the old
or new radix - old and new representations may
not be exactly equal
22Radix Conversion
Given a value X represented in source system with
radix ?s, represent the same number in a
destination system with radix ?d
Consider the integral part of the number, XI, in
the ?d system
Consider the integral part of the number, XI, in
the ?d system
If XI is divided by ?d , we obtain x0 as a
remainder and quotient
Can Repeatedly Divide to Obtain Converted Value
23Radix Conversion Example
XI 34610 ?s10
?d 3
Fixed-point Decimal to Ternary Integer
Conversion, (arithmetic in old radix)
XI 1102113
Check by evaluating the radix polynomial
24Radix Conversion (fractional)
Consider the fractional part of the value in ?d
Fixed point system
Thus, PI is the desired digit We can repeatedly
multiply by the ?d value
25Radix Conversion Example
XI 0.29110 ?s10
?d 5
Fixed-point Decimal to Pentary Fractional
Conversion (arithmetic in old radix)
0.29110 is Finite Fraction for ?s10, but
infinite fraction for ?d 5