abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
place_pads.c
Go to the documentation of this file.
1 /*===================================================================*/
2 //
3 // place_pads.c
4 //
5 // Aaron P. Hurst, 2003-2007
6 // ahurst@eecs.berkeley.edu
7 //
8 /*===================================================================*/
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <math.h>
13 #include <limits.h>
14 
15 #include "place_base.h"
16 
18 
19 
20 // --------------------------------------------------------------------
21 // globalPreplace()
22 //
23 /// \brief Place pad ring, leaving a core area to meet a desired utilization.
24 //
25 /// Sets the position of pads that aren't already fixed.
26 ///
27 /// Computes g_place_coreBounds and g_place_padBounds. Determines
28 /// g_place_rowHeight.
29 //
30 // --------------------------------------------------------------------
31 void globalPreplace(float utilization) {
32  int i, c, h, numRows;
33  float coreArea = 0, totalArea = 0;
34  int padCount = 0;
35  float area;
36  ConcreteCell **padCells = NULL;
37  AbstractCell *padType = NULL;
38  ConcreteCell *cell;
39  float nextPos;
40  int remainingPads, northPads, southPads, eastPads, westPads;
41 
42  printf("PLAC-00 : Placing IO pads\n");;
43 
44  // identify the pads and compute the total core area
47 
48  for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
49  cell = g_place_concreteCells[c];
50  area = getCellArea(cell);
51  if (cell->m_parent->m_pad) {
52  padType = cell->m_parent;
53  } else {
54  coreArea += area;
56  }
57 
58  if (cell->m_fixed) {
63  } else if (cell->m_parent->m_pad) {
64  padCells = realloc(padCells, sizeof(ConcreteCell **)*(padCount+1));
65  padCells[padCount++] = cell;
66  }
67  totalArea += area;
68  }
69  if (!padType) {
70  printf("ERROR: No pad cells\n");
71  exit(1);
72  }
75 
76  coreArea /= utilization;
77 
78  // create the design boundaries
79  numRows = sqrt(coreArea)/g_place_rowHeight+1;
80  h = numRows * g_place_rowHeight;
84  // increase the dimensions by the width of the padring
86  if (padCount) {
87  printf("PLAC-05 : \tpreplacing %d pad cells\n", padCount);
88  g_place_padBounds.x -= padType->m_width;
89  g_place_padBounds.y -= padType->m_height;
92  }
93 
94  printf("PLAC-05 : \tplaceable rows : %d\n", numRows);
95  printf("PLAC-05 : \tcore dimensions : %.0fx%.0f\n",
97  printf("PLAC-05 : \tchip dimensions : %.0fx%.0f\n",
99 
100  remainingPads = padCount;
101  c = 0;
102 
103  // north pads
104  northPads = remainingPads/4; remainingPads -= northPads;
105  nextPos = 0;
106  for(i=0; i<northPads; i++) {
107  cell = padCells[c++];
108  cell->m_x = g_place_padBounds.x+cell->m_parent->m_width*0.5 + nextPos;
109  cell->m_y = g_place_padBounds.y+cell->m_parent->m_height*0.5;
110  nextPos += (g_place_padBounds.w-padType->m_width) / northPads;
111  }
112 
113  // south pads
114  southPads = remainingPads/3; remainingPads -= southPads;
115  nextPos = 0;
116  for(i=0; i<southPads; i++) {
117  cell = padCells[c++];
118  cell->m_x = g_place_padBounds.w+g_place_padBounds.x-cell->m_parent->m_width*0.5 - nextPos;
120  nextPos += (g_place_padBounds.w-2*padType->m_width) / southPads;
121  }
122 
123  // east pads
124  eastPads = remainingPads/2; remainingPads -= eastPads;
125  nextPos = 0;
126  for(i=0; i<eastPads; i++) {
127  cell = padCells[c++];
129  cell->m_y = g_place_padBounds.y+cell->m_parent->m_height*0.5 + nextPos;
130  nextPos += (g_place_padBounds.h-padType->m_height) / eastPads;
131  }
132 
133  // west pads
134  westPads = remainingPads;
135  nextPos = 0;
136  for(i=0; i<westPads; i++) {
137  cell = padCells[c++];
138  cell->m_x = g_place_padBounds.x+cell->m_parent->m_width*0.5;
139  cell->m_y = g_place_padBounds.h+g_place_padBounds.y-cell->m_parent->m_height*0.5 - nextPos;
140  nextPos += (g_place_padBounds.h-padType->m_height) / westPads;
141  }
142 
143 }
144 
146 
Rect g_place_padBounds
Definition: place_base.c:31
VOID_HACK exit()
AbstractCell * m_parent
Definition: place_base.h:57
float h
Definition: place_base.h:36
float x
Definition: place_base.h:35
float m_width
Definition: place_base.h:45
float y
Definition: place_base.h:35
ConcreteCell ** g_place_concreteCells
Definition: place_base.c:33
char * realloc()
float getCellArea(const ConcreteCell *cell)
Definition: place_base.c:99
bool m_fixed
Definition: place_base.h:59
float m_height
Definition: place_base.h:45
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Rect g_place_coreBounds
Definition: place_base.c:30
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
float w
Definition: place_base.h:36
ABC_NAMESPACE_IMPL_START int g_place_numCells
Definition: place_base.c:26
float g_place_rowHeight
Definition: place_base.c:28
ABC_NAMESPACE_IMPL_START void globalPreplace(float utilization)
Place pad ring, leaving a core area to meet a desired utilization.
Definition: place_pads.c:31