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
Include directory structure proposal. #1674
Conversation
Ok, but do you have the corresponding change for the yosys plugin ?
|
@tgingold no I don't. Should it be applied only here https://github.com/ghdl/ghdl-yosys-plugin? |
Yes.
|
Ok, I think it would also make sense to do the same for |
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.
IMHO the synth
subdir adds unnecessary complexity. There are two header files and four total. Even if we add a couple more, having additional subdirs is overkill. Instead, I would merge synth.h
and gates.h
in a single file.
I think that renaming ghdlsynth to synth and ghdlsynth_gates to gates is sensible.
@umarcor
I guess they are separate because one is auto generated. |
I was thinking about con |
1d6c0a2
to
40c4f3f
Compare
How are the tests for vpi organized? If I replace |
It must be `#include <vpi_user.h>`. But the path returned by `--vpi-include` should append the `ghdl/` part.
|
3755160
to
dad9b29
Compare
If I understand correctly, another way is to add install.vpi.local: all.vpi
$(MKDIR) -p include lib
$(INSTALL_DATA) -p $(GRTSRCDIR)/vpi_user.h include/
$(INSTALL_DATA) -p $(GRTSRCDIR)/vhpi_user.h include/ and then use |
But wait ..., if I was correct then the tests should pass right now. |
I think it is important to keep `#include <vpi_user.h>` so that the code is portable among simulators.
|
Ok, it is all getting a little bit fuzzy, so lets clear it.
Isn't it related with what people have in |
`install.vpi` is used during `make install`. `install.vpi.local` is used to locally copy the vpi include files in the object directory so that it is possible run the testsuite without installing.
The option `--vpi-include-dir` (sorry I forget the `-dir`) is used while compiling vpi plugin to get the include path.
If it contains the `/ghdl` subdir at the end, users will be able to use `#include <vpi_user.h>` while the `vpi_user.h` file be in a `/ghdl` subdir (like `/usr/local/include/ghdl`).
|
Ok, I I understand what you have written, but I do not understand why is this complexity with In
If user wants some custom installation path then it is specified in the Makefile with variable or during configure step. |
You can consider it is useful at least for the testsuite. The vpi tests need to have `vpi_user.h` in the include path and the corresponding library. Instead of configuring the testsuite, a test can invoke ghdl to get the paths and the libraries.
|
Ok, the tests pass. The only change that would need to be applied to the ghdl-yosys-plugin is probably: diff --git a/src/ghdl.cc b/src/ghdl.cc
index 413d371..de06f1f 100644
--- a/src/ghdl.cc
+++ b/src/ghdl.cc
@@ -27,7 +27,7 @@ USING_YOSYS_NAMESPACE
#ifdef YOSYS_ENABLE_GHDL
-#include "ghdlsynth.h"
+#include "ghdl/synth.h"
using namespace GhdlSynth; @tgingold you can check and merge if you like, or give feedback what you do not like. |
I think |
@Xiretza which tests? |
|
@Xiretza where are these tests? Why are they not catched by the CI? |
This specific one is in |
Ok this is all getting messy. I would opt for one uniform way. Locally or globally headers are always placed in |
I think |
Why If it is supposed that user will always compile vpi via find . -name *.c -exec sed -i 's/#include <vpi_user.h>/#include <ghdl\/vpi_user.h>/' {} \; . |
|
Thanks. I will fix the fallouts. |
vpi_user.h is almost standard, but it may differ from simulator to simulator, and every simulator provides its version.
So I think it makes sense to install it in a ghdl specific subdirectory. Just to avoid a clash.
|
Why ghdl --vpi-compile serves as an wrapper for vpi compilation at all?
At least for the testsuite.
By the way, project of any size can be easily adjusted to this change within few seconds:
find . -name *.c -exec sed -i 's/#include <vpi_user.h>/#include <ghdl\/vpi_user.h>/' {} \;
It's indeed not difficult, but better to avoid it!
|
GHDL's testsuite was initially designed for being executed after Later, some features were added to the makefiles because some packagers wanted to run the testsuite in-place and before |
I would propose following policy for storing and installing include header files.
include
directory, for example insrc/synth/include
.ghdl/
. For exampple,The include would be
#include "ghdl/synth/synth.h"
.The Makefile probably can be improved, but this is just proposal.