Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tree and Array Multipliers Lecture 8. Required Reading Chapter 11, Tree and Array Multipliers Chapter 12.5, The special case of squaring Note errata at:

Similar presentations


Presentation on theme: "Tree and Array Multipliers Lecture 8. Required Reading Chapter 11, Tree and Array Multipliers Chapter 12.5, The special case of squaring Note errata at:"— Presentation transcript:

1 Tree and Array Multipliers Lecture 8

2 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

3

4 Notation a Multiplicand a k-1 a k-2... a 1 a 0 x Multiplier x k-1 x k-2... x 1 x 0 p Product (a  x) p 2k-1 p 2k-2... p 2 p 1 p 0

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

6 Basic Multiplication Equations x =  x i  2 i i=0 k-1 p = a  x p = a  x =  a  x i  2 i = = x 0 a2 0 + x 1 a2 1 + x 2 a2 2 + … + x k-1 a2 k-1 i=0 k-1

7 Unsigned Multiplication a 4 a 3 a 2 a 1 a 0 x 4 x 3 x 2 x 1 x 0 x a 4 x 0 a 3 x 0 a 2 x 0 a 1 x 0 a 0 x 0 a 4 x 1 a 3 x 1 a 2 x 1 a 1 x 1 a 0 x 1 a 4 x 2 a 3 x 2 a 2 x 2 a 1 x 2 a 0 x 2 a 4 x 3 a 3 x 3 a 2 x 3 a 1 x 3 a 0 x 3 a 4 x 4 a 3 x 4 a 2 x 4 a 1 x 4 a 0 x 4 p0p0 p1p1 p9p9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 + ax 0 2 0 ax 1 2 1 ax 2 2 2 ax 3 2 3 ax 4 2 4

8 Full tree multiplier - general structure

9 7 x 7 tree multiplier

10 A slice of a balanced-delay tree for 11 inputs

11 Tree multiplier with a more regular structure

12 12 Unsigned vs. Signed Multiplication 1111 x 11100001 15 x 225 1111 x 00000001 x 1 UnsignedSigned

13 2’s Complement Multiplication (1) a 4 a 3 a 2 a 1 a 0 x 4 x 3 x 2 x 1 x 0 x 2020 2323 2 2121 -2 4 -a 4 a 3 a 2 a 1 a 0 -x 4 x 3 x 2 x 1 x 0 x 2020 2323 2 2121 2424 

14 -a 4 a 3 a 2 a 1 a 0 -x 4 x 3 x 2 x 1 x 0 x -a 4 x 0 a 3 x 0 a 2 x 0 a 1 x 0 a 0 x 0 -a 4 x 1 a 3 x 1 a 2 x 1 a 1 x 1 a 0 x 1 -a 4 x 2 a 3 x 2 a 2 x 2 a 1 x 2 a 0 x 2 -a 4 x 3 a 3 x 3 a 2 x 3 a 1 x 3 a 0 x 3 -a 0 x 4 p0p0 p1p1 -p 9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 + 2’s Complement Multiplication (2) -a 1 x 4 -a 2 x 4 -a 3 x 4 a4x4a4x4 2020 2323 2 2121 2929 2424 2525 2626 2727 2828

15 2’s Complement Multiplication (3) p0p0 p1p1 -p 9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 2020 2323 2 2121 2929 2424 2525 2626 2727 2828  p0p0 p1p1 p9p9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 2020 2323 2 2121 -2 9 2424 2525 2626 2727 2828

16 - a j x i = - a j (1 - x i ) = a j x i - a j = a j x i + a j - 2 a j z = 1 - z 2’s Complement Multiplication (4) z = 1 - z - a j x i = - (1- a j ) x i = a j x i - x i = a j x i + x i - 2 x i - a j x i = - (1- a j x i ) = a j x i - 1 = a j x i + 1 - 2 -a j = - (1 - a j ) = a j - 1 = a j + 1 - 2 -x i = - (1 - x i ) = x i - 1 = x i + 1 - 2

17 -a 4 x 0 -a 4 x 1 -a 4 x 2 -a 4 x 3 + a4x0a4x0 a4a4 -a 4 a4x1a4x1 a4a4 a4x2a4x2 a4a4 a4x3a4x3 a4a4 a4x0a4x0 a4a4 a4x2a4x2 a4x1a4x1 a4x3a4x3 a4a4

18 + a0x4a0x4 x4x4 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 4 -a 2 x 4 -a 3 x 4

23 a0x4a0x4 1 a2x4a2x4 a1x4a1x4 a3x4a3x4 1 a4x0a4x0 a4x1a4x1 a4x2a4x2 a4x3a4x3 2929 2424 2525 2626 2727 2828 a0x4a0x4 1 a2x4a2x4 a1x4a1x4 a3x4a3x4 a4x0a4x0 a4x1a4x1 a4x2a4x2 a4x3a4x3 a0x4a0x4 1 a2x4a2x4 a1x4a1x4 a3x4a3x4 1 a4x0a4x0 a4x1a4x1 a4x2a4x2 a4x3a4x3 -2 9

24 -a 4 a 3 a 2 a 1 a 0 -x 4 x 3 x 2 x 1 x 0 x a 4 x 0 a 3 x 0 a 2 x 0 a 1 x 0 a 0 x 0 a 4 x 1 a 3 x 1 a 2 x 1 a 1 x 1 a 0 x 1 a 4 x 2 a 3 x 2 a 2 x 2 a 1 x 2 a 0 x 2 a 4 x 3 a 3 x 3 a 2 x 3 a 1 x 3 a 0 x 3 a 0 x 4 p0p0 p1p1 p 9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 + Modified Baugh-Wooley Multiplier a 1 x 4 a 2 x 4 a 3 x 4 a4x4a4x4 2020 2323 2 2121 -2 9 2424 2525 2626 2727 2828 1 1

25 Basic array multiplier

26 5 x 5 Array Multiplier

27 Array Multiplier - Basic Cell x y c in c out s FA

28 -a 4 a 3 a 2 a 1 a 0 -x 4 x 3 x 2 x 1 x 0 x a 4 x 0 a 3 x 0 a 2 x 0 a 1 x 0 a 0 x 0 a 4 x 1 a 3 x 1 a 2 x 1 a 1 x 1 a 0 x 1 a 4 x 2 a 3 x 2 a 2 x 2 a 1 x 2 a 0 x 2 a 4 x 3 a 3 x 3 a 2 x 3 a 1 x 3 a 0 x 3 a 0 x 4 p0p0 p1p1 p9p9 p2p2 p3p3 p4p4 p5p5 p6p6 p7p7 p8p8 + Baugh-Wooley 2’s Complement Multiplier a 1 x 4 a 2 x 4 a 3 x 4 a4x4a4x4 2020 2323 2 2121 -2 9 2424 2525 2626 2727 2828 x4x4 a4a4 x4x4 a4a4 1

29 Modifications in a 5 x 5 multiplier

30 Array Multiplier – Modified Basic Cell s i-1 cici c i+1 sisi FA xnxn amam

31 5 x 5 Array Multiplier with modified cells

32 Pipelined 5 x 5 Multiplier

33 Xilinx FPGA Implementation Equations Z = (2x m-1 +x m-2 )  Y  2 m-2 + … + (2x i+1 +x i )  Y  2 i + … + +(2x 3 +x 2 )  Y  2 2 + (2x 1 +x 0 )  Y  2 0 (2x i+1 +x i )  Y = p i(k+1) p ik p i(k-1) …p i2 p i1 p i0 p ij = x i  y j xor x i+1  y j-1 xor c j c j+1 = (x i  y j )(x i+1  y j-1 ) + (x i  y j )  c j + (x i+1  y j-1 )  c j c 0 = c 1 = 0

34 Modified Basic Cell Xilinx FPGA Implementation c j+1 cjcj p ij FA yjyj xixi x i+1 y j-1

35 LUT 01 xixi yiyi c j+1 cjcj p ij x i+1 y i-1 Modified Basic Cell Xilinx FPGA Implementation LUT: x i  y j xor x i+1  y j-1 p ij = x i  y j xor x i+1  y j-1 xor c j c j+1 = (x i  y j )(x i+1  y j-1 ) + (x i  y j )  c j + (x i+1  y j-1 )  c j

36 Xilinx FPGA Multiplier

37 Optimizations for Squaring (1)

38 Optimizations for Squaring (2) x i x j x j x i x i x j xixi x i x j + x i x j = 2 x i x j x i x j + x i = 2 x i x j - x i x j + x i = = 2 x i x j + x i (1-x j ) = = 2 x i x j + x i x j x i x i = x i

39 Squaring Using Look-Up Tables for relatively small values k input=a output=a 2 0 1 2 3 2 k -1 0 1 4 9 (2 k -1) 2 416 i i2i2... 2 k words 2k-bit each

40 Multiplication Using Squaring a  x = (a+x) 2 - (a-x) 2 4


Download ppt "Tree and Array Multipliers Lecture 8. Required Reading Chapter 11, Tree and Array Multipliers Chapter 12.5, The special case of squaring Note errata at:"

Similar presentations


Ads by Google