Repository navigation
Expand file tree
/
Copy pathstk_layout.h
More file actions
207 lines (159 loc) · 5.87 KB
/
Copy pathstk_layout.h
File metadata and controls
207 lines (159 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/*************************************************************************
*
* Copyright (c) 2019-2021 Rajit Manohar
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
**************************************************************************
*/
#ifndef __ACT_STK_LAYOUT_PASS_H__
#define __ACT_STK_LAYOUT_PASS_H__
#include <act/act.h>
#include <map>
#include <unordered_set>
#include "geom.h"
#include <common/path.h>
/*-- data structures --*/
class ActStackLayout {
public:
ActStackLayout (ActPass *a);
LayoutBlob *getLayout (Process *p = NULL);
long snap_up_x (long);
long snap_up_y (long);
long snap_dn_x (long);
long snap_dn_y (long);
void *localop (ActPass *ap, Process *p, int mode);
void run_post (Process *top);
void runrec (int mode, UserDef *u);
void resetForDesignRefresh ();
void setBBox (Process *p, long llx, long lly, long urx, long ury);
int getBBox (Process *p, long *llx, long *lly, long *urx, long *ury);
void incBBox (Process *p);
long getBBoxCount (Process *p);
int getImport () { return _rect_import; }
void reportDirs (FILE *fp);
void cacheConfig ();
struct pHashtable *getStats() { return _cellStats; }
void _getAreaInfo (Process *p, unsigned long *dx, unsigned long *dy);
list_t *getWeakSupplies () { return _weak_supplies; }
void _maxHeightlocal (LayoutBlob *b);
void addWeakNets (Process *p);
phash_bucket_t *getWeakNets (Process *p);
private:
int _localdiffspace (Process *p);
LayoutBlob *_readlocalRect (Process *p);
/* mode 0 */
LayoutBlob *_createlocallayout (Process *p);
/* does the actual work of the method above */
LayoutBlob *_createlocallayout_stk (netlist_t *n,
list_t *stks, int diffspace);
/* mode 1 */
int _lef_header;
int _cell_header;
int _emitlocalLEF (Process *p);
void _emitLocalWellLEF (FILE *fp, Process *p);
void _computeWell (LayoutBlob *blob, int flavor, int type,
long *llx, long *lly, long *urx, long *ury,
int is_welltap = 0);
void emitLEFHeader (FILE *fp);
void emitWellHeader (FILE *fp);
/* mode 2 */
void _collectLocalStats(Process *p);
/* mode 3 */
void _maxHeightlocal (Process *p);
/* mode 4 */
void _emitlocalRect (Process *p);
/* this is mode 5 */
void emitDEFHeader (FILE *fp, Process *p);
/* pad doubles as bb_x, ratio as bb_y if is_bounding_box is true*/
void emitDEF (FILE *fp, Process *p, double pad = 1.4, double ratio = 1.0, int do_pins = 1, bool is_bounding_box = false, double bb_llx = 0, double bb_lly = 0);
/* welltap */
LayoutBlob **wellplugs;
int _wellplug_count;
netlist_t *dummy_netlist; // dummy netlist
LayoutBlob *_createwelltap (int flavor);
LayoutBlob *_readwelltap (int flavor);
void _emitwelltaprect (int flavor);
void _emitwelltaplef (int flavor);
/* layoutblob list following the shared staticizer type list */
list_t *_weak_supplies;
LayoutBlob *_createweaksupply (ActNetlistPass::shared_stat *s);
LayoutBlob *_readweaksupply (ActNetlistPass::shared_stat *s);
void _emitweaksupplyrect (ActNetlistPass::shared_stat *, LayoutBlob *);
void _emitweaksupplylef (ActNetlistPass::shared_stat *, LayoutBlob *);
void _match_shared_stat (ActNetlistPass::shared_stat_inst *,
listitem_t **, listitem_t **);
/* weak nets */
struct pHashtable *_wknets;
/* compute aligned LEF boundary */
LayoutBlob *snapWells (LayoutBlob *b, const char *name = "-?-",
Process *p = NULL);
LayoutBlob *computeLEFBoundary (LayoutBlob *b);
ActDynamicPass *stk;
ActNetlistPass *nl;
/*-- bounding box for black boxes --*/
struct pHashtable *boxH;
/*-- statistics for area breakdown --*/
struct pHashtable *_cellStats;
void _getNetDetails (Process *p, unsigned long *ncount,
unsigned long *ecount, unsigned long *ekeeper);
int isEmpty (list_t *stk);
Act *a;
ActPass *me;
int lambda_to_scale;
/* temporary variables */
int _total_instances;
double _total_area;
double _total_stdcell_area;
int _maxht;
int _ymax, _ymin; // aux vars
/* arguments */
FILE *_fp, *_fpcell;
int _do_rect;
const char *_version;
unsigned int _micron_conv;
double _manufacturing_grid;
RoutingMat *_m_align_x;
RoutingMat *_m_align_y;
int _horiz_metal;
int _pin_layer;
RoutingMat *_pin_metal;
int _rect_wells;
/* -- .rect file management -- */
int _rect_import; /* set to 1 if .rects can be read in from files,
0 otherwise */
path_info_t *_rect_inpath; // input path for rectangles, if any
const char *_rect_outdir; // rect output directory, if any
const char *_rect_outinitdir; // rect output directory for initial
// unwired layout
int _extra_tracks_top;
int _extra_tracks_bot;
int _extra_tracks_left;
int _extra_tracks_right;
std::unordered_set<Process *> *visited;
};
extern "C" {
void layout_init (ActPass *ap);
void layout_run (ActPass *ap, Process *p);
void layout_recursive (ActPass *ap, UserDef *u, int mode);
void *layout_proc (ActPass *ap, Process *p, int mode);
void *layout_data (ActPass *ap, Data *d, int mode);
void *layout_chan (ActPass *ap, Channel *c, int mode);
void layout_free (ActPass *ap, void *v);
void layout_done (ActPass *ap);
int layout_runcmd (ActPass *ap, const char *nm);
}
#endif /* __ACT_STK_LAYOUT_PASS_H__ */