EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the...

58
EE5311- Digital IC Design Module 6 - Adders and Multipliers Janakiraman V Assistant Professor Department of Electrical Engineering Indian Institute of Technology Madras Chennai November 6, 2017 Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 1/58

Transcript of EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the...

Page 1: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

EE5311- Digital IC DesignModule 6 - Adders and Multipliers

Janakiraman V

Assistant ProfessorDepartment of Electrical EngineeringIndian Institute of Technology Madras

Chennai

November 6, 2017

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 1/58

Page 2: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Learning Objectives

◮ Design a full adder with least PMOS stack size using selfduality principle

◮ Construct adder architectures to reduce delay from O(N)to O(

√N) - O(log2(N))

◮ Draw timing diagrams to show the signal propagation ofvarious adders

◮ Design an array multiplier for both signed and unsignedmultiplication

◮ Optimize the arrary multiplier using the inverting propertyof a Full Adder

◮ Derive the Modified Booth Encoding to reduce thenumber of partial products

◮ Design and implement a multipler based on the ModifiedBooth Encoding algorithm

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 2/58

Page 3: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Outline

◮ Adders◮ Basic terminology◮ Full adder circuit design◮ Inverting Adder◮ Carry Save Adder◮ Carry Select Adder◮ Carry Look Ahead Adder

◮ Multipliers◮ Basic Terminology◮ Booth and Modified Booth Encoding◮ 2s Complement Airthmetic◮ Array Multiplier◮ Carry Save Multipler◮ Signed multiplication and carry save implementation◮ Final Addition

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 3/58

Page 4: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Basic Adder Terminology

A B Ci S Co Carry Status0 0 0 0 0 Delete0 0 1 1 0 Delete0 1 0 1 0 Propagate0 1 1 0 1 Propagate1 0 0 1 0 Propagate1 0 1 0 1 Propagate1 1 0 0 1 Generate/ Propagate1 1 1 1 1 Generate/ Propagate

Table: Truth Table of a Full Adder

S = A⊕ B ⊕ Ci

Co = AB + BCi + CiA

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 4/58

Page 5: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Basic Adder Terminology

◮ G = AB - Generate Carry

◮ D = A.B - Delete Carry

◮ P = A⊕ B - Propagate Carry

G ,D,P are independent of Ci

S = P ⊕ Ci

Co = G + PCi

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 5/58

Page 6: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Ripple Adder

FAFA FAFACi

A2 B2

Co2

A1 B1

Co1

A3 B3

Co3

A0 B0

Co0

S0 S1 S2 S3

tripple−adder = (N − 1)tcarry + tsum

◮ Worst case delay is linear in N i.e. tripple−adder ∝ N

◮ Carry optimization is more important than Sum

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 6/58

Page 7: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Properties of a Full Adder

Logic functions are written in SoP form (Sum of minterms)

S =∑

m(1, 2, 4, 7)

S =∑

m(0, 3, 5, 6)

Co =∑

m(3, 5, 6, 7)

Co =∑

m(0, 1, 2, 4)

Inverting Property

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 7/58

Page 8: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder - Inverting Property

FA FA

S

CoCi

A B

CoCi

A B

S

Figure: Inverting Property

S = S(A,B ,C )

Co = Co(A,B ,C )

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 8/58

Page 9: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder

Co

A B

Ci

A

B

Ci A

BA B

Figure: Full Adder Carry Circuit

Co = AB + BCi + CiA

S = ABCi + Co(A+ B + Ci)

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 9/58

Page 10: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder - Problems

Co

A B

Ci

A

B

Ci A

BA B

Figure: Full Adder Carry Circuit

◮ Tall PMOS stacks in both Sum and Carry◮ Load capacitance of Co is very large - 6CG + 2CDiff

◮ Carry goes through extra inverter - Critical path◮ Sum optimization is not as important

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 10/58

Page 11: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder - Observations

Co

A B

Ci

A

B

Ci A

BA B

Figure: Full Adder Carry Circuit

◮ Ci is connected to smaller PMOS stack - Lower logicaleffort

◮ Ci is connected to the transistor closest to the output.

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 11/58

Page 12: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder - Optimization

FA’ FA’FA’ FA’

EVEN EVENODD ODD

S0

B1 A2 B2A0 B0 A3 B3

Co0 Co1 Co2 Co3

S3

Ci

S1 S2

A1

Figure: FA’ is a Full Adder w/o inverter in the carry path

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 12/58

Page 13: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Full Adder - Optimization

FA’ FA’FA’ FA’

EVEN EVENODD ODD

S0

B1 A2 B2A0 B0 A3 B3

Co0 Co1 Co2 Co3

S3

Ci

S1 S2

A1

Figure: FA’ is a Full Adder w/o inverter in the carry path

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 13/58

Page 14: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Mirror Adder

4 4 4

2 2 2 3

6

2

4

3

3

6

6

2

2

4

4

6

6

6

12

12

B

BA

A

Ci

CiB

B

A

A

Ci

CiS

B

Co

A

A

B

Ci

BA

BA

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 14/58

Page 15: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Mirror Adder - Features

◮ Requires 24 transistors as opposed to 28 transistors

◮ PUN and PDN as identical - Self duality

◮ Ci is connected to the transistors closest to the output

◮ Transistors in the carry stage need to be optimized(Upsized) for speed

◮ Invereter not available to size for delay optimization

◮ Upsize carry stage to 3-4X

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 15/58

Page 16: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Transmission Gate Based Adder

A

A

A

P

B B

Ci

A

P

P

A

P

P

Ci

Ci

AP

Co

Ci Ci

P

S

S = P ⊕ Ci

Co = G + PCi

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 16/58

Page 17: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Manchester Carry Gate - Static Implementation

VDD

P

A

P

Ci

Co

G

D

Co

P

Ci

P

S = P ⊕ Ci

Co = G + PCi

P = A⊕ B

G = AB

D = A.B

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 17/58

Page 18: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Manchester Carry Gate - Dynamic Implementation

GP

Ci

D

Ci

P φ

Co

P

Co

G

φ

VDDVDD

S = P ⊕ Ci

Co = G + PCi

P = A⊕ B

G = AB

D = A.B

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 18/58

Page 19: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Manchester Carry Chain Adder

Ci,0

P3

φ

G3

φ

VDD

Co,3

P0

φ

G0

φ

VDD

Co,0

P1

φ

G1

φ

VDD

Co,1

P2

φ

G2

φ

VDD

Co,2

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 19/58

Page 20: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Manchester Carry Chain - Delay

C3

R3

CN

RNR1

C1

R2

C2

Co,NCi,0

τ =N(N + 1)

2RC

◮ Worst case delay - Carry propagates from input to output

◮ Delays scales as N2 - Need to buffer between wires

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 20/58

Page 21: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Adder Optimization

◮ Ripple adder delay O(N)

◮ Practical only for few bits

◮ Desktops use 32 bits

◮ Servers use 64 Bits

◮ GPUs require 128 Bits

◮ Adders are citial to their performance

◮ Goal : Propagation delay should be < O(N)

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 21/58

Page 22: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Skip Adder

FA FAFA FA

1

P1 G1

Co1

P2 G2

Co2Co0

S0 S1 S2 S3

Ci

P0 G0 P3 G3

Co3

BP = P0P1P2P3

0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 22/58

Page 23: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Skip Chain

Bits 0−3

Compute (G, P)

Propagation

Carry

Sum

Bits 4−7

Compute (G, P)

Propagation

Carry

Sum

Bits 8−11

Compute (G, P)

Propagation

Carry

Sum

Bits 12−15

Compute (G, P)

Propagation

Carry

Sum

tGP

tsumtbypass

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 23/58

Page 24: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Skip ChainBits 0−3

Compute (G, P)

Propagation

Carry

Sum

Bits 4−7

Compute (G, P)

Propagation

Carry

Sum

Bits 8−11

Compute (G, P)

Propagation

Carry

Sum

Bits 12−15

Compute (G, P)

Propagation

Carry

Sum

tGP

tsumtbypass

tcarry−skip = tGP +Mtcarry +(N

M−1)tbypass +(M−1)tcarry + tsum

◮ Still proportional to N , however linear with N/M

◮ Still better than ripple adder.

◮ Carry skip starts showing lesser delay for N > 4− 8

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 24/58

Page 25: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Skip vs Ripple Adder

2 4 6 8 10 12 14 160

5

10

15

20

N

t p

Ripple AdderCarry Skip Adder

◮ The Carry-Skip adder is beneficial for N > 4 . . . 8

◮ The bypass overhead is high for small N

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 25/58

Page 26: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Linear Carry Select Adder

FA FAFA FA

FA FAFA FASUM

S0−3

Co0

P0 G0 P3 G3P1 G1

Co1

P2 G2

Co20

Co0

P0 G0 P3 G3P1 G1

Co1

P2 G2

Co21

Co3

Ci,0

0

1

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 26/58

Page 27: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Linear Carry Select Chain

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 0−3

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 4−7

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 12−15

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 8−11

1

S0−3

0 1

S4−7

1

S12−15

0 1

Ci,0

0

S8−11

0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 27/58

Page 28: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Linear Carry Select Chain

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 0−3

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 4−7

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 12−15

Compute (G,P)

Carry(0) Carry(1)

MUX

SUM

Bit 8−11

1

S0−3

0 1

S4−7

1

S12−15

0 1

Ci,0

0

S8−11

0

tcarry−select = tGP +Mtcarry +N

Mtmux + tsum

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 28/58

Page 29: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Linear Carry Select Chain

CARRY-GEN-0

t = 1

t = 2

t = 3

t = 4

t = 5

t = 6

t = 7

t = 8

C0C3

C7

C11

CARRY-GEN-1

A15−0, B15−0

GEN PROP

MUX

tcarry−select = tGP +Mtcarry +N

Mtmux + tsum

Reference: Prof. Vinita’s Lecture notes [3]Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 29/58

Page 30: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Linear Carry Select Chain

(5)

(1) (1) (1) (1) (1) (1) (1) (1)

Compute (G,P)

Bit 0−3

Compute (G,P)

Bit 4−7

Compute (G,P)

Bit 12−15

Compute (G,P)

Bit 8−11

MUX

SUM

MUX

SUM

MUX

SUM

MUX

SUM

Carry(0) Carry(1) Carry(0) Carry(1) Carry(0) Carry(1)Carry(0) Carry(1)

(6)

(9)

(10)

(5)(5)(8)(7)

(5) (5)(5)(5)(5)

S0−3 S4−7 S12−15

Ci,0

S8−11

0 1 1 0 10 0 1

Increasing mismatch in arrival times at the mux

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 30/58

Page 31: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Square Root Carry Select Chain

MUX

(1) (1) (1) (1) (1) (1) (1) (1)

(6)(6) (7)(7)

Compute (G,P)

Bit 0−1

Compute (G,P)

Bit 2−4

Compute (G,P)

Bit 9−13

Compute (G,P)

Bit 5−8

MUX

SUM

MUX

SUM

MUX

SUM

MUX

SUM

Carry(0) Carry(1) Carry(0) Carry(1) Carry(0) Carry(1)Carry(0) Carry(1)

(4)

(7)

(6)(5)(5) (5)(4)(4)(3) (3)

(8)

Bit 14−19

(7)

(8)

(9)

SUM

S0−1 S9−13

Ci,0

0 1 1 0 10 0 1

S5−8S2−4 S14−19

◮ Equalize the arrival times at the multiplexer◮ Let the first stage add M bits◮ Subsequent stages progressively add one bit more◮ There are P such stages

N = M + (M + 1) + (M + 2) + (M + 3) + . . .+ (M + P − 1)

N = MP +P(P − 1)

2=

P2

2+ P(M − 1

2)

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 31/58

Page 32: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Square Root Carry Select Chain

A13−0, B13−0

CARRY-GEN-1

GEN PROP

MUX

CARRY-GEN-0

t = 1

t = 2

t = 3

t = 4

t = 5

t = 6

C0C1

C2C4

C5C8

C9C13

Reference: Prof. Vinita’s Lecture notes [3]

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 32/58

Page 33: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Square Root Carry Select Chain

Propagatation delay, for large N and small M

tadd = tGP +Mtcarry + Ptmux + tsum

N ≈ P2

2

tadd = tGP +Mtcarry + (√2N)tmux + tsum

tadd = O(√N)

Still limited by carry ripple

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 33/58

Page 34: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Look Ahead Adder

Can we do away with the carry ripple?

Co,k = f (Ak ,Bk ,Co,k−1)

Co,k = Gk + PkCo,k−1

Co,k = Gk + Pk(Gk−1 + Pk−1Co,k−2)

Co,k = Gk + Pk(Gk−1 + Pk−1(Gk−2 + Pk−2(. . .P1(P0 + G0Ci ,0))))

◮ Each bit now is independent of the carry ripple

◮ Extra hardware required

◮ Delay is indepenent of number of bits?

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 34/58

Page 35: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Look Ahead Adder

G0

G1

G2

G3

P0

P1

P2

P3

Ci,0

Co,3

VDD

◮ Not scalable for large N◮ G0,P0 drives all carry out cicuits. Needs strong driver◮ N bits has N + 1 parallel branches - Large area required◮ N bit implementaion has up to N + 1 transistor stacks -

Slow performanceJanakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 35/58

Page 36: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Block Propagate and Generate

Define a sub-block from bits i − j and define the blockpropagate and generate as follows

◮ Gi :j - Block Generates a carry out independent of carry in- G3:2 = G3 + P3G2

◮ Pi :j - Block Propagates a carry - P3:2 = P3P2

Define a pair (Gi :j ,Pi :j) and a new DOT operator as

(G ,P).(G ′,P ′) = (G + PG ′,PP ′)

(G3:2,P3:2) = (G3,P3).(G2,P2)

DOT operator is associative but not commutative

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 36/58

Page 37: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry

LookAhead

LogAdder

− C

ompute P

ropagate and Generate

− C

ompute S

um

− D

OT

operator

(A2, B2)S2

(A3, B3)S3

(A1, B1)S1

(A4, B4)S4

(A5, B5)S5

(A6, B6)S6

(A7, B7)S7

(A8, B8)S8

(A9, B9)S9

(A10, B10)S10

(A11, B11)S11

(A12, B12)S12

(A0, B0)S0

(A14, B14)S14

(A13, B13)S13

(A15, B15)S15

Janakira

man,IIT

MEE5311-Digita

lIC

Desig

n,Module

6-Adders

andMultip

liers37/58

Page 38: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Multipliers - Definitions

X =N−1∑

i=0

Xi2i

Y =M−1∑

j=0

Yj2j

Z = X × Y

Z =M+N−1∑

k=0

Zk2k =

N−1∑

i=0

(

M−1∑

j=0

XiYj2i+j

)

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 38/58

Page 39: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Multipliers - Definitions

1 0 1 1 Multiplicand× 1 1 0 Multiplier

0 0 0 0 PP01 0 1 1 PP1

1 0 1 1 PP2

1 0 0 0 0 1 0 Result

Multipliers need to perform three main tasks:

◮ Partial Product (PP) Generation

◮ Partial Product Accumulation

◮ Final addition

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 39/58

Page 40: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Partial Product GenerationPP0

PP2

PP1

PP3

PP5

PP6

PP7

PP4

X0

YkX

2

X1

X3

X5

X6

X7

X4

◮ AND of the multiplicand (X − N bits) with each bit ofthe multiplier (Y −M bits)

◮ Generates M partial products which are N bits each

◮ Each PP is either ZERO or the Multiplicand itself

◮ Large number of additions

◮ How do you reduce the number of PP?

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 40/58

Page 41: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Booth Encoding

◮ If multiplier = 0111-1110, No. of non-zero PP = 6

◮ Can be encoded as follows : 0111− 1110 = 1000− 0010

◮ 1 = −1

◮ Equivalent to treating the multiplier as a radix 4 number

Y =

(M−1)/2∑

j=0

Yj4j . . . (Yj ∈ {−1, 0, 1, 2})

◮ Number of partial products reduced to at most half

◮ Multiplying by {0, 1} is a simple AND operation

◮ Multiplying by {−1, 0, 1, 2} requires inversion and shiting

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 41/58

Page 42: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Modified Booth Encoding

Z = X × (YM−12M−1 + . . .Y42

4 + Y323 + Y22

2 + Y121 + Y0)2

0

Z = X × (. . .Y424 + Y3(2

4 − 23) + Y222 + Y1(2

2 − 21) + Y0))

Z = X × (. . .+ [−2Y3 + Y2 + Y1]22 + [−2Y1 + Y0]2

0))

◮ Partition the miltiplier into sets of 3 with 1 overlappingbit (b2i+1, b2i , b2i−1)

◮ Multiplicand is operated on based on−2b2i+1 + b2i + b2i−1

Reference: Prof. Vinita’s Lecture notes [3]

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 42/58

Page 43: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Modified Booth Encoding

b2i+1 b2i b2i−1 Recoded Bits0 0 0 00 0 1 +Multiplicand0 1 0 +Multiplicand0 1 1 +2×Multiplicand1 0 0 −2×Multiplicand1 0 1 -Multiplicand1 1 0 -Multiplicand1 1 1 0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 43/58

Page 44: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Example

1 1 0 1 -31 0 1 1 -5

0 0 0 0 0 0 1 1 3 Y1Y0Y−1 = 110[−X ]0 0 0 0 1 1 12 Y3Y2Y1 = 101[(−X ) << 2]

0 0 0 0 1 1 1 1 15

◮ Sign extension is critical.

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 44/58

Page 45: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Partial Product Accumulation

◮ Generated PP have to be summed

◮ Requires a large nmumber of adders

◮ Simplest is an array of adders - Array Multiplier

◮ PP Shifting to the left is achieved through routing

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 45/58

Page 46: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

2s Complement Numbers

Needed to represent negative numbers. MSB used to representthe sign

X =N−1∑

i=0

Xi2i

X = −2N−1XN−1 +N−2∑

i=0

Xi2i

X = −([2N−1XN−1 − 1]−N−2∑

i=0

Xi2i + 1)

◮ If XN−1 = 1, invert the least N − 1 bits and add 1

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 46/58

Page 47: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

2s Complement Numbers - Sign Extension

Extend the sign bit (MSB) to additonal K bits to form aN + K bit number

X =N−1∑

i=0

Xi2i

X = −2N−1XN−1 +N−2∑

i=0

Xi2i

X = −2N−1XN−1(2K − 2K−1 − 2K−2 . . .− 2− 1) +

N−2∑

i=0

Xi2i

(2K − 2K−1 − 2K−2 . . .− 2− 1) = 2K − (2K − 1) = 1

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 47/58

Page 48: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

2s Complement Multiplication

Z = X × (−2M−1YM−1 +M−2∑

i=0

Yi2i)

Z = X × (−2M−1YM−1) + X ×M−2∑

i=0

Yi2i

◮ If bM−1 = 1, the final partial product should be TwosComplement of X

◮ All intermedaite partial products should be signedextensions of X

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 48/58

Page 49: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Example

1 1 0 1 -31 0 1 1 -5

1 1 1 1 1 1 0 1 -3 −31 1 1 1 1 0 1 -6 −3 << 10 0 0 0 0 0 0 0 << 20 0 0 1 1 24 2s complement of −3 << 3

0 0 0 0 1 1 1 1 15

◮ Sign extension is critical.

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 49/58

Page 50: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Array Multiplier

FAFAFA HA

FAFAFA HA

FAFAHA HA

X3 X2 X1 X0Y1

X3 X2 X1 X0Y0

X3 X2 X1 X0Y3

X3 X2 X1 X0Y2

Z0

Z1

Z2

Z3Z4Z5Z6Z7

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 50/58

Page 51: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Array Multiplier Critical Path

FAFAFA HA

FAFAFA HA

FAFAHA HA

X3 X2 X1 X0Y1

X3 X2 X1 X0Y0

X3 X2 X1 X0Y3

X3 X2 X1 X0Y2

Z0

Z1

Z2

Z3Z4Z5Z6Z7

CP1

CP2

◮ All path delays are almost equal

◮ Cannot optimize for one critical path

tmult = [(M − 1) + (N − 2)]tcarry + (M − 1)tsum + tand

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 51/58

Page 52: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Save Multiplier Critical Path

FAFA

HA HAHA HA

FAHA

FAFAHA FA

FAFA HAHA Vector Merge

X3 X2 X1 X0Y1

X3 X2 X1 X0Y0

X3 X2 X1 X0Y3

X3 X2 X1 X0Y2

Z0

Z1

Z2

Z3

Z4Z5Z6Z7

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 52/58

Page 53: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Carry Save Multiplier Critical Path

FAFA

HA HAHA HA

FAHA

FAFAHA FA

FAFA HAHA Vector Merge

X3 X2 X1 X0Y1

X3 X2 X1 X0Y0

X3 X2 X1 X0Y3

X3 X2 X1 X0Y2

Z0

Z1

Z2

Z3

Z4Z5Z6Z7

tmult−cs = tand + (M − 1)tcarry + tmerge

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 53/58

Page 54: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Optimized 2s Complement Multiplication

Z = (−2N−1

XN−1 +

N−2∑

i=0

Xi 2i) × (−2

M−1YM−1 +

M−2∑

j=0

Yj 2j)

Z = 2M+N−2

XN−1YM−1 − 2N−1

XN−1

M−2∑

j=0

Yj 2j) − 2

M−1YM−1

N−2∑

i=0

Xi 2i+

N−2∑

i=0

M−2∑

j=0

XiYj 2i+j

X3 X2 X1 X0 X = −2N−1XN−1 +∑N−2

i=0Xi 2

i

Y3 Y2 Y1 Y0 Y = −2M−1YM−1 +∑M−2

j=0Yj 2

j

Y0X2 Y0X1 Y0X0∑N−1

i=0Y0Xi 2

i

Y1X2 Y1X1 Y1X0∑N−1

i=0Y1Xi 2

i+1

Y2X2 Y2X1 Y2X0∑N−1

i=0Y2Xi 2

i+2

Y3X3 XN−1YM−12N+M−2

1 1 Y3X2 Y3X1 Y3X0 1 1 1∑N−2

i=0YM−1Xi 2

i+M−1

1

1 1 X3Y2 X3Y1 X3Y0 1 1 1∑M−2

j=0XN−1Yj 2

j+N−1

1Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 54/58

Page 55: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Optimized 2s Complement Multiplication

X3 X2 X1 X0

Y3 Y2 Y1 Y0

1 X3Y0 Y0X2 Y0X1 Y0X0

X3Y1 Y1X2 Y1X1 Y1X0

X3Y2 Y2X2 Y2X1 Y2X0

1 Y3X3 Y3X2 Y3X1 Y3X0

Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 55/58

Page 56: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Signed Carry Save Multiplier

Vector Merge

FAFA

HA HAHA HA

FAHA

FAFAHA FA

FAFA HAFA

X0Y1

X1Y0

X1Y1

X2Y0

X2Y1

X3Y0

X3Y1

1

X0Y2

X1Y2

X2Y2

X3Y2

X0Y3

X1Y3

X2Y3

X3Y3

1

Z1

Z3

Z4Z5Z6Z7

Z2

Z0

X0Y0

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 56/58

Page 57: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

Final Additon

◮ Vector merginig (tmerge) is in the critical path

◮ Use a suitable fast adder to reduce the delay◮ Carry save adder◮ Carry select adder◮ Carry Look Ahead Adder

◮ Make sure it fits well with the array multiplier layout

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 57/58

Page 58: EE5311- Digital IC Design · EE5311- Digital IC Design ... Optimize the arrary multiplier using the inverting property of a Full Adder ... Mirror Adder 4 4 4

References

The material presented here is based on the following books/lecture notes

1. Digital Integrated Circuits Jan M. Rabaey, AnanthaChandrakasan and Borivoje Nikolic 2nd Edition, PrenticeHall India

2. CMOS VLSI Design, Neil H.E. Weste, David Harris andAyan Banerjee, 3rd Edition, Pearson Education

3. Prof. Vinita Vasudevan’s lecture notes on adders andmultipliers [http://www.ee.iitm.ac.in/∼vinita/digic.html]

Janakiraman, IITM EE5311- Digital IC Design, Module 6 - Adders and Multipliers 58/58