• 沒有找到結果。

MCSNLA: Minimum-cost Single Net Layer Assignment

Chapter 6 Post3DGR: Post Optimization of 3D Global Routing Results

6.4 Negotiation-based Layer Assignment (NLA)

6.4.2 MCSNLA: Minimum-cost Single Net Layer Assignment

Figure 6.6 illustrates the single-net layer assignment problem. Given a 2D routing topology of a net N(V2D, E2D) where V2D and E2D denote the sets of 2D G-cells and 2D grid edges passed by N, respectively; and given a set of pin locations of N in Gk, which is denoted by P3D. The single-net layer assignment problem for net N is to identify a 3D tree connecting all pins in P3D, which consists of a set of 3D grid edges denoted E3D, the edges of E3D are the corresponding edges of E2D. For instance, Given a 2D routing topology of N(V2D, E2D) in Fig. 6.6(a) and given P3D in Fig. 6.6(b), where V2D={v0, v1, v2, v3, v4, v5}, E2D={e1, e2, e3, e4, e5} and P3D={v0,2, v2,1, v3,1, v5,3}, the single net layer assignment identifies a 3D tree as shown in Fig. 6.6(c), E3D={e1,2, e2,1, e3,1, e4,2, e5,3}, this result contains three vias.

The algorithm flow of MCSNLA is similar to the single net layer assignment algorithm in [27], MCSNLA and the algorithm in [27] both adopt a dynamic programming technique. However, previous works is for via count minimization while this work addresses on minimizing the sum of the congestion cost and via cost. Before detail the algorithm of MCSNLA, we first introduce some notations.

Fig. 6.6. An example of single net layer assignment. (a) a 2D routing topology of a net N(V2D, E2D);

(b) a set of N's pin locations in Gk; (c) a layer assignment solution.

(a)

(b)

(c)

110

1. k: the number of layers in the 3D grid graph.

2. ch(vi): the set of child nodes of vi. In Fig. 6.6(a), ch(v2)={v3, v4}.

3. ch_e(vi): the set of grid edges connecting vi to its child nodes. In Fig. 6.6(a), ch_e(v2)={e3, e4}.

4. pinL(vi, P3D): the layer of the pin at vi. In Fig. 6.6(b), pinL(v5)=3.

5. T(vi): a 2D tree rooted at vi.

6. ti,z: a 3D tree rooted at vi,z. The ti,z is an assignment solution of T(vi). A 3D tree consists of a set of 3D grid edges and a set of required vias for connecting those grid edges and pins. Figure 6.6(c) shows a 3D tree t0,2.

7. S(vi,z): the set of 3D trees rooted at vi,z. 8. S(vi): the set of assignment solutions of T(vi).

9. numVia(ti,z): the total via number of ti,z. In Fig. 6.6(c), numVia(t0,2) is three.

10. via(Δ): Δ is a set of layers, via(Δ) denotes a set of required vias connecting the layers of Δ.

The objective cost function of MCSNLA is formulated as follows, MCSNLA can always identify the minimum-cost assignment solution .

i,z i,z

i,z viaCost t e t e

t ) numVia( ) congCost( )

cost( , (6.3)

where ti,z is a 3D tree identified by MCSNLA, congCost(e) denotes the congestion cost of grid edge e, and viaCost is an user defined constant for the cost of a single via. The formulation of congCost(e) will be detailed in the next subsection and viaCost is set to 100 in our implement. MCSNLA is a 2-phase algorithm based on dynamic-programming technique. During the first phase, the net N(V2D, E2D) is regarded as a 2D tree T(v0), v0 is the root, the root and the leaves of T(v0) must contain a pin. Next, MCSNLA enumerates all possible 3D trees starting at leaf nodes in a bottom-up manner until reaching the root, MCSNLA would dynamically discard inferior tree (discarded later) to keep the size of solution space reasonable. In the second phase, the minimum-cost assignment solution for the entire tree is extracted from the set of possible 3D trees, then each net edge is assigned to the corresponding layer based on the minimum-cost assignment solution in a top-down manner. Figure 6.7 shows the pseudo code of MCSNLA. Lines 2-13 are the bottom-up phase, the procedure InitSol initializes a 3D tree

111

rooted at the leaf node. The procedure EnumSol enumerates all possible 3D tree rooted at the internal node vi,z. The procedure PruneSol discards the redundant trees from S(vi,z) that the size of S(vi,z) is limited in a reasonable range. Line 15 to line 18 is the top-down phase. Line 16 enumerates all possible assignment solutions for entire 3D tree into S(v0,x). Line 17 extracts the minimum-cost one from S(v0,x).

Finally, each net edge of N is assigned to a corresponding layer of Gk according to the minimum-cost assignment solution.

Figure 6.8 shows the pseudo code of InitSol. At line 3, |I| represents the number of required vias connecting the pin's layer to layer z. Because ti,z only includes vias, the cost of ti,z is only contains the via cost. Figure 6.9 shows the pseudo code of EnumSol. Without the loss of generality, we suppose that vi has three child nodes in the pseudo code. At line 3, an 3D tree ti,z is constructed by composing ta,la, tb,lb,

Fig. 6.7. The pseudo code of MCSNLA

Algorithm MCSNLA

Input: net N(V2D

, E

2D

), pin locations P

3D

, 3D grid graph G

k

;

1. //Bottom-Up phase

2. foreach node vi in the order given by a postorder traversal of V2D, vi is not the root.

3. foreach layer z from 1 to k 4. set S(vi,z) to Φ

5. if vi is a leaf node

6. S(vi,z)←InitSol(vi,z, P3D) 7. else

8. S(vi,z)←EnumSol(vi.z, ch(vi), ch_e(vi) , P3D) 9. end if

10. PruneSol(S(vi,z)) 11. end foreach

12. S(vi)=S(vi,0)∪S(vi,1)∪...∪S(vi,k) 13. end foreach

14. //Top-Down phase 15. x=pinL(v0, P3D)

16. S(v0,x)←EnumSol(v0.x, ch(v0), ch_e(v0), P3D) 17. t0,x←Select_solution(S(v0,x))

18. TopDown_Assignment( N, Gk, t0,x ) 19. end

112

tc,lc, ea,la, eb,lb, ec,lc and I. The ta,la, tb,lb and tc,lc are the sub-trees of ti,z, the ea,la, eb,lb and ec,lc are the 3D grid edges connecting the roots of ta,la, tb,lb and tc,lc to the 3D nodes vi,la, vi,lb and vi,lc, respectively. The vias in I connect vi,la, vi,lb, vi,lc and vi,z. If a pin is located at a layer of vi, vias also need to connect to this pin. Figure 6.10 shows an example for constructing a 3D tree ti,3 that consists of ta,2, tb,3, tc,4, ea,2, eb,3, ec,4, and I. At line 4, the cost of ti,z is identified by adding up the cost of ta,la, tb,lb, tc,lc, the congestion cost of ea,la, eb,lb, ec,lc, and the via cost of I. The loop of lines 1-6 enumerates all possible 3D trees rooted at vi,z

and calculates the cost of each possible 3D tree. For instance, as the enumeration of all possible 3D trees rooted at v2,2 for the net in Fig. 6.6, by assuming that S(v3)={t3,1, t3,2, t3,3}, S(v4)={t4,1, t4,2, t4,3} and viaCost is set to 1, Fig. 6.11(a) shows the costs of sub-trees and the congestion costs of the 3D grid edges connecting the roots of sub-trees to v2,2. Figure 6.11(b) shows all enumerated 3D trees rooted at v2,2, and lists the cost of each enumerated 3D tree.

Procedure InitSol

Input: node vi,z

, 3D pins location P

3D

1. I= via( pinL(vi, P3D), z) 2. ti,z=I

3. cost(ti,z)=|I| *viaCost 4. inset ti,z into S(vi,z) 5. return S(vi,z)

Fig. 6.8. Procedure InitSol of MCSNLA

Procedure EnumSol

Input: node vi,z

, ch(v

i

)={v

a

, v

b

, v

c

}, ch_e(v

i

)={e

a

, e

b

, e

c

}, pins location P

3D

1. foreach solutions ta,la, tb,lb and tc,lc of S(va), S(vb) and S(vc), respectively.

2. I= via(la, lb, lc, pinL(vi, P3D), z) 3. ti,z= ta,la+tb,lb+ tc,lc+ea,la+eb,lb+ ec,lc+I

4. cost(ti,z)=cost(ta,la)+cost(tb,lb)+cost(tc,lc)+congCost(ea,la)+congCost(eb,lb)+

congCost(ec,lc)+ |I|*viaCost 5. inset ti,z into S(vi,z)

6. end foreach 7. return S(vi,z)

Fig. 6.9. Procedure EnumSol of MCSNLA

113

In order to limit the size of S(vi,z) in a reasonable range, PruneSol discards the inferior trees from S(vi,z). An inferior tree is defined as follows:

Definition 1. inferior tree: An 3D tree t is regarded as an inferior tree if another 3D tree i,zw t exists i,zu

such that the cost(t ) is greater than cost(i,zw t ). i,zu

If there are more than one 3D trees in S(vi,z), after pruning inferior trees, only the minimum-cost tree will be reserved in S(vi,z), the other 3D trees will be discarded. For example, there are nine 3D trees enumerated by EnumSol in Fig. 6.11. After pruning inferior trees, only t27,2 will be reserved in S(vi,z).

Fig. 6.11. An example of EnumSol. (a) The costs of 3D sub-trees and the congestion costs of the grid edges connecting to the root of each sub-tree to v2,2; (b) all possible combinations to build tree t2.2.

(a)

(b)

Fig. 6.10. An example for constructing a 3D tree ti,3 that consists of ta,2, tb,3, tc,4, ea,2, eb,3, ec,4, and I

114

Applying this scheme to pruning solutions can make MCSNLA obtain the minimum-cost assignment solution in a polynomial time. The time complexity of MCSNLA and the size of solution set are analyzed as follows.

Lemma 1. For each node vi, i≠0, the size of S(vi) is k.

Proof: According to line 12 in Fig. 6.7, the size of S(vi) is the sum of the size of S(vi,z), 1≤z≤k. Because only the minimum-cost tree is reserved in S(vi,z), the size of S(vi,z) is one. Thus, the size of S(vi) is k.

Lemma 2. The time complexity of InitSol is O(1). Moreover, as the child number of vi is q, the time complexities of EnumSol and PruneSol for vi,z, 1≤z≤k, are both O(kq).

Proof: There are no loops in InitSol and all operations in InitSol are constant time, so the time complexity of InitSol is obviously O(1). In EnumSol, the loop from line 1 to line 6 of Fig. 6.9 enumerates all combinations of the child node's solutions. With lemma 1, the solution set size of each child node is k that there are kq combinations of the child node's solutions. Therefore, the loop of lines 1-6 runs kq iterations, so the time complexity of EnumSol is O(kq). Moreover, PruneSol scans all solutions in S(vi,z) to reserve the minimum-cost one. Because S(vi,z) contains most kq solutions enumerated by EnumSol, the time complexity of scanning kq solutions in PruneSol is also O(kq).

Theorem 1. The worst time complexity of MCSNLA is O(|V2D|*k4), |V2D| represents the number of G-cells in 2D grid graph passed by N.

Proof: In the bottom-up phase of Fig. 6.7, an inner loop is from line 3 to line 11 and an outer loop is from line 2 to line 13. EnumSol and PruneSol are the most time consuming parts of the inner loop, according to lemma 2, the time complexities of EnumSol and PruneSol are both O(kq), and the inner loop runs k iterations, so the time complexity of the inner loop is O(k*(kq+kq))=O(kq+1). Moreover, the outer loop runs |V2D|-1 iterations, thus the time complexity of the outer loop is O((|V2D|-1)*kq+1)=O(|V2D|*kq+1). Because the child number q of each node except the root must be less or equal to three, the worst time complexity of the outer loop is O(|V2D|*k4) as q is three. In the

115

top-down phase, the worst time complexities of EnumSol and Select_solution are both O(k4) since the child number of the root is four at most, and TopDown_Assignment takes the time of |V2D|-1 to assign each net edge to the corresponding layer. Thus, the worst time complexity of whole MCSNLA is O(|V2D|*k4)+O(k4)+ O(|V2D|-1)=O(|V2D|*k4).

Theorem 2. MCSNLA can always identify the minimum-cost assignment solution.

Proof: We prove this theorem by the contradiction method. By assuming that t0,z is the minimum-cost solution for a net but MCSNLA identifies a suboptimal solution t'0,z. Because the cost of t'0,z is greater than t0,z, following equation holds, according to Definition 1, t'i,r is an inferior tree that will be discarded from the solution set. Because t'i,r

is not reserved in the solution set, t'0,z is impossibly constructed by its sub-tree t'i,r. This implies that MCSNLA never identifies a suboptimal solution t'0,z. Namely, MCSNLA can always identify the minimum-cost assignment solution.