Use SigParser with non-preprocessed verilog file
Added by Jeffrey Lin 7 months ago
Hi,
Can I use the SigParser module with a regular verilog file, i.g., a verilog file having `include and macros? Right now, when I try to pass a regular verilog file to the ->parse_file() (instead of ->parse_preproc_file()) subroutine without going through Preproc.pm first, it stops at line 1: Define or directive not defined: `include.
Is there anyway I can get around this problem? I really want to use SigParser.pm instead of Parser.pm for it's ability to recognize module definition and cell instantiation, other than just callback on keyword and symbol in Parser.pm. But I don't want to preprocess the files. I want the `include and macro information.
Thanks, Jeffrey Lin
Replies (2)
RE: Use SigParser with non-preprocessed verilog file - Added by Wilson Snyder 7 months ago
Nope. The preprocessor is what does expansion which is required to properly parse the language with SigParser. I don't believe a general alternative is possible.
However if you restrict the input to a language subset and you don't play too many `define tricks you might be able to pull out specific things of interest and translate them. See how vppreproc does it.
RE: Use SigParser with non-preprocessed verilog file - Added by Jeffrey Lin 7 months ago
Thank you Wilson,
With that possibility gone, I'll just have to parse the preprocessed file and collect information and apply them to the original file again. Luckily Preprocessed file still save the original file's line number.
Thank you very much.
Jeffrey Lin
(1-2/2)
![[logo]](/img/veripool_small.png)