36
Multioperand Addition Lecture 6

Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Embed Size (px)

Citation preview

Page 1: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Multioperand Addition

Lecture 6

Page 2: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Required Reading

Chapter 8, Multioperand Addition

Note errata at:http://www.ece.ucsb.edu/~parhami/text_comp_arit_1ed.htm#errors

Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design

Page 3: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Recommended Reading

J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems

Chapter 11.1.12 Multioperand Adders

Page 4: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Applications of multioperand addition

Multiplication Inner product

s = x(i) y(i) = i=0

n-1

i=0

n-1

p(i)p=a·x

Page 5: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Number of bits of the result

S = x(i)

i=0

n-1

x(i) [0..2k-1]

Smax = n (2k-1)Smin = 0

# of bits of S = log2 (Smax + 1) =

= log2 (n (2k-1) + 1) log2 n 2k =

= k + log2 n

Page 6: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Serial implementation of multioperand addition

Page 7: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Adding 7 numbers in the binary tree of adders

Page 8: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Ripple-carry adders at levels i and i+1

Page 9: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Example: Adding 8 3-bit numbers

Page 10: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Ripple-Carry Carry Propagate Adder (CPA)

a1 b1

FAc2

s1

a0 b0

FAc0c1

s0

a2 b2

FAc3

s2

an-1 bn-1

FAcn

sn-1

cn-1 . . .

Page 11: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry Save Adder (CSA)

FA

c2 s1

a0 b0

FA

c1 s0

FA

c3 s2

FA

cn sn-1 cn-1

. . .

c0

s3

a1 b1 c1a2 b2 c2an-1 bn-1 cn-1

Page 12: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

A Ripple-Carry vs. Carry-Save Adder

Page 13: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

0 1 0 1 01 1 0 1 11 0 1 1 1

24 23 22 21 20

0 0 1 1 01 1 0 1 1

xyz

sc

Operation of a Carry Save Adder (CSA)

Example

x+y+z = s + c

Page 14: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry propagate and carry-save adders in dot notation

Page 15: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Specifying full- and half-adder blocks in dot notation

Page 16: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry-save adder for four operands

x3 x2 x1 x0

y3 y2 y1 y0

z3 z2 z1 z0

w3 w2 w1 w0

s3 s2 s1 s0

c4 c3 c2 c1

w3 w2 w1 w0

c4 s3 s2 s1 s0

c4 c3 c2 c1

’’’’’’’’

S5 S4 S3 S2 S1 S0

Page 17: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry-save adder for four operands

s0s1s2s3 c1c2c3c4

s0s1s2s3 c1c2c3c4’’’’’’’’

Page 18: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry-save adder for four operands

x y z

4 4 4

CSA

CSA

4

w

CPA

sc

s’c’

S

Page 19: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Carry-save adder for six operands

CSA tree Implementation of one-bit slice

Page 20: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Tree of carry save adders reducingseven numbers to two

Page 21: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Addition of sevensix-bit numbersin dot notation

Page 22: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Adding sevenk-bit numbers:block diagram

Page 23: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Relationship Between Number of Inputs and Tree Height

Page 24: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Latency

LatencyCSA = h(n) TFA + LatencyCPA(k, n)

Tree heightfor n operands

Widths

CSA

CPA

k .. k + log2 ntypically

close to k bits

k + log2 n

Component Adders

Parameters of tree carry-save adders (1)

Page 25: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Maximum number of inputs that can be reduced to two by an h-level tree, n(h)

Parameters of tree carry-save adders (2)

n(0) = 2

n(h) = n(h-1)32

n(1) = 3n(2) = 4n(3) = 6

n(4) = 9n(5) = 13n(6) = 19

2 ( )h-1 < n(h) 2 ( )h32

32

Page 26: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Parameters of tree carry-save adders (3)

Smallest height of the tree carry save adder for n operands, h(n)

h(n) = 1 + h( )23

n

h(n) log ( )

h(2) = 0

n2

3

2

Page 27: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors
Page 28: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Wallace vs. Dadda Trees (1)

Wallace trees

Dadda trees

• Reduce the size of the final Carry Propagate Adder (CPA)• Optimum from the point of view of speed

• Reduce the cost of the carry save tree• Optimum (among the CSA trees) from the point of view of area

Page 29: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

• Wallace reduces number of operands at earliest opportunity– Goal of this is to have smallest number of bits

for CPA adder– However, sometimes having a few bits longer

CPA adder does not affect the propagation delay significantly (i.e. carry-lookahead)

• Dadda seeks to reduce the number of FA and HA units – May be at the cost of a slightly larger final CPA

Wallace vs. Dadda Trees (2)

Page 30: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Wallace Tree

Page 31: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Dadda Tree

Page 32: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

0 1 0 1 01 1 0 1 11 0 1 1 11 0 1 1 11 1 1 1 1

24 23 22 21 20

0 1 1 1 0 0 1 1 0 01 0 0 1 1

abcde

s0s1s2

5-to-3 Parallel Counter

a+b+c+d+e = s0+s1+s2

Page 33: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

S0

S1

S2

‘0’

e

LUT F

d

c

a

b

d

c

a

bLUT G

Implementation of 1-bit of 5-to-3 parallel counter

using single CLB slice of a Virtex FPGA

Page 34: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

w w w w w

w

CSA

CSA

CSA

CPA

y=a+b+c+d+e mod 2w

a b c d ew w w w w

w

PC

CSA

CPA

y=a+b+c+d+e mod 2w

a b c d e

s2 s1 s0

Carry Save Adder vs. 5-to-3 Parallel Counter

Page 35: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors

Generalized Parallel Counters

(5, 5; 4)-counter Fig. 8.17 Dot notation for a (5, 5; 4)-counter and the use of such counters for reducing five numbers to two numbers.

. . .

Multicolumn reduction

(2, 3; 3)-counter

Unequal columns

Generalized parallel counter = Parallel compressor

Page 36: Multioperand Addition Lecture 6. Required Reading Chapter 8, Multioperand Addition Note errata at: parhami/text_comp_arit_1ed.htm#errors