Floorplanning: An Optimal Floorplan, in Terms of Area
Floorplanning: An Optimal Floorplan, in Terms of Area
com
Floorplanning
Inputs to the oorplanning problem:
D L
Objectives: Minimize area, reduce wirelength for (critical) nets, maximize routability, determine shapes of exible blocks
7
w w
6 1
2 3
1
A nonoptimal floorplan
1
www.jntuworld.com
N J
4 2
. w
5
u t jn
4
U T
7 5
r o w
. ld
m o c
3
www.jntuworld.com
Floorplan Design
D L
w w
N J
3 1 5 e 2
. w
b
U T
c
u t jn
c
r o w
. ld
a
m o c
y 2 b 3 6
d 5
f
2
www.jntuworld.com
www.jntuworld.com
Floorplanning: Terminology
Rectangular dissection: Subdivision of a given rectangle by a nite # of horizontal and vertical line segments into a nite # of non-overlapping rectangles.
D L
1 2
4 6
w w
5 7
H
2 1 H
V
N J
H
3 2
V
. w
2
U T
V 6 7 4 5
Skewed slicing tree: One in which no node and its right child are the same.
V H
1 V
6 7 V
u t jn
5 7
6
Slicing tree: A binary tree, where each internal node represents a vertical cut line or horizontal cut line, and each leaf a basic rectangle.
Slicing structure: a rectangular dissection that can be obtained by repetitively subdividing rectangles horizontally or vertically.
r o w
. ld
m o c
H
H
3
Nonslicing floorplan
Slicing floorplan
4 5
www.jntuworld.com
www.jntuworld.com
D L
Wong & Liu, A new algorithm for oorplan design, DAC86. Consider slicing oorplans.
Wong & Liu, Floorplan design for rectangular and L-shaped modules, ICCAD87. Also consider L-shaped modules.
N J
Wong, Leong, Liu, Simulated Annealing for VLSI Design, pp. 3171, Kluwer academic Publishers, 1988.
w w
. w
u t jn
U T
r o w
. ld
m o c
www.jntuworld.com
www.jntuworld.com
Solution Representation
An expression E = e1 e2 . . . e2n1 , where ei {1, 2, . . . , n, H, V }, 1 i 2n 1, is a Polish expression of length 2n 1 i 1. every operand j , 1 j n, appears exactly once in E ; 2. (the balloting property) for every subexpression Ei = e1 . . . ei, 1 i 2n 1, #operands > #operators.
D L
Polish expression Postorder traversal. ijH : rectangle i on bottom of j ; ijV : rectangle i on the left of j .
w w
4
H
6 1 2 3
1
2 7 5
6 E = 16H2V75VH34HV
www.jntuworld.com
N J
H
. w
u t jn
U T
V
r o w
. ld
3 4
m o c
www.jntuworld.com
D L
V
1
H 2 3
3 1 2
V
4 1
nonskewed!
Nonskewed cases
w w
....... HH ........
www.jntuworld.com
N J
n j . w
U T
w tu
H H
E = 123H4VV
or
. ld
m o c
H 2 3
E = 123HV4V
skewed!
V V
....... VV ........
www.jntuworld.com
D L
Given a normalized Polish expression, we can construct a unique rectangular slicing structure.
7 6
5 2
w w
1
E = 16H2V75VH34HV
A normalized Polish expression
N J
. w3
u t jn
U T
H 2 7 6
r o w
V
. ld
V V 5
m o c
H 3 4
www.jntuworld.com
www.jntuworld.com
Neighborhood Structure
Chain: HV HV H . . . or V HV HV . . .
D L
1 6 H 3 5 V 2 H V 7 4 H V
3 types of moves:
M 2 (Chain Invert): Complement some chain (V = H, H = V ). M 3 (Operator/Operand Swap): Swap two adjacent operand and operator.
N J
w w
. w
U T
Adjacent: 1 and 6 are adjacent operands; 2 and 7 are adjacent operands; 5 and V are adjacent operand and operator.
u t jn
r o w
chain
. ld
m o c
www.jntuworld.com
www.jntuworld.com
Eects of Perturbation
D L
3 2 M2 1
4 3 1 2
M1
Check M 3 moves: Assume that the M3 move swaps the operand ei with the operator ei+1 , 1 i k 1. Then, the swap will not violate the balloting property i 2Ni+1 < i.
Nk : # of operators in the Polish expression E = e1 e2 . . . ek , 1 k 2n 1.
N J
w w
n j . w
U T
w tu
12V4H3V
12V3H4V
or
12H3H4V
. ld
4
m o c
2 M3 1
4 3
12H34HV
www.jntuworld.com
www.jntuworld.com
Cost Function
= A + W .
A: area of the smallest rectangle
D L
R O
r o w
3 2 M2 1
: user-specied parameter
4 3 1 2 M1 1 3
. ld
4
m o c
2 1 4 3
N J
10
W =
ij cij dij .
w w
. w
u t jn
4 2
U T
M3
A: 12H34HV
www.jntuworld.com
www.jntuworld.com
D L
wi hi hi wi
y = six
hi
wi
xi >= a, yi >= b
w w
N J
Bounding area
j . w
y
y = six
U T
y = six
y
u t n
y = ri x
x
hi
W
corner points
wi
r o w
feasible region
. ld
x
x
m o c
i
1 y = six y = r ix y = r x
y = ri x
hi
1 x y=s
i
wi
wi hi
(b) rigid, free (c) flexible, fixed (d) flexible, free orientation orientation orientation
11
www.jntuworld.com
www.jntuworld.com
Area Computation
D L
{ (5,5) (9,4) }
2
H
{ (3,5) (6,,4) }
{ (2,5) (3,4) } H
2 3
2 1
{ (6,2) (3,3) }
V
1
O
5
2
3
u1 v
u2
w w
u1 v
u2
u2 w
u1+u2
2
3
N J
V
. w
v+w
u1
u t jn
max{u1, u2}
U T
V
H
4
r o w
6
V { (3,2) }
. ld
m o c
5 3 6 4
H
max{v, w}
Wiring cost?
12
www.jntuworld.com
www.jntuworld.com
D L
O
V
W
1
M1
N J
E = 12H34V56VHV
w w
. w
U T
3
u t jn
6
r o w
H
. ld
V
2
m o c
H
V
4
5
V 6
E = 12H35V46VHV
13
www.jntuworld.com
www.jntuworld.com
D L
(contd)
H
H
V
O
6
M2
1
H
2
2
3
4
w w
1 2
N J
V
5
H
. w
H
4
U T
V
1
E = 12H34V56VHV
u t jn
r o w
. ld
V
m o c
V
H
5
4
E = 12H34V56HVH
M3
H
V 6
E = 12H34V56VHV
E = 123H4V56VHV
14
www.jntuworld.com
www.jntuworld.com
Annealing Schedule
Initial solution: 12V 3V . . . nV .
D L
R
Ti = riT0 , i # of accepted moves < 5%, run out of time.
= 1, 2, 3, . . .; r = 0.85.
At each temperature, try kn moves (k = 510). Terminate the annealing process if temperature is low enough, or
w w
N J
15
. w
u t jn
www.jntuworld.com
U T
r o w
. ld
m o c
n
www.jntuworld.com
Algorithm: Simulated Annealing Floorplanning(P, , r, k) 1 begin 2 E 12V 3V 4V . . . nV ; /* initial solution */ 3 Best E ; T0 ln(avg ; M M T uphill 0; N = kn; P) 4 repeat 5 M T uphill reject 0; 6 repeat 7 SelectMove(M ); 8 Case M of 9 M1 : Select two adjacent operands ei and ej ; N E Swap(E, ei , ej ); 10 M2 : Select a nonzero length chain C ; N E Complement(E, C ); 11 M3 : done F ALSE ; 12 while not (done) do 13 Select two adjacent operand ei and operator ei+1 ; 14 if (ei1 = ei+1 ) and (2Ni+1 < i) then done T RU E ; 15 N E Swap(E, ei , ei+1 ); 16 M T M T + 1; cost cost(N E ) cost(E ); cost 17 if (cost 0) or (Random < e T ) 18 then 19 if (cost > 0) then uphill uphill + 1; 20 E N E; 21 if cost(E ) < cost(best) then best E ; 22 else reject reject + 1; 23 until (uphill > N ) or (M T > 2N ); 24 T = rT ; /* reduce temperature */ 25 until ( reject > 0.95) or (T < ) or OutOf T ime; MT 26 end
D L
w w
N J
. w
u t jn
U T
r o w
. ld
m o c
16
www.jntuworld.com
www.jntuworld.com
D L
(xi, yi): coordinate of the lower left corner of module Mi. ai wi/hi bi: aspect ratio wi/hi of module Mi. (Note: We dened aspect ratio as hi/wi before.)
N J
Goal: Find a mixed integer linear programming (ILP) formulation for the oorplan design.
w w
. w
u t jn
U T
r o w
. ld
m o c
17
www.jntuworld.com
www.jntuworld.com
wi hi
D L
Mi
R
u t jn
(xi, yi)
w w
www.jntuworld.com
N J
. w
U T
r o w
. ld
m o c
www.jntuworld.com
Nonoverlap Constraints
Two modules Mi and Mj are nonoverlap, if at least one of the following linear constraints is satised (cases encoded by pij and qij ): pij qij Mi to the left of Mj : xi + w i xj 0 0 Mi below Mj : yi + h i y j 0 1 Mi to the right of Mj : xi wj xj 1 0 Mi above Mj : yi h j yj 1 1
D L
w w
hi
wi
wj hj
wi
www.jntuworld.com
N J
. w
xi + w i yi + h i xi w j yi h j
U T
Introduce two 0, 1 variables pij and qij to denote that one of the above inequalities is enforced; e.g., pij = 0, qij = 1 yi + hi yj is satised.
u t jn
r o w
. ld
m o c
www.jntuworld.com
D L
1. no two modules overlap (i, j : 1 i < j n); 2. each module is enclosed within a rectangle of width W and height H (xi + wi W, yi + hi H, 1 i n); 4. pij , qij {0, 1}. wi, hi are known.
N J
19
3. xi 0, yi 0, 1 i n;
w w
. w
u t jn
www.jntuworld.com
U T
r o w
. ld
m o c
www.jntuworld.com
D L
subject to
# continuous variables: O(n); # integer variables: O(n2 ); # linear constraints: O(n2 ). Unacceptably huge program for a large n! (How to cope with it?) Popular LP software: LINDO, lp solve, etc. 20
w w
www.jntuworld.com
N J
. w
U T
xi + wi W, yi + hi y, xi + wi xj + W (pij + qij ), yi + hi yj + H (1 + pij qij ), xi wj xj W (1 pij + qij ), yi hj yj H (2 pij qij ), xi , y i 0 , pij , qij {0, 1},
u t jn
r o w
. ld
m o c
www.jntuworld.com
D L
For each module i with free orientation, associate a 0-1 variable ri : ri = 0: 0 rotation for module i. ri = 1: 90 rotation for module i. M = max{W, H }. 21
www.jntuworld.com
N J
subject to xi + ri hi + (1 ri )wi W, yi + ri wi + (1 ri )hi y, xi + ri hi + (1 ri )wi xj + M (pij + qij ), yi + ri wi (1 ri )hi yj + M (1 + pij qij ), xi rj hj + (1 rj )wj xj M (1 pij + qij ), yi rj wj (1 rj )hj yj M (2 pij qij ), xi , yi 0, pij , qij {0, 1},
w w
. w
u t jn
U T
r o w
. ld
m o c
www.jntuworld.com
Flexible Modules
Assumptions: wi , hi are unknown; area lower bound: Ai . Module size constraints: wi hi Ai ; ai Hence, wmin =
wi hi
D L
bi .
Ai , bi
Ai ai , wmax =
Ai bi , hmin =
hmax =
wi hi Ai nonlinear! How to x?
Can apply a rst-order approximation of the equation: a line passing through (wmin , hmax ) and (wmax , hmin ).
Substitute i wi + ci for hi to form linear constraints (xi , yi , wi are unknown; i , j , ci , cj can be computed as above).
w w
N J
j . w
U T
u t n
r o w
. ld
Ai . ai
m o c
/ y = mx + c / / slope / / c = y0 mx0 /
22
www.jntuworld.com
www.jntuworld.com
h Ai = wi * hi
D L
h max
hi =
i wi
+ ci
h min
wmin
wmax
w w
www.jntuworld.com
N J
. w
u t jn
U T
r o w
. ld
m o c
www.jntuworld.com
D L
w w
N J
23
. w
www.jntuworld.com
U T
u t jn
Questions:
r o w
. ld
m o c
www.jntuworld.com
D L
w w
www.jntuworld.com
N J
. w
u t jn
W
U T
r o w
Partial floorplan
. ld
m o c
www.jntuworld.com
D L
R
(a) C3 C2 C1 (c)
Dead space
w w
C4
R4
(d)
N J
R5 R3 R2 R1
. w
u t jn
U T
(b)
r o w
. ld
m o c
24
www.jntuworld.com