[FIRRTL] Add configuration file support for FIRRTL instance choices#9870
Open
[FIRRTL] Add configuration file support for FIRRTL instance choices#9870
Conversation
This commit proposes a mechanism to configure options based on a single header file instead of tool arguments. Previously, FIRRTL instance choices required configuration through command-line arguments. This change introduces support for a FIRRTL_CONFIGURATION_FILE macro that allows users to specify all configuration options in a single SystemVerilog header file. For exmaple an user can create a `user-config.svh` that contains include statements of option header files and compile it with ``` -DFIRRTL_CONFIGURATION_FILE=user-config.svh -I<user-config.svh's parent> ``` This approach centralizes configuration management and simplifies the build process by replacing multiple command-line arguments with a single include file.
uenoku
commented
Mar 7, 2026
| [&]() { | ||
| StringRef body = R"(`define FIRRTL_CONFIGURATION_INCLUDED | ||
| `define _STRINGIFY(x) `"x`" | ||
| `include `_STRINGIFY(`FIRRTL_CONFIGURATION_FILE) |
Member
Author
There was a problem hiding this comment.
This was added to allow -DFIRRTL_CONFIGURATION_FILE=configuration.svh (otherwise need escape-DFIRRTL_CONFIGURATION_FILE=\"configuration.svh\").
uenoku
commented
Mar 7, 2026
| sv::IfDefOp::create( | ||
| b, "FIRRTL_CONFIGURATION_FILE_", [] {}, | ||
| [&]() { | ||
| StringRef body = R"(`define FIRRTL_CONFIGURATION_INCLUDED |
Member
Author
There was a problem hiding this comment.
Suggested change
| StringRef body = R"(`define FIRRTL_CONFIGURATION_INCLUDED | |
| StringRef body = R"( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes a mechanism to configure options based on a single header file instead of tool arguments.
Previously, FIRRTL instance choices required configuration through command-line arguments. This change introduces support for a FIRRTL_CONFIGURATION_FILE macro that allows users to specify all configuration options in a single SystemVerilog header file.
For exmaple an user can create a
user-config.svhthat contains include statements of option header files and compile it withThis approach centralizes configuration management and simplifies the build process by replacing multiple command-line arguments with a single include file.
AI-assisted-by: Sonnet 4.5