14 #ifndef VERILOG_PREPROCESSOR_H 15 #define VERILOG_PREPROCESSOR_H 37 typedef struct verilog_default_net_type_t{
45 unsigned int token_number,
46 unsigned int line_number,
53 typedef struct verilog_line_directive_t{
62 typedef struct verilog_timescale_directive_t{
88 typedef struct verilog_include_directive_t{
100 unsigned int lineNumber
108 typedef struct verilog_macro_directive_t{
139 typedef struct verilog_preprocessor_conditional_context_t{
198 typedef struct verilog_preprocessor_context_t{
278 unsigned int token_number,
279 unsigned int line_number,
void verilog_preprocessor_else(unsigned int lineno)
Handles an else statement being encountered.
Definition: verilog_preprocessor.c:362
verilog_preprocessor_conditional_context * verilog_preprocessor_new_conditional_context(char *condition, int line_number)
Creates and returns a new conditional context.
Definition: verilog_preprocessor.c:256
void verilog_preprocessor_macro_define(unsigned int line, char *macro_name, char *macro_text, size_t text_len)
Instructs the preprocessor to register a new macro definition.
Definition: verilog_preprocessor.c:192
verilog_timescale_directive timescale
Timescale information.
Definition: verilog_preprocessor.h:209
void verilog_preproc_exit_cell_define()
Tells the preprocessor we are no longer defining PLI modules.
Definition: verilog_preprocessor.c:70
Contains Declarations of datastructures and functions which represent and operate on the Verilog Abst...
ast_list * search_dirs
Where to look for include files.
Definition: verilog_preprocessor.h:212
char * macro_value
The value it expands to.
Definition: verilog_preprocessor.h:111
ast_list * includes
Include directives.
Definition: verilog_preprocessor.h:207
int line_number
Where the `ifdef came from.
Definition: verilog_preprocessor.h:141
char * macro_id
The name of the macro.
Definition: verilog_preprocessor.h:110
verilog_preprocessor_context * verilog_new_preprocessor_context()
Creates a new pre-processor context.
Definition: verilog_preprocessor.c:8
A hash table object.
Definition: verilog_ast_common.h:209
ast_stack * current_file
Stack of files currently being parsed.
Definition: verilog_preprocessor.h:205
void verilog_preprocessor_nounconnected_drive(ast_primitive_strength direction;)
Handles the entering of a no-unconnected drive directive.
ast_net_type
Describes the type of a net in Verilog.
Definition: verilog_ast.h:2372
unsigned int line
The line to set the current counter to.
Definition: verilog_preprocessor.h:54
ast_boolean emit
Only emit tokens iff true.
Definition: verilog_preprocessor.h:199
char * verilog_preprocessor_current_file(verilog_preprocessor_context *preproc)
Returns the file currently being parsed by the context, or NULL.
Definition: verilog_preprocessor.c:53
char * condition
The definition to check for.
Definition: verilog_preprocessor.h:140
void verilog_preprocessor_resetall()
Handles the encounter of a `resetall directive as described in annex 19.6 of the spec.
Definition: verilog_preprocessor.c:115
char * precision
Precision of each timestep.
Definition: verilog_preprocessor.h:64
char * scale
The timescale to simulate on.
Definition: verilog_preprocessor.h:63
unsigned int token_number
Token number of the directive.
Definition: verilog_preprocessor.h:38
verilog_include_directive * verilog_preprocessor_include(char *filename, unsigned int lineNumber)
Handles the encounter of an include directive.
Definition: verilog_preprocessor.c:139
ast_stack * ifdefs
Storage for conditional compile stack.
Definition: verilog_preprocessor.h:211
void verilog_preproc_default_net(unsigned int token_number, unsigned int line_number, ast_net_type type)
Registers a new default net type directive.
Definition: verilog_preprocessor.c:96
verilog_default_net_type * verilog_new_default_net_type(unsigned int token_number, unsigned int line_number, ast_net_type type)
Creates and returns a new default net type directive.
Definition: verilog_preprocessor.c:76
ast_primitive_strength unconnected_drive_pull
nounconnectedrive
Definition: verilog_preprocessor.h:210
ast_list * net_types
Storage for default nettype directives.
Definition: verilog_preprocessor.h:208
ast_hashtable * macrodefines
`define kvp matching.
Definition: verilog_preprocessor.h:206
Keeps track of the points at which default net type directives are encountered.
Definition: verilog_preprocessor.h:37
void verilog_preprocessor_macro_undefine(char *macro_name)
Removes a macro definition from the preprocessors lookup table.
Definition: verilog_preprocessor.c:243
void verilog_preprocessor_elseif(char *macro_name, unsigned int lineno)
Handles an elseif statement being encountered.
Definition: verilog_preprocessor.c:320
ast_boolean in_cell_define
TRUE iff we are in a cell define.
Definition: verilog_preprocessor.h:201
char * file
The file we should pretend stuff comes from.
Definition: verilog_preprocessor.h:55
ast_boolean file_found
Can we find the file?
Definition: verilog_preprocessor.h:91
ast_boolean wait_for_endif
Emit nothing more until `endif.
Definition: verilog_preprocessor.h:144
unsigned int line
Line number of the directive.
Definition: verilog_preprocessor.h:109
void verilog_free_preprocessor_context(verilog_preprocessor_context *tofree)
Frees a preprocessor context and all child constructs.
Definition: verilog_preprocessor.c:60
void verilog_preprocessor_set_file(verilog_preprocessor_context *preproc, char *file)
Clears the stack of files being parsed, and sets the current file to the supplied string...
Definition: verilog_preprocessor.c:38
ast_boolean condition_passed
Did the condition pass?
Definition: verilog_preprocessor.h:142
char * scratch
A scratch variable. DO NOT USE.
Definition: verilog_preprocessor.h:203
Container struct for the linked list data structure.
Definition: verilog_ast_common.h:41
A very simple stack.
Definition: verilog_ast_common.h:131
ast_boolean is_ndef
True if directive was `ifndef.
Definition: verilog_preprocessor.h:143
Contains Declarations of value-independent data structures like linked lists which are used in the as...
ast_boolean
Stores the values of booleans.
Definition: verilog_ast.h:94
void verilog_preprocessor_endif(unsigned int lineno)
Handles an else statement being encountered.
Definition: verilog_preprocessor.c:411
Stores information on an include directive.
Definition: verilog_preprocessor.h:88
verilog_preprocessor_context * yy_preproc
Stores all information needed for the preprocessor.
Definition: verilog_preprocessor.h:198
unsigned int line_number
Line number of the directive.
Definition: verilog_preprocessor.h:39
ast_net_type type
The net type.
Definition: verilog_preprocessor.h:40
unsigned int lineNumber
The line number of the directive.
Definition: verilog_preprocessor.h:90
unsigned int token_count
Keeps count of tokens processed.
Definition: verilog_preprocessor.h:200
A simple container for macro directives.
Definition: verilog_preprocessor.h:108
Describes a line directive.
Definition: verilog_preprocessor.h:53
char * filename
The file to include.
Definition: verilog_preprocessor.h:89
void verilog_preproc_enter_cell_define()
Tells the preprocessor we are now defining PLI modules and to tag them as such.
Definition: verilog_preprocessor.c:65
void verilog_preprocessor_ifdef(char *macro_name, unsigned int lineno, ast_boolean is_ndef)
Handles an ifdef statement being encountered.
Definition: verilog_preprocessor.c:274
unsigned char level
Level of include depth.
Definition: verilog_preprocessor.h:56
Describes a simulation timescale directive.
Definition: verilog_preprocessor.h:62
Stores information regarding a particular level of conditional compilation.
Definition: verilog_preprocessor.h:139
ast_primitive_strength
Describes the drive strength of a single primitive.
Definition: verilog_ast.h:1912