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
[Verilog] Interface Array Testcase #3704
Conversation
I agree. This is a generate loop. I think an array of instances to be exactly that. An array of interfaces is very clearly an array of hierarchy objects and would map there too.
So the VPI assumes that everything that's a GPI_GENARRAY is a pseudo handle instead of an actual handle like I'll have to look into the Questa and Riviera results when I get home. |
I still don't really understand what a pseudo-region is, I think gpi.h needs a lot more clarification. My perception is it's the same as hierarchy arrays or hierarchy scopes, and sometimes the handle may be missing? However in the vpiimpl nothing in to_gpi_objtype returns GPI_GEN_ARRAY, so we only have code that treats these handles as if they're not there. Or if they are there, for convenience uses the GPI_ARRAY to avoid iterating, instead doing size/index/range discovery |
You are absolutely correct there. I'm not certain myself how a pseudo-region works. But it is an implementation detail, not necessarily an API concern. The entire C++ codebase needs a major facelift, but it's not public API, so it's lower on my own radar than Python rn. Sweeping C++ changes are a 3.0 issue. Until then we just need something that works, even if it's ugly as sin. |
See the wiki for some details on pseudo-regions. |
For VPI, there are actual differences between an instance array and gen scope array. We need a way to distinguish hierarchy arrays like |
Is the difference in terms of implementation or capability? Still seems like it's an array of scopes, which is kind of what GPI_GENARRAY is. |
Conceptually In fact, cocotb/src/cocotb/share/lib/vpi/VpiImpl.cpp Lines 367 to 380 in fdf7286
We don't iterate over When using VPI, gen scope and gen scope array objects are not instance objects like modules, packages, and interfaces are, and need to be handled differently internally. So I think for instance arrays, we either need to differentiate Pseudo-region implementation needs an update, and maybe at that time we could merge |
Rerunning CI. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3704 +/- ##
==========================================
- Coverage 72.67% 72.64% -0.03%
==========================================
Files 49 49
Lines 8050 8050
Branches 2212 2218 +6
==========================================
- Hits 5850 5848 -2
- Misses 1689 1695 +6
+ Partials 511 507 -4 ☔ View full report in Codecov by Sentry. |
Since #3824 landed first, you'll need to update the test expectations. Use positive logic, not |
185aed7
to
14e0db1
Compare
Riviera failures.
|
assert len(dut.sv_if_arr) == 3 | ||
|
||
|
||
@cocotb.test(expect_fail=cocotb.SIM_NAME.lower().startswith("riviera")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect_error=IndexError if Riviera else ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh does expect_fail only cover asserts and not any general fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. I'm glad you didn't know that, it's not a great system, and one we hope to replace, so users not touching them is a good thing.
This should be a HierarchyArrayObject, not a NonHierarchyIndexableObject. I'm not sure how we'd like to approach this. I would think it should be a cast to GPI_GENARRAY. I'm not sure what this is, there's no comments in gpi.h about it except for mentioning pseudo handles with it. Do pseudo handles (GPI_GENARRAY) mean that the handle doesn't exist in the hierarchy that we query from? Or does it just mean arrays that are in the structure?
I can't map vpiInstanceArray / vpiInterfaceArray to GPI_GENARRAY because it needs vpi_iterate with vpiRange. Indexing works however with this approach. Should I make a range iterator, and use that depending on the vpitype? Or try and get it to map these special types of GPI_ARRAY to HierarhcyObjectArray?