ACT Library
Loading...
Searching...
No Matches
netlist.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * This file is part of the ACT library
4 *
5 * Copyright (c) 2015, 2017, 2018-2019 Rajit Manohar
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 **************************************************************************
23 */
24#ifndef __NETLIST_H__
25#define __NETLIST_H__
26
27#include <stdio.h>
28#include <act/act.h>
29#include <act/passes/booleanize.h>
30#include <common/bool.h>
31#include <common/list.h>
32#include <common/bitset.h>
33#include <common/array.h>
34
35#define EDGE_NFET 0
36#define EDGE_PFET 1
37
38struct edge;
39struct node;
40typedef struct edge edge_t;
41
42/* actual edge width is:
43
44 EDGE_WIDTH(edge, i, fold, minw)
45 edge = edge pointer
46 i = 0..nfolds-1 for the # of folds of this edge
47 fold = folding threshold for this type of edge
48 minw = min width of a transistor
49*/
50#define _STD_WIDTH_PER_FOLD(x) ((x)->w/(x)->nfolds)
51#define _RESIDUAL_WIDTH(x) ((x)->w % (x)->nfolds)
52#define EDGE_WIDTH(x,i) (_STD_WIDTH_PER_FOLD(x) + (((i) == (x)->nfolds-1) ? _RESIDUAL_WIDTH(x) : 0))
53
55 act_booleanized_var_t *v; /* var pointer */
56
57 act_prs_expr_t *e_up, *e_dn; /* parsed expression: explicit
58 keepers omitted */
59
60 bool_t *b; /* the bdd for the variable */
61
62 bool_t *up, *dn; /* pull-up, pull-down, including
63 explicit keepers */
64
65 struct node *n;
66
67 struct node *vdd, *gnd; /* power supply for the gate: used to
68 check if two gates are compatible */
69
70 unsigned int spec_keeper:1; // special keeper
71 unsigned int unstaticized:2; /* unstaticized!
72 0 = generate keeper
73 1 = no keeper, but it is state-holding
74 2 = no keeper, but it is combinational
75 */
76 unsigned int stateholding:1; /* state-holding variable */
77 unsigned int usecf:2; /* combinational feedback (2 = default) */
78 unsigned int manualkeeper:2; /* node has a manually specified
79 keeper: 0 = no, 1 = std, 2 = comb feedback */
80
81 struct node *inv; /* var is an input to an inverter
82 whose output is inv */
83
84 void *extra; /* space for rent */
85};
86
87/* transistor-level netlist graph */
88typedef struct node {
89 int i; /* node id# */
90 struct act_nl_varinfo *v; /* some have names (could be NULL) */
91
92 list_t *e; /* edges */
93
94 bool_t *b; /* bool expr for this node */
95
96 /* flags */
97 unsigned int contact:1; /* 1 if it needs a contact */
98 unsigned int supply:1; /* is a power supply */
99 unsigned int inv:1; /* 1 if it is a generated inverter
100 for staticizers */
101 unsigned int visited:1; /* visited flag for nodes */
102
103
104 /* arrays are EDGE_NFET/EDGE_PFET indexed */
105 list_t *wl; /* max reff calculation: worklist */
106 double reff[2]; /* actual reff value */
107
108 unsigned char reff_set[2]; /* 1 if set by attr, 0 otherwise */
109
110 double cap; /* cap to GND on the node */
111 double resis; /* output resistance of the node */
112
113 struct node *next; /* global list of nodes for the
114 Netlist */
116
117struct edge {
118 node_t *g; /* gate on the edge */
119 node_t *bulk; /* body */
120 node_t *a, *b; /* two nodes */
121
122 int w, l; /* w, l for the gate */
123 int flavor; /* lvt,svt,hvt,od18,... */
124
125 /* nfolds: # of folds */
127
128 /* # of repeated lengths */
129 int nlen;
130
131 unsigned int type:1; /* 0 = nfet, 1 = pfet */
132
133 unsigned int pchg:1; /* internal precharge expression */
134 unsigned int keeper:1; /* weak keeper */
135 unsigned int combf:1; /* combinational feedback */
136
137 unsigned int raw:1; /* explicitly specified fet */
138
139 unsigned int pruned:1; /* 1 = pruned during sharing */
140 unsigned int tree:1; /* is part of the current tree! */
141
142 unsigned int visited; /* visited this edge?; count if the
143 edge is folded */
144};
145
148 double val;
149};
150
151typedef struct {
153
154 BOOL_T *B;
155 node_t *hd, *tl;
156 list_t *caps; // list of capacitors
157 int idnum; /* used to number the nodes */
158
159 struct Hashtable *atH[2]; /* hash table for @-labels to node mapping */
160
161 list_t *vdd_list, *gnd_list; /* list of Vdd/GND node_t pointers */
162 list_t *psc_list, *nsc_list;
163
164 node_t *Vdd, *GND;
165 node_t *psc, *nsc; /* substrate contacts */
166
167 int weak_supply_vdd, weak_supply_gnd;
168 /* if > 0, this block has weak supply ports. It includes the count of the
169 # of gates that share the weak inv within the block */
170 int vdd_len, gnd_len; /* sizing info for the weak supply
171 exported */
172 int nid_wvdd, nid_wgnd; /* node ids! */
173
174 A_DECL (int, instport_weak); /* node # for instance ports for weak
175 supplies */
176
177 struct {
178 int w, l; /* current size */
179 int nf; /* current fold */
180 unsigned char flavor; /* current flavor */
181 int sw, sl; /* staticizer sizes */
182 } sz[2]; /* sizes */
183
184 unsigned int leak_correct:1; /* correct leakage */
185
186} netlist_t;
187
188
189/* -- netlist pass -- */
190
191class ActNetlistPass : public ActPass {
192 public:
195
196 int run (Process *p = NULL);
197
199
201
202 void Print (FILE *fp, Process *p);
203
205 static node_t *string_to_node (netlist_t *, char *s);
206 static void sprint_node (char *buf, int sz, netlist_t *N, node_t *n);
207 static void sprint_conn (char *buf, int sz, act_connection *c);
208 static void emit_node (netlist_t *N, FILE *fp, node_t *n, int mangle = 0);
209
210 static void spice_to_act_name (char *s, char *t, int sz, int xconv);
211
212 static int getGridsPerLambda() { return grids_per_lambda; }
213
214 private:
215 void *local_op (Process *p, int mode = 0);
216 void free_local (void *v);
217
219
220 /* lambda value */
221 double lambda;
224
225 /* minimum transistor size */
229 int _fin_width; // for FinFETs, snaps all widths to
230 // integer fin width
231
232 /* maximum transistor size */
235
236 /* strength ratios */
237 double p_n_ratio;
239
240 /* load cap */
242
243 /* netlist generation mode */
245
246 /* folding parameters */
252
253 /* local and global Vdd/GND */
254 static const char *local_vdd, *local_gnd, *global_vdd, *global_gnd;
256
257 /* printing flags */
261
265
268 const char *extra_fet_string;
269
271
273
274 /* series gate warnings */
277
278 /* unit capacitance */
279 double unit_cap;
280
281
284 int num_vdd_share,
285 int num_gnd_share,
286 int vdd_len,
287 int gnd_len,
288 node_t *weak_vdd, node_t *weak_gnd);
289
290 void generate_prs_graph (netlist_t *N, act_prs_lang_t *p, int istree = 0);
292 int num_vdd_share,
293 int num_gnd_share,
294 int vdd_len, int gnd_len,
295 node_t *weak_vdd, node_t *weak_gnd);
296
297 FILE *_outfp;
298
301
304 int find_length_fit (int len);
305 void set_fet_params (netlist_t *n, edge_t *f, unsigned int type,
306 act_size_spec_t *sz);
307 int create_expr_edges (netlist_t *N, int type, node_t *left,
308 act_prs_expr_t *e, node_t *right, int sense);
309
310 void _check_emit_warning (int d, int depth, ActId *id);
311};
312
313
314#endif /* __NETLIST_H__ */
This pass is used to pre-process information about languages and variables within the design....
Definition: booleanize.h:271
The main Act class used to read in an ACT file and create basic data structures. All design informati...
Definition: act.h:334
This class is used to store Act identifiers that correspond to instances. Identifiers have an optiona...
Definition: act_id.h:56
Definition: netlist.h:191
netlist_t * getNL(Process *p)
int weak_share_min
Definition: netlist.h:272
void Print(FILE *fp, Process *p)
static int getGridsPerLambda()
Definition: netlist.h:212
int discrete_fet_length_sz
Definition: netlist.h:250
double unit_cap
Definition: netlist.h:279
int top_level_only
Definition: netlist.h:270
static const char * global_vdd
Definition: netlist.h:254
int swap_source_drain
Definition: netlist.h:267
static void spice_to_act_name(char *s, char *t, int sz, int xconv)
double output_scale_factor
Definition: netlist.h:260
double manufacturing_grid
Definition: netlist.h:222
void set_fet_params(netlist_t *n, edge_t *f, unsigned int type, act_size_spec_t *sz)
int weak_share_max
Definition: netlist.h:272
int find_length_window(edge_t *e)
int p_fold
Definition: netlist.h:248
int black_box_mode
Definition: netlist.h:244
int series_p_warning
Definition: netlist.h:276
double p_n_ratio
Definition: netlist.h:237
int n_fold
Definition: netlist.h:247
int series_n_warning
Definition: netlist.h:275
int * discrete_fet_length
Definition: netlist.h:251
int fet_spacing_diffcontact
Definition: netlist.h:263
int fet_diff_overhang
Definition: netlist.h:264
int use_subckt_models
Definition: netlist.h:266
static Act * current_act
Definition: netlist.h:255
static const char * global_gnd
Definition: netlist.h:254
const char * extra_fet_string
Definition: netlist.h:268
static void sprint_node(char *buf, int sz, netlist_t *N, node_t *n)
void generate_netgraph(netlist_t *N, int num_vdd_share, int num_gnd_share, int vdd_len, int gnd_len, node_t *weak_vdd, node_t *weak_gnd)
double weak_to_strong_ratio
Definition: netlist.h:238
int min_l_in_lambda
Definition: netlist.h:227
void generate_staticizers(netlist_t *N, int num_vdd_share, int num_gnd_share, int vdd_len, int gnd_len, node_t *weak_vdd, node_t *weak_gnd)
double default_load_cap
Definition: netlist.h:241
void generate_prs_graph(netlist_t *N, act_prs_lang_t *p, int istree=0)
ActBooleanizePass * bools
Definition: netlist.h:218
int emit_parasitics
Definition: netlist.h:259
int ignore_loadcap
Definition: netlist.h:258
netlist_t * generate_netlist(Process *p)
netlist_t * genNetlist(Process *p)
void * local_op(Process *p, int mode=0)
static void sprint_conn(char *buf, int sz, act_connection *c)
static const char * local_vdd
Definition: netlist.h:254
static void emit_node(netlist_t *N, FILE *fp, node_t *n, int mangle=0)
int min_w_in_lambda
Definition: netlist.h:226
int fet_spacing_diffonly
Definition: netlist.h:262
static node_t * connection_to_node(netlist_t *n, act_connection *c)
int _fin_width
Definition: netlist.h:229
int max_p_w_in_lambda
Definition: netlist.h:234
static int grids_per_lambda
Definition: netlist.h:223
void free_local(void *v)
double leak_adjust
Definition: netlist.h:228
void fold_transistors(netlist_t *N)
FILE * _outfp
Definition: netlist.h:297
void enableSharedStat()
static const char * local_gnd
Definition: netlist.h:254
int discrete_len
Definition: netlist.h:249
int max_n_w_in_lambda
Definition: netlist.h:233
void _check_emit_warning(int d, int depth, ActId *id)
static node_t * string_to_node(netlist_t *, char *s)
ActNetlistPass(Act *a)
netlist_t * emitNetlist(Process *p)
int create_expr_edges(netlist_t *N, int type, node_t *left, act_prs_expr_t *e, node_t *right, int sense)
int find_length_fit(int len)
int run(Process *p=NULL)
double lambda
Definition: netlist.h:221
The main ActPass class used to implement an ACT analysis/synthesis pass. All the core tools use this ...
Definition: act.h:791
Act * a
Definition: act.h:810
User-defined processes.
Definition: types.h:750
Connections.
Definition: value.h:113
struct node node_t
This structure is computed for each process by the Booleanize pass. It summarizes the information abo...
Definition: booleanize.h:187
The core data type for a variable accessed in an ACT process. A variable may be an act_booleanized_va...
Definition: booleanize.h:103
Definition: netlist.h:54
unsigned int unstaticized
Definition: netlist.h:71
bool_t * dn
Definition: netlist.h:62
act_booleanized_var_t * v
Definition: netlist.h:55
bool_t * b
Definition: netlist.h:60
unsigned int usecf
Definition: netlist.h:77
struct node * n
Definition: netlist.h:65
struct node * gnd
Definition: netlist.h:67
act_prs_expr_t * e_dn
Definition: netlist.h:57
struct node * inv
Definition: netlist.h:81
bool_t * up
Definition: netlist.h:62
unsigned int stateholding
Definition: netlist.h:76
void * extra
Definition: netlist.h:84
act_prs_expr_t * e_up
Definition: netlist.h:57
unsigned int manualkeeper
Definition: netlist.h:78
struct node * vdd
Definition: netlist.h:67
unsigned int spec_keeper
Definition: netlist.h:70
A production rule expression, corresponding to the guard for the production rule.
Definition: lang.h:97
Structure that holds a prs sub-language body. This consists of a linked-list of individual items in t...
Definition: lang.h:140
Sizing specifier for variables.
Definition: lang.h:83
Definition: netlist.h:117
node_t * bulk
Definition: netlist.h:119
unsigned int raw
Definition: netlist.h:137
int w
Definition: netlist.h:122
int flavor
Definition: netlist.h:123
node_t * b
Definition: netlist.h:120
unsigned int pruned
Definition: netlist.h:139
unsigned int type
Definition: netlist.h:131
unsigned int keeper
Definition: netlist.h:134
int nfolds
Definition: netlist.h:126
int l
Definition: netlist.h:122
unsigned int tree
Definition: netlist.h:140
int nlen
Definition: netlist.h:129
unsigned int visited
Definition: netlist.h:142
node_t * a
Definition: netlist.h:120
unsigned int combf
Definition: netlist.h:135
node_t * g
Definition: netlist.h:118
unsigned int pchg
Definition: netlist.h:133
Definition: netlist.h:146
double val
Definition: netlist.h:148
node_t * n2
Definition: netlist.h:147
node_t * n1
Definition: netlist.h:147
Definition: netlist.h:151
list_t * gnd_list
Definition: netlist.h:161
unsigned char flavor
Definition: netlist.h:180
unsigned int leak_correct
Definition: netlist.h:184
act_boolean_netlist_t * bN
Definition: netlist.h:152
int l
Definition: netlist.h:178
int idnum
Definition: netlist.h:157
int sl
Definition: netlist.h:181
int nid_wgnd
Definition: netlist.h:172
BOOL_T * B
Definition: netlist.h:154
A_DECL(int, instport_weak)
node_t * GND
Definition: netlist.h:164
int weak_supply_gnd
Definition: netlist.h:167
int gnd_len
Definition: netlist.h:170
node_t * hd
Definition: netlist.h:155
list_t * caps
Definition: netlist.h:156
int nf
Definition: netlist.h:179
list_t * nsc_list
Definition: netlist.h:162
node_t * nsc
Definition: netlist.h:165
Definition: netlist.h:88
unsigned int inv
Definition: netlist.h:99
list_t * e
Definition: netlist.h:92
bool_t * b
Definition: netlist.h:94
int i
Definition: netlist.h:89
unsigned int contact
Definition: netlist.h:97
double resis
Definition: netlist.h:111
list_t * wl
Definition: netlist.h:105
double reff[2]
Definition: netlist.h:106
unsigned char reff_set[2]
Definition: netlist.h:108
struct node * next
Definition: netlist.h:113
unsigned int supply
Definition: netlist.h:98
struct act_nl_varinfo * v
Definition: netlist.h:90
unsigned int visited
Definition: netlist.h:101
double cap
Definition: netlist.h:110