Presentation is loading. Please wait.

Presentation is loading. Please wait.

CDA3101 Recitation Section 5

Similar presentations


Presentation on theme: "CDA3101 Recitation Section 5"— Presentation transcript:

1 CDA3101 Recitation Section 5
Ripple Carry vs Carry Lookahead Adder Boolean Multiplication (Booth's Algorithm)

2 Boolean Addition - One Bit Adder
Takes two 1-bit numbers, and a carry-in, and computes the sum, with carry-out. CIN A Y B COUT ADD

3 Boolean Addition - One Bit Adder
CIN A Y B COUT Logic Circuit ADD Truth Table A B CIN SUM (Y) COUT 1

4 Ripple Carry - N Bit Adder
CIN Y COUT A0 B0 Y0 Put several 1-bit adders end-to-end, connected via carry-in and carry-out Time Complexity in number of bits? Each adder must wait for previous adder's carry: O(N) A B CIN Y COUT A1 B1 Y1 A B CIN Y COUT A2 B2 Y2 Carry

5 Carry Lookahead Adder - N Bit Adder (CLA)
Can we do better? If we could predict the carry, output at each adder, we wouldn't need to wait. For convenience, define: Pi = Ai + Bi Gi = Ai Bi Now from the truth table: COUTi = Gi + Pi CINi COUTi = Gi + Pi COUTi-1 A B CIN COUT 1

6 Carry Lookahead Adder - N Bit Adder (CLA)
The boolean algebra expression for Ci is expanded as follows. COUT0 = G0 + P0 COUT0-1 COUT1 = G1 + P1 COUT0 = G1 + P1 G0 COUT2 = G2 + P2 COUT1 = G2 + P2 (G1 + P1 G0) COUT3 = G3 + P3 COUT2 = G3 + P3 (G2 + P2 (G1 + P1 G0)) COUT4 = G4 + P4 COUT3 = ...

7 Carry Lookahead Adder - N Bit Adder (CLA)
Tradeoff - more hardware, lower latency. Cost to build 16 bit CLA is prohibitively expensive. Intermediate solution connects Ripple Carry Adders together using lookahead logic. Complexity - O(logN)

8 Pencil and Paper Multiplication Algorithm
A series of partial products followed by a summation step. Problem: Does not work with negative numbers. 0010 x 1101 0000

9 Pencil and Paper Multiplication Algorithm

10 Solution: Booth’s Algorithm 
A , Q M Multiplicand Q Multiplier Count n START = 10 = 01 Q0,Q-1 = 00 = 11 A A - M A A + M Arithmetic shift right: A, Q, Q-1 Count Count - 1 No Yes Count = 0 ? END 10

11 Problem 1 - Booth's Multiplication Algorithm
Use Booth's Algorithm to find the product 6x5 in signed binary notation. 6 = 0110 5 = 0101

12 Problem 1 - Booth's Multiplication Algorithm
Operation A Q Q-1 M Count Subtract 0000 0101 0110 4 Shift 1010 Add 1101 0010 1 3 0011 0001 1001 2 1011 1100 Done 1110 Answer: = 30

13 Problem 2 - Booth's Multiplication Algorithm
Use Booth's Algorithm to find the product -3x9 in signed binary notation. -3 = 11101 9 = 01001 *Why are we using 5 bits now, instead of 4?

14 Problem 2 - Booth's Multiplication Algorithm
Operation: A Q Q-1 M Count Subtract 00000 01001 11101 5 Shift 00011 Add 00001 10100 1 4 11110 11111 01010 3 10101 2 00010 Done 00101 Answer: = -27

15 Booth's Algorithm Simulator
or/Booth/


Download ppt "CDA3101 Recitation Section 5"

Similar presentations


Ads by Google