Digital Arithmetic - Ercegovac/Lang 2003 1 - Introduction
Digital Arithmetic - Ercegovac/Lang 2003 1 - Introduction
DIGITAL ARITHMETIC
Miloš D. Ercegovac
Computer Science Department
University of California Los Angeles
and
Tomás Lang
Department of Electrical and Computer Engineering
University of California at Irvine
Viewgraphs Copyright
c 2003 by the authors
Copyright
c 2004 by Elsevier Science (USA)
• General-purpose processors
3 Address calculations
- basic operations
- fixed point and floating point
- IEEE standard
- vector processors
• Areas of application:
- signal processing
- embedded systems
- matrix computations
- graphics, vision, multi-media
- cryptography and security
- robotics, instrumentation; others?
• Features:
- better use of technology
- improvement in speed, area, power
- flexibility in
* implementation; decomposition into modules
* number systems and data formats; algorithms
• Need good design tools; difficult to change; FPGAs?
• Flexibility
F :N →V
• Choose NRS to
– allow efficient computation(s)
– suitable interface with other systems
• Different implementation-performance constraints
=⇒ variety of NRS
c) Nonredundant/redundant
Redundant: F −1(X) = F −1(Y )
i=0
where
W = (wn−1, . . . , w0) weight vector
Define
R = (rn−1, . . . , r0) radix vector
so that
w0 = 1 wi = wi−1ri−1
• Fixed-radix NRS
ri = r
Then wi = ri so that
n−1
x= xi r i
X
i=0
• Negative radix
n−1
r = −2, x = Pi=0 xi(−2)i
1011 = (-8) + 0 + (-2) + 1 = -9
0111 = 0 + 4 + (-2) + 1 = 3
• Complex radix
√
r = 2j, j = −1, xi ∈ {0, 1, 2, 3} (Knuth’s quarter imaginary NRS)
W: -8j -4 +2j +1
1231 =⇒1 × (−8j) + 2 × (−4) + 3 × (2j) + 1 × 1 = −7 − 2j
• Non-canonical digit set, r = 2, {-1,0,1} or {0,1,2}
Example: radix 4 D = {−3, −2, −1, 0, 1, 2, 3}
• Fixed radix r
• Non-canonical digit set
D = {−a, −a + 1, . . . , −1, 0, 1, . . . , b − 1, b}
• Symmetric if a = b
• Redundant a + b + 1 > r (a, b ≤ r − 1)
– ”standard” a, b ≤ r − 1
– over-redundant a, b > r − 1
– Redundancy factor
a 1
ρ = , ρ>
r−1 2
• ri 6= rj
• Example: Representation of time R = (31, 24, 60, 60)
• Example: Factorial number system
ri = i + 2, i = 0, . . . , n − 1
R = (n + 1, n, . . . , 3, 2)
wi = (i + 1)!
where xi = x mod mi
• Represents uniquely integers in the range
n−1
0 ≤ x < Πi=0 mi
(more later)
Examples:
• True-and-Complement (TC):
– 2’s complement
– 1s’ complement
• Biased representation
C − |x| if x < 0
• Converse mapping
xR if xR < C/2
x =
xR − C if xR > C/2
• B – bias
• −k ≤ x ≤ k
• xR = x + B
•B≥k
• Bottom-up development
Primitives
+ Addition/subtraction
+ Multioperand addition
+ Arithmetic shifts
+ Multiplication by digit
+ Result-digit selection (PLA)
+ Table look-up
+ Multiplication
• Algorithms
+ Composition of primitives
Uses: Concatenation
• Examples:
3 multiplication R[i + 1] = 1r (R[i] + X · r nyi)
3 division R[i + 1] = rR[i] − qi+1Y qi+1 = g(R[i + 1], Y )
• Example:
3 division
R[i + 1] = rR[i](1 + qi+1r−(i+1)) + qi+1
qi+1 = g(R[i], Y )
Q[i + 1] = Q[i](1 + qi+1r−(i+1))
• Iterative Approximations
Z[i + 1] = f (Z[i], X, Y ) until g(Z(i)) < ε
Example:
3 reciprocal
Z[i + 1] = Z[i](2 − Z[i]X)
• Polynomial Approximations
z = a 0 + a 1 x + a 2 x2 + · · ·
• Measures
+ Execution time
+ Throughput
• Improving speed
a) Arithmetic level
+ Reducing number of steps
Example: higher radix
Example: combinational instead of sequential
+ Reducing time of step
Example: carry-save adder instead of carry-propagate
+ Overlap steps (concurrency/pipelining)
Example: multiple generation and addition (in mult.)
Example: simultaneous additions (in mult.)
b) Implementation level
+ Reduce number of logic levels
• Measures
+ Packaging
+ Interconnection complexity
+ Number of pins
+ Number of chips and types of chips
+ Number of gates and types of gates
+ Area
+ Design cost; verification and testing cost
+ Power dissipation
+ Power consumption
• Reduction of cost