-
Notifications
You must be signed in to change notification settings - Fork 25
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
Selecting a list element from a list of bit-vectors returns an int #172
Comments
Hi @grahamcx, Thanks for raising this issue, and very happy to hear that you're finding value in PyVSC. Unfortunately, this example may be running into limits (or, at least, corner cases) of Python's operator overloading capabilities. When you index list_of_blocks to read an element, PyVSC currently returns the value of the element which, most of the time, we want to see as a Python int value. In this case, we want to be able to further slice it to get a specific bit or bits. Let me play with this a bit. There still may be a way to get this to work as-is. If not, I should be better informed as to the options. Best Regards, |
Hi @grahamcx, good news! This issue did end up being an operator-overloading issue. The subscript of the array returned the array element as an 'int' value. It should have returned a ValueInt object in order to allow the value to subsequently be subscripted. I made the change, and now an expanded version of your testcase runs: pyvsc/ve/unit/test_partselect.py Lines 61 to 77 in 743b6d3
The 0.8.2 release contains the fix, and should be available on PyPi within a few minutes. Thanks again for the issue report! |
Thanks for the speedy fix @mballance, that's great news. I'll give that a try. Graham |
Hi @mballance
First up I'd like to say that pyvsc is amazing. Having tried python-based verification before, the main blocker that has stopped me moving away from systemverilog has always been decent constrained random generation, which pyvsc has totally solved.
However, I'm having an issue with lists of bit-vectors. Essentially, if I have a variable of type vsc.bit_t(x), I can pick out arbitrary bits or bit-ranges from that vector, just like I can in systemverilog. But if I create a list of elements of type vsc.bit_t(x), then select one of those elements, I get an int back instead, meaning I can no longer select indvidual bits any more.
Looking through the code it seems the is_scalar flag is causing this behaviour, which I appreciate may be useful in some circumstances, but without a way to override it, is quite limiting in others.
Thanks,
Graham
The text was updated successfully, but these errors were encountered: