-
Notifications
You must be signed in to change notification settings - Fork 211
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
Python logical operator 'and' silently dropped #137
Comments
Yes, you cannot use |
Is there any way to make it a hard error? |
Actually it should raise |
@sbourdeauducq Because of the special case in
I don't understand why it lives in |
Where should it be instead? |
@sbourdeauducq Is it realistic to make only |
Maybe, can you test it (including with ARTIQ)? |
OK |
I also just ran into this problem: class OrderTest(Module):
def __init__(self):
counter = Signal(8)
sig = Signal()
self.sync += [
counter.eq(counter + 1),
If((counter == 1) or (counter == 2) or (counter == 3),
sig.eq(1)
)
]
print(str(verilog.convert(OrderTest()))) This results in: ...
if ((counter == 2'd3)) begin
sig <= 1'd1;
end
... |
FYI this (and many other issues) are fixed in https://github.com/m-labs/nmigen/. But nMigen is not yet quite ready. |
Triage: fixed in nMigen. |
@sbourdeauducq @whitequark What is the correct way of doing logical AND or logical OR in Migen then? |
|
This is the bitwise operator, which does not behave like the logical operator. |
It does. For one bit expressions they are the same. |
In nMigen you can use |
Thanks for your answers! Is there a bool() equivalent in Migen or should we use something like |
|
The following migen snippet:
produces the following Verilog:
The text was updated successfully, but these errors were encountered: