forked from rmanohar/layout
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstk_layout.h
164 lines (127 loc) · 4.31 KB
/
stk_layout.h
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
/*************************************************************************
*
* 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 (void);
void runrec (int mode, UserDef *u);
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);
private:
int _localdiffspace (Process *p);
LayoutBlob *_readlocalRect (Process *p);
/* mode 0 */
LayoutBlob *_createlocallayout (Process *p);
/* 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 _reportLocalStats(Process *p);
/* mode 3 */
void _maxHeightlocal (Process *p);
/* mode 4 */
void _emitlocalRect (Process *p);
/* this is mode 5 */
void emitDEFHeader (FILE *fp, Process *p);
void emitDEF (FILE *fp, Process *p, double pad = 1.4, double ratio = 1.0, int do_pins = 1);
/* welltap */
LayoutBlob **wellplugs;
netlist_t *dummy_netlist; // dummy netlist
LayoutBlob *_createwelltap (int flavor);
LayoutBlob *_readwelltap (int flavor);
void _emitwelltaprect (int flavor);
/* aligned LEF boundary */
LayoutBlob *computeLEFBoundary (LayoutBlob *b);
ActDynamicPass *stk;
ActNetlistPass *nl;
/*-- bounding box for black boxes --*/
struct pHashtable *boxH;
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__ */