-
Notifications
You must be signed in to change notification settings - Fork 217
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
[VeriblePreProcessor][4]: Handling file inclusion in "VerilogPreprocess" class. #1375
[VeriblePreProcessor][4]: Handling file inclusion in "VerilogPreprocess" class. #1375
Conversation
…o generate all variants with the new mode generate-variants
…ass for the moment.
"verible::CmdPositionalArguments" class only supports these types so far: SV files, +define+<name>[=<value>], and +incdir+<dir>.
- Added a feature to VerilogPreprocess which allows to store paths, That can be used later to find the SV file to include. - The preprocessor tool takes these paths from the user, as a +incdir+<path>[+<another_path>] and set then in VerilogPreprocess. - The included files macros and conditionals can be expanded and evaluated. - Some limitations exists and were written as TODOs in place, need to open issues for these.
Let's await until we're done with the other PRs, to not have too many review comments going on in parallel that might be harder to merge later. Not everything might apply, but it is good to have a look to have an informed choice knowing what already exists and could be re-used. |
absl::Status AddDefineFromCmdLine( | ||
std::pair<absl::string_view, absl::string_view> define); | ||
|
||
// Add search directory paths passed to the tool with +incdir+<path>. | ||
absl::Status AddIncludeDirFromCmdLine(absl::string_view include_dir_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will start by replacing both of these functions with SetFileList()
.
@@ -219,6 +235,9 @@ class VerilogPreprocess { | |||
bool current_branch_condition_met_; | |||
}; | |||
|
|||
// Paths to search into during handling `include | |||
std::vector<std::string> search_paths_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be the FileList
containing defines, incdirs and SystemVerilog files.
A question: The SystemVerilog files will not be needed here, is there a way to make use of it? or remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change everything as needed.
Maybe we have a sub-type in FileList
that contain preprocessing information.
struct FileList {
struct PreprocessingInfo {
std::vector<std::string> include_dirs;
// ... macro defintions
};
std::vector<std::string> file_paths;
PreprocessingInfo preprocessing;
};
Then use that type with only the relevant parts:
FileList::PreprocessingInfo
Might need to change all the places the current FileList
is used, but it is worthwhile to improve clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a cycle in dependency problem whenever I try to include verilog_project.h
in verilog_preprocess.h
, because the former includes verilog_analyzer.h
, which also includes verilog_preprocess.h
.
Would it be a good idea if I isolate the definition of the FileList
in a separte file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Put FileList
in a separate file.
Do you want to rebase this one or create a fresh new one as it might be easier ? |
I will create a fresh branch for this. |
Closed by #1482 |
NOTE: This is a part of the sequentially splitted PRs from PR #1360.
Description:
VerilogPreprocess
which allows to store paths,That can be used later to find the SV file to include.
as a
+incdir+<path>[+<another_path>]
and set them inVerilogPreprocess
.need to open issues for these.