-
Notifications
You must be signed in to change notification settings - Fork 250
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
source file ordering issues with python2.7 (VUnit is not properly finding compile order) #556
Comments
I will have a look on this problem this evening. In the meantime would it be possible for you to create a minimal verifiable example (https://stackoverflow.com/help/minimal-reproducible-example)? Just take one small part of your code and try to reproduce it, maybe by focusing on just one test bench. When you can reproduce you can copy the code and strip everything except the shell of the entities/architectures/packages since it is not relevant for dependency scanning. |
Yeah, I will work on that. I'll have to go through a few people so this is probably not something I can share publically. Once I get the code stripped down, I will let you know, but it might be a few days. From a use standpoint, is there a way to force VUnit to accept all incoming files as if they're in the correct compile order and just tell it which file the testbench is in, or only allow it to scan for testbenches? |
First of all There is no way currently to disable parsing but enable test case scanning since test case scanning uses the parse results. Test case files should not be encrypted so this should not be a problem. The order in Regarding permission to release your code as a minimal verifiable example. You can remove everything in the code except the shell which removes. That is all processes, statements, signals, ports, generics etc. Thus only the name of entities remain and the instantiation statements without ports. If you still think the names give away to much information you can obfuscate them. Maybe your bug is related to the upper/lower case of the library name. VHDL is case insensitive so the case can be inconsistently used. VUnit should handle this now but we used to be case sensitive until (#241). IMHO a good VHDL code should not rely on case insensitivity to work so this case might not be tested good since we do not write so much such code. Maybe there is still some bug related to inconsistent case of library name i.e mixing To get more debug information from VUnit you can use the |
Another common thing that has caused this behavior for me is relying on default binding rule instead of explicitly indicating the library when instantiating a block. YES: |
So if I understand you correctly, then you're saying you have issues when instantiating like this:
If this is the case, is there a way to still make this work? Unfortunately, we use this style all over the place. I like it because it simplifies either having to place the component inst in a package or noting the library name when instantiating. |
Using |
@kraigher I found a couple problems that cause this bug in VUnit. The first is when using a type in one package and declaring a subtype in a seperate package with the path to the original type. I am adding those files now with the problem code uncommented in the second package and the fix uncommented. Unfortunately, this fix will not work for us, but this is what I had to do to get VUnit to stop compiling the two packages in the wrong order. This package should be under
The below package needs to be under
Basically our use case is that we cannot touch anything in the I have been running
I will start obfuscating the code for the next example for another peice of problem code I found. |
That type of dependency is not supported by VUnit as it requires full parsing and semantic analysis to perform reliably. The preferred work around is to add a use clause on top of the library PMC_CONTROL_Base;
use PMC_CONTROL_Base.pmcCntrl; This will cause VUnit to pick up a dependency between the files. Alternatively you can use add a manual dependency via the Python API. |
@kraigher Okay awesome, that fixed both issues that I found. Is there a reason that using your method works, but the below doesn't?
|
The method you list with |
Okay cool. As for dependencies, I am having the same problem in some other libraries with slightly different failure cases regarding the same parsing problem. One thing that we do all over the place is the following for instantiating dependencies in a library so we don't need to put the component instantiation in the package:
In this case, we would like to keep only important components in our package for other libraries to reference while the building blocks that are not useful elsewhere are not accessible except locally. By this I mean that the component I guess this leads back to the problem that I don't need VUnit to re-shuffle all my files to scan for dependencies except the testbench. I feed in the files in the proper order, so it feels like I'm chasing my tail for a non-problem if there was support for that. |
Dependency scanning works very well for entity instantiation of the form |
Sure maybe it could have some use to manually specify test benches without dependency scanning. There has been very little demand for it since dependency scanning works well except for a few cases which are easy to work around. You claim to have a list of files in the proper order already. Howerver your dependencies are most likely not linear but a tree/graph. The distinction does not matter for a clean compile but for an incremental compile after changing one file it does. Not everything below that file in a typical file list needs to be compiled. This matters a lot in large projects. |
So then what is the syntax for this? If I just use the code snippet that you referenced without importing the library
Then I still see the same warning if I have the below:
What is causing this error message? Basically, the problem I am seeing is that VUnit is not recognizing the correct dependencies in certain libraries. In the
However, in a different lib, I do not import the library at all, I just instantiate the component in the working directory using |
I think you might have found a bug. VUnit will replace the work with the current library name but it seems it does not work when the library name is not all lower case. This is due to the complexity of supporting case sensitive library names in Verilog but not VHDL. I will make a fix. In the meantime as a work around you can use lower case names in the |
I have now pushed a fix to master. Could you try it? |
I have some bugs I'm working on for a different project, but I'll get to this as soon as I can! |
@kraigher Okay last "bug" I believe that I found. Lets say I have a package with all my components defined and this compiles first: pkg.vhd
Now, I have a file with multiple entities/architectures within it (horrible practice, but I didn't write this and have to live with it): file.vhd
Why is it that the |
My understanding of your scenario is that In VHDL there is no equivalence between components and entities and it is a misunderstanding to say that a component ent1 is the same as entity ent1. To make a circuit board analogy: A component defines a socket and an entity defines a chip. A chip could fit into a socket if it has the correct pinning. But multiple chips can also fit into the same socket. The purpose of a component is to be able to switch which corresponding entity that is instantiated via for example a configuration block. In most simple cases it would seem to a user that there is a direct relation between component and entity because of VHDL default binding rules where a entity in the same library as the component is automatically configured for the component instantiation without a configuration block explicitly selecting the entity to instantiate. |
I am transitioning a massive code-base to use VUnit for automated testing. For some reason, I am not able to get VUnit to properly discover the correct file ordering. Because of this, I used an
OrderedDict()
to prevent keys from getting shuffled, but when I setno_parse=True
, then I don't know how to get VUnit to start compiling in activeHDL with the first library/file that I added since it also cannot find the testbenchWhen I keep
no_parse=False
,library.cfg
gets the ordering correct. However, I start getting warnings about files that VUnit has parsed because it cannot find the library. Below, I am iterating over my dictionary of{'library' : ['<list of paths>']}
to add all my source files to the proper libraries:below is
library.cfg
which is in the order that I would expectHowever, this is the first thing that VUnit prints. It is saying it cant find library
PMC_CONTROL_Base
, but it should have realized thatdpCntrlPack.vhd
needed to be parsed beforedpCntrlBody.vhd
:Then when it starts compiling, I see this problem. The first file that the VUnit parser thought was supposed to be compiled was incorrect as this file has a dependency of
PMC_CONTROL_Base
:The names above might be confusing, but basically the VUnit parser incorrectly parsed dependencies in my code-base all over the place and I'm unsure of how to debug and fix it. When I add generate a .tcl script to compile and run all these files, everything works fine and I don't get any errors from aldec.
The text was updated successfully, but these errors were encountered: