1 / 19

CSE 246: Computer Arithmetic Algorithms and Hardware Design

CSE 246: Computer Arithmetic Algorithms and Hardware Design. Fall 2006 Lecture 5: Addition and Multiplication. Instructor: Prof. Chung-Kuan Cheng. Topics:. False Path: Cycles Multi-Operands Addition Carry Save Addition Multiplication 2 ’ s Complement Booth Recoding. False Path: Cycles.

Download Presentation

CSE 246: Computer Arithmetic Algorithms and Hardware Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Topics: • False Path: Cycles • Multi-Operands Addition • Carry Save Addition • Multiplication • 2’s Complement • Booth Recoding

  3. False Path: Cycles • Cycles of False Paths: Eg. 1’s complement number addition Positive: x Negative: (2n-1)-x • Addition (2n-1)-x + (2n-1)-y = 2n+(2n-1)-(x+y)-1 A3,0 B3,0 Cout Cin Adder S3,0

  4. Example • 0+0=0 11111 0 + 11111 0 111110 111111 0 • -3-5 = -8 11100 -3 + 11010 -5 110110 110111 -8

  5. Multi-Operand Addition • Carry save adder: a (3,2) counter

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

  7. Other Counters • (7,3) counter • (5,3) counter S1 Ca Cb S0 S2 S0 • Design of (5,3) counter using full adders Ca Cb S0 Ca Cb S0

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

  9. 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. Multiplication a3 a2 a1 a0 *b3 b2 b1 b0 -a3b0 a2b0 a1b0 a0b0 -a3b1 a2b1 a1b1 a0b1 -a3b2 a2b2 a1b2 a0b2 a3b3 -a2b3 -a1b3 -a0b3 • Traditional multiplication of negative numbers

  11. Multiplication a3 a2 a1 a0 *b3 b2 b1 b0 a3b0 a2b0 a1b0 a0b0 a3b1 a2b1 a1b1 a0b1 a3b2 a2b2 a1b2 a0b2 a3b3 a2b3 a1b3 a0b3 0 -a3 -a3 -a3 0 -a2 -a1 -a0 • -xy = x(1-y)-x = xy-x

  12. Multiplication a3 a2 a1 a0 *b3 b2 b1 b0 a3b0 a2b0 a1b0 a0b0 a3b1 a2b1 a1b1 a0b1 a3b2 a2b2 a1b2 a0b2 a3b3 a2b3 a1b3 a0b3 0 -a3 -a3 -a3 0 -b3 -b3 -b3 • -xy = xy-x = xy-y

  13. Multiplication a3 a2 a1 a0 *b3 b2 b1 b0 a3b0 a2b0 a1b0 a0b0 a3b1 a2b1 a1b1 a0b1 a3b2 a2b2 a1b2 a0b2 a3b3 a2b3 a1b3 a0b3 a3 0 0 a3 b3 0 0 b3 -1 -1 • Replay 0 -a -a -a by a 0 0 a -1 -1

  14. Multiplication a3 a2 a1 a0 *b3 b2 b1 b0 a3b0 a2b0 a1b0 a0b0 a3b1 a2b1 a1b1 a0b1 a3b2 a2b2 a1b2 a0b2 a3b3 a2b3 a1b3 a0b3 a3 0 0 a3 -1 b3 0 0 b3 • Fast multiplication: we avoid calculating the 2’s complement of multiplicand, which means a potential long carry chain

  15. Booth Recoding • Multiplication: n row by 2n-1 column matrix for addition • Objective: reduce # rows • Radix 2 booth recoding • Radix 4 booth recoding

  16. Radix 2 Booth Recoding • Use 1,0,-1 to recode • Recoding table

  17. Example 1 0 1 1 1 0 1 0 1 0 -1 1 0 0 -1 1 -1 1 -1 Assume 0 x5 x4 x3 x2 x1 -x5 x4 -x4 x3 -x3 x2 -x2 x1 -x1 x4-x5 x3-x4 x2-x3 x1-x2 0-x1 y5 y4 y3 y2 y1

  18. Radix 4 Booth Recoding • Use 2,1,0,-1,-2 to recode (zi/2=2yi+1+yi)

  19. Examples Bin 0 1 , 1 1 , 1 1 0 31 Radix 4: 2 , 0 , -1 2*42-1 = 31 2x6 2x4 2x2 x5 x3 x1 -2x6+x5+x4 -2x4+x3+x2 -2x2+x1+x0 x6 x5 x4 x3 x2 x1 x0

More Related