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

Fix use reference parsing of instantiated packages #1056

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diedricm
Copy link

@diedricm diedricm commented Sep 9, 2024

Another day, another attempt to submit something useful :)

What is the status quo:
The VUnit VHDL parser understands the following line:
use firstname.secondname;
as a reference to a library "firstname". This is an issue if firstname is instead the name of an instantiated package. Later on VUnit obviously cannot find such a library and produces a warning.

What this patch changes:
The changes in this PR filter out all the detected references in a design file based on the detected package instantiations. Only those references, that target a library, whose name is identical to that of an instantiated package, are removed.

Side effects
I believe this to be without undesirable side effects. If, at any point, a library and an instantiated name exist, that have the same name, then the code is malformed and should fail during compilation. It is therefore always safe to remove references to assumed libraries if there exists a package with the same name.

Scope
This does not fix all issues with instantiated packages though. The filter does not know about the declaration of instantiated packages in other design files. Those could be the relevant primary units (package, entity) or simply inside another visible package. Detecting those cases would require a more complete semantic analysis of the code though.

This commit adds a small fix in the VHDL parser that filters out references to instantiated packages in this design file, as they would otherwise produce "library XYZ not found" warnings later on.
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