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

COCOTB : Unable to acess VHDL packages. #891

Closed
aqeelmahroof opened this issue May 17, 2024 · 1 comment
Closed

COCOTB : Unable to acess VHDL packages. #891

aqeelmahroof opened this issue May 17, 2024 · 1 comment
Labels

Comments

@aqeelmahroof
Copy link

Hi,

It's common to have constants defined in VHDL packages. Based on cocotb issue 1833, the only way to access the packages is using

my_pkg = cocotb.handle.SimHandle(cocotb.simulator.get_root_handle("my_pkg"))

In NVC, there seems to be a check, which doesn't allow this. When Cocotb tries to access the package, it gives the following error:

2.00ns WARNING  gpi                                VHPI: DUT 'MY_DUT' doesn't match requested toplevel my_pkg 
2.00ns ERROR    gpi                                No root handle found
2.00ns INFO     cocotb.regression                  pu_filter_random_test.basic_pu_filter_test failed
                                                   Traceback (most recent call last):
                                                     File "/cocotb/regression.py", line 158, in func
                                                       res = await cocotb.triggers.with_timeout(
                                                     File "/cocotb/triggers.py", line 1014, in with_timeout
                                                       res = await First(timeout_timer, trigger)
                                                     File "/cocotb/triggers.py", line 902, in _wait
                                                       return await first_trigger  # the first of multiple triggers that fired
                                                     File "/cocotb/triggers.py", line 136, in __await__
                                                       return (yield self)
                                                     File "/cocotb/task.py", line 235, in __await__
                                                       return (yield self)
                                                     File "my_test.py", line 98, in run_phase
                                                       my_pkg = cocotb.handle.SimHandle(cocotb.simulator.get_root_handle("my_pkg"))
                                                     File "/cocotb/handle.py", line 1033, in SimHandle
                                                       t = handle.get_type()
                                                   AttributeError: 'NoneType' object has no attribute 'get_type'

nvc version

nvc 1.13-devel (1.12.0.r41.g3edb4fec) (Using LLVM 14.0.0)
Copyright (C) 2011-2024  Nick Gasson

cocotb version = 2.0.0.dev0+65d102f2

Is it possible to relax that check ?

@nickg nickg added the vhpi label May 17, 2024
nickg added a commit to nickg/cocotb that referenced this issue May 18, 2024
See issue cocotb#1833 and also nickg/nvc#891.

I have only been able to test this with latest NVC master branch.
@nickg
Copy link
Owner

nickg commented May 18, 2024

I've added support for accessing package constants through VHPI but it needs some cocotb changes as well, see cocotb/cocotb#3899.

@nickg nickg closed this as completed May 18, 2024
nickg added a commit to nickg/cocotb that referenced this issue May 18, 2024
See issue cocotb#1833 and also nickg/nvc#891.

I have only been able to test this with latest NVC master branch.
nickg added a commit to nickg/cocotb that referenced this issue May 20, 2024
See issue cocotb#1833 and also nickg/nvc#891.

I have only been able to test this with latest NVC master branch.
nickg added a commit to nickg/cocotb that referenced this issue May 20, 2024
See issue cocotb#1833 and also nickg/nvc#891.

I have only been able to test this with latest NVC master branch.
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

2 participants