ACT Library
Loading...
Searching...
No Matches
booleanize.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * Copyright (c) 2019-2021 Rajit Manohar
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 **************************************************************************
21 */
22#ifndef __ACT_BOOLEANIZE_H__
23#define __ACT_BOOLEANIZE_H__
24
25#include <map>
26#include <act/act.h>
27#include <act/extmacro.h>
28
37 unsigned int omit:1;
38 unsigned int input:1;
39 unsigned int bidir:1;
43 unsigned int used:1;
47 unsigned int netid;
48};
49
58 unsigned int input:1;
59 unsigned int bidir:1;
63};
64
65
73typedef struct act_dynamic_var {
77 unsigned int isint:1;
81 int width;
83
84
103typedef struct act_booleanized_var {
107 unsigned int input:1;
108 unsigned int output:1;
110 unsigned int used:1;
111 unsigned int ischan:1;
114 unsigned int chanflag:2;
121 unsigned int isint:1;
123 unsigned int usedchp:1;
124 unsigned int isglobal:1;
125 unsigned int isport:1;
128 unsigned int ischpport:1;
132 unsigned int isfragmented:1;
136 unsigned int width;
137 unsigned int w2;
146 void *extra;
148
149
156typedef struct {
161
162
169typedef struct {
172 unsigned int skip:1;
173 unsigned int port:1;
176
177
187typedef struct {
191
192 unsigned int visited:1;
193 unsigned int isempty:1;
195 struct pHashtable *cH;
200 struct pHashtable *cdH;
207 A_DECL (struct netlist_bool_port, chpports);
208 A_DECL (struct netlist_bool_port, ports);
210
211 A_DECL (act_connection *, instports);
217
218 A_DECL (act_connection *, instchpports);
224
225 A_DECL (struct netlist_global_port, used_globals);
229
231 struct pHashtable *nH;
233
236
238
239
240
272 public:
275
282 int run (Process *p = NULL);
283
292
293
300 void createNets (Process *p = NULL);
301
305 void Print (FILE *fp, Process *p);
306
313
320 ActId *);
321
322 /*-- internal data structures and functions --*/
323 private:
324 void *local_op (Process *p, int mode = 0);
326 void free_local (void *);
328
335
338
339 FILE *_fp;
341
342 /*-- internal functions: generate booleans for a process --*/
343
351
357 void _print (Process *p);
358
370 ActId *prefix,
371 Scope *s,
372 UserDef *u, int nochp);
373
383 ValueIdx *vx, Process *p);
384
397 act_boolean_netlist_t *subinst,
398 ActId *prefix,
399 Scope *s, UserDef *u, int *count, int *count2);
400
410 int mode);
411
412 /*--- create netlist helper functions ---*/
413
416
419
421 void addPin (act_boolean_netlist_t *n, int netid,
422 const char *name, Array *a,
423 act_connection *pin);
424
426 void importPins (act_boolean_netlist_t *n, int netid, const char *name, Array *a, act_local_net_t *net);
427
428};
429
430
431
432
433
434#endif /* __ACT_BOOLEANIZE_H__ */
struct act_dynamic_var act_dynamic_var_t
struct act_booleanized_var act_booleanized_var_t
This pass is used to pre-process information about languages and variables within the design....
Definition: booleanize.h:271
~ActBooleanizePass()
release storage
static act_dynamic_var_t * isDynamicRef(act_boolean_netlist_t *, act_connection *)
FILE * _fp
Definition: booleanize.h:339
act_boolean_netlist_t * getBNL(Process *p)
int run(Process *p=NULL)
void update_used_flags(act_boolean_netlist_t *n, ValueIdx *vx, Process *p)
int black_box_mode
Definition: booleanize.h:329
void _createNets(Process *p)
void addPin(act_boolean_netlist_t *n, int netid, const char *name, Array *a, act_connection *pin)
int addNet(act_boolean_netlist_t *n, act_connection *c)
void * local_op(Process *p, int mode=0)
static act_dynamic_var_t * isDynamicRef(act_boolean_netlist_t *, ActId *)
int _create_nets_run
Definition: booleanize.h:336
void _print(Process *p)
void append_base_port(act_boolean_netlist_t *n, act_connection *c, Type *t, int mode)
void importPins(act_boolean_netlist_t *n, int netid, const char *name, Array *a, act_local_net_t *net)
void free_local(void *)
void createNets(Process *p=NULL)
void flatten_ports_to_bools(act_boolean_netlist_t *n, ActId *prefix, Scope *s, UserDef *u, int nochp)
act_boolean_netlist_t * _create_local_bools(Process *p)
void rec_update_used_flags(act_boolean_netlist_t *n, act_boolean_netlist_t *subinst, ActId *prefix, Scope *s, UserDef *u, int *count, int *count2)
ActBooleanizePass(Act *a)
constructor
void Print(FILE *fp, Process *p)
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
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
const char * name
the name for the pass
Definition: act.h:822
Dense arrays, sparse arrays, and array dereferences.
Definition: act_array.h:65
A user-defined data types.
Definition: types.h:1062
This is used to record information about a macro from an ACT configuration file.
Definition: extmacro.h:62
User-defined processes.
Definition: types.h:750
This is the data structure that holds all instances and their associated types within a scope....
Definition: namespaces.h:77
The abstract base class for all types in the system.
Definition: basetype.h:45
UserDef stores information that is common to all user-defined types. User-defined types are more comp...
Definition: types.h:310
This class is used to create an instance in a scope. The name comes from the fact that this is used t...
Definition: value.h:342
Connections.
Definition: value.h:113
This structure is computed for each process by the Booleanize pass. It summarizes the information abo...
Definition: booleanize.h:187
Scope * cur
The local scope of the process.
Definition: booleanize.h:190
A_DECL(struct netlist_bool_port, ports)
ExternMacro * macro
Definition: booleanize.h:234
A_DECL(act_connection *, instports)
A_DECL(struct netlist_global_port, used_globals)
struct pHashtable * cdH
Definition: booleanize.h:200
Process * p
Definition: booleanize.h:188
struct pHashtable * cH
Definition: booleanize.h:195
A_DECL(act_local_net_t, nets)
the list of nets
A_DECL(struct netlist_bool_port, chpports)
the list of CHP ports
A_DECL(act_connection *, instchpports)
unsigned int visited
Definition: booleanize.h:192
unsigned int isempty
Definition: booleanize.h:193
struct pHashtable * nH
Definition: booleanize.h:231
The core data type for a variable accessed in an ACT process. A variable may be an act_booleanized_va...
Definition: booleanize.h:103
unsigned int ischan
Definition: booleanize.h:111
unsigned int used
Definition: booleanize.h:110
unsigned int ischpport
Definition: booleanize.h:128
unsigned int usedchp
Definition: booleanize.h:123
unsigned int output
Definition: booleanize.h:108
short proc_out
Definition: booleanize.h:140
unsigned int isglobal
Definition: booleanize.h:124
unsigned int width
Definition: booleanize.h:136
void * extra
Definition: booleanize.h:146
unsigned int input
Definition: booleanize.h:107
short proc_in
Definition: booleanize.h:140
act_connection * id
Definition: booleanize.h:104
unsigned int isport
Definition: booleanize.h:125
unsigned int isint
Definition: booleanize.h:121
unsigned int chanflag
Definition: booleanize.h:114
unsigned int isfragmented
Definition: booleanize.h:132
unsigned int w2
Definition: booleanize.h:137
CHP programs can have complex dynamic accesses, with runtime array references. The Booleanize pass re...
Definition: booleanize.h:73
int width
for integers, this is the bit-width
Definition: booleanize.h:81
unsigned int isint
1 if this is an int, 0 if it is a bool
Definition: booleanize.h:77
ActId * aid
The array name as an ID.
Definition: booleanize.h:76
Array * a
array info: dimensions
Definition: booleanize.h:80
Data * isstruct
Definition: booleanize.h:78
act_connection * id
Definition: booleanize.h:74
This is used for flat netlist generation to represent a net that consists of a net name and a list of...
Definition: booleanize.h:169
act_connection * net
Definition: booleanize.h:170
unsigned int port
1 if this is a port
Definition: booleanize.h:173
unsigned int skip
set to skip this net
Definition: booleanize.h:172
A_DECL(act_local_pin_t, pins)
array of pins for the net
This is used for flat netlist generation to represent an I/O pin for a leaf cell.
Definition: booleanize.h:156
act_connection * pin
Definition: booleanize.h:158
ActId * inst
Definition: booleanize.h:157
Process * cell
Definition: booleanize.h:159
This holds information about a port in the Booleanized netlist data structure.
Definition: booleanize.h:35
unsigned int omit
Definition: booleanize.h:37
unsigned int used
Definition: booleanize.h:43
unsigned int input
Definition: booleanize.h:38
unsigned int netid
Definition: booleanize.h:47
act_connection * c
Definition: booleanize.h:36
unsigned int bidir
Definition: booleanize.h:39
This is used to hold information about a global signal used in a process.
Definition: booleanize.h:56
unsigned int bidir
Definition: booleanize.h:59
act_connection * c
Definition: booleanize.h:57
unsigned int input
Definition: booleanize.h:58