Top Banner
Tree and Array Multipliers Lecture 7
36

Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

May 03, 2018

Download

Documents

HoàngLiên
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Tree and Array Multipliers

Lecture 7

Page 2: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Required Reading

Chapter 11, Tree and Array Multipliers Chapter 12.5, The special case of squaring 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: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The
Page 4: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Notation

a Multiplicand ak-1ak-2 . . . a1 a0 x Multiplier xk-1xk-2 . . . x1 x0 p Product (a ⋅ x) p2k-1p2k-2 . . . p2 p1 p0

Page 5: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Multiplication of two 4-bit unsigned binary numbers in dot notation

Page 6: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Basic Multiplication Equations

x = ∑ xi ⋅ 2i

i=0

k-1 p = a ⋅ x

p = a ⋅ x = ∑ a ⋅ xi ⋅ 2i =

= x0a20 + x1a21 + x2a22 + … + xk-1a2k-1

i=0

k-1

Page 7: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Unsigned Multiplication

a4 a3 a2 a1 a0

x4 x3 x2 x1 x0 x

a4x0 a3x0 a2x0 a1x0 a0x0

a4x1 a3x1 a2x1 a1x1 a0x1

a4x2 a3x2 a2x2 a1x2 a0x2

a4x3 a3x3 a2x3 a1x3 a0x3

a4x4 a3x4 a2x4 a1x4 a0x4

p0 p1 p9 p2 p3 p4 p5 p6 p7 p8

+

ax0 20

ax1 21

ax2 22

ax3 23

ax4 24

Page 8: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Full tree multiplier - general structure

Page 9: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

7 x 7 tree multiplier

Page 10: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

A slice of a balanced-delay tree for 11 inputs

Page 11: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Tree multiplier with a more regular structure

Page 12: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

12

Unsigned vs. Signed Multiplication

1111 1111 x

11100001

15 15 x

225

1111 1111 x

00000001

-1 -1 x

1

Unsigned Signed

Page 13: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

2’s Complement Multiplication (1)

a4 a3 a2 a1 a0

x4 x3 x2 x1 x0 x

20 23 22 21 -24

-a4 a3 a2 a1 a0

-x4 x3 x2 x1 x0 x

20 23 22 21 24

Page 14: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4 a3 a2 a1 a0

-x4 x3 x2 x1 x0 x

-a4x0 a3x0 a2x0 a1x0 a0x0

-a4x1 a3x1 a2x1 a1x1 a0x1

-a4x2 a3x2 a2x2 a1x2 a0x2

-a4x3 a3x3 a2x3 a1x3 a0x3

-a0x4

p0 p1 -p9 p2 p3 p4 p5 p6 p7 p8

+

2’s Complement Multiplication (2)

-a1x4 -a2x4 -a3x4 a4x4

20 23 22 21 29 24 25 26 27 28

Page 15: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

2’s Complement Multiplication (3)

p0 p1 -p9 p2 p3 p4 p5 p6 p7 p8

20 23 22 21 29 24 25 26 27 28

p0 p1 p9 p2 p3 p4 p5 p6 p7 p8

20 23 22 21 -29 24 25 26 27 28

Page 16: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

- aj xi = - aj (1 - xi) = aj xi - aj = aj xi + aj - 2 aj

z = 1 - z

2’s Complement Multiplication (4)

z = 1 - z

- aj xi = - (1- aj ) xi = aj xi - xi = aj xi + xi - 2 xi

- aj xi = - (1- aj xi) = aj xi - 1 = aj xi + 1 - 2

-aj = - (1 - aj) = aj - 1 = aj + 1 - 2

-xi = - (1 - xi) = xi - 1 = xi + 1 - 2

Page 17: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4x0 -a4x1

-a4x2 -a4x3 +

a4x0

a4

-a4

a4x1

a4

-a4

a4x2

a4

-a4

a4x3

a4

-a4

a4x0

a4

a4x2 a4x1 a4x3 a4 -1

Page 18: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

+

a0x4

x4

-x4

a1x4

x4

-x4

a2x4

x4

-x4

a3x4

x4

-x4

a0x4 x4

a2x4 a1x4 a3x4 x4

-1

-a0x4 -a1x4 -a2x4 -a3x4

Page 19: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

a4x0

a4

a4x2 a4x1 a4x3 a4 -1

a0x4 x4

a2x4 a1x4 a3x4 x4 -1

29 24 25 26 27 28

a4x0

a4

a4x2 a4x1 a4x3 a4 -1

a0x4

x4

a2x4 a1x4 a3x4 x4

a4x0

a4

a4x2 a4x1 a4x3 a4 1

a0x4

x4

a2x4 a1x4 a3x4 x4

-29

Page 20: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4 a3 a2 a1 a0

-x4 x3 x2 x1 x0 x

a4x0 a3x0 a2x0 a1x0 a0x0

a4x1 a3x1 a2x1 a1x1 a0x1

a4x2 a3x2 a2x2 a1x2 a0x2

a4x3 a3x3 a2x3 a1x3 a0x3

a0x4

p0 p1 p9 p2 p3 p4 p5 p6 p7 p8

+

Baugh-Wooley 2’s Complement Multiplier

a1x4 a2x4 a3x4 a4x4

20 23 22 21 -29 24 25 26 27 28

x4

a4 x4

a4 1

Page 21: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4x0 -a4x1

-a4x2 -a4x3 +

a4x0

1

-1

a4x1

1

-1

a4x2

1

-1

a4x3

1

-1

1 -1

a4x0 a4x1 a4x2 a4x3

Page 22: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

+

a0x4

1

-1

a1x4

1

-1

a2x4

1

-1

a3x4

1

-1

a0x4 1

a2x4 a1x4 a3x4

-1

-a0x4 -a1x4 -a2x4 -a3x4

Page 23: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

a0x4 1

a2x4 a1x4 a3x4

-1

1 -1

a4x0 a4x1 a4x2 a4x3

29 24 25 26 27 28

a0x4 1

a2x4 a1x4 a3x4 -1

a4x0 a4x1 a4x2 a4x3

a0x4 1

a2x4 a1x4 a3x4 1

a4x0 a4x1 a4x2 a4x3

-29

Page 24: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4 a3 a2 a1 a0

-x4 x3 x2 x1 x0 x

a4x0 a3x0 a2x0 a1x0 a0x0

a4x1 a3x1 a2x1 a1x1 a0x1

a4x2 a3x2 a2x2 a1x2 a0x2

a4x3 a3x3 a2x3 a1x3 a0x3

a0x4

p0 p1 p9 p2 p3 p4 p5 p6 p7 p8

+

Modified Baugh-Wooley Multiplier

a1x4 a2x4 a3x4 a4x4

20 23 22 21 -29 24 25 26 27 28

1 1

Page 25: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Basic array multiplier

Page 26: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

5 x 5 Array Multiplier

Page 27: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Array Multiplier - Basic Cell

x

y

cin

cout s

FA

Page 28: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

-a4 a3 a2 a1 a0

-x4 x3 x2 x1 x0 x

a4x0 a3x0 a2x0 a1x0 a0x0

a4x1 a3x1 a2x1 a1x1 a0x1

a4x2 a3x2 a2x2 a1x2 a0x2

a4x3 a3x3 a2x3 a1x3 a0x3

a0x4

p0 p1 p9 p2 p3 p4 p5 p6 p7 p8

+

Baugh-Wooley 2’s Complement Multiplier

a1x4 a2x4 a3x4 a4x4

20 23 22 21 -29 24 25 26 27 28

x4

a4 x4

a4 1

Page 29: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Modifications in a 5 x 5 multiplier

Page 30: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Array Multiplier – Modified Basic Cell

si-1 ci

ci+1 si

FA

xn

am

Page 31: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

5 x 5 Array Multiplier with modified cells

Page 32: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Pipelined 5 x 5 Multiplier

Page 33: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Optimizations for Squaring (1)

Page 34: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Optimizations for Squaring (2)

xi xj xj xi

xi xj

xi xj xi

xi xj xi xj

xi xj + xi xj = 2 xi xj

xi xj + xi = 2 xi xj - xi xj + xi = = 2 xi xj + xi (1-xj) = = 2 xi xj + xi xj

xi xi = xi

Page 35: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Squaring Using Look-Up Tables for relatively small values k

input=a output=a2 0 1 2 3

2k-1

0 1 4 9

(2k-1)2

4 16

i i2 . . .

. . .

2k words 2k-bit each

Page 36: Tree and Array Multipliers - George Mason Universityece.gmu.edu/.../S14/viewgraphs/ECE645_lecture7_tree_multipliers.pdf · Chapter 11, Tree and Array Multipliers Chapter 12.5, The

Multiplication Using Squaring

a ⋅ x = (a+x)2 - (a-x)2

4