Switches
The parser has a number of switches that control the parsing of files. Below is detail on a subset of the switches. For a complete list see the Man Page .
- -y <directory> This switch may be used to specify a verilog library search path for tools that require modules to be resolved.
- -v <lib_filename> This switch may be used to specify a verilog library file for tools that require modules to be resolved.
- +libext+<extension> This switch may be used to specify the library file suffix (used with the -y switch). Multiple extensions may be specified by appending more extensions: +libext+<ext1>+<ext2>+...
- -infervectors This switch will allow the parser to infer register definitions and vector wire definitions.
- -macrocheck This switch will cause the use of undefined macros to be flagged as errors.
- -keeptickdefines This switch makes a best effort attempt to keep tick defines and `include statements in the code (EXPERIMENTAL). `include statements are keep if the include file is composed solely of pragmas, comments and `define statements. `variables are evaluated if their definition is in the same preprocessor zone as their instantiation. Command line switches are in zone by themselves. Each compilation unit (e.g. verilog inpug file) starts a new zone. Included files are part of the zone of the including file. -passthru regions start a new zone. `ifdef and `ifndef regions start a new zone if they are dependent upon undefined preprocessor variables or are dependent upon preprocessor variable defined in another zone. One of the side effects of enabling this switch is that `define and `include statements can only occur on statement boundries in the source code, otherwise a parsing error will result.
- +incdir+<directory> This switch will cause 'directory' to be searched to resolve `include preprocessor directives. Multiple paths may be specified by either using +incdir+ switches or by specifing multiple i directories: +incdir+<dir1>+<dir2>+....
- -allowmissingincludes This switch will ignore `include preprocessor directives that cannot be resolved.
- +define+<name>=<val> This switch specifies `define variables on the command line.
- +<name>+<val> This switch is used to specify plusargs for tools that use them.
- -pragma <regexp> This switch is used to identify classes of comments as pragmas. Vrq will ensure that pragmas are not move relative to the code they are embedded in. Note a side effect of using pragmas is that vrq only allows pragmas in very specific locations in the code. Vrq uses regcomp to process the match. Please see the 'regcomp' man page for the format of 'regexp'. Multiple -pragma switch may appear on the command line. If no -pragma switch is specified, vrq will make all i // synopsys ..... and comments as pragmas.
- -passthru <name> This switch can be used to create a label to identify regions of the source code that vrq should ignore and pass though verbatim. These regions of code will be treated as comments and `define substitution will be performed. To use the label use `ifdef/`endif and `ifndef/`endif pairs to flags the regions as shown below:
`ifdef label
put code here that you want to pass through
`endif
or
`ifndef
put code here that you want to pass through
`endif
Tool Pipelines
Vrq parses each file creating an Abstract Syntax Tree (AST) for each file. This vector of AST's is passed on through a filter pipeline. Each filter in the pipeline is specified using the -tool <toolname> switch. A filter always takes a vector of AST's as input and optionally outputs a vector of AST's. If a pipeline is specified where the final filter produces AST's, vrq will automatically append the 'dump' tool to the end of the pipeline.
For instance if the following switches are used; -tool filter1 -tool filter2 is specified, vrq will create the following pipeline: Parser -> filter1 -> filter2 -> dump
Some tools are compiled in, others come with the vrq distribution and are compiled as DLLs placed in the plugin dir specified at vrq install time. The search path for plugins may be augmented by using the PLUGIN_DIR environment variable. ie PLUGIN_DIR=path1:path2:path3. Third parties can create their own filters using the vrq API. If these plugins are placed in the plugin search path, vrq will automatically recognize them.
Each AST is tagged by the parser with the input file name it was derived from. Tools may modify these names and trees. Tools may also expand or contract the number of AST in the vector.