On the Use of Flexible, Rectilinear Blocks to Obtain Minimum-Area Floorplans in Mixed Block and Cell Designs DINESH P. MEHTA University of Tennessee Space Institute and NAVEED SHERWANI Intel Corporation This paper presents three minimum-area floorplanning algorithms that use flexible arbitrary rectilinear shapes for the standard cell regions in MBC designs. The first algorithm (pure HCST) introduces a grid traversal technique which guarantees a minimum-area floorplan. The second algorithm (Hybrid-BF) uses a combination of HCST and Breadth First (BF) traversals to give a practical solution that approximately places flexible blocks at specified locations called seeds. The third algorithm (Hybrid-MBF) improves on the shapes of the flexible blocks generated by Hybrid-BF by using a combination of HCST and a Modified Breadth First (MBF) traversal. All three algorithms are polynomial in the number of grid squares. Optimized implementations of Hybrid-BF and Hybrid-MBF required less than two seconds on a SUN SPARCstation10. Categories and Subject Descriptors: B.7.2 [Integrated Circuits]: Design Aids—Layout; F.2.2 [Analysis of Algorithms and Problem Complexity]: Nonnumerical Algorithms and Problems—Routing and layout; G.2.2 [Discrete Mathematics]: Graph Theory—Graph algorithms General Terms: Algorithms Additional Key Words and Phrases: Floorplanning, mixed block and cell designs, rectilinear polygons 1. INTRODUCTION Traditional floorplanning algorithms have used rectangles [Kozminski and Kinnen 1988; Otten 1982; Suthantavibul et al. 1991; Vijayan and Tsay 1991; Chong and Sahni 1993; Pan and Liu 1995; Dai et al. 1989; Pan et al. Authors’ addresses: D. P. Mehta, Computer Science Department, University of Tennessee Space Institute, Tullahoma, TN 37388-9700; N. Sherwani, Design Technologies, Intel Corporation, Hillsboro, OR 97124. Permission to make digital / hard copy of part or all of this work for personal or classroom use is granted without fee provided that the copies are not made or distributed for profit or commercial advantage, the copyright notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and / or a fee. © 2000 ACM 1084-4309/00/0100 –0082 $5.00 ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000, Pages 82–97. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs • 83 1994] and simple rectilinear shapes [Wang and Wong 1992; Dasgupta et al. 1995; Wong and Liu 1989; Yeap and Sarrafzadeh 1993; Nakatake et al. 1996] to realize placeable modules. The reason for this limitation was to “facilitate automation” [Sarrafzadeh and Wong 1996]; i.e., to simplify the algorithms themselves and to simplify subsequent place-and-route within the modules. Rectangular floorplans were further limited to sliceable floorplans to simplify the algorithms (e.g., the floorplan area optimization problem is NP-complete for general floorplans, but solvable in polynomial time for sliceable floorplans [Otten 1983; Stockemeyer 1983]). Sliceable floorplans also simplify the channel ordering problem. However, these limitations to rectangles and further, to sliceable floorplans led to restricted floorplan solutions. A recognition of this led to algorithms that also use simple rectilinear shapes (e.g., L-shapes) to represent modules. These approaches improve floorplan quality, but make the algorithms more complex because of the additional cases that have to be considered. In this paper we will demonstrate that the removal of these limitations by using arbitrary rectilinear shapes results in practical algorithms which produce zero-wasted-area floorplans. Moreover, current layout tools can work on a rectilinear boundary by modeling it as a bounding rectangle with keepout regions. Further, since 5– 6 routing layers are available in current designs, routing is primarily accomplished in over-the-cell areas rather than in channels. Thus, the floorplanner does not need to be concerned with the channel ordering problem. Although our algorithms are general, they are especially applicable to mixed block and cell (MBC) designs [Sherwani 1995]. In an MBC design, regular structures such as RAM and datapath blocks are usually implemented as full-custom macro cells (called blocks or fixed blocks). The remaining logic is implemented using a “sea of standard cells.” Blocks are said to be “glued” together by these cells. A common approach to laying out MBC designs consists of forming groups of standard cells called flexible blocks or juice blocks. Our floorplanner assumes that a seed location is specified for each flexible block. This specifies an approximate location for that block. In MBC designs, an expert (either a program or a knowledgeable user) can exploit knowledge of the functional relationship between a flexible block and related fixed blocks to specify a good location. Most of the existing layout algorithms for MBC designs require flexible blocks to be rectangles [Apte and Kedem 1990; Upton et al. 1990; Putatunda et al. 1988; Lee 1993]. All of these, except Lee [1993], restrict the fixed block shapes to rectangles. In Lee [1993], the fixed block shapes may be rectilinear, but flexible blocks are still rectangular. We present three floorplanning algorithms, all of which utilize a grid data representation of the floorplan area. The first algorithm (pure HCST) employs a novel grid traversal technique, which guarantees a minimumarea floorplan. However, this algorithm places flexible blocks without regard to their seed locations. Another flaw with pure HCST is that it results in floorplans where flexible blocks have long snakelike shapes. Such shapes are undesirable because they make it difficult for the subsequent place-and-route step to converge. For example, routability would be a ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 84 • D. P. Mehta and N. Sherwani problem if a large number of nets must be routed through a long, narrow region. Also, such shapes permit two cells in a flexible block to be very far away from each other. Any advantage of having two cells in the same block is nullified since there is no guarantee that they will be near each other in the final placement. Thus, these misshapen blocks place a greater burden on the place-and-route software to meet routing specifications and timing specifications on critical paths. In response to these flaws, we have developed two practical floorplanners. The Hybrid-BF algorithm uses a combination of HCST and the Breadth First (BF) traversal technique. In addition to guaranteeing minimum-area, Hybrid-BF results in better-shaped flexible blocks and places them so that they respect their seed locations. The Hybrid-MBF algorithm uses a Modified Breadth First (MBF) traversal in conjunction with HCST. It results in better-shaped blocks than Hybrid-BF. Both algorithms require O ~ g 2 ! time in the worst case, where g is the number of available grid squares. Optimized implementations of these two algorithms required less than two seconds on a SUN SPARCstation 10 for each of our industrial examples. In Section 2, we formulate the problem and describe the data and input representation. Section 3 provides the theoretical framework for the HCST traversal technique and shows that it results in a minimum-area floorplan. Section 4 describes the Hybrid-BF and Hybrid-MBF algorithms. Section 5 evaluates the quality of the floorplans generated by Hybrid-BF and HybridMBF algorithms and compares it to some of our previous work. This section also describes six implementations of each algorithm and presents the run times for each implementation. Section 6 concludes the paper. 2. THE MBC FLOORPLANNING PROBLEM 2.1 Data Representation We use a data representation in which a uniform grid is imposed on the chip plane. Each block (fixed or flexible) is denoted by a unique integer. A grid square is labeled by the integer corresponding to the block that occupies that square. This ensures that two blocks will never overlap. A block i is the geometric union of all grid squares labeled i . 2.2 Problem Formulation Given the grid representation of a floorplan boundary of arbitrary rectilinear shape within which fixed blocks and seeds have been assigned locations with one seed per flexible block, obtain a floorplan which partitions the available area (i.e., the grid squares not occupied by fixed blocks) among the flexible blocks. Each flexible block is allowed to take any rectilinear shape. The solution should attempt to satisfy the following objectives: (1) [C]onnectivity: There must be a path between any two grid squares belonging to the same flexible block, such that neighboring grid squares ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs • 85 on the path have a side in common and that all grid squares on the path belong to the flexible block. (2) [A]rea: We state this objective as follows: if (available area $ total area required by the flexible blocks) then a floorplan solution exists. Clearly, if less area is provided than is required by the flexible blocks, the problem cannot be solved. Henceforth, we will assume that the area provided is exactly equal to the sum of the areas of the flexible blocks, in which case the objective reduces to a minimum-area objective. (3) [P]roximity: Minimize the mean of the radii of all flexible blocks, where the radius of a flexible block is defined as the maximum Manhattan distance of the shortest path between a seed and any grid square of the flexible block, such that all grid squares on the shortest path belong to that flexible block. This objective attempts to force the seed to be at the “center” of the flexible block. (4) [S]ides: Minimize the number of sides in each flexible block to obtain better-shaped blocks. An Example. Figure 1 shows a floorplan grid, four preplaced fixed blocks, and the seeds corresponding to the four flexible blocks. The seed locations are denoted by the integers 1– 4 in the figure. The areas of flexible blocks 1, 2, 3, and 4 are assumed to be 150, 120, 110, and 90, respectively (all areas are in terms of number of grid squares). Notice that the available area is 470 5 150 1 120 1 110 1 90.1 3. THE PURE HCST ALGORITHM It is trivial to satisfy criteria A alone: assuming that the number of available grid squares exceeds or equals the number of grid squares required by the flexible blocks, arbitrarily assign the requisite number of grid squares to each flexible block. If the number of available grid squares is g , then an algorithm to perform this task requires O ~ g ! time. Next, we will show that satisfying objectives A and C simultaneously is nontrivial. LEMMA 1. There exist problem instances for which it is impossible to construct a floorplan that satisfies objectives A and C simultaneously. PROOF. The example of Figure 2 shows such a problem instance, proving the lemma: the area available for flexible blocks is 23 units. Let there be two flexible blocks f 1 and f 2 of areas 11 and 12 units respectively, which are to be placed in the available area. No allocation of grid squares to flexible blocks is possible such that f 1 and f 2 are both connected. e 1 The boundary of the floorplan was made L-shaped so that the available area is equal to the required area. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 86 • D. P. Mehta and N. Sherwani 1 2 4 3 Fig. 1. An example of an input to the MBC floorplanning problem. The areas of flexible blocks 1, 2, 3, and 4 are assumed to be 150, 120, 110, and 90, respectively. In view of this, we add some restrictions to the problem instance that would guarantee that criteria A and C will be satisfied. The first restriction is to require the available grid squares to be connected. The second (called the even restriction) is as follows: let any corner of the layout boundary denote the origin (0,0). Then, both coordinates of every corner of the layout and of every fixed block must be even. An example of a layout that satisfies this property is shown in Figure 3(a). The fixed blocks are shaded. If an input grid does not satisfy the even criterion, we increase the resolution of the grid by a factor of 2 in each dimension. Any corner ~ i, j ! of the floorplan boundary or fixed block in the original grid becomes ~ 2i, 2j ! in the new grid and the even restriction is immediately satisfied. THEOREM 1. Any problem instance which satisfies the even criterion and all of whose available grid squares are connected satisfies A and C . PROOF. Since the coordinates of each corner of the layout and every fixed block are both even, it is possible to obtain a new grid in which 2 3 2 blocks are replaced by 1 3 1 squares. Figure 3(b) is the modified grid corresponding to the grid in Figure 3(a). Think of this modified grid as the connected graph G whose vertices correspond to available grid squares and whose edges join neighboring squares. Consider any spanning tree of G . The solid lines of Figure 3(c) delineate a spanning tree for the grid of Figure 3(b). Traverse the spanning tree starting at the (arbitrarily chosen) ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs FIXED BLOCK Fig. 2. • 87 FIXED BLOCK Illustration of Lemma 1. solid circle, as shown by the dashed line in Figure 3(c). This “twice around the tree” tour corresponds to a Hamiltonian cycle in the original grid as shown by the dashed line in Figure 3(a). More precisely, the four quarters of each vertex in the grid graph correspond to the 4 grid squares in each 2 3 2 block of the original grid. Finally, we note that a Hamiltonian cycle of length L is sufficient to place any set of flexible blocks with arbitrary areas whose sum is less than or equal to L , such that each flexible block is connected. This is done as follows: choose any flexible block; let its area be a i . Then, traverse the grid squares in the Hamiltonian cycle until a i squares have been visited. Repeat with the remaining flexible blocks by continuing to traverse the rest of the Hamiltonian cycle from the point at which we stopped. e Creating the spanning tree and traversing the Hamiltonian cycle require O ~ g ! time, which is optimal. Note that pure HCST makes no attempt to ensure that the squares occupied by a flexible block are near (or even include) its seed. Rather, it results in a floorplan in which some flexible blocks (e.g., 1, 4, and 6) are long snakelike structures (Figure 3(d)). 4. THE HYBRID-BF ALGORITHM If proximity was the only criterion being considered, we could use a Breadth-First (BF) traversal technique on the grid to place a flexible block. Such a traversal starts at the seed of a flexible block and occupies grid squares (traverses grid graph vertices) until the requisite number of grid squares (equal to the area of the flexible block) are occupied. Example: Consider the grid and seed square of Figure 4(a). Assume that the flexible block corresponding to this seed must occupy 32 squares. Figure 4(b) shows the placement of the flexible block assuming that the BF algorithm traverses the neighbors of a square in the order N(orth), E(ast), S(outh), W(est). Numbers indicate the order in which squares are traversed (the seed square is assigned the number 0). LEMMA 2. Given a connected grid, a seed square, and the number of squares to be occupied, the BF algorithm computes a connected flexible block with minimum radius. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 88 D. P. Mehta and N. Sherwani • 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 (a) (b) 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 6 6 6 6 6 6 6 6 1 1 1 1 1 1 1 1 6 4 4 4 4 4 4 6 1 6 6 6 6 1 1 1 6 4 4 6 1 6 6 6 6 1 1 1 6 4 4 6 1 6 6 6 6 1 1 6 4 4 6 1 6 6 6 6 1 6 4 4 6 1 6 6 6 6 1 6 4 5 4 6 6 1 1 1 1 6 5 5 5 5 5 4 6 6 3 3 2 6 5 5 5 5 5 4 6 6 6 6 3 3 2 6 5 5 5 5 5 4 4 4 6 6 3 3 2 6 5 5 5 5 5 4 4 4 6 6 3 3 2 6 5 5 5 5 5 4 4 4 6 6 3 3 2 6 5 5 5 5 5 4 4 4 6 6 6 6 3 3 2 6 5 5 5 5 5 4 4 4 4 3 3 3 3 3 2 6 5 4 4 4 4 3 3 3 3 3 2 6 5 4 4 4 4 3 3 3 3 3 6 5 4 4 4 4 3 3 3 3 3 2 2 2 2 2 2 2 6 5 4 4 4 4 3 3 3 3 3 2 2 2 2 2 2 2 1 4 2 4 3 4 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 2 2 2 1 1 1 2 2 2 1 1 1 2 10 11 12 13 14 15 16 17 18 19 20 21 22 (c) (d) Fig. 3. (a) Layout satisfying the conditions of Theorem 1. (b) Modified grid. (c) Spanning tree for modified grid. (d) Floorplan obtained by using HCST assuming that flexible blocks 1, . . . , 6 require 58, 32, 37, 53, 40, and 68 squares, respectively. 23 S 24 13 25 24 23 25 14 5 22 10 9 16 7 1 6 15 26 19 8 1 5 12 27 12 4 0 2 8 17 27 17 4 0 2 11 26 22 11 3 9 18 28 18 7 3 6 13 28 21 10 19 29 21 16 14 15 20 29 30 31 20 30 31 (a) Fig. 4. (b) (c) Placement of a flexible block using the (b) BF. (c) MBF algorithm. PROOF. Connectivity follows from the definition of BF—a square is traversed only if it is adjacent to a square that was traversed earlier. The minimum radius property follows from the observation that BF occupies all squares that are a distance i from the seed square before occupying any square at distance i 1 1 or greater. e ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs • 89 This suggests an algorithm for floorplanning flexible blocks: place flexible blocks one by one using the BF algorithm outlined above. Note that this does not guarantee that the mean radius over all flexible blocks is minimized. Furthermore, the grid does not necessarily remain connected. This could make it impossible to place the remaining flexible blocks. For example, Figure 4(b) shows that the grid has been disconnected into two components, one of which contains 5 squares. If there is no set of flexible blocks in the input whose areas add up to 5, then it is impossible to achieve connectivity. Finally, the number of sides of each flexible block is likely to be very high because of the staircase boundaries that are formed when BF is used. We propose to reduce the number of sides per flexible block by employing a modified-BF (MBF) traversal: the MBF traversal attempts to traverse the N, E, S, and W neighbors of a square followed by its NE, SE, SW, and NW neighbors. An attempt to traverse a NE neighbor is made only if either its N or E neighbor was successfully traversed. This is done to ensure that the original square and its NE neighbor are connected in the final floorplan. Similar precautions are taken before traversing SE, SW, and NW neighbors. The placement of the flexible block of Figure 4(a) using the MBF technique results in Figure 4(c). The radius of the block is 5 and the number of sides is 10, relative to the BF technique where these quantities are 4 and 24, respectively. In the remainder of this section, we propose a hybrid algorithm which combines the BF technique with the HCST technique. Unlike pure HCST, we do not initially require the grid to satisfy the even criterion. If necessary, we will double the resolution of portions of the grid. The algorithm places flexible blocks one at a time. As before, a flexible block is placed in BFS order by occupying squares starting with the seed. The difference is that the algorithm verifies that the occupation of a grid square will not disconnect the grid. The square is occupied if and only if it passes this test. The BF algorithm guarantees that a flexible block is not placed if and only if there is no available square adjacent to the flexible block that does not disconnect the grid. In the event that a flexible block cannot be placed by BF, the algorithm uses the HCST technique to place the rest of the flexible block and to start with the next flexible block. The algorithm is outlined below: Algorithm Hybrid-BF 1. for each flexible block F { 2. s 5 seed square of F ; 3. while F is not placed { 4. if (s does not disconnect the grid G of available squares) { 5. Assign s to F ; 6. repeat 7. let s 5 next available square in BF order; 8. until (s does not disconnect G or no squares available) 9. } ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 90 D. P. Mehta and N. Sherwani • 1 5 5 5 5 5 5 5 5 6 5 6 5 6 1 2 3 4 5 6 3 4 4 4 4 3 3 3 3 3 3 3 4 4 3 3 3 3 3 3 3 3 3 3 4 4 4 3 3 3 3 3 3 3 3 3 4 4 4 3 3 3 3 3 3 3 3 3 3 3 5 5 5 3 3 3 3 3 5 5 5 3 3 3 3 3 5 5 5 5 3 3 3 2 3 6 5 3 3 3 3 2 2 2 2 2 2 2 2 6 5 3 1 2 2 2 2 2 2 2 2 2 6 5 6 5 6 5 5 5 1 Fig. 5. 5 1 1 1 2 2 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2 2 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 A snapshot during the execution of Hybrid. else { // s disconnects the available squares Let C be the union of s and all connected components (except the largest) of the disconnected grid resulting from the occupation of s ; if (#squares in C # # remaining squares of F ) assign all squares in C to F else { Double the grid resolution of C Use HCST to fill C with all the squares in F followed by squares from other flexible blocks Let F 5 the flexible block that is currently being processed. } // end if Let s 5 an available neighbor of s in the original grid. } // end else } // end of while 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 2 } We now illustrate the algorithm by running it on the grid of Figure 5. Flexible blocks 1– 4 have already been placed, and flexible block 5 is being placed. The only available square s is in position (1, 6) of the grid. This square, which is obtained in line 7, would disconnect the available grid squares into two parts, one containing 5 squares, the other containing 50 squares. This causes the algorithm to enter the else clause of line 10 in the next iteration of the while loop. C (line 11) consists of s and the 5 squares above it. In general, the grid may be broken into 2, 3, or 4 components. In the latter two cases, C is the union of the 2 (or 3) smallest components and s . Assume that 4 squares of block 5 remain to be assigned. This causes the ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs • 91 else clause of line 14 to be executed. Each square of C is split into four squares. Since 4 squares of flexible block 5 remain to be assigned in the original grid, 16 squares of flexible block 5 remain to be assigned in the new grid. After HCST runs out of 5s (line 16), it begins placing squares from some other flexible block(s) as shown in the magnified diagram on the left. After C is filled, we revert to the original grid and continue to place squares from the current block (number 6) starting from the available square adjacent to s (1, 7) using the BF algorithm. THEOREM 2. Hybrid-BF satisfies criteria A and C in a floorplan whose available grid squares are initially connected. PROOF. We show that at any time in the algorithm, (1) the flexible blocks (or their portions) that have been placed are connected and (2) the available squares (if any) are connected. Clearly, this is true at the beginning. At the end of the algorithm, when all flexible blocks are placed, this statement implies that all flexible blocks are connected. The BF traversal is used to fill squares of a flexible block f 1 up to the point that a square s is reached (line 10), whose occupation would disconnect the available grid into 2– 4 connected components. From Lemma 2, the squares that have so far been assigned to f 1 are connected. Also, at this point the available squares are connected. Lines 11–20 fill squares in C : the union of $ s % and all but one of the 2– 4 connected components. Note that C is also connected. C ’s resolution is doubled to satisfy the even criterion. Next, Pure HCST fills squares in C starting from a sub-square of s that is adjacent to the f 1 -occupied square from which the BF-traversal attempted to fill s and ending at a sub-square of s that is adjacent to remaining connected component that was not included in C . Note that the start and end sub-squares should be adjacent to each other to facilitate HCST. Theorem 1 ensures that the flexible blocks that were completely placed in C are connected. The choice of the start square ensures that f 1 is connected. The choice of the end square ensures that the flexible block that was being placed when HCST ran out of squares in C will be connected when the BF traversal resumes in the next iteration of the while loop. The available grid is the connected component that was not included in C , and is connected, by definition. e O ~ g ! time is required to perform the connectivity check of lines 4 and 8. A grid square is checked for connectivity at most 4 times (once for each neighbor). Since there are g grid squares, the worst case complexity of the BF component of our algorithm is O ~ g 2 ! . The HCST component of the algorithm is linear in the number of grid squares and does not increase the time complexity. The Hybrid-MBF algorithm is obtained by replacing the BF traversal implied in Line 7 with the MBF traversal. The proof of correctness with respect to Objectives A and C , and the time complexity are identical to that for Hybrid-BF. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 92 • D. P. Mehta and N. Sherwani Table I. Floorplan Input Data No of Fixed Blocks No of Flexible Blocks FP1 FP2 FP3 FP4 4 4 6 8 4 5 6 8 Area(Fixed) Area(Flexible) 77 104 137 445 470 448 1605 1890 5. EXPERIMENTAL RESULTS Six variations of both hybrid algorithms were implemented in C11 and run on a SPARCstation10. The six variations only differ from each other in their implementations and therefore their run times, but all compute the same floorplan. For data, we used 4 industrial floorplans (Table I) [Mehta et al. 1995]. Quality of Floorplans The quality metrics for each of the four floorplans are shown in Table II. A opt is the optimal area obtained by both algorithms. A COLONIZE is the area we obtained by using an iterative algorithm with an unbounded time complexity [Mehta et al. 1995]. P BF and P MBF are the proximities obtained by the BF- and MBF-based algorithms, respectively. P LB is a lower bound on the proximity for a given set of flexible blocks. It is computed by assuming that each flexible block has minimum radius. The minimum radius of a flexible block is the radius obtained when a BF algorithm is used to place the block in an infinitely large grid all of whose squares are available. S BF and S MBF are the average number of sides of all flexible blocks obtained by the BF- and MBF-based algorithms, respectively. The lower bound is 4, when all flexible blocks are rectangles. As expected, there is a significant drop in the number of sides when MBF is used instead of BF. This is accompanied by a slight increase in proximity. In one case, the proximity improved when MBF was used. Figures 6 and 7 show some of the floorplans obtained by our algorithms. Figures 6(a) and 7(a) correspond to the input of Figure 1. The integers associated with the flexible blocks indicate the order in which they were processed, while their position within each flexible block denotes the location of the seed for that flexible block. In all the cases tried, the algorithm never had to execute the else clause of line 14 of the hybrid algorithm. This can be attributed to the large ratio of standard cell area to fixed block area in the floorplans used in our experiments. Since pure HCST ignores proximity and side minimization, Hybrid-BF and HybridMBF can be expected to result in poor proximity and side minimization for circuits with low standard cell area/fixed block area ratios. An important observation resulting from our experiments is that the relative positions of fixed blocks and seeds in the problem instance are crucial to succeeding with respect to the proximity objective. A poor initial placement (e.g., Figure 6(a)) in which seeds and fixed blocks are clustered ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs Table II. 93 • Quality of MBC Floorplanning Algorithms Floorplan A opt A COLONIZE P BF P MBF P LB S BF S MBF FP1 FP2 FP3 FP4 547 552 1742 2335 576 600 1764 2500 23.0 15.6 20.9 29.0 23.75 15.40 23.40 30.90 7.8 6.6 9.8 11.0 38.0 36.8 61.5 72.0 19.5 15.2 18.75 20.0 1 1 2 2 4 3 3 4 (a) Fig. 6. (b) Floorplans generated by the hybrid BF-based algorithm. 1 1 2 2 4 3 3 4 (a) Fig. 7. (b) Floorplans generated by the hybrid MBF-based algorithm. together will result in poor proximity, whereas a better initial placement (Figure 6(b)) gives better proximity results. Average radii for flexible blocks in Figure 6(a) and Figure 6(b) were 23 and 14.25, respectively. Figure 7 shows the floorplans obtained by using MBF instead of BF on the same inputs as Figure 6. Average radii for Figures 7(a) and 7(b) were 23.75 and 15, respectively. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 94 • D. P. Mehta and N. Sherwani Implementation Issues A check was added which ensures that the seed square of a flexible block is never filled by another flexible block. This results in the narrow paths often used to connect the seed to the rest of the block in Figure 6(a) (for blocks 2, 3, and 4). We experimented with three variations of the BF and MBF algorithms. The three variations use different algorithms to check that the occupation of a grid square does not disconnect the available grid. Since this check is performed each time a grid square is being allotted to a flexible block, its impact on run times is quite significant. In the first variation (V1), a depth-first algorithm which starts at any available square, is used to traverse the connected component containing that square. The number of squares in that connected component equals the number of squares available in the entire floorplan if and only if the available grid squares are connected. The second and third variations utilize the following observation. LEMMA 3. Occupying an available square, c disconnects an originally connected grid if and only if there is no path between at least one pair of c ’s (at most 4) available neighbors. PROOF. if: Clearly, if there is no path between a pair of squares, the grid is disconnected. only if: Suppose that the occupation of grid square c disconnects the grid, but there is a path between each pair of c ’s available neighbors. Consider the grid prior to c ’s occupation. Since the grid was originally connected, there is a path between each square and c . Consider the shortest such path. This path must go through one of c ’s available neighbors and it cannot go through two of c ’s neighbors (otherwise it would not be a shortest path). After c ’s occupation, there will still be a path between each square and one of c ’s neighbors (i.e., the shortest path in the original grid without the last edge). But, since each pair of c ’s neighbors are connected, all grid squares are connected to each other—so the grid is not disconnected, which is a contradiction. e Figure 8 illustrates this observation. Square c 2 disconnects the available grid while squares c 1 and c 3 do not. Notice that there is no path between the available neighbors w 2 and e 2 of c 2 , once c 2 is occupied. On the other hand, there continue to be paths between any pair of (n 3 , w 3 , s 3 ) after c 3 is occupied. c 1 has only one available neighbor, hence its occupation does not disconnect the grid. The second variation ~ V2 ! takes advantage of this by counting c ’s available neighbors. If this quantity is 1 (e.g., for c 1 in Figure 8), then c does not disconnect the grid, and it is not necessary to run the DF algorithm to check for connectivity. The third variation ( V3 ) differs from the second when c has two or more available neighbors. In this case, a BF ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs Fig. 8. • 95 Illustration of Lemma 3. traversal starting at one of c ’s available neighbors is used. If this traversal visits all of the remaining available neighbors of c , then c does not disconnect the grid and the BF traversal is immediately halted. In practice, the neighbors of c are often connected by short paths and the BFS traversal halts after visiting very few squares. In contrast, the DF algorithm used in the first two variations always traverses all available squares. The BF and DF algorithms mentioned above traverse the grid by marking all the squares visited. After the traversal is concluded, it is necessary to reset all the marked values in the grid.2 For each of the three variations we experimented with two methods for resetting the grid. In the first ~ M1 ! , a DF traversal which only traverses marked squares is used. In the second ~ M2 ! , all squares in the two-dimensional array used to store the grid are traversed. Table III shows the run times for each of the six variations of the hybrid BF and MBF algorithms for the four floorplans described in Table I. We summarize the results below: (1) In general, the hybrid BF algorithm is faster than the hybrid MBF algorithm. (2) As expected, variation V 3 is faster than V 2 which is faster than V 1 . V 1 is slower than V 2 by a factor of 1.14 –1.32, and is slower than V 3 by a factor of 3.27–27.39. (3) M 1 takes more time than M 2 for variations V 1 and V 2 , while M 2 takes more time for variation V 3 . 6. CONCLUSIONS In the preceding sections, we have outlined two practical hybrid algorithms for floorplanning flexible blocks in MBC designs. These algorithms employ 2 S. Hauck proposed an elegant technique that makes it possible to avoid this step: Suppose that an unsigned integer is used to represent the contents of the grid squares. Then, we reserve the highest integers in its range to denote fixed and flexible blocks. Let the remaining integers be [0, maxint]. Initially, all available squares contain 0. When grid connectivity is checked for the i th time ~ i $ 1 ! , integer i is used to mark squares; squares containing values less than i are considered to be available in this iteration. It is not necessary to reset squares marked i , since they will be treated as available in subsequent connectivity checks. After all maxint integers are used, it will, however, be necessary to reset all squares with integers in [1, maxint]. This practically removes the overhead of unmarking squares at the end of each connectivity check. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. 96 D. P. Mehta and N. Sherwani • Table III. ~ V, M ! ~ V 1, ~ V 1, ~ V 2, ~ V 2, ~ V 3, ~ V 3, M 1! M 2! M 1! M 2! M 1! M 2! MBC Floorplanning Algorithm Run Times (in seconds) FP1 FP2 FP3 FP4 MBF BF MBF BF MBF BF MBF BF 1.31 0.73 0.98 0.56 0.21 0.20 1.17 0.66 0.90 0.50 0.12 0.14 0.87 0.49 0.66 0.37 0.10 0.11 0.89 0.49 0.74 0.41 0.15 0.15 15.99 8.72 13.72 7.49 0.97 1.19 14.44 7.90 12.69 6.92 0.89 1.09 22.02 12.11 18.57 10.21 1.58 1.81 19.45 10.69 16.68 9.16 0.71 1.20 the new HCST traversal technique introduced in this paper in combination with traditional graph traversal techniques to achieve minimum-area floorplans. Both algorithms attempt to locate flexible blocks at the specified seed positions and both require O ~ g 2 ! time, where g is the number of grid squares. The MBF-based algorithm computes floorplans with significantly better shapes than the BF-based algorithms. The quality of a floorplan is closely tied to the quality of the input which consists of seed and fixed block positions and area estimates for flexible blocks. The area estimates for flexible blocks must take routing area into consideration. If the floorplan quality is unsatisfactory (e.g., timing/routing specifications cannot be met in subsequent steps), it may be necessary to rerun the floorplanner with better input data. The fast speed of our algorithms makes it possible to rerun the floorplanner on improved input specifications with minimal impact to the design cycle time. Studies on the impact of input specifications on the floorplanner would be useful. In this regard, it will also be useful to study more formally the impact of various shapes on routability and timing. ACKNOWLEDGMENTS The authors thank one of the referees for pointing out a flaw in one of our results, and Prof Scott Hauck for a suggestion on improving the implementation. REFERENCES APTE, J. AND KEDEM, G. 1990. Heuristic algorithms for combined standard cell and macro block layouts. In Proceedings of the Sixth MIT Conference on Advanced Research in VLSI (AUSCRYPT ’90, MIT, Boston, MA, 1990), W. J. Dally, Ed. MIT Press, Cambridge, MA, 367–385. CHONG, K. AND SAHNI, S. 1993. Optimal realizations of floorplans. IEEE Trans. Comput.Aided Des. 12 (June 1993), 793– 801. DAI, W., ESCHERMANN, B., KUH, E., AND PEDRAM, M. 1989. Hierarchical placement and floorplanning in BEAR. IEEE Trans. Comput.-Aided Des. 8, 1335–1349. DASGUPTA, P. S., SUR-KOLAY, S., AND BHATTACHARYA, B. B. 1995. A unified approach to topology generation and area optimization of general floorplans. In Proceedings of the 1995 IEEE/ACM International Conference on Computer-Aided Design (ICCAD-95, San Jose, CA, Nov. 5–9), R. Rudell, Ed. IEEE Computer Society Press, Los Alamitos, CA, 712–715. ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000. Flexible, Rectilinear Blocks in Mixed Block and Cell Designs • 97 KOZMINSKI, K. A. AND KINNEN, E. 1988. Rectangular dualization and rectangular dissections. IEEE Trans. Circ. Syst. 35 (Nov. 1988), 1401–1416. LEE, T.-C. 1993. A bounded 2D contour searching algorithm for floorplan design with arbitrarily shaped rectilinear and soft modules. In Proceedings of the 30th International Conference on Design Automation (DAC ’93, Dallas, TX, June 14 –18), A. E. Dunlop, Ed. ACM Press, New York, NY, 525–530. MEHTA, D. P., SHANBHAG, A., AND SHERWANI, N. A. 1995. A new approach for floorplanning in MBC designs. Technical Report No. 95-02. Space Institute, Univ. Tennessee, Knoxville, TN. NAKATAKE, S., FUJIYOSHI, K., MURATA, H., AND KAJITANI, Y. 1996. Module placement on BSG-structure and IC layout applications. In Proceedings of the 1996 IEEE/ACM International Conference on Computer-Aided Design (ICCAD ’96, San Jose, CA, Nov. 10 –14, 1996), R. A. Rutenbar and R. H. J. M. Otten, Eds. IEEE Computer Society Press, Los Alamitos, CA, 484 – 491. OTTEN, R. 1982. Automatic floorplan design. In Proceedings of the 19th ACM/IEEE Conference on Design Automation ACM Press, New York, NY, 261–267. OTTEN, R. 1983. Efficient floorplan optimization. In Proceedings of the International Conference on Computer Aided Design 499 –503. PAN, P. AND LIU, C. L. 1995. Area minimization for floorplans. IEEE Trans. Comput.-Aided Des. 14 (Jan.), 123–132. PAN, P., SHI, W., AND LIU, C. L. 1994. Area minimization for hierarchical floorplans. In Proceedings of the 1994 IEEE/ACM International Conference on Computer-Aided Design (ICCAD ’94, San Jose, CA, Nov. 6 –10, 1994), J. A. G. Jess and R. Rudell, Eds. IEEE Computer Society Press, Los Alamitos, CA, 436 – 440. PUTATUNDA, R., SMITH, D., STEBNISKY, M., PUSCHAK, C., AND PATENT, P. 1988. VITAL: Fully automatic placement strategies for very large semicustom designs. In Proceedings of the International Conference on Computer Design (ICCD ’88) 434 – 439. SARRAFZADEH, M. AND WONG, C. K. 1996. An Introduction to VLSI Physical Design. McGraw-Hill, Inc., New York, NY. SHERWANI, N. 1995. Algorithms for VLSI Physical Design Automation. Kluwer Academic Publishers, Hingham, MA. STOCKEMEYER, L. 1983. Optimal orientation of cells in slicing floorplan designs. Inf. Control 57, 2, 91–101. SUTHANTAVIBUL, S., SHRAGOWITZ, E., AND ROSEN, J. B. 1991. An analytic approach to floorplan design and optimization. IEEE Trans. Comput.-Aided Des. 10 (June 1991), 761–769. UPTON, M., SAMII, K., AND SUGIYAMA, S. 1990. Integrated placement for mixed macro cell and standard cell designs. In Proceedings of the ACM/IEEE Conference on Design Automation (DAC ’90, Orlando, FL, June 24-28), R. C. Smith, Ed. ACM Press, New York, NY, 32–35. VIJAYAN, G. AND TSAY, R. 1991. A new method for floorplanning using topological constraint reduction. IEEE Trans. Comput.-Aided Des. 10 (Dec. 1991), 1494 –1501. WANG, T. AND WONG, D. 1988. Optimal floorplanning area minimization. IEEE Trans. Comput.-Aided Des. CAD-7, 11 (Nov.), 992–1002. WONG, D. F. AND LIU, C. L. 1989. Floorplan design of VLSI circuits. Algorithmica 4, 263–291. YEAP, K. AND SARRAFZADEH, M. 1993. Floorplanning by graph dualization: 2-concave rectilinear modules. SIAM J. Comput. 22 (June 1993), 500 –526. Received: April 1996; revised: November 1997; accepted: July 1998 ACM Transactions on Design Automation of Electronic Systems, Vol. 5, No. 1, January 2000.