Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

Arithmetic Circuits-2

Multipliers
Array multipliers

Shifters
Barrel shifter Logarithmic shifter

ECE 261

James Morizio

Binary Multiplication
M-1 N-1

X = Xi 2i
i=0

Y = i=0 Yi 2i
Multiplier

Multiplicand Product

Z=X*Y = i=0 ( XiYj2i+j) j=0


Partial products
N-1 M-1

Product = Sum of partial products


ECE 261 James Morizio 2

Multiplication
Example:
1100 : 1210 0101 : 510

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100 0000

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100 0000 1100

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100 0000 1100 0000

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100 0000 1100 0000 00111100 : 6010

ECE 261

James Morizio

Multiplication
Example:
1100 : 1210 0101 : 510 1100 0000 1100 0000 00111100 : 6010 multiplicand multiplier partial products product

M x N-bit multiplication
Produce N M-bit partial products Sum these to produce M+N-bit product
ECE 261 James Morizio 9

The Binary Multiplication


1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 + 1 0 1 0 1 0 1 1 1 0 0 1 1 1 0
ECE 261 James Morizio 10

Multiplicand Multiplier
AND operation Partial Products

General Form
Multiplicand: Multiplier: Product: Y = (yM-1, yM-2, , y1, y0) X = (xN-1, xN-2, , x1, x0)
M 1 N 1 i N 1 M 1 P = y j 2 j xi 2 = xi y j 2i + j i =0 j =0 j =0 i =0
y5 x5 x0y5 x1y5 x2y5 x3y5 x4y5 x5y5 p11 p10 x5y4 p9 x4y4 x5y3 p8 x3y4 x4y3 x5y2 p7 x2y4 x3y3 x4y2 x5y1 p6 x1y4 x2y3 x3y2 x4y1 x5y0 p5 p4 p3 p2 p1 p0 y4 x4 x0y4 x1y3 x2y2 x3y1 x4y0 y3 x3 x0y3 x1y2 x2y1 x3y0 y2 x2 x0y2 x1y1 x2y0 y1 x1 x0y1 x1y0 y0 x0 x0y0

multiplicand multiplier

partial products

product

ECE 261

James Morizio

11

Dot Diagram
Each dot represents a bit
x0

partial products multiplier x x15

ECE 261

James Morizio

12

The Array Multiplier


x3 x3 x2 x2 x1 x1 x0 y1 HA x3 FA x3 x2 x2 FA x1 FA x1 FA x0 y3 FA x0 HA
Z2

x0

y0

Z0

HA y2
Z1

FA: Full adder HA: Half adder (two inputs)

FA
Z7 Z6

FA
Z5

FA
Z4

HA
Z3

Propagation delay = ?
13

ECE 261

James Morizio

The MxN Array Multiplier Critical Path


HA FA FA HA

FA

FA

FA

HA

Critical Path 1 Critical Path 2


Critical Path 1 & 2

FA

FA

FA

HA

ECE 261

James Morizio

14

Carry-Save Multiplier
HA HA HA HA

HA

FA

FA

FA

HA

FA

FA

FA

Carries saved for next adder stage Unique critical path Trade offs?

HA

FA

FA

HA

ECE 261

James Morizio

15

Adder Cells in Array Multiplier


P VDD A VDD Ci P Ci A B V DD P B A P Ci P Co P VDD S

Ci

Ci A

Identical Delays for Carry and Sum


ECE 261 James Morizio

16

Multiplier Floorplan
X3 X2 X1 X0 Y0 Y1 HA Multiplier Cell C S C S C S C S Z0 FA Multiplier Cell Y2 C S C S C S C S Z1 Vector Merging Cell

Y3

C S

C S

C S

C S Z2

X and Y signals are broadcasted through the complete array.

C S

C S

C S

C S

Z7

Z6

Z5

Z4

Z3

ECE 261

James Morizio

17

Multipliers Summary
Optimiz a tio n Go a ls Diffe re nt Vs Bina ry Adde r Onc e Ag a in: Ide ntify Critic a l P a th Othe r po s s ible te c hnique s - Lo g a rithmic ve rs us Line a r (Wallace tree multiplier) - Da ta e nc o ding (Bo o th) - P ipe lining

ECE 261

James Morizio

18

Comparators
0s detector: A = 00000 1s detector: A = 11111 Equality comparator: A = B Magnitude comparator: A<B

ECE 261

James Morizio

19

1s & 0s Detectors
1s detector: N-input AND gate 0s detector: NOTs + 1s detector (N-input NOR)
A7 A6 A5 A4 A3 A2 A1 A0
A7 A6 A5 A4 A3 A2 A1 A0 allones

A3 A2
allones

A1 A0

allzeros

ECE 261

James Morizio

20

Equality Comparator
Check if each bit is equal (XNOR, aka equality gate) 1s detect on bitwise equality
B[3] A[3] B[2] A[2] B[1] A[1] B[0] A[0] A=B

ECE 261

James Morizio

21

Magnitude Comparator
Compute B-A and look at sign B-A = B + ~A + 1 For unsigned numbers, carry out is sign bit
A B
C B3 A3 B2 A2 B1 A1 B0 A0 Z A=B N

A B

ECE 261

James Morizio

22

Shifters
Logical Shift:
Shifts number left or right and fills with 0s 1011 LSR 1 = 0101 1011 LSL1 = 0110

Arithmetic Shift:
Shifts number left or right. Rt shift sign extends 1011 ASR1 = 1101 1011 ASL1 = 0110

Rotate:
Shifts number left or right and fills with lost bits 1011 ROR1 = 1101 1011 ROL1 = 0111
ECE 261 James Morizio 23

The Binary Shifter


Right nop Left

One-bit shifts
Ai Bi

Ai-1

Bi-1
Bit-Slice i

ECE 261

James Morizio

24

Multi-bit Shifters
Cascade one-bit shifters? Complex, unwieldy, slow for larger number of shifts Two other types of shifters
Barrel shifter Logarithmic shifter

ECE 261

James Morizio

25

The Barrel Shifter


A3 B3 S h1 A2 B2

Shift by 0 to 3 bits

S h2 A1 B1 S h3 A0 B0

: Data Wire : Control Wire

S h0

S h1

S h2

S h3

ECE 261

James Morizio

26

The Barrel Shifter


Area dominated by wiring Propagation delay is theoretically constant (at most one transmission gate), independent of shifter size, no. of shifts Reality: Capacitance on buffer input maximum shift width

ECE 261

James Morizio

27

4x4 barrel shifter


A3 A2 A1 A0

Sh0

Sh1

Sh2

Sh3

Widthbarrel ~ 2 pm M

Buffer
pm = metal/poly pitch M = no. of shifts
28

ECE 261

James Morizio

Logarithmic Shifter
Staged approach, e.g. 7 = 1 + 2 + 4, 5 = 1 + 0 + 4 Shifter with maximum shift width M consists of log2M stages
Sh1 Sh1 Sh2 Sh2 Sh4 Sh4

A3

B3

A2

B2

A1

B1

A0

B0

ECE 261

James Morizio

29

0-7 bit Logarithmic Shifter


A 3 Out3 A 2

Out2

Out1

Out0

ECE 261

James Morizio

30

Funnel Shifter
A funnel shifter can do all six types of shifts Selects N-bit field Y from 2N-bit input
Shift by k bits (0 k < N)
2N-1 B offset + N-1 N-1 C offset 0

ECE 261

James Morizio

31

Funnel Shifter Operation

Computing N-k requires an adder


ECE 261 James Morizio 32

Funnel Shifter Design 1


N N-input multiplexers
Use 1-of-N hot select signals for shift amount nMOS pass transistor design (Vt drops!)
k[1:0] left Inverters & Decoder s3 s2 s1 s0 Y3 Y2 Z6 Z5 Z4 Z3 Z2 Z1 Z0 Y1 Y0

ECE 261

James Morizio

33

Funnel Shifter Design 2


k1 k0

Log N stages of 2-input muxes


No select decoding needed

left

Z0 Z1 Z2 Z3 Z4 Z5 Z6
ECE 261 James Morizio

Y0 Y1 Y2 Y3

34

You might also like