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

The main Act class used to read in an ACT file and create basic data structures. All design information can be accessed through this data structure. More...

#include <act.h>

Public Member Functions

 Act (const char *s=NULL)
 
 ~Act ()
 
void Merge (const char *s)
 
bool LocalizeGlobal (const char *s)
 
void Expand ()
 
void mangle (char *s)
 
int mangle_set_char (unsigned char c)
 
int mangle_active ()
 
int mangle_string (const char *src, char *dst, int sz)
 
int unmangle_string (const char *src, char *dst, int sz)
 
void mfprintf (FILE *fp, const char *s,...)
 
void ufprintf (FILE *fp, const char *s,...)
 
int msnprintf (char *fp, int sz, const char *s,...)
 
int usnprintf (char *fp, int sz, const char *s,...)
 
void msnprintfproc (char *fp, int sz, UserDef *u, int omit_ns=0)
 
void mfprintfproc (FILE *fp, UserDef *u, int omit_ns=0)
 
int unmangle_stringproc (const char *src, char *dst, int sz)
 
ProcessfindProcess (const char *s, bool allow_expand=false)
 
ProcessfindProcess (ActNamespace *ns, const char *s, bool allow_expand=false)
 
UserDeffindUserdef (const char *s)
 
ActNamespacefindNamespace (const char *s)
 
ActNamespacefindNamespace (ActNamespace *ns, const char *s)
 
ActNamespaceGlobal ()
 
void Print (FILE *fp)
 
void pass_register (const char *name, ActPass *p)
 
ActPasspass_find (const char *name)
 
void pass_unregister (const char *name)
 
const char * pass_name (const char *name)
 
list_t * getDecomp (Process *p)
 
list_t * getDecompTypes ()
 
TypeFactorygetTypeFactory ()
 
int getLevel ()
 get default level
 
int getLevel (Process *p)
 get level for this type
 
int getLevel (ActId *id)
 get level for this instance
 
int getRefSteps ()
 
void decRefSteps ()
 
void incRefSteps ()
 

Static Public Member Functions

static void Init (int *argc, char ***argv, const char *optional_conf)
 
static void Init (int *argc, char ***argv, list_t *multi_conf=NULL)
 
static int getOptions (int *argc, char ***argv)
 
static void setOptionString (char *str)
 
static void config_info (const char *s)
 
static void generic_msg (const char *s)
 

Static Public Attributes

static int max_recurse_depth
 
static int max_loop_iterations
 
static list_t * cmdline_args
 
static int emit_depend
 

Static Private Member Functions

static int _process_act_arg (const char *argvp, int *tech_specified, char **conf)
 

Private Attributes

TypeFactorytf
 type factory for the Act instance
 
ActNamespacegns
 the global namespace pointer
 
int mangle_characters [256]
 which characters do we mangle?
 
int inv_map [256]
 map used for inverse lookup
 
int any_mangling
 1 if there is any name mangling, 0 otherwise
 
struct Hashtable * passes
 Table of any ActPass-es.
 
int refine_steps
 
int num_type_levels [ACT_MODEL_TOTAL]
 
char ** type_levels [ACT_MODEL_TOTAL]
 
int num_inst_levels [ACT_MODEL_TOTAL]
 
char ** inst_levels [ACT_MODEL_TOTAL]
 
int default_level
 the default modeling level
 

Static Private Attributes

static Log * L
 Used for log messages.
 
static char * _getopt_string
 the string used for getopt
 

Detailed Description

The main Act class used to read in an ACT file and create basic data structures. All design information can be accessed through this data structure.

Constructor & Destructor Documentation

◆ Act()

Act::Act ( const char *  s = NULL)

Create an act data structure for the specified input file

Parameters
sis the name of the file containing the top-level ACT. If NULL, then the library is initialized without any ACT file being read.

◆ ~Act()

Act::~Act ( )

Member Function Documentation

◆ _process_act_arg()

static int Act::_process_act_arg ( const char *  argvp,
int *  tech_specified,
char **  conf 
)
staticprivate

Internal function used to actually process an argument, used to avoid replicating code.

◆ config_info()

static void Act::config_info ( const char *  s)
static

Config debugging

◆ decRefSteps()

void Act::decRefSteps ( )
inline

decrement the number of remaining refinement steps

◆ Expand()

void Act::Expand ( )

Expand types. This expands the entire design, updating the data structures stored in the Act class.

◆ findNamespace() [1/2]

ActNamespace * Act::findNamespace ( ActNamespace ns,
const char *  s 
)

Find a namespace nested within another namespace

Parameters
nsis the parent namespace
sis the name of the nested namespace
Returns
the ActNamespace pointer if found, NULL otherwise

◆ findNamespace() [2/2]

ActNamespace * Act::findNamespace ( const char *  s)

Find a namespace.

Parameters
sis the name of the namespace
Returns
the ActNamespace pointer if found, NULL otherwise

◆ findProcess() [1/2]

Process * Act::findProcess ( ActNamespace ns,
const char *  s,
bool  allow_expand = false 
)

Find a process within a namespace

Parameters
sis the name of the process
nsis the ACT namespace
allow_expandif set to true, then if the process has angle brackets then findProcess is allowed to expand the process
Returns
the process pointer if found, NULL otherwise

◆ findProcess() [2/2]

Process * Act::findProcess ( const char *  s,
bool  allow_expand = false 
)

Find a process given a name

Parameters
sis the name of the process
allow_expandif set to true, then if the process has angle brackets then findProcess is allowed to expand the process
Returns
process pointer, or NULL if not found

◆ findUserdef()

UserDef * Act::findUserdef ( const char *  s)

Find a user-defined type

Parameters
sis the name of the type
Returns
the UserDef pointer if found, NULL otherwise

◆ generic_msg()

static void Act::generic_msg ( const char *  s)
static

◆ getDecomp()

list_t * Act::getDecomp ( Process p)

Certain ACT passes can re-write the ACT and introduce decomposed processes. Currently the chpmem and chparb passes have this property, as they extract parts of the CHP and introduce new processes/instances. This method returns a list of list of ValueIdx pointers generated by the decomposition passes.

Parameters
pis the Process to query for any decomposed components
Returns
a list of list of ValueIdx pointers. The list could be NULL if nothing exists.

◆ getDecompTypes()

list_t * Act::getDecompTypes ( )
Returns
a list of Process pointers that were generated during decomposition, if any. See the getDecomp() method for more details.

◆ getLevel() [1/3]

int Act::getLevel ( )

get default level

◆ getLevel() [2/3]

int Act::getLevel ( ActId id)

get level for this instance

◆ getLevel() [3/3]

int Act::getLevel ( Process p)

get level for this type

◆ getOptions()

static int Act::getOptions ( int *  argc,
char ***  argv 
)
static

When the ACT library is used as part of a scripting language, it is sometimes useful for the script to initiate argument processing. This function is used to process command-line arguments, and create auxillary data structures to record the options specified by the user. The option string (ala getopt()) is set by the setOptionString() method.

Parameters
argcis a pointer to argc (command-line processing)
argvis a pointer to argv (command-line processing)
Returns
1 if this succeeded, 0 if there was an error during command-line argument processing.

◆ getRefSteps()

int Act::getRefSteps ( )
inline

return the remaining refinement steps

◆ getTypeFactory()

TypeFactory * Act::getTypeFactory ( )
inline

Returns the type factory used to manipulate/create types.

Returns
the TypeFactory used by the ACT library.

◆ Global()

ActNamespace * Act::Global ( )
inline
Returns
the ActNamespace pointer for the global namespace

◆ incRefSteps()

void Act::incRefSteps ( )
inline

increment the number of remaining refinement steps

◆ Init() [1/2]

static void Act::Init ( int *  argc,
char ***  argv,
const char *  optional_conf 
)
static

Initialize the ACT library. *argc and *argv are modified to reflect the command-line options left after ACT has extracted the ones it understands

Parameters
argcis a pointer to argc (command-line processing)
argvis a pointer to argv (command-line processing)
optional_confis a file name for an optional configuration file that must be loaded as part of the initialization. A configation name can be of the form prefix:file.conf. Here the names in the configuration file are assumed to be enclosed in a begin prefix/end group.

◆ Init() [2/2]

static void Act::Init ( int *  argc,
char ***  argv,
list_t *  multi_conf = NULL 
)
static

Another initialization method, supporting multiple configuration files. *argc and *argv are modified to reflect the command-line options left after ACT has extracted the ones it understands

Parameters
argcis a pointer to argc (command-line processing)
argvis a pointer to argv (command-line processing)
multi_confis a list of strings, each corresponding to a configuration file name (same as the simple Init method). All the configuration files are loaded as part of the initialization.

◆ LocalizeGlobal()

bool Act::LocalizeGlobal ( const char *  s)

Change global signal to use the port list throughout the design.

Parameters
sis the name of the global signal
Returns
true on success, false on error

◆ mangle()

void Act::mangle ( char *  s)

Install string mangling functionality

Parameters
sis a string corresponding to the list of characters to be mangled.

◆ mangle_active()

int Act::mangle_active ( )
inline
Returns
1 if mangling is active, 0 otherwise

◆ mangle_set_char()

int Act::mangle_set_char ( unsigned char  c)

Specify the character used as the prefix for the name mangling procedure.

Parameters
cis the character used as the name mangling character.

◆ mangle_string()

int Act::mangle_string ( const char *  src,
char *  dst,
int  sz 
)

mangle string from src to dst.

Parameters
srcis the source string
dstis the destination string
szis the space available in the destination string
Returns
0 on success, -1 on error

◆ Merge()

void Act::Merge ( const char *  s)

Merge in ACT file "s" into current ACT database

Parameters
sis the name of an ACT file

◆ mfprintf()

void Act::mfprintf ( FILE *  fp,
const char *  s,
  ... 
)

Mangle fprintf functionality. This provides an fprintf() API, except the output is mangled.

Parameters
fpoutput file pointer
sformat string

◆ mfprintfproc()

void Act::mfprintfproc ( FILE *  fp,
UserDef u,
int  omit_ns = 0 
)

Non-standard mangling for user-defined types

Parameters
fpis the output file
uis the user-defined type
omit_nsis 1 if you don't want to include the namespace in the string

◆ msnprintf()

int Act::msnprintf ( char *  fp,
int  sz,
const char *  s,
  ... 
)

Mangle snprintf functionality. This provides an snprintf() API, except the output is mangled.

Parameters
fpoutput string buffer
szsize of the output buffer
sformat string
Returns
snprintf() result

◆ msnprintfproc()

void Act::msnprintfproc ( char *  fp,
int  sz,
UserDef u,
int  omit_ns = 0 
)

Non-standard mangling for user-defined types.

Parameters
fpis the output buffer
szis the size of the output buffer
uis the user-defined type
omit_nsis 1 if you don't want to include the namespace in the string

◆ pass_find()

ActPass * Act::pass_find ( const char *  name)

Search for a pass by its registered name.

Parameters
nameis the name of the pass
Returns
the ActPass that is registered by the specified name, NULL if the pass does not exist.

◆ pass_name()

const char * Act::pass_name ( const char *  name)
Returns
an immutable string that corresponds to the pass name, NULL if the pass does not exist
Parameters
nameis the name of the pass of interest

◆ pass_register()

void Act::pass_register ( const char *  name,
ActPass p 
)

Register an ActPass with the ACT library

Parameters
nameis the name of the pass
pis the ActPass to be registered

◆ pass_unregister()

void Act::pass_unregister ( const char *  name)

Remove a previosly registered ActPass from the ACT library

Parameters
nameis the name of the pass

◆ Print()

void Act::Print ( FILE *  fp)

Prints the entire ACT data structure to a file.

Parameters
fpis the file pointer to which the output is written.

◆ setOptionString()

static void Act::setOptionString ( char *  str)
static

This function works together with getOptions() and is used to specify the option string for command-line argument processing.

Parameters
stris the getopt string for arguments

◆ ufprintf()

void Act::ufprintf ( FILE *  fp,
const char *  s,
  ... 
)

Unmangle fprintf functionality. This provides an fprintf() API, except the output is unmangled.

Parameters
fpoutput file pointer
sformat string

◆ unmangle_string()

int Act::unmangle_string ( const char *  src,
char *  dst,
int  sz 
)

unmangle string from src to dst.

Parameters
srcis the source string
dstis the destination string
szis the space available in the destination string
Returns
0 on success, -1 on error

◆ unmangle_stringproc()

int Act::unmangle_stringproc ( const char *  src,
char *  dst,
int  sz 
)

Unmangle string, assuming this is a process name and was mangled with process mangling. Same arguments and return value as unmangle_string().

◆ usnprintf()

int Act::usnprintf ( char *  fp,
int  sz,
const char *  s,
  ... 
)

Unmangle snprintf functionality. This provides an snprintf() API, except the output is mangled.

Parameters
fpoutput string buffer
szsize of the output buffer
sformat string
Returns
snprintf() result

Member Data Documentation

◆ _getopt_string

char* Act::_getopt_string
staticprivate

the string used for getopt

◆ any_mangling

int Act::any_mangling
private

1 if there is any name mangling, 0 otherwise

◆ cmdline_args

list_t* Act::cmdline_args
static

Command-line arguments if -opt= is used. Used to record the options from setOptionString().

◆ default_level

int Act::default_level
private

the default modeling level

file, corresponds to the instance string table for each modeling level

◆ emit_depend

int Act::emit_depend
static

Parser flags. If this is set, then the names of .act files read in during parsing are printed out. This is used by the adepend tool, which can be useful when writing Makefiles.

◆ gns

ActNamespace* Act::gns
private

the global namespace pointer

◆ inst_levels

char** Act::inst_levels[ACT_MODEL_TOTAL]
private

read from configuration

◆ inv_map

int Act::inv_map[256]
private

map used for inverse lookup

◆ L

Log* Act::L
staticprivate

Used for log messages.

◆ mangle_characters

int Act::mangle_characters[256]
private

which characters do we mangle?

◆ max_loop_iterations

int Act::max_loop_iterations
static

Maximum number of iterations for general loops

◆ max_recurse_depth

int Act::max_recurse_depth
static

Maximum depth of recursion for expanding types

◆ num_inst_levels

int Act::num_inst_levels[ACT_MODEL_TOTAL]
private

read from configuration file, corresponds to the size of the instance table for each modeling level

◆ num_type_levels

int Act::num_type_levels[ACT_MODEL_TOTAL]
private

read from configuration file, corresponds to the size of the type table for each modeling level

◆ passes

struct Hashtable* Act::passes
private

Table of any ActPass-es.

◆ refine_steps

int Act::refine_steps
private

number of refinement steps to process

◆ tf

TypeFactory* Act::tf
private

type factory for the Act instance

◆ type_levels

char** Act::type_levels[ACT_MODEL_TOTAL]
private

read from configuration file, the type string table for each modeling level


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