ACT Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ActBooleanizePass Class Reference

This pass is used to pre-process information about languages and variables within the design. The pass computes the act_boolean_netlist_t data structure, which contains information about all the local variables used by the process. More...

#include <booleanize.h>

Inheritance diagram for ActBooleanizePass:
ActPass

Public Member Functions

 ActBooleanizePass (Act *a)
 constructor
 
 ~ActBooleanizePass ()
 release storage
 
int run (Process *p=NULL)
 
act_boolean_netlist_tgetBNL (Process *p)
 
void createNets (Process *p=NULL)
 
void Print (FILE *fp, Process *p)
 
- Public Member Functions inherited from ActPass
 ActPass (Act *_a, const char *name, int doroot=0)
 
virtual ~ActPass ()
 release storage
 
void update (Process *p)
 
int rundeps (Process *p=NULL)
 
const char * getName ()
 
virtual int run (Process *p=NULL)
 
int completed ()
 
int pending ()
 
void * getMap (UserDef *u)
 
void * getGlobalInfo ()
 
ActgetAct ()
 
ActPassgetPass (const char *name)
 
ProcessgetRoot ()
 
virtual void run_recursive (Process *p=NULL, int mode=0)
 
void disableUpdate ()
 
void enableUpdate ()
 
void mkStickyVisited ()
 
void clrStickyVisited ()
 

Static Public Member Functions

static act_dynamic_var_tisDynamicRef (act_boolean_netlist_t *, act_connection *)
 
static act_dynamic_var_tisDynamicRef (act_boolean_netlist_t *, ActId *)
 
- Static Public Member Functions inherited from ActPass
static void refreshAll (Act *a, Process *p=NULL)
 

Private Member Functions

void * local_op (Process *p, int mode=0)
 
void free_local (void *)
 
act_boolean_netlist_t_create_local_bools (Process *p)
 
void _print (Process *p)
 
void flatten_ports_to_bools (act_boolean_netlist_t *n, ActId *prefix, Scope *s, UserDef *u, int nochp)
 
void update_used_flags (act_boolean_netlist_t *n, ValueIdx *vx, 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)
 
void append_base_port (act_boolean_netlist_t *n, act_connection *c, Type *t, int mode)
 
void _createNets (Process *p)
 
int addNet (act_boolean_netlist_t *n, act_connection *c)
 
void addPin (act_boolean_netlist_t *n, int netid, const char *name, Array *a, act_connection *pin)
 
void importPins (act_boolean_netlist_t *n, int netid, const char *name, Array *a, act_local_net_t *net)
 

Private Attributes

int black_box_mode
 
int _create_nets_run
 
FILE * _fp
 

Additional Inherited Members

- Protected Member Functions inherited from ActPass
virtual void _actual_update (Process *p)
 
int AddDependency (const char *pass)
 
- Protected Attributes inherited from ActPass
int _finished
 has the pass finished execution?
 
int _sticky_visited
 
Acta
 
list_t * deps
 
list_t * fwdeps
 
const char * name
 the name for the pass
 
int _update_propagate
 
int _root_dirty
 
Process_root
 the root of the design
 
void * _global_info
 

Detailed Description

This pass is used to pre-process information about languages and variables within the design. The pass computes the act_boolean_netlist_t data structure, which contains information about all the local variables used by the process.

The reason this is called "Booleanize" is that channels/integers are expanded out into collections of Booleans as specified by the user. For example, imagine the following program:

defchan e1of2 <: chan(bool) (bool t, f, e) { ... }
defproc test (e1of2? l; e1of2 r) { ... }

Running the Booleanize pass will expand out the ports for test into l.t, l.f, l.e, r.t, r.f, r.e. These will be part of the Boolean port list (the ports array). The CHP level of abstraction would have ports l and r, since we treat those as channels for CHP level modeling, and so those two variables will appear in the chpports array but not the ports array.

If in the above example l.e and r.e are connected to each other internally within test, then one of the two ports will be marked as omitted using the omit flag (see the netlist_bool_port).

Constructor & Destructor Documentation

◆ ActBooleanizePass()

ActBooleanizePass::ActBooleanizePass ( Act a)

constructor

◆ ~ActBooleanizePass()

ActBooleanizePass::~ActBooleanizePass ( )

release storage

Member Function Documentation

◆ _create_local_bools()

act_boolean_netlist_t * ActBooleanizePass::_create_local_bools ( Process p)
private

This is the local call to create the act_boolean_netlist_t data structure for the process. This assumes that all child processes have been processed already.

Parameters
pis the Process of interest

◆ _createNets()

void ActBooleanizePass::_createNets ( Process p)
private

Helper function for createNets()

◆ _print()

void ActBooleanizePass::_print ( Process p)
private

Helper function to print local process info

Parameters
pis the local process Implicitly uses _fp as the output file.

◆ addNet()

int ActBooleanizePass::addNet ( act_boolean_netlist_t n,
act_connection c 
)
private

Helper function for createNets()

◆ addPin()

void ActBooleanizePass::addPin ( act_boolean_netlist_t n,
int  netid,
const char *  name,
Array a,
act_connection pin 
)
private

Helper function for createNets()

◆ append_base_port()

void ActBooleanizePass::append_base_port ( act_boolean_netlist_t n,
act_connection c,
Type t,
int  mode 
)
private

Helper function for update_used_flags()

Parameters
nis the netlist where the port is to be appended
cis the new port
tis the Type for the port
modeis 0 if this is both a CHP and Boolean port, 1 if this is Boolean-only, and 2 if it is CHP-only

◆ createNets()

void ActBooleanizePass::createNets ( Process p = NULL)

Create net data structure that contains a netname and instance names + pins

Parameters
pis the top level process

◆ flatten_ports_to_bools()

void ActBooleanizePass::flatten_ports_to_bools ( act_boolean_netlist_t n,
ActId prefix,
Scope s,
UserDef u,
int  nochp 
)
private

Recursively expand out ports into their consitituent leaf types

Parameters
prefixis used to construct the full ActId name for the expanded port component. This is the prefix to the current instance.
nis the boolean netlist data structure
sis the parent scope of the current user defined object
uis the current user-defined object
nochpis a flag saying we've broken down a channel so skip for chp

◆ free_local()

void ActBooleanizePass::free_local ( void *  )
privatevirtual

impementation of the ActPass operations

Reimplemented from ActPass.

◆ getBNL()

act_boolean_netlist_t * ActBooleanizePass::getBNL ( Process p)
Parameters
pis a pointer to a process; NULL means the top-level global namespace (the global scope, external to any process)
Returns
the booleanized netlist pointer for the spceified process

◆ importPins()

void ActBooleanizePass::importPins ( act_boolean_netlist_t n,
int  netid,
const char *  name,
Array a,
act_local_net_t net 
)
private

Helper function for createNets()

◆ isDynamicRef() [1/2]

static act_dynamic_var_t * ActBooleanizePass::isDynamicRef ( act_boolean_netlist_t ,
act_connection  
)
static
Returns
the act_dynamic_var_t structure (if it exists) given an act_boolean_netlist_t pointer and a connection pointer

◆ isDynamicRef() [2/2]

static act_dynamic_var_t * ActBooleanizePass::isDynamicRef ( act_boolean_netlist_t ,
ActId  
)
static
Returns
the act_dynamic_var_t structure (if it exists) given an act_boolean_netlist_t pointer and an ActId from the process corresponding to the act_boolean_netlist_t pointer.

◆ local_op()

void * ActBooleanizePass::local_op ( Process p,
int  mode = 0 
)
privatevirtual

implementation of the ActPass operations

Reimplemented from ActPass.

◆ Print()

void ActBooleanizePass::Print ( FILE *  fp,
Process p 
)

Print ports/flags computed.

◆ rec_update_used_flags()

void ActBooleanizePass::rec_update_used_flags ( act_boolean_netlist_t n,
act_boolean_netlist_t subinst,
ActId prefix,
Scope s,
UserDef u,
int *  count,
int *  count2 
)
private

Helper function for update_used_flags().

Parameters
nis the netlist where the update should be done
subinstis the netlist of current instance
prefixis the prefix to current instance
sis the scope in which the instance exists
uis the user-defined type corresponding to the prefix
countis the in/out used to track instports to make things simpler for other tools
count2is the same as count, but for chp ports

◆ run()

int ActBooleanizePass::run ( Process p = NULL)
virtual

Run the pass

Parameters
pis the top-level process. Must be an expanded process. (NULL means the global namespace scope)
Returns
1 on success, 0 on failure

Reimplemented from ActPass.

◆ update_used_flags()

void ActBooleanizePass::update_used_flags ( act_boolean_netlist_t n,
ValueIdx vx,
Process p 
)
private

Update the used flags in the current act_boolean_netlist_t, based on connections to the ports of a specific instance of a process type

Parameters
pis the process type
vxis a process instance of type Process p.
nis the netlist where the flags should be updated.

Member Data Documentation

◆ _create_nets_run

int ActBooleanizePass::_create_nets_run
private

set to 1 if the creatNets() operation has already been run.

◆ _fp

FILE* ActBooleanizePass::_fp
private

used internally as the FILE pointer for printing.

◆ black_box_mode

int ActBooleanizePass::black_box_mode
private

if set to 1, this pass operates in "black box" mode. In this mode, an empty process is assumed to correspond to an external black box macro and hence all the ports are assumed to exist even though they are not referenced within the process.


The documentation for this class was generated from the following file: