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

Signals should support (sig1 (not) in sig2) #237

Closed
emilazy opened this issue Sep 28, 2019 · 3 comments
Closed

Signals should support (sig1 (not) in sig2) #237

emilazy opened this issue Sep 28, 2019 · 3 comments
Labels

Comments

@emilazy
Copy link
Contributor

emilazy commented Sep 28, 2019

This is for consistency with strings; Signals operate like strings (i.e. sig[0] is another Signal like with strings rather than element type like most collections, they can be sliced, etc.), so for consistency __contains__ should support finding longer substrings than the one-bit case. (The windowing comparisons are also a little annoying to write out by hand, so it would be handy to have around, even if it's not necessarily a terribly common operation.)

@whitequark
Copy link
Contributor

This is actually completely impossible because Python is bad.

@mithro
Copy link

mithro commented Oct 13, 2019

Maybe I don't understand what @emilazy was asking, but it seems like sig in sig2 and sig not in sig2 should work even when sig is multiple bits wide?

@whitequark
Copy link
Contributor

@mithro It's impossible to make the in operator return an nMigen signal (anything that isn't a boolean or convertible to it).

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

3 participants