Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Lecture 5.

Similar presentations


Presentation on theme: "CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Lecture 5."— Presentation transcript:

1 CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Lecture 5

2 CSE 2462 Topics: False Path: Cycles Multi-Operands Addition  Carry Save Addition Multiplication  2 ’ s Complement  Booth Recoding

3 CSE 2463 False Path: Cycles  Cycles of False Paths: Eg. 1 ’ s complement number addition Positive: x Negative: (2 n -1)-x  Addition (2 n -1)-x + (2 n -1)-y = 2 n +(2 n -1)-(x+y)-1 C out A 3,0 B 3,0 S 3,0 Adder C in

4 CSE 2464 Example  -3-5 = -8 11100 -3 + 11010 -5 110110 110111 -8  0+0=0 11111 0 + 11111 0 111110 111111 0

5 CSE 2465 Multi-Operand Addition  Carry save adder: a (3,2) counter

6 CSE 2466 Example  A (3,2) counter compresses X rows to 2/3X rows each time  Tree structure in implementation

7 CSE 2467 Other Counters  (5,3) counter CaCa CbCb S0S0  (7,3) counter S0S0 S2S2 S1S1  Design of (5,3) counter using full adders CaCa CbCb S0S0 CaCa CbCb S0S0

8 CSE 2468 Multiplication  Examples 0101 5 * 0110 6 0000 0101 0000 0011110 30 0101 5 * 1010 -6 0000 0101 1011 1100010 -30 2 ’ s complement of -5

9 CSE 2469 Multiplication  Examples (Cont.) 1011 -5 * 0110 6 0000 111011 11011 0000 11100010 -30 1011 -5 * 1010 -6 0000 111011 00000 0101 10011110 30 2 ’ s complement of 5 Sign bits

10 CSE 24610 Multiplication a 3 a 2 a 1 a 0 * b 3 b 2 b 1 b 0 -a 3 b 0 a 2 b 0 a 1 b 0 a 0 b 0 -a 3 b 1 a 2 b 1 a 1 b 1 a 0 b 1 -a 3 b 2 a 2 b 2 a 1 b 2 a 0 b 2 a 3 b 3 -a 2 b 3 -a 1 b 3 -a 0 b 3  Traditional multiplication of negative numbers

11 CSE 24611 Multiplication a 3 a 2 a 1 a 0 * b 3 b 2 b 1 b 0 a 3 b 0 a 2 b 0 a 1 b 0 a 0 b 0 a 3 b 1 a 2 b 1 a 1 b 1 a 0 b 1 a 3 b 2 a 2 b 2 a 1 b 2 a 0 b 2 a 3 b 3 a 2 b 3 a 1 b 3 a 0 b 3 0 -a 3 -a 3 -a 3 0 -a 2 -a 1 -a 0  -xy = x(1-y)-x = xy-x

12 CSE 24612 Multiplication a 3 a 2 a 1 a 0 * b 3 b 2 b 1 b 0 a 3 b 0 a 2 b 0 a 1 b 0 a 0 b 0 a 3 b 1 a 2 b 1 a 1 b 1 a 0 b 1 a 3 b 2 a 2 b 2 a 1 b 2 a 0 b 2 a 3 b 3 a 2 b 3 a 1 b 3 a 0 b 3 0 -a 3 -a 3 -a 3 0 -b 3 -b 3 -b 3  -xy = xy-x = xy-y

13 CSE 24613 Multiplication a 3 a 2 a 1 a 0 * b 3 b 2 b 1 b 0 a 3 b 0 a 2 b 0 a 1 b 0 a 0 b 0 a 3 b 1 a 2 b 1 a 1 b 1 a 0 b 1 a 3 b 2 a 2 b 2 a 1 b 2 a 0 b 2 a 3 b 3 a 2 b 3 a 1 b 3 a 0 b 3 a 3 0 0 a 3 b 3 0 0 b 3  Replay 0 -a -a -a by a 0 0 a

14 CSE 24614 Multiplication a 3 a 2 a 1 a 0 * b 3 b 2 b 1 b 0 a 3 b 0 a 2 b 0 a 1 b 0 a 0 b 0 a 3 b 1 a 2 b 1 a 1 b 1 a 0 b 1 a 3 b 2 a 2 b 2 a 1 b 2 a 0 b 2 a 3 b 3 a 2 b 3 a 1 b 3 a 0 b 3 a 3 0 0 a 3 -1 b 3 0 0 b 3  Fast multiplication: we avoid calculating the 2 ’ s complement of multiplicand, which means a potential long carry chain

15 CSE 24615 Booth Recoding  Multiplication: n rows by 2n-1 column matrix for addition  Objective: try to reduce n rows to log n rows  Radix 2 booth recoding  Radix 4 booth recoding

16 CSE 24616 Radix 2 Booth Recoding  Use 1,0,-1 to recode  Recoding table idxixi x i-1 y i =(x i-1 -x i ) 0000No change 1011End of string of 1 ’ s 210Begin of string of 1 ’ s 3110No change

17 CSE 24617 Example 1 0 1 1 1 0 1 0 1 0 -1 1 0 0 -1 1 -1 1 -1 Assume here is 0 x 5 x 4 x 3 x 2 x 1 -x 5 x 4 -x 4 x 3 -x 3 x 2 -x 2 x 1 -x 1 x 4 -x 5 x 3 -x 4 x 2 -x 3 x 1 -x 2 0-x 1 y 5 y 4 y 3 y 2 y 1

18 CSE 24618 Radix 4 Booth Recoding  Use 2,1,0,-1,-2 to recode (z i/2 =2y i+1 +y i ) idx i+ 1 xixi x i-1 y i+1 yiyi z i/2 0000000 No string of 1 ’ s 1001011 End of string of 1 ’ s 201011 Isolated 1 3011102 End of string of 1 ’ s 41000-2 Begin of string of 1 ’ s 51011 End of one string, begin new string 61100 Begin of string of 1 ’ s 7111000 String of all 1 ’ s

19 CSE 24619 Examples Bin 0 1, 1 1, 1 1 0 31 Radix 4: 2, 0, -1 2*4 2 -1 = 31 2x 6 2x 4 2x 2 x 5 x 3 x 1 -2x 6 +x 5 +x 4 -2x 4 +x 3 +x 2 -2x 2 +x 1 +x 0 x 6 x 5 x 4 x 3 x 2 x 1 x 0


Download ppt "CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Lecture 5."

Similar presentations


Ads by Google