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

cxxrtl: Use the base name of the interface file for the include directive #4063

Merged
merged 3 commits into from
Dec 13, 2023

Conversation

Henkru
Copy link
Contributor

@Henkru Henkru commented Dec 10, 2023

This pull request addresses an issue where an incorrect include file name is generated for the .cc file when using the -header flag and the filename includes folders.

For example:

// top.v
module top ();
endmodule
$ mkdir -p build && yosys -p "read_verilog top.v; write_cxxrtl -header build/top.cc"

The following files are created: build/top.h and build/top.cc. The top.cc has the following include directive to include the top.h:

#include "build/top.h"

It should instead be:

#include "top.h"

…tive

Prior to this fix, the `CxxrtlBackend` used the entire path for the include
directive when a separated interface file is generated (via the `-header`
option). This commit updates the code to use the base name of the interface
file.

Since the C++11 standard is used by default, we cannot take advantage of
the `std::filesystem` to get the basename.
@Henkru Henkru requested a review from whitequark as a code owner December 10, 2023 23:24
@Henkru Henkru force-pushed the fix/cxxrtl-header-basename branch from 8245f40 to ceed04b Compare December 11, 2023 10:28
backends/cxxrtl/cxxrtl_backend.cc Outdated Show resolved Hide resolved
backends/cxxrtl/cxxrtl_backend.cc Outdated Show resolved Hide resolved
@whitequark whitequark merged commit 1c8e58a into YosysHQ:master Dec 13, 2023
14 of 16 checks passed
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.

3 participants