8000 Add support for VHDL packages by nickg · Pull Request #3899 · cocotb/cocotb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add support for VHDL packages #3899

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

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

Conversation

nickg
Copy link
Contributor
@nickg nickg commented May 18, 2024

See issue #1833 and also nickg/nvc#891.

I have only been able to test this with latest NVC master branch.

Copy link
codecov bot commented May 18, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 76.81%. Comparing base (365edc2) to head (74d2c7e).

Files with missing lines Patch % Lines
src/cocotb/share/lib/vhpi/VhpiCbHdl.cpp 72.00% 4 Missing and 3 partials ⚠️
src/cocotb/share/lib/vhpi/VhpiImpl.cpp 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3899      +/-   ##
==========================================
+ Coverage   76.79%   76.81%   +0.01%     
==========================================
  Files          56       56              
  Lines        8429     8461      +32     
  Branches     2057     2071      +14     
==========================================
+ Hits         6473     6499      +26     
- Misses       1479     1486       +7     
+ Partials      477      476       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nickg nickg force-pushed the vhdl-packages branch 2 times, most recently from 56a0893 to 226e54a Compare May 20, 2024 20:57
@nickg
Copy link
Contributor Author
nickg commented May 20, 2024

Doesn't seem to work with any of the commercial simulators but I don't have a license at the moment to debug.

Copy link
Member
@ktbarrett ktbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into the Questa VHPI failure after work. Code looks good though.

@ktbarrett
Copy link
Member

Questa FLI passes test_get_root_handle, not fails.

Questa VHPI fails test_package_access_vhdl and test_get_root_handle causes a crash so it should be skipped.

I have no idea why the discovery tests are different now in Riviera VHPI.

@ktbarrett
Copy link
Member
ktbarrett commented Mar 6, 2025

Our CI only tests released versions of simulators, so we will have to wait until the version of NVC with the fix is released before integrating this PR. But I have manually confirmed that it does work on NVC master branch.

I fixed the issue in VCS. It wasn't finding a file, so I added $(PWD)/ back.

The Riviera issue was due to calling vhpi_release_handle on a finished iterator. This is not necessary per IEEE 1076-2019 23.33 and probably caused a double free in the Riviera internals that really hosed stuff. I also noticed that other VHPI iterator were doing this as well so I opened #4533.

handle._discover_all()
# All VHPI sims have issue with discovering sub-objects,
# so we just always iterate to discover all children.
handle._discover_all()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem here? vhpi_handle_by_name doesn't work in packages? I would rather fix this in NVC than have this workaround recursively discover all objects as I build VHPI objects lazily and this would cause a lot of redundant allocations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure. I know for certain this is required for Icarus and Riviera. I need to poke into it more, but ran out of time before passing out last night.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like only NVC supports getting child handles by name from package objects. Weird...

I'd hate to add all those simulators to the list that needs to _discover_all first, and there's probably a better way to do that by delegating to discover_all if a lookup fails, but that's work I don't want to have to do before 2.0. So I guess we will just pessimize those simulators for the 2.0 release and try to fix it before 2.1.

< 8000 /div>
@ktbarrett ktbarrett force-pushed the vhdl-packages branch 4 times, most recently from 312021b to a722e7d Compare April 22, 2025 17:18
@@ -1053,6 +1053,7 @@ def _build_command(self) -> List[_Command]:
+ ["-a"]
+ [str(source) for source in self.sources if is_vhdl_source(source)]
+ [str(source) for source in self.vhdl_sources]
+ ["--preserve-case"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imphil
Copy link
Member
imphil commented May 14, 2025

@nickg Would you mind splitting out the change that makes cocotb use --preserve-case into a separate PR? I think we can get that merged right away.

Co-authored-by: Kaleb Barrett <dev.ktbarrett@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:codebase:gpi relating to the GPI or one of the implementations category:codebase:handle relating to handles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0