Verilog Parser

Functions and data structures representing identifiers for all Verilog Constructs. More...

Data Structures

struct  ast_identifier
 Structure containing all information on an identifier. More...
 

Enumerations

enum  ast_id_range_or_index { ID_HAS_RANGE, ID_HAS_RANGES, ID_HAS_INDEX, ID_HAS_NONE }
 Used to tell if an identifier has a bit vector or index attatched to it. More...
 
enum  ast_identifier_type {
  ID_ARRAYED, ID_BLOCK, ID_CELL, ID_CONFIG,
  ID_ESCAPED_ARRAYED, ID_ESCAPED_HIERARCHICAL_BRANCH, ID_ESCAPED_HIERARCHICAL, ID_ESCAPED_HIERARCHICALS,
  ID_ESCAPED, ID_EVENT, ID_EVENT_TRIGGER, ID_FUNCTION,
  ID_GATE_INSTANCE, ID_GENERATE_BLOCK, ID_GENVAR, ID_HIERARCHICAL_BLOCK,
  ID_HIERARCHICAL_EVENT, ID_HIERARCHICAL_FUNCTION, ID_HIERARCHICAL, ID_HIERARCHICAL_NET,
  ID_HIERARCHICAL_TASK, ID_HIERARCHICAL_VARIABLE, ID_CSV, ID_INOUT_PORT,
  ID_INPUT, ID_INPUT_PORT, ID_INSTANCE, ID_LIBRARY,
  ID_MODULE, ID_MODULE_INSTANCE, ID_NAME_OF_GATE_INSTANCE, ID_NAME_OF_INSTANCE,
  ID_NET, ID_OUTPUT, ID_OUTPUT_PORT, ID_PARAMETER,
  ID_PORT, ID_REAL, ID_SIMPLE_ARRAYED, ID_SIMPLE_HIERARCHICAL_BRANCH,
  ID_SIMPLE_HIERARCHICAL, ID_SIMPLE, ID_SPECPARAM, ID_SYSTEM_FUNCTION,
  ID_SYSTEM_TASK, ID_TASK, ID_TOPMODULE, ID_UNKNOWN,
  ID_UNEXPANDED_MACRO, ID_UDP, ID_UDP_INSTANCE, ID_VARIABLE
}
 Describes the type of contruct that the identifier corresponds to. More...
 

Functions

ast_identifier ast_append_identifier (ast_identifier parent, ast_identifier child)
 Used to construct linked lists of hierarchical identifiers. More...
 
int ast_identifier_cmp (ast_identifier a, ast_identifier b)
 Acts like strcmp but works on ast identifiers.
 
void ast_identifier_set_index (ast_identifier id, ast_expression *index)
 Used to set the index field of an identifier. More...
 
void ast_identifier_set_range (ast_identifier id, ast_range *range)
 Used to set the range field of an identifier. More...
 
char * ast_identifier_tostring (ast_identifier id)
 Simply returns the fully qualified representation of an identifier as a string. More...
 
ast_identifier ast_new_identifier (char *identifier, unsigned int from_line)
 Creates and returns a new node representing an identifier. More...
 
ast_identifier ast_new_system_identifier (char *identifier, unsigned int from_line)
 Creates and returns a new node representing an identifier. More...
 

Detailed Description

Functions and data structures representing identifiers for all Verilog Constructs.

Enumeration Type Documentation

Used to tell if an identifier has a bit vector or index attatched to it.

Enumerator
ID_HAS_RANGE 

Has a range selector.

ID_HAS_RANGES 

Has >1 range selector.

ID_HAS_INDEX 

Has an index selector.

ID_HAS_NONE 

Has neither a range or index selector.

Describes the type of contruct that the identifier corresponds to.

Enumerator
ID_MODULE 

Declaration.

ID_MODULE_INSTANCE 

Instantiation.

ID_UNKNOWN 

Used when we don't know the type.

ID_UNEXPANDED_MACRO 

For when the pre-processor hasn't run.

ID_UDP 

Declaration.

ID_UDP_INSTANCE 

Instantiation.

Function Documentation

ast_identifier ast_append_identifier ( ast_identifier  parent,
ast_identifier  child 
)

Used to construct linked lists of hierarchical identifiers.

The child node is linked to the next field of the parent, and the parent field returned.

Parameters
[in]child- The child to add to the hierarchy.
[in,out]parent- The parent identifier.
void ast_identifier_set_index ( ast_identifier  id,
ast_expression *  index 
)

Used to set the index field of an identifier.

Parameters
[in,out]id- The identifier to set the index for.
[in]index- The index the identifier refers to.
Postcondition
Also sets the range_or_idx member to ID_HAS_INDEX
void ast_identifier_set_range ( ast_identifier  id,
ast_range *  range 
)

Used to set the range field of an identifier.

Parameters
[in,out]id- The identifier to set the range for.
[in]range- The range the identifier refers to.
Postcondition
Also sets the range_or_idx member to ID_HAS_RANGE
char* ast_identifier_tostring ( ast_identifier  id)

Simply returns the fully qualified representation of an identifier as a string.

Where the identifier is "simple" or a system id, then the identifier will just be returned as a character array. Where it is a hierarchical idenifier, then a dot separated string of all identifiers in the hierarchy will be returned.

Parameters
[in]id- The identifier object to return a string representation of.
Returns
A copy of the identifiers full name, as a null terminated character array.
ast_identifier ast_new_identifier ( char *  identifier,
unsigned int  from_line 
)

Creates and returns a new node representing an identifier.

By default, the returned identifier has the ID_UNKNOWN type, and this is set later when the parser winds back up and knows which rules to follow. Also, the is_system member is set to false. If you want a new system idenifier instance, use the ast_new_system_identifier function.

Parameters
identifierString text of the identifier.
from_lineTHe line the idenifier came from.
ast_identifier ast_new_system_identifier ( char *  identifier,
unsigned int  from_line 
)

Creates and returns a new node representing an identifier.

By default, the returned identifier has the ID_SYSTEM_* type,

Parameters
identifierString text of the identifier.
from_lineTHe line the idenifier came from.