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

VHPI: Preserve original name case for CaseNameP and FullCaseNameP #723

Open
Forty-Bot opened this issue Jun 18, 2023 · 4 comments
Open

VHPI: Preserve original name case for CaseNameP and FullCaseNameP #723

Forty-Bot opened this issue Jun 18, 2023 · 4 comments
Labels

Comments

@Forty-Bot
Copy link
Contributor

CaseNameP and FullCaseNameP are specified to use "...the case of letters in the identifier of the ... declaration." However, we currently always return these properties as uppercase.

I don't think this is particularly high priority (and would likely take a lot of effort to resolve). However, the cocotb folks requested that a tracking issue be created for this deviation.

@nickg
Copy link
Owner

nickg commented Jun 24, 2023

I don't really want to track the original case of identifiers in addition to the normalised uppercase identifier so I've implemented this in a slightly hacky/best-effort way for declarations using the source location to find the original identifier in the file and fall back to the upper-case name if that doesn't work. Seems to work ok in my limited testing.

@Forty-Bot
Copy link
Contributor Author

There were two main bugs I saw related to CaseName:

  • Cocotb asks for something in lowercase and is surprised when we give it something in uppercase
  • Cocotb gets a handle via vhpi_scan and gets the same handle later via vhpi_handle_by_name and gets confused when the names aren't the same.

So this really needs to be accompanied by making vhpi_handle_by_name case-sensitive, which also means converting the other (Full)CaseNames (in c_name etc.).


That said I've been pretty happy with my solution of just converting all requested identifiers to uppercase in cocotb.

@nickg
Copy link
Owner

nickg commented Jun 24, 2023

That said I've been pretty happy with my solution of just converting all requested identifiers to uppercase in cocotb.

Yes if they can live with that it would be much simpler.

@ktbarrett
Copy link

Yes if they can live with that it would be much simpler.

Unfortunately we can't since we service SV code as well. We can't know what PLI interface returned an object, nor the original source language of any object, due to the abstraction of the GPI. Nor do we want to know, as that's the whole point of abstracting the interface away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants