ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
place_base.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Rect
 
struct  AbstractCell
 
struct  ConcreteCell
 
struct  ConcreteNet
 

Macros

#define ABC__phys__place__place_base_h
 
#define true   1
 
#define false   0
 

Typedefs

typedef struct Rect Rect
 
typedef struct AbstractCell AbstractCell
 
typedef struct ConcreteCell ConcreteCell
 
typedef struct ConcreteNet ConcreteNet
 

Functions

void addConcreteNet (ConcreteNet *net)
 Adds a net to the placement database.
 
void addConcreteCell (ConcreteCell *cell)
 
void delConcreteNet (ConcreteNet *net)
 Does not deallocate memory.
 
void delConcreteCell (ConcreteCell *cell)
 Removes a cell from the placement database.
 
void globalPreplace (float utilization)
 Place pad ring, leaving a core area to meet a desired utilization.
 
void globalPlace ()
 Performs analytic placement using a GORDIAN-like algorithm.
 
void globalIncremental ()
 Performs analytic placement using a GORDIAN-like algorithm.
 
void globalFixDensity (int numBins, float maxMovement)
 Doesn't deal well with fixed cells in the core area.
 
float fastEstimate (ConcreteCell *cell, int numNets, ConcreteNet *nets[])
 
float fastTopoPlace (int numCells, ConcreteCell *cells[], int numNets, ConcreteNet *nets[])
 
Rect getNetBBox (const ConcreteNet *net)
 Returns the bounding box of a net.
 
float getNetWirelength (const ConcreteNet *net)
 Returns the half-perimeter wirelength of a net.
 
float getTotalWirelength ()
 Returns the total HPWL of all nets.
 
float getCellArea (const ConcreteCell *cell)
 
void writeBookshelf (const char *filename)
 
int netSortByL (const void *a, const void *b)
 Sorts nets by position of one of its corners.
 
int netSortByR (const void *a, const void *b)
 
int netSortByB (const void *a, const void *b)
 
int netSortByT (const void *a, const void *b)
 
int netSortByID (const void *a, const void *b)
 
int cellSortByX (const void *a, const void *b)
 Sorts cells by either position coordinate.
 
int cellSortByY (const void *a, const void *b)
 
int cellSortByID (const void *a, const void *b)
 

Variables

int g_place_numCells
 
int g_place_numNets
 
float g_place_rowHeight
 
Rect g_place_coreBounds
 
Rect g_place_padBounds
 
ConcreteCell ** g_place_concreteCells
 
ConcreteNet ** g_place_concreteNets
 

Macro Definition Documentation

◆ ABC__phys__place__place_base_h

#define ABC__phys__place__place_base_h

Definition at line 11 of file place_base.h.

◆ false

#define false   0

Definition at line 29 of file place_base.h.

◆ true

#define true   1

Definition at line 28 of file place_base.h.

Typedef Documentation

◆ AbstractCell

typedef struct AbstractCell AbstractCell

◆ ConcreteCell

typedef struct ConcreteCell ConcreteCell

◆ ConcreteNet

typedef struct ConcreteNet ConcreteNet

◆ Rect

typedef struct Rect Rect

Function Documentation

◆ addConcreteCell()

void addConcreteCell ( ConcreteCell * cell)

The cell object must already be allocated and the ID must be set appropriately.

Definition at line 155 of file place_base.c.

155 {
156 assert(cell);
157 assert(cell->m_id >= 0);
158 if (cell->m_id >= g_place_concreteCellsSize) {
166 }
167 if (cell->m_id >= g_place_numCells) {
169 sizeof(ConcreteCell*)*(cell->m_id+1-g_place_numCells));
170 g_place_numCells = cell->m_id+1;
171 }
172 g_place_concreteCells[cell->m_id] = cell;
173}
ConcreteCell ** g_place_concreteCells
Definition place_base.c:33
int g_place_concreteCellsSize
Definition place_base.c:34
ABC_NAMESPACE_IMPL_START int g_place_numCells
Definition place_base.c:26
#define assert(ex)
Definition util_old.h:213
char * memset()
char * realloc()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addConcreteNet()

void addConcreteNet ( ConcreteNet * net)

Adds a net to the placement database.

The net object must already be allocated and the ID must be set appropriately.

Definition at line 114 of file place_base.c.

114 {
115 assert(net);
116 assert(net->m_id >= 0);
117 if (net->m_id >= g_place_concreteNetsSize) {
125 }
126 if (net->m_id >= g_place_numNets) {
128 sizeof(ConcreteNet*)*(net->m_id+1-g_place_numNets));
129 g_place_numNets = net->m_id+1;
131 }
132 g_place_concreteNets[net->m_id] = net;
133}
ConcreteNet ** g_place_concreteNets
Definition place_base.c:35
int g_place_concreteNetsSize
Definition place_base.c:36
int g_place_numNets
Definition place_base.c:27
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellSortByID()

int cellSortByID ( const void * a,
const void * b )

Definition at line 338 of file place_base.c.

338 {
339 const ConcreteCell *pa = *(const ConcreteCell **)a;
340 const ConcreteCell *pb = *(const ConcreteCell **)b;
341
342 if (!pa && !pb) return 0;
343 else if (!pa) return -1;
344 else if (!pb) return 1;
345 if (pa->m_id < pb->m_id) return -1;
346 if (pa->m_id > pb->m_id) return 1;
347 return 0;
348}
Here is the caller graph for this function:

◆ cellSortByX()

int cellSortByX ( const void * a,
const void * b )

Sorts cells by either position coordinate.

These are for use with qsort().

Can tolerate pointers to NULL objects.

Definition at line 314 of file place_base.c.

314 {
315 const ConcreteCell *pa = *(const ConcreteCell **)a;
316 const ConcreteCell *pb = *(const ConcreteCell **)b;
317
318 if (!pa && !pb) return 0;
319 else if (!pa) return -1;
320 else if (!pb) return 1;
321 if (pa->m_x < pb->m_x) return -1;
322 if (pa->m_x > pb->m_x) return 1;
323 return 0;
324}
Here is the caller graph for this function:

◆ cellSortByY()

int cellSortByY ( const void * a,
const void * b )

Definition at line 326 of file place_base.c.

326 {
327 const ConcreteCell *pa = *(const ConcreteCell **)a;
328 const ConcreteCell *pb = *(const ConcreteCell **)b;
329
330 if (!pa && !pb) return 0;
331 else if (!pa) return -1;
332 else if (!pb) return 1;
333 if (pa->m_y < pb->m_y) return -1;
334 if (pa->m_y > pb->m_y) return 1;
335 return 0;
336}
Here is the caller graph for this function:

◆ delConcreteCell()

void delConcreteCell ( ConcreteCell * cell)

Removes a cell from the placement database.

Does not deallocate memory.

Important: does not modify nets that may point to this cell. If these are connections are not removed, segmentation faults and other nasty errors will occur.

Definition at line 216 of file place_base.c.

216 {
217 assert(cell);
218 g_place_concreteCells[cell->m_id] = 0;
220
222}
void delCellFromPartition(ConcreteCell *cell, Partition *p)
Definition place_base.c:180
Partition * g_place_rootPartition
Here is the call graph for this function:

◆ delConcreteNet()

void delConcreteNet ( ConcreteNet * net)

Does not deallocate memory.

Definition at line 141 of file place_base.c.

141 {
142 assert(net);
143 g_place_concreteNets[net->m_id] = 0;
145}

◆ fastEstimate()

float fastEstimate ( ConcreteCell * cell,
int numNets,
ConcreteNet * nets[] )

Definition at line 92 of file place_inc.c.

93 {
94 float len = 0;
95 int n;
96 Rect box;
97
98 assert(cell);
99
100 for(n=0; n<numNets; n++) {
101 box = getNetBBox(nets[n]);
102 if (cell->m_x < box.x) len += (box.x - cell->m_x);
103 if (cell->m_x > box.x+box.w) len += (cell->m_x-box.x-box.w);
104 if (cell->m_y < box.y) len += (box.x - cell->m_y);
105 if (cell->m_y > box.y+box.h) len += (cell->m_y-box.y-box.h);
106 }
107
108 return len;
109}
ConcreteNet * nets
Definition abcPlace.c:35
Rect getNetBBox(const ConcreteNet *net)
Returns the bounding box of a net.
Definition place_base.c:45
int numNets
Definition place_test.c:68
float w
Definition place_base.h:36
float x
Definition place_base.h:35
float y
Definition place_base.h:35
float h
Definition place_base.h:36
Here is the call graph for this function:

◆ fastTopoPlace()

float fastTopoPlace ( int numCells,
ConcreteCell * cells[],
int numNets,
ConcreteNet * nets[] )

◆ getCellArea()

float getCellArea ( const ConcreteCell * cell)

Definition at line 99 of file place_base.c.

99 {
100 assert(cell);
101 return cell->m_parent->m_width*cell->m_parent->m_height;
102}
float m_width
Definition place_base.h:45
float m_height
Definition place_base.h:45
AbstractCell * m_parent
Definition place_base.h:57
Here is the caller graph for this function:

◆ getNetBBox()

Rect getNetBBox ( const ConcreteNet * net)

Returns the bounding box of a net.

Definition at line 45 of file place_base.c.

45 {
46 int t;
47 Rect r;
48
49 assert(net);
50
51 r.x = r.y = INT_MAX;
52 r.w = r.h = -INT_MAX;
53 for(t=0; t<net->m_numTerms; t++) {
54 r.x = net->m_terms[t]->m_x < r.x ? net->m_terms[t]->m_x : r.x;
55 r.y = net->m_terms[t]->m_y < r.y ? net->m_terms[t]->m_y : r.y;
56 r.w = net->m_terms[t]->m_x > r.w ? net->m_terms[t]->m_x : r.w;
57 r.h = net->m_terms[t]->m_y > r.h ? net->m_terms[t]->m_y : r.h;
58 }
59 r.w -= r.x; r.h -= r.y;
60 return r;
61}
ConcreteCell ** m_terms
Definition place_base.h:72
Here is the caller graph for this function:

◆ getNetWirelength()

float getNetWirelength ( const ConcreteNet * net)

Returns the half-perimeter wirelength of a net.

Definition at line 70 of file place_base.c.

70 {
71 Rect r;
72
73 assert(net);
74
75 r = getNetBBox(net);
76 return r.w+r.h;
77}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalWirelength()

float getTotalWirelength ( )

Returns the total HPWL of all nets.

Definition at line 86 of file place_base.c.

86 {
87 float r = 0;
88 int n;
89 for(n=0; n<g_place_numNets; n++) if (g_place_concreteNets[n])
91 return r;
92}
float getNetWirelength(const ConcreteNet *net)
Returns the half-perimeter wirelength of a net.
Definition place_base.c:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalFixDensity()

void globalFixDensity ( int numBins,
float maxMovement )

Doesn't deal well with fixed cells in the core area.

Definition at line 43 of file place_bin.c.

43 {
44
45 printf("QCLN-10 : \tbin-based density correction\n");
46
47 spreadDensityX(numBins, maxMovement);
48 // spreadDensityY(numBins, maxMovement);
49}
ABC_NAMESPACE_IMPL_START void spreadDensityX(int numBins, float maxMovement)
Definition place_bin.c:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalIncremental()

void globalIncremental ( )

Performs analytic placement using a GORDIAN-like algorithm.

Requires a valid set of partitions.

Definition at line 94 of file place_gordian.c.

94 {
96 printf("WARNING: Can not perform incremental placement\n");
98 return;
99 }
100
101 printf("PLAC-10 : Incremental global placement\n");
102
104
105 printf("QMAN-00 : \tconstructing initial quadratic problem...\n");
107
109 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
110
111 // clean up
113 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
115 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
116}
float getTotalWirelength()
Returns the total HPWL of all nets.
Definition place_base.c:86
float g_place_rowHeight
Definition place_base.c:28
void globalFixDensity(int numBins, float maxMovement)
Doesn't deal well with fixed cells in the core area.
Definition place_bin.c:43
void solveQuadraticProblem(bool useCOG)
Calls quadratic solver.
void constructQuadraticProblem()
Constructs the matrices necessary to do analytical placement.
Definition place_genqp.c:53
void globalPlace()
Performs analytic placement using a GORDIAN-like algorithm.
void sanitizePlacement()
Moves any cells that are outside of the core bounds to the nearest location within.
void incrementalPartition()
Adds new cells to an existing partition. Partition sizes/locations are unchanged.
#define IGNORE_COG
Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalPlace()

void globalPlace ( )

Performs analytic placement using a GORDIAN-like algorithm.

Updates the positions of all non-fixed non-pad cells.

Definition at line 39 of file place_gordian.c.

39 {
40 bool completionFlag = false;
41 int iteration = 0;
42
43 printf("PLAC-10 : Global placement (wirelength-driven Gordian)\n");
44
46
47 // build matrices representing interconnections
48 printf("QMAN-00 : \tconstructing initial quadratic problem...\n");
50
51 // iterate placement until termination condition is met
52 while(!completionFlag) {
53 printf("QMAN-01 : \titeration %d numPartitions = %d\n",iteration,g_place_numPartitions);
54
55 // do the global optimization in each direction
56 printf("QMAN-01 : \t\tglobal optimization\n");
58
59 // -------- PARTITIONING BASED CELL SPREADING ------
60
61 // bisection
62 printf("QMAN-01 : \t\tpartition refinement\n");
64 completionFlag |= refinePartitions();
65
66 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
67
68 iteration++;
69 }
70
71 // final global optimization
72 printf("QMAN-02 : \t\tfinal pass\n");
75 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
76
77 // clean up
79 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
81 printf("QMAN-01 : \t\twirelength = %e\n", getTotalWirelength());
82}
ABC_NAMESPACE_IMPL_START int g_place_numPartitions
#define REALLOCATE_PARTITIONS
bool refinePartitions()
Splits large leaf partitions.
#define FINAL_REALLOCATE_PARTITIONS
void reallocPartitions()
Reallocates the partitions based on placement information.
void initPartitioning()
Initializes data structures necessary for partitioning.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalPreplace()

void globalPreplace ( float utilization)

Place pad ring, leaving a core area to meet a desired utilization.

Sets the position of pads that aren't already fixed.

Computes g_place_coreBounds and g_place_padBounds. Determines g_place_rowHeight.

Definition at line 31 of file place_pads.c.

31 {
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}
Rect g_place_padBounds
Definition place_base.c:31
float getCellArea(const ConcreteCell *cell)
Definition place_base.c:99
Rect g_place_coreBounds
Definition place_base.c:30
VOID_HACK exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netSortByB()

int netSortByB ( const void * a,
const void * b )

Definition at line 263 of file place_base.c.

263 {
264 const ConcreteNet *pa = *(const ConcreteNet **)a;
265 const ConcreteNet *pb = *(const ConcreteNet **)b;
266 Rect ba, bb;
267
268 if (!pa && !pb) return 0;
269 else if (!pa) return -1;
270 else if (!pb) return 1;
271 ba = getNetBBox(pa), bb = getNetBBox(pb);
272 if (ba.y + ba.h < bb.y + bb.h) return -1;
273 if (ba.y + ba.h > bb.y + bb.h) return 1;
274 return 0;
275}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netSortByID()

int netSortByID ( const void * a,
const void * b )

Definition at line 291 of file place_base.c.

291 {
292 const ConcreteNet *pa = *(const ConcreteNet **)a;
293 const ConcreteNet *pb = *(const ConcreteNet **)b;
294
295 if (!pa && !pb) return 0;
296 else if (!pa) return -1;
297 else if (!pb) return 1;
298 if (pa->m_id < pb->m_id) return -1;
299 if (pa->m_id > pb->m_id) return 1;
300 return 0;
301}

◆ netSortByL()

int netSortByL ( const void * a,
const void * b )

Sorts nets by position of one of its corners.

These are for use with qsort().

Can tolerate pointers to NULL objects.

Definition at line 235 of file place_base.c.

235 {
236 const ConcreteNet *pa = *(const ConcreteNet **)a;
237 const ConcreteNet *pb = *(const ConcreteNet **)b;
238 Rect ba, bb;
239
240 if (!pa && !pb) return 0;
241 else if (!pa) return -1;
242 else if (!pb) return 1;
243 ba = getNetBBox(pa), bb = getNetBBox(pb);
244 if (ba.x < bb.x) return -1;
245 if (ba.x > bb.x) return 1;
246 return 0;
247}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netSortByR()

int netSortByR ( const void * a,
const void * b )

Definition at line 249 of file place_base.c.

249 {
250 const ConcreteNet *pa = *(const ConcreteNet **)a;
251 const ConcreteNet *pb = *(const ConcreteNet **)b;
252 Rect ba, bb;
253
254 if (!pa && !pb) return 0;
255 else if (!pa) return -1;
256 else if (!pb) return 1;
257 ba = getNetBBox(pa), bb = getNetBBox(pb);
258 if (ba.x + ba.w < bb.x + bb.w) return -1;
259 if (ba.x + ba.w > bb.x + bb.w) return 1;
260 return 0;
261}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ netSortByT()

int netSortByT ( const void * a,
const void * b )

Definition at line 277 of file place_base.c.

277 {
278 const ConcreteNet *pa = *(const ConcreteNet **)a;
279 const ConcreteNet *pb = *(const ConcreteNet **)b;
280 Rect ba, bb;
281
282 if (!pa && !pb) return 0;
283 else if (!pa) return -1;
284 else if (!pb) return 1;
285 ba = getNetBBox(pa), bb = getNetBBox(pb);
286 if (ba.y < bb.y) return -1;
287 if (ba.y > bb.y) return 1;
288 return 0;
289}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeBookshelf()

void writeBookshelf ( const char * filename)

Definition at line 94 of file place_io.c.

94 {
95 writeBookshelfNodes("out.nodes");
96 writeBookshelfPl("out.pl");
97}
void writeBookshelfPl(const char *filename)
Definition place_io.c:66
ABC_NAMESPACE_IMPL_START void writeBookshelfNodes(const char *filename)
Definition place_io.c:26
Here is the call graph for this function:

Variable Documentation

◆ g_place_concreteCells

ConcreteCell** g_place_concreteCells
extern

Definition at line 33 of file place_base.c.

◆ g_place_concreteNets

ConcreteNet** g_place_concreteNets
extern

Definition at line 35 of file place_base.c.

◆ g_place_coreBounds

Rect g_place_coreBounds
extern

Definition at line 30 of file place_base.c.

◆ g_place_numCells

int g_place_numCells
extern

Definition at line 26 of file place_base.c.

◆ g_place_numNets

int g_place_numNets
extern

Definition at line 27 of file place_base.c.

◆ g_place_padBounds

Rect g_place_padBounds
extern

Definition at line 31 of file place_base.c.

◆ g_place_rowHeight

float g_place_rowHeight
extern

Definition at line 28 of file place_base.c.