ACT Library
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions
lang.h File Reference

Contains the data structures for each ACT sub-language. More...

#include "expr.h"
#include <common/mstring.h>
#include <common/list.h>
#include <common/array.h>

Go to the source code of this file.

Classes

class  act_attr
 Attribute list associated with an instance. More...
 
class  act_size_spec_t
 Sizing specifier for variables. More...
 
class  act_prs_expr
 A production rule expression, corresponding to the guard for the production rule. More...
 
class  act_prs_lang
 Structure that holds a prs sub-language body. This consists of a linked-list of individual items in the prs body. More...
 
class  act_prs
 Structure that holds all the prs { } blocks in a particular scope. This is a linked-list of blocks, each of which can have their own voltage domain specification. More...
 
class  act_chp_gc
 Data structure for guarded commands. More...
 
class  act_chp_lang
 Data structure for the chp sub-language body. More...
 
class  act_func_arguments
 Used to represent log(...) arguments. Holds either a string or an expression. More...
 
class  act_chp
 Holds a CHP sub-language. More...
 
class  act_spec
 The specification sub-language. More...
 
class  act_refine
 The refinement sub-language just contains an ActBody. More...
 
class  act_sizing_directive
 An individual sizing directive. More...
 
class  act_sizing
 The sizing { ... } body data. More...
 
class  act_initialize
 The Initialize { ... } body. Only used in the global namespace. More...
 
class  act_dataflow_element
 An individual dataflow element. More...
 
class  act_dataflow_order
 An order directive in the dataflow language, used for optimizations in the presence of hierarchy. More...
 
class  act_dataflow
 The dataflow sub-language. More...
 
class  act_languages
 This holds all the sub-langugae bodies in a namespace/user-defined type definition. More...
 

Macros

#define ACT_CHP_STMT_END   17
 
#define ACT_SPEC_ISTIMING(x)   ((x)->type == -1 || (x)->type == -2 || (x)->type == -3 || (x)->type == -4)
 
#define ACT_SPEC_ISTIMINGFORK(x)   ((x)->type == -1 || (x)->type == -2)
 

Typedefs

typedef struct act_attr act_attr_t
 
typedef struct act_prs_expr act_prs_expr_t
 
typedef struct act_prs_lang act_prs_lang_t
 
typedef struct act_chp_gc act_chp_gc_t
 
typedef struct act_chp_lang act_chp_lang_t
 
typedef struct act_func_arguments act_func_arguments_t
 
typedef void *(* ACT_VAR_CONV) (void *, void *)
 

Enumerations

enum  act_prs_expr_type {
  ACT_PRS_EXPR_AND = 0 , ACT_PRS_EXPR_OR = 1 , ACT_PRS_EXPR_VAR = 2 , ACT_PRS_EXPR_NOT = 3 ,
  ACT_PRS_EXPR_LABEL = 4 , ACT_PRS_EXPR_ANDLOOP = 5 , ACT_PRS_EXPR_ORLOOP = 6 , ACT_PRS_EXPR_TRUE = 7 ,
  ACT_PRS_EXPR_FALSE = 8
}
 
enum  act_prs_lang_type {
  ACT_PRS_RULE = 0 , ACT_PRS_GATE = 1 , ACT_PRS_LOOP = 2 , ACT_PRS_TREE = 3 ,
  ACT_PRS_SUBCKT = 4 , ACT_PRS_CAP = 5
}
 
enum  act_chp_lang_type {
  ACT_CHP_COMMA = 0 , ACT_CHP_SEMI = 1 , ACT_CHP_SELECT = 2 , ACT_CHP_SELECT_NONDET = 3 ,
  ACT_CHP_LOOP = 4 , ACT_CHP_DOLOOP = 5 , ACT_CHP_SKIP = 6 , ACT_CHP_ASSIGN = 7 ,
  ACT_CHP_SEND = 8 , ACT_CHP_RECV = 9 , ACT_CHP_FUNC = 10 , ACT_CHP_SEMILOOP = 11 ,
  ACT_CHP_COMMALOOP = 12 , ACT_CHP_HOLE = 13 , ACT_CHP_ASSIGNSELF = 14 , ACT_CHP_MACRO = 15 ,
  ACT_HSE_FRAGMENTS = 16
}
 
enum  act_dataflow_element_types {
  ACT_DFLOW_FUNC = 0 , ACT_DFLOW_SPLIT = 1 , ACT_DFLOW_MERGE = 2 , ACT_DFLOW_MIXER = 3 ,
  ACT_DFLOW_ARBITER = 4 , ACT_DFLOW_CLUSTER = 5 , ACT_DFLOW_SINK = 6
}
 

Functions

void prs_print (FILE *, act_prs *)
 
void chp_print (FILE *, act_chp *)
 
void chp_print (FILE *fp, act_chp_lang_t *c)
 
void hse_print (FILE *, act_chp *)
 
void spec_print (FILE *, act_spec *)
 
void refine_print (FILE *, act_refine *)
 
void sizing_print (FILE *, act_sizing *)
 
void initialize_print (FILE *, act_initialize *)
 
void dflow_print (FILE *, act_dataflow *)
 
void dflow_print (FILE *, act_dataflow_element *)
 
void act_print_size (FILE *fp, act_size_spec_t *sz)
 
act_initializeinitialize_expand (act_initialize *, ActNamespace *, Scope *)
 
act_prsprs_expand (act_prs *, ActNamespace *, Scope *)
 
act_specspec_expand (act_spec *, ActNamespace *, Scope *)
 
void refine_expand (act_refine *, ActNamespace *, Scope *)
 
act_sizingsizing_expand (act_sizing *, ActNamespace *, Scope *)
 
act_dataflowdflow_expand (act_dataflow *, ActNamespace *, Scope *)
 
act_chpchp_expand (act_chp *, ActNamespace *, Scope *)
 
void chp_expand_macromode (int mode)
 
act_chp_lang_tchp_expand (act_chp_lang_t *, ActNamespace *, Scope *)
 
act_attr_tinst_attr_expand (act_attr_t *a, ActNamespace *ns, Scope *s)
 
act_attr_tprs_attr_expand (act_attr_t *a, ActNamespace *ns, Scope *s)
 
act_size_spec_tact_expand_size (act_size_spec_t *sz, ActNamespace *ns, Scope *s)
 
void chp_check_channels (act_chp_lang_t *c, Scope *s)
 
const char * act_spec_string (int type)
 
const char * act_dev_value_to_string (int)
 
int act_dev_string_to_value (const char *s)
 
act_prs_expr_tact_prs_complement_rule (act_prs_expr_t *e)
 
act_prs_expr_tact_prs_celement_rule (act_prs_expr_t *e)
 
void act_print_one_prs (FILE *fp, act_prs_lang_t *p)
 
act_prs_expr_tact_prs_expr_nnf (void *cookie, struct Hashtable *at_hash, act_prs_expr_t *e, ACT_VAR_CONV conv_var)
 
char * act_prs_expr_to_string (list_t *id_list, act_prs_expr_t *e)
 
char * act_expr_to_string (list_t *id_list, Expr *e)
 
void act_expr_collect_ids (list_t *l, Expr *e)
 
void act_prs_expr_free (act_prs_expr_t *e)
 
void act_chp_free (act_chp_lang_t *)
 
void act_chp_macro_check (Scope *s, ActId *id)
 
ActIdexpand_var_write (ActId *id, ActNamespace *ns, Scope *s)
 
int act_hse_direction (act_chp_lang_t *, ActId *)
 
int act_expr_has_neg_probes (Expr *e)
 

Detailed Description

Contains the data structures for each ACT sub-language.

Macro Definition Documentation

◆ ACT_CHP_STMT_END

#define ACT_CHP_STMT_END   17

1 more than the last enumeration of act_chp_lang_type

◆ ACT_SPEC_ISTIMING

#define ACT_SPEC_ISTIMING (   x)    ((x)->type == -1 || (x)->type == -2 || (x)->type == -3 || (x)->type == -4)

◆ ACT_SPEC_ISTIMINGFORK

#define ACT_SPEC_ISTIMINGFORK (   x)    ((x)->type == -1 || (x)->type == -2)

Typedef Documentation

◆ act_attr_t

typedef struct act_attr act_attr_t

◆ act_chp_gc_t

typedef struct act_chp_gc act_chp_gc_t

◆ act_chp_lang_t

typedef struct act_chp_lang act_chp_lang_t

◆ act_func_arguments_t

◆ act_prs_expr_t

typedef struct act_prs_expr act_prs_expr_t

◆ act_prs_lang_t

typedef struct act_prs_lang act_prs_lang_t

◆ ACT_VAR_CONV

typedef void *(* ACT_VAR_CONV) (void *, void *)

Used as a leaf conversion function in act_prs_expr_nnf

Enumeration Type Documentation

◆ act_chp_lang_type

Enumeartion tyoe to capture the elements of a chp sub-language body

Enumerator
ACT_CHP_COMMA 

comma or parallel composition

ACT_CHP_SEMI 

sequential composition

ACT_CHP_SELECT 

selection statement

ACT_CHP_SELECT_NONDET 

non-deterministic selection statement

ACT_CHP_LOOP 

CHP while loop.

ACT_CHP_DOLOOP 

CHP do loop.

ACT_CHP_SKIP 

skip statement

ACT_CHP_ASSIGN 

assignment

ACT_CHP_SEND 

send operation

ACT_CHP_RECV 

receive operation

ACT_CHP_FUNC 

used for log(...) logging statement

ACT_CHP_SEMILOOP 

syntactic replication with semi-colon; removed after expansion

ACT_CHP_COMMALOOP 

syntactic replication with commas; removed after expansion

ACT_CHP_HOLE 

a "hole"—only used by downstream tools

ACT_CHP_ASSIGNSELF 

same as assign, used to indicate self-assignment in some tools

ACT_CHP_MACRO 

a macro call, gets removed when chp_expand() is called

ACT_HSE_FRAGMENTS 

used to support fragmented hse

◆ act_dataflow_element_types

The type field used for dataflow elements

Enumerator
ACT_DFLOW_FUNC 

function dataflow element

ACT_DFLOW_SPLIT 

split dataflow element

ACT_DFLOW_MERGE 

merge dataflow element

ACT_DFLOW_MIXER 

mixer dataflow element

ACT_DFLOW_ARBITER 

arbiter dataflow element

ACT_DFLOW_CLUSTER 

a cluster of dataflow elements

ACT_DFLOW_SINK 

a dataflow sink

◆ act_prs_expr_type

Enumeration type for the prs guards used in the prs sub-language data structure.

Enumerator
ACT_PRS_EXPR_AND 

"&" operator

ACT_PRS_EXPR_OR 

"|" operator

ACT_PRS_EXPR_VAR 

leaf variable

ACT_PRS_EXPR_NOT 

"~" operator

ACT_PRS_EXPR_LABEL 

leaf "@label"

ACT_PRS_EXPR_ANDLOOP 

replicated &-loop

ACT_PRS_EXPR_ORLOOP 

replicated |-loop

ACT_PRS_EXPR_TRUE 

constant "true"

ACT_PRS_EXPR_FALSE 

constant "false"

◆ act_prs_lang_type

Enumeration type for elements of a prs sub-language body

Enumerator
ACT_PRS_RULE 

a production rule

ACT_PRS_GATE 

a transmission gate / pass transistor

ACT_PRS_LOOP 

a loop of production rules

ACT_PRS_TREE 

a tree { ... } block

ACT_PRS_SUBCKT 

a subckt { ... } block

ACT_PRS_CAP 

a capacitor

Function Documentation

◆ act_chp_free()

void act_chp_free ( act_chp_lang_t )

Free a CHP lang body

◆ act_chp_macro_check()

void act_chp_macro_check ( Scope s,
ActId id 
)

This checks to see if the variable is correctly accessible by a macro. This is an internal call, but is also needed by expr_expand(); hence it is exported.

Parameters
sis the scope
idis the identifer to be checked.

◆ act_dev_string_to_value()

int act_dev_string_to_value ( const char *  s)

Convert the device flavor string into an index. The default index is 0, so 0 should always be the default transistor flavor

◆ act_dev_value_to_string()

const char * act_dev_value_to_string ( int  )

Convert a device flavor value to the flavor string name

◆ act_expand_size()

act_size_spec_t * act_expand_size ( act_size_spec_t sz,
ActNamespace ns,
Scope s 
)

Expansion helper for width/length/flavor/folding spec on variables

◆ act_expr_collect_ids()

void act_expr_collect_ids ( list_t *  l,
Expr e 
)

Pass in a non-NULL list of ActId *'s. This function collects any new ids and adds them to the list l. This list is suitable for use in act_expr_to_string and

Parameters
lis the list that is used to collect all the IDs in the expression
eis the Expr pointer

◆ act_expr_has_neg_probes()

int act_expr_has_neg_probes ( Expr e)

Check if an expression has a negated probe. Only use this on a guard expression

◆ act_expr_to_string()

char * act_expr_to_string ( list_t *  id_list,
Expr e 
)

Construct a unique string that summarizes the expression tree for an ACT Expr data structure.

Parameters
id_listis the list of ActId pointers or any other opaque pointer. The string contains position values for leaf variables.
eis the expression
Returns
a string that captures the expression tree

◆ act_hse_direction()

int act_hse_direction ( act_chp_lang_t ,
ActId  
)

Returns 0 if the ID is not found, 1 if it is read, 2 if it is written

◆ act_print_one_prs()

void act_print_one_prs ( FILE *  fp,
act_prs_lang_t p 
)

Print a single production rule

◆ act_print_size()

void act_print_size ( FILE *  fp,
act_size_spec_t sz 
)

◆ act_prs_celement_rule()

act_prs_expr_t * act_prs_celement_rule ( act_prs_expr_t e)

Apply a C-element transformation to the rule. This makes a copy of the expression and inverts each variable in the rule.

◆ act_prs_complement_rule()

act_prs_expr_t * act_prs_complement_rule ( act_prs_expr_t e)

Compute a new prs expression that is the complement of the provided expression. The original rule is copied.

◆ act_prs_expr_free()

void act_prs_expr_free ( act_prs_expr_t e)

Free a prs expression

◆ act_prs_expr_nnf()

act_prs_expr_t * act_prs_expr_nnf ( void *  cookie,
struct Hashtable *  at_hash,
act_prs_expr_t e,
ACT_VAR_CONV  conv_var 
)

Makes a copy of the provided prs expression, and converts it into negation-normal form. Any at-labels are translated into their corresponding expression as well.

All variable pointers at the leaves are converted using the conv_var function that is an argument to this function. The first argument of the function is the cookie, the second is the ID pointer for the expression.

Parameters
at_hashis a hash table from label strings to act_prs_lang_t pointers
eis the prs expression
cookieis used for the conversion function
conv_varis the conversion function used for the leaves of the expression.
Returns
new prs expression in negation-normal form.

◆ act_prs_expr_to_string()

char * act_prs_expr_to_string ( list_t *  id_list,
act_prs_expr_t e 
)

Construct a unique string that summarizes the expression tree for production rule expressions

Parameters
id_listis the list of ActId pointers or any other opaque pointer. The string contains position values for leaf variables.
eis the expression
Returns
a string that captures the expression tree

◆ act_spec_string()

const char * act_spec_string ( int  type)

Given a spec #, returns the string from the spec table corresponding to the spec directive.

◆ chp_check_channels()

void chp_check_channels ( act_chp_lang_t c,
Scope s 
)

Check that the CHP body only accesses unfragmented channels/integers.

◆ chp_expand() [1/2]

act_chp * chp_expand ( act_chp ,
ActNamespace ,
Scope  
)

Expand a chp { ... } block. Also used for hse { ... }

◆ chp_expand() [2/2]

act_chp_lang_t * chp_expand ( act_chp_lang_t ,
ActNamespace ,
Scope  
)

chp_expand helper for the items within the language block

◆ chp_expand_macromode()

void chp_expand_macromode ( int  mode)

Set the CHP expansion mode (1 if in macro, 0 otherwise)

◆ chp_print() [1/2]

void chp_print ( FILE *  ,
act_chp  
)

◆ chp_print() [2/2]

void chp_print ( FILE *  fp,
act_chp_lang_t c 
)

◆ dflow_expand()

act_dataflow * dflow_expand ( act_dataflow ,
ActNamespace ,
Scope  
)

Expand a dataflow { ... } block

◆ dflow_print() [1/2]

void dflow_print ( FILE *  ,
act_dataflow  
)

◆ dflow_print() [2/2]

void dflow_print ( FILE *  ,
act_dataflow_element  
)

◆ expand_var_write()

ActId * expand_var_write ( ActId id,
ActNamespace ns,
Scope s 
)

Expand an ActId corresponding to a chp variable that can be written. This permits arrays to have dynamic de-references.

Parameters
idis the ActId to be expanded
nsis the namespace
sis the scope
Returns
the expanded variable, checking that it is actually something that can be written.

◆ hse_print()

void hse_print ( FILE *  ,
act_chp  
)

◆ initialize_expand()

act_initialize * initialize_expand ( act_initialize ,
ActNamespace ,
Scope  
)

Expand an Initialize { ... } block

◆ initialize_print()

void initialize_print ( FILE *  ,
act_initialize  
)

◆ inst_attr_expand()

act_attr_t * inst_attr_expand ( act_attr_t a,
ActNamespace ns,
Scope s 
)

Expansion helper for instance attributes

◆ prs_attr_expand()

act_attr_t * prs_attr_expand ( act_attr_t a,
ActNamespace ns,
Scope s 
)

Expansion helper for prs attributes

◆ prs_expand()

act_prs * prs_expand ( act_prs ,
ActNamespace ,
Scope  
)

Expand a prs { ... } block

◆ prs_print()

void prs_print ( FILE *  ,
act_prs  
)

◆ refine_expand()

void refine_expand ( act_refine ,
ActNamespace ,
Scope  
)

Expand a refine { .. } block

◆ refine_print()

void refine_print ( FILE *  ,
act_refine  
)

◆ sizing_expand()

act_sizing * sizing_expand ( act_sizing ,
ActNamespace ,
Scope  
)

Expand a sizing { ... } block

◆ sizing_print()

void sizing_print ( FILE *  ,
act_sizing  
)

◆ spec_expand()

act_spec * spec_expand ( act_spec ,
ActNamespace ,
Scope  
)

Expand a spec { ... } block

◆ spec_print()

void spec_print ( FILE *  ,
act_spec  
)