Docsity

CS3220 Processor Design Homework 2 - Carry-Save Addition and Booth Multiplication - Prof. , Assignments of Computer Science

Toggle sidebar
bg1
Homework 2
Prof. Loh
CS3220 - Processor Design - Spring 2005
Handed Out: 01 Feb 2005
Due: 08 Feb 2005
1. Carry-Save Addition
In class we saw a carry-save adder that takes three inputs x, y, z and produces two outputs c, s such that x+y+z=c+s.
Consider a generalized carry-save adder that takes inputs x0, x1, x2, ..., xn−1and produces output y0, y1, ..., ym−1such
that n > m and Pn−1
i=1 xi=Pm−1
j=1 yj.
(a) Consider a 5-to-3 carry-save adder (n= 5, m = 3), with inputs x4, x3, x2, x1, x0and outputs y2, y1, y0. Fill in
the truth table for the y’s, given the 32 possible values of the x’s:
x4x3x2x1x0y2y1y0
0 0 0 0 0 0 0 0
.
.
..
.
..
.
.
(b) Draw a Wallace tree using 5-to-3 carry-save adders to add 32 numbers together. After the last 5-to-3 CSA, you
will need to use a 3-to-2 CSA, followed by a final look-ahead carry adder (LCA/parallel-prefix adder) to complete
the carry.
(c) For Ninputs each kbits in width, what is the asymptotic gate delay to add all Nnumbers together using 5-to-3
carry-save adders (plus the final 3-to-2 and LCA)?
(d) For three outputs (m= 3), what is the maximum number of inputs (largest value of n)?
(e) Write the asymptotic delay to add Ninputs each of kbits in width assuming X-to-3 carry save adders, where X
is the value from problem 1d.
2. Booth-Multiplication In class, we saw Booth Multiplication algorithms for processing 1 or 2 bits per step. The
algorithm can be extended to processes as many bits per step as you wish, although the logic gets more and more
complicated. Consider a Radix-8 Booth Multiplier (processes 3 bits per step). Fill in the following table to determine
the 3-bit Booth encoding, where Mis the multiplier:
Current Bits Previous Bit Operation Reason
xi+2 xi+1 xixi−1— —
0 0 0 0 Nothing In middle of run of zeros
0 0 0 1 +MEnded a run of ones
0 0 1 0 +MEnded a run of zeros (-M), Ended a run of ones (+2M)
.
.
..
.
..
.
..
.
.
3. Hybrid-Multiplier With regular multiplication using an adder tree (e.g. a Wallace tree), the multiplication problem
basically boils down to adding knumbers together (assuming inputs are k-bit values). A 2-bit Booth encoding allows
pf2

Partial preview of the text

Download CS3220 Processor Design Homework 2 - Carry-Save Addition and Booth Multiplication - Prof. and more Assignments Computer Science in PDF only on Docsity!

Homework 2

Prof. Loh

CS3220 - Processor Design - Spring 2005

Handed Out: 01 Feb 2005

Due: 08 Feb 2005

  1. Carry-Save Addition

In class we saw a carry-save adder that takes three inputs x, y, z and produces two outputs c, s such that x+y+z = c+s.

Consider a generalized carry-save adder that takes inputs x 0 , x 1 , x 2 , ..., xn− 1 and produces output y 0 , y 1 , ..., ym− 1 such

that n > m and

n− 1

i=

xi =

m− 1

j=

yj.

(a) Consider a 5-to-3 carry-save adder (n = 5, m = 3), with inputs x 4 , x 3 , x 2 , x 1 , x 0 and outputs y 2 , y 1 , y 0

. Fill in

the truth table for the y’s, given the 32 possible values of the x’s:

x 4 x 3 x 2 x 1 x 0 y 2 y 1 y 0

(b) Draw a Wallace tree using 5-to-3 carry-save adders to add 32 numbers together. After the last 5-to-3 CSA, you

will need to use a 3-to-2 CSA, followed by a final look-ahead carry adder (LCA/parallel-prefix adder) to complete

the carry.

(c) For N inputs each k bits in width, what is the asymptotic gate delay to add all N numbers together using 5-to-

carry-save adders (plus the final 3-to-2 and LCA)?

(d) For three outputs (m = 3), what is the maximum number of inputs (largest value of n)?

(e) Write the asymptotic delay to add N inputs each of k bits in width assuming X-to-3 carry save adders, where X

is the value from problem 1d.

  1. Booth-Multiplication In class, we saw Booth Multiplication algorithms for processing 1 or 2 bits per step. The

algorithm can be extended to processes as many bits per step as you wish, although the logic gets more and more

complicated. Consider a Radix-8 Booth Multiplier (processes 3 bits per step). Fill in the following table to determine

the 3-bit Booth encoding, where M is the multiplier:

Current Bits Previous Bit Operation Reason

x i+ x i+ x i x i− 1

0 0 0 0 Nothing In middle of run of zeros

0 0 0 1 +M Ended a run of ones

0 0 1 0 +M Ended a run of zeros (-M ), Ended a run of ones (+2M )

  1. Hybrid-Multiplier With regular multiplication using an adder tree (e.g. a Wallace tree), the multiplication problem

basically boils down to adding k numbers together (assuming inputs are k-bit values). A 2-bit Booth encoding allows

you to group two bits together and only have to perform one addition (or subtraction) for those two bits. Similarly, a

3-bit Booth encoding allows you to only perform one addition per three bits.

16-bit multiplication would normally require adding together 16 numbers. Show how to use a 2-bit Booth encoding

to reduce a 16-bit multiplication to adding together only 8 numbers. Complete the multiplication by summing the 8

numbers with a Wallace tree (using 3-to-2 CSAs and a final LCA).

You may use regular logic gates, MUXes, and the following basic blocks:

CSA

Booth

CSA

x 2 x 1 x 0

x 3 x 4

x y z

c s

Booth

{-2M,-M,0,+M,+2M}

xi+1 xi xi− 1

LCA

x y

z

To get you started: