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

Specifying exact header files instead of include directories #184

Closed
colluca opened this issue Sep 26, 2024 · 1 comment
Closed

Specifying exact header files instead of include directories #184

colluca opened this issue Sep 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@colluca
Copy link
Contributor

colluca commented Sep 26, 2024

This is a proposal to extend, or change, the current way header files are "tracked" by Bender.

Current implementation

Currently, header files are not tracked at all, i.e. Bender has no knowledge about the header files a design depends on. Instead, only the directories containing these files are tracked, as needed to update the search path for invoked tools, e.g. through incdir directives.

The include directories are manually tracked through the export_include_dirs entry in the package manifest.

Limitation

Through the flist command, Bender can be successfully used to generate dependency lists for use in Makefiles, at least including all source files a target depends on.

To properly encode all dependencies, header files would also have to be included in this list.

A first attempt to achieve this would be to recursively list all files under the include directories tracked by Bender. While this might obviously provide a gross approximation, the information might not even be complete, e.g. if a source file uses the following include directive ``include "../some_file.sv"`.

Proposal

To solve this, we could explicitly track header files in the manifest file. Include directories could then be specified manually using export_include_dirs, or derived from the header files themselves, e.g. as the parent directories of the specified header files.

I believe explicitly tracking the header files provided within a package would also be a good self-documenting practice.

@colluca
Copy link
Contributor Author

colluca commented Oct 3, 2024

After some more experimentation, I was able to generate a dependency list using Verilator and sed.

This is a better approach, as the header prerequisites can be fully derived from the source files and include directories, removing the need to explicitly declare what header files are exported by a package, which would be in some sense redundant.

The solution can be found in pulp-platform/snitch_cluster#193.

@colluca colluca closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant