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

Generate VPI files in the same dir with Verilog #576

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

quark17
Copy link
Collaborator

@quark17 quark17 commented Jul 15, 2023

This addresses an issue reported in Discussion #575.

Generated Verilog files are placed in the -vdir directory or, if no -vdir is specified, in the same directory as the source file being compiles. VPI wrapper files are also placed in the -vdir, but if no -vdir is specified, they were being placed in the current directory (where BSC is invoked). These should be consistent, so the location for VPI wrappers is fixed to match the generated Verilog.

Simple testing is added to bsc.options.

Generated Verilog files are placed in the -vdir directory or, if
no -vdir is specified, in the same directory as the source file being
compiles.  VPI wrapper files are also placed in the -vdir, but if
no -vdir is specified, they were being placed in the current directory
(where BSC is invoked).  These should be consistent, so the location
for VPI wrappers is fixed to match the generated Verilog.
Previously, the linking stage assumed that VPI wrapper files were in
the vdir or (if no vdir) the current directory (where BSC is invoked).
This probably explains why the compile stage had been changed to put
the VPI wrappers in the current directory (see previous commit, which
reverts that change).  BSC needs to support linking where VPI wrappers
are found in various directories -- both because of the change to the
compile stage (to put the VPI wrappers in the various source directories)
but also because the files may not have been compiled with the same
vdir.  Specificaly, users will want to compile files into a library,
that can be used with multiple designs; those files should be able to
sit in their own directory tree.  If the library contains imported C
functions, then VPI wrapper files will be in the directory tree, and
the BSC link stage will need to be able to find them.  Now that the
compile stage is putting VPI wrapper files in the same location with
Verilog files, the linking stage can use the Verilog search path to
find them.  This makes that change and adds tests.
@quark17
Copy link
Collaborator Author

quark17 commented Jul 17, 2023

I have pushed a commit which also changes the BSC link step, to search for VPI wrapper files in the Verilog search path. This allows BSC to link designs that pull in previously-compiled code from various places, which might each have their own VPI wrappers -- where previously BSC expected the wrappers to be in one directory (either the link step's vdir or the current directory where the link step is invoked).

@quark17 quark17 merged commit fdf107c into B-Lang-org:main Aug 2, 2023
28 checks passed
@quark17 quark17 deleted the vpi_wrappers_to_srcdir branch August 2, 2023 11:14
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.

1 participant