Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVerilog Preprocessor #183

Open
fangism opened this issue Feb 5, 2020 · 0 comments
Open

SystemVerilog Preprocessor #183

fangism opened this issue Feb 5, 2020 · 0 comments
Labels
help wanted Extra attention is needed preprocessor anything related to preprocessing (conditionals, macros, etc.)

Comments

@fangism
Copy link
Collaborator

fangism commented Feb 5, 2020

Today, Verible's parser reads unpreprocessed source files because it was originally designed for single-file operations. The limitations of this approach are understood and accepted.
If there is interest in working toward a proper compiler toolchain, the very first thing we'd need is a preprocessor, to handle `includes and expand `defined macros, etc.

It is known that Verilog preprocessing is sophisticated: macro definitions may contain preprocessing directives that should be interpreted as they are evaluated and expanded. A classic paper on this subject can be found here: https://www.veripool.org/papers/Preproc_Good_Evil_SNUGBos10_paper.pdf

Test suite:
The most important first step is amassing a test suite solely around preprocessing correctness. A comprehensive, implementation-independent, (and open-source) test suite would set the goal post (for all projects). For example, a SystemVerilog parsing test suite is being collected here
https://github.com/SymbiFlow/sv-tests .

Design considerations:
Can start with a standalone tool, but would really like something that can be integrated, for performance benefits and serializability.

Pseudo-preprocessing, or limited preprocessing with partial information.
This would help with single-source file operations, for example by evaluating locally defined macros, and helping the parser see inside macros where possible.

Ping this issue if you are interested in discussing or helping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed preprocessor anything related to preprocessing (conditionals, macros, etc.)
Projects
None yet
Development

No branches or pull requests

1 participant