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
Array names revert to "$signal" #281
Comments
This is definitely not the right way to write testcases. The object You can get the value of any signal in |
Thanks for your quick response! Unfortunately I can't figure out how to call it -- I presume you mean |
Oh wow that's a fascinating Python syntax edge case: turns out you can't really use
|
Anyway, this works:
|
Yup, works, thank you so much for your help! |
You can certainly use >>> def f(): yield from [(yield 1) for _ in range(10)]
...
>>> list(f())
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1] This is by the way another reason to use await/async as it gives you a cleaner and arguably more robust separation between async IO and language constructs like generators. |
[I'm a nmigen novice, so apologies if I'm doing something silly]
I'm trying to test a combinatorial module function that returns an array of Signals.
In my test functions, I have been iterating over
sim._state.pending
to find all signals by name and check if they have the right values, but this seems to fall down when the result is an Array.Here is a minimal example:
for me this prints
However, I was expecting to see something like
res [13, 6]
.I guess what's happening is my loop is iterating over signals, whether or not they're part of an Array, and for those that are, there is no explicit name and therefore it defaults to
$signal
(as can be seen inast.py
).It may well be the case that I'm testing my modules in a backward way (please tell me!) but I can't figure out a simple way to get at the result of
res
and check the values programmatically. Is this a bug? Is there a better way to do what I'm trying to do?Thoughts appreciated.
The text was updated successfully, but these errors were encountered: