partitioning 1

41
VLSI Layout Algorithms CSE 6404 A 46 B 65 C 11 D 56 E 2 3 F 8 H 37 G 19 I 12 J 14 K 27 X=(AB*CD)+ (A+D)+(A(B+C)) Y = (A(B+C)+AC+ D+A(BC+D)) Dr. Md. Saidur Rahman

Upload: birlas

Post on 21-Jul-2016

28 views

Category:

Documents


1 download

DESCRIPTION

layout

TRANSCRIPT

Page 1: Partitioning 1

VLSI Layout AlgorithmsCSE 6404

A 46

B 65

C 11D 56

E

23

F 8

H 37

G 19

I 12 J 14

K 27

X=(AB*CD)+ (A+D)+(A(B+C))Y = (A(B+C)+AC+ D+A(BC+D))

Dr. Md. Saidur Rahman

Page 2: Partitioning 1

Circuit Partitioning

Page 3: Partitioning 1

Why is circuit partitioning necessary?

The circuit is too large to be placed on a single chip.

The larger the gate count of the circuit, the larger the number of I/O pins associated with the circuit. So circuit partitioning is necessary due to I/O pin limitations.

Page 4: Partitioning 1

Decomposition of a complex system into smaller subsystemsDone hierarchicallyPartitioning done until each subsystem has manageable sizeEach subsystem can be designed independently

Interconnections between partitions minimizedLess hassle interfacing the subsystemsCommunication between subsystems usually costly

Page 5: Partitioning 1

Example: Partitioning of a Circuit

[©Sherwani]

Input size: 48

Cut 1=4Size 1=15

Cut 2=4Size 2=16 Size 3=17

Page 6: Partitioning 1

Hierarchical Partitioning

• Levels of partitioning:– System-level partitioning:

Each sub-system can be designed as a single PCB– Board-level partitioning:

Circuit assigned to a PCB is partitioned into sub-circuitseach fabricated as a VLSI chip

– Chip-level partitioning:Circuit assigned to the chip is divided into manageable sub-circuits

[©Sherwani]

Page 7: Partitioning 1

System Hierarchy

Page 8: Partitioning 1

Levels of Partitioning

System Level Partitioning

Board Level Partitioning

Chip Level Partitioning

System

PCBs

Chips

Subcircuits/ Blocks

Page 9: Partitioning 1

Delay at Different Levels of Partitions

AB

C

PCB1

[©Sherwani]

D

x

10x

20xPCB2

Page 10: Partitioning 1

Problem Definition

5

64 2 1

3

456 2

3

1

Page 11: Partitioning 1

Problem Definition

Given a graph G=(V,E), where each vertex v in V has a size s(v), and each edge e in E has a weight w(e), the problem is to divide the set V into k subsets V1, V2, ….Vk, such that an objective function is optimized, subject to certain constraints.

5

64 2 1

3

456 2

3

1

Page 12: Partitioning 1

Cost Functions and Constraints

Bounded size partitions

Minimize external wiring

Delay due to partitioning

Number of terminals

Number of partitions

Page 13: Partitioning 1

Bounded size partitions

iVv

iAvs )(

Each subcircuit has an upper bound on size.

It is desirable to divide the circuit into roughly equal sizes.

Vk

vsk

vsViVv Vv

i1)(1)(

Page 14: Partitioning 1

Two-way partitioning problem

Each node has unit size

Each edge has unit weight

Find two partition V1 and V2 such that

Each of V1 and V2 has equal size

External wiring will be minimum (cut-set will haveto minimize)

Page 15: Partitioning 1

2

3

45

67

8 9

1011

1213 14

15

16

Page 16: Partitioning 1

2

3

45

67

8 9

1011

1213 14

15

s = 1

t = 16st-numbering

i s t , has two neighbors j, k

.kij

Page 17: Partitioning 1

2

3

45

67

8 9

1011

1213 14

15

s = 1

t = 16st-numbering

Size of cutset = 4

Page 18: Partitioning 1

2

3

45

67

89

10

11

12

131415

s = 1

t = 16st-numbering

Size of cutset = 3

To find a bipartition with the minimum cutset, we have to enumerate all bipartitions.We need to enumerate all st-numbering.

Page 19: Partitioning 1

Two-way partitioning problem

Each node has unit size

Each edge has unit weight

Find two partitions V1 and V2 such thatEach of V1 and V2 has equal size

External wiring will be minimum (cut-set will haveto minimmize)

NP-hard problem.

Heuristic techniques to approximate solutions.

Page 20: Partitioning 1

Classification of Partitioning Algorithms

Deterministic algorithms

Stochastic algoritms

Page 21: Partitioning 1

Classification of Partitioning Algorithms

Constructive algorithms

Iterative algorithms

Page 22: Partitioning 1

Problem instance

Constructive heuristic

Iterative heuristic

Stopping criteria

output

Page 23: Partitioning 1

Kernighan-Lin (KL) Algorithm

• On non-weighted graphs• An iterative improvement technique• A two-way (bisection) partitioning algorithm• The partitions must be balanced (of equal size)

Page 24: Partitioning 1

Kernighan-Lin (KL) Algorithm

BA

nBA

Initial partition A, B

Size of the cut set

BbAa

abcT,

We have to minimize the size of the cut set.

Page 25: Partitioning 1

Initial Partition Optimal Partition

A, BA*, B*

Swap BYwithAX such that

BAY

BAX

YX

*

*

Page 26: Partitioning 1

Initial Partition Optimal Partition

B*

Swap BYwithAX such that

BAY

BAX

YX

*

*

How to find X and Y ?

A

B

A*X

Y X

Y

Page 27: Partitioning 1

Internalcost

GA GB

a1a2

an

aia3

a5 a6

a4

b2

bj

b4 b3

b1b6

b7

b5

Ax Byybxbbbb

aaa

jjjjj

iii

CCIEDIED

Likewise,

[©Kang]

Externalcost

By

yaaAx

xaa iiiiCECI ,

Page 28: Partitioning 1

• Lemma: Consider any ai A, bj B.If ai, bj are interchanged, the gain is

• Proof: Total cost before interchange (T) between A and B

Total cost after interchange (T’) between A and B

Therefore

Gain Calculation (cont.)

jiji baba CDDg 2

[©Kang]

others) allfor cost (jiji baba CEET

others) allfor cost (jiji baba CIIT

jijjii babbaa CIEIETTg 2iaD jbD

Page 29: Partitioning 1

Gain Calculation (cont.)• Lemma:

– Let Dx’, Dy’ be the new D values for elements of A - {ai} and B - {bj}. Then after interchanging ai & bj,

• Proof:– The edge x-ai changed from internal in Dx to external in Dx’

– The edge y-bj changed from internal in Dx to external in Dx’

– The x-bj edge changed from external to internal

– The y-ai edge changed from external to internal• More clarification in the next two slides

}{ , 22

}{ , 22

jyaybyy

ixbxaxx

bByCCDD

aAxCCDD

ij

ji

[©Kang]

Page 30: Partitioning 1

Clarification of the Lemma

ai

bjx

Page 31: Partitioning 1

• Decompose Ix and Ex to separate edges from ai and bj:

Write the equations before the move

• ... And after the move

ji xbxxax CECI

ji

ij

xbxa

xaxbxxx

CC

CCIED

)()(

ji

ji

xbxax

xbxax

CCD

CCD

22

ij xaxxbx CECI

Page 32: Partitioning 1

Kernighan-Lin (KL) Algorithm

• Iterate as long as the cutsize improves:– Find a pair of vertices that result in the largest

decrease in cutsize if exchanged– Exchange the two vertices (potential move)– “Lock” the vertices– If no improvement possible, and

still some vertices unlocked, thenexchange vertices that result in smallest increase in cutsize

Page 33: Partitioning 1

Example: KL

• Step 1 - InitializationA = {2, 3, 4}, B = {1, 5, 6}A’ = A = {2, 3, 4}, B’ = B = {1, 5, 6}

• Step 2 - Compute D valuesD1 = E1 - I1 = 1-0 = +1D2 = E2 - I2 = 1-2 = -1D3 = E3 - I3 = 0-1 = -1D4 = E4 - I4 = 2-1 = +1D5 = E5 - I5 = 1-1 = +0D6 = E6 - I6 = 1-1 = +0

[©Kang]

5

64 2 1

3Initial partition

456 2

3

1

Page 34: Partitioning 1

Example: KL (cont.)– Step 3 - compute gains

g21 = D2 + D1 - 2C21 = (-1) + (+1) - 2(1) = -2

g25 = D2 + D5 - 2C25 = (-1) + (+0) - 2(0) = -1

g26 = D2 + D6 - 2C26 = (-1) + (+0) - 2(0) = -1

g31 = D3 + D1 - 2C31 = (-1) + (+1) - 2(0) = 0

g35 = D3 + D5 - 2C35 = (-1) + (0) - 2(0) = -1

g36 = D3 + D6 - 2C36 = (-1) + (0) - 2(0) = -1

g41 = D4 + D1 - 2C41 = (+1) + (+1) - 2(0) = +2

g45 = D4 + D5 - 2C45 = (+1) + (+0) - 2(+1) = -1

g46 = D4 + D6 - 2C46 = (+1) + (+0) - 2(+1) = -1

– The largest g value is g41 = +2 interchange 4 and 1 (a1, b1) = (4, 1)

A’ = A’ - {4} = {2, 3}B’ = B’ - {1} = {5, 6} both not empty

[©Kang]

Page 35: Partitioning 1

Example: KL (cont.)• Step 4 - update D values of node connected to vertices (4, 1)

D2’ = D2 + 2C24 - 2C21 = (-1) + 2(+1) - 2(+1) = -1D5’ = D5 + 2C51 - 2C54 = +0 + 2(0) - 2(+1) = -2D6’ = D6 + 2C61 - 2C64 = +0 + 2(0) - 2(+1) = -2

• Assign Di = Di’, repeat step 3 :g25 = D2 + D5 - 2C25 = -1 - 2 - 2(0) = -3g26 = D2 + D6 - 2C26 = -1 - 2 - 2(0) = -3g35 = D3 + D5 - 2C35 = -1 - 2 - 2(0) = -3g36 = D3 + D6 - 2C36 = -1 - 2 - 2(0) = -3

• All values are equal;arbitrarily choose g36 = -3 (a2, b2) = (3, 6)A’ = A’ - {3} = {2}, B’ = B’ - {6} = {5}

New D values are:D2’ = D2 + 2C23 - 2C26 = -1 + 2(1) - 2(0) = +1D5’ = D5 + 2C56 - 2C53 = -2 + 2(1) - 2(0) = +0

• New gain with D2 D2’, D5 D5’ g25 = D2 + D5 - 2C52 = +1 + 0 - 2(0) = +1 (a3, b3) = (2, 5) [©Kang]

Page 36: Partitioning 1

Example: KL (cont.)• Step 5 - Determine the # of

moves to takeg1 = +2

g1 + g2 = +2 - 3 = -1

g1 + g2 + g3 = +2 - 3 + 1 = 0• The value of k for max G is 1

X = {a1} = {4}, Y = {b1} = {1}• Move X to B, Y to A A = {1, 2, 3}, B = {4, 5, 6}• Repeat the whole process:

• • • • •• The final solution is A = {1, 2, 3}, B = {4, 5, 6}

5

64 2 1

3

Page 37: Partitioning 1

Kernighan-Lin (KL) Algorithm

• Initialize– Bipartition G into V1 and V2, s.t., |V1| = |V2| 1– n = |V|

• Repeat– for i=1 to n/2

• Find a pair of unlocked vertices vai V1 and vbi V2 whoseexchange makes the largest decrease or smallest increasein cut-cost

• Mark vai and vbi as locked• Store the gain gi.

– Find k, s.t. i=1..k gi=Gaink is maximized– If Gaink > 0 then

move va1,...,vak from V1 to V2 and vb1,...,vbk from V2 to V1.

• Until Gaink 0

Page 38: Partitioning 1

Kernighan-Lin (KL) Example

a

bc

d

e

f

g

h

4 { a, e } -2

0 -- 01 { d, g } 32 { c, f } 13 { b, h } -2

Step No. Vertex Pair Gain

5

5213

Cut-cost

[©Sarrafzadeh]

Gain sum03420

Page 39: Partitioning 1

Kernighan-Lin (KL) Example

a

b c

d

e

fg

h

4 { a, e } -2

0 -- 01 { d, g } 32 { c, f } 13 { b, h } -2

Step No. Vertex Pair Gain

5

5213

Cut-cost

[©Sarrafzadeh]

Gain sum03420

Page 40: Partitioning 1

Kernighan-Lin (KL) : Analysis• Time complexity?

– Inner (for) loop• Iterates n/2 times• Iteration 1: (n/2) x (n/2)• Iteration i: (n/2 – i + 1)2.

– Passes? Usually independent of n– O(n3)

• Drawbacks?– Local optimum– Balanced partitions only– No weight for the vertices– High time complexity

Page 41: Partitioning 1

References and Copyright• Some of the slides are used from the following references (with

some modification if necessary).– [©Sarrafzadeh] © Majid Sarrafzadeh, 2001;

Department of Computer Science, UCLA– [©Sherwani] © Naveed A. Sherwani, 1992

(companion slides to [She99])– [©Keutzer] © Kurt Keutzer, Dept. of EECS,

UC-Berekeleyhttp://www-cad.eecs.berkeley.edu/~niraj/ee244/index.htm

– [©Gupta] © Rajesh Gupta UC-Irvinehttp://www.ics.uci.edu/~rgupta/ics280.html

– [©Kang] © Steve Kang UIUChttp://www.ece.uiuc.edu/ece482/

– [@Kia] @ Kia Bazargan, University of Minnesota– [@Pan] @ Prof. David Z. Pan,

http://users.ece.utexas.edu/~dpan/2008Fall_EE382V/