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

make --define work also for verilog preprocessor macros. #1110

Closed

Conversation

Blebowski
Copy link
Contributor

Insert macros from --define option also to Verilog processor.

Do not de-initialize the macro table after single Verilog file is pre-processed.
This matches Verilog style behavior where all files compiled via single invocation
of tool are considered as single compilation unit.

@Blebowski Blebowski force-pushed the define-vlog-macro-from-command-line branch from 7ee0289 to a52f498 Compare December 21, 2024 21:16
@Blebowski Blebowski force-pushed the define-vlog-macro-from-command-line branch from a52f498 to 29e1380 Compare December 21, 2024 21:19
nickg added a commit that referenced this pull request Dec 31, 2024
@nickg
Copy link
Owner

nickg commented Dec 31, 2024

I did this slightly differently in 2ce462d.

This matches Verilog style behavior where all files compiled via single invocation of tool are considered as single compilation unit.

The System Verilog LRM actually allows either behaviour, see 3.12.1:

The exact mechanism for defining which files constitute a compilation unit is tool-specific. However, compliant tools shall provide use models that allow both of the following cases:
a) All files on a given compilation command line make a single compilation unit (in which case the declarations within those files are accessible following normal visibility rules throughout the entire set of files).
b) Each file is a separate compilation unit (in which case the declarations in each compilation-unit scope are accessible only within its corresponding file).

I don't particularly like the the mode where all files are a single compilation unit and I'd rather not have it by default, but I added a --single-unit option to enable this.

@nickg nickg closed this Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants