You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--- good.v 2019-07-24 20:20:50.179566232 +0000+++ bad.v 2019-07-24 20:21:05.291656753 +0000@@ -1190,7 +1190,7 @@
i2cmastersubtarget_sda_o_i2cmaster_next_value_ce4 <= 1'd1;
end else begin
if ((i2cmastersubtarget_sda_o == 1'd1)) begin
- if ((1'd1 | (i2cmastersubtarget_sda_i == 1'd1))) begin+ if ((1'sd1 | $signed({1'd0, (i2cmastersubtarget_sda_i == 1'd1)}))) begin
i2cmaster_next_state <= 2'd3;
end
end
Given that (n)Migen signals can be negated only with ~ and booleans can be negated only with not, this seems to be a potential source of serious bugs. Unfortunately I'm not sure what can be done to fix it (since by the time the value is coerced to an nMigen constant, its boolean-ness is long lost), and nMigen is indeed still susceptible to this issue:
I just discovered this bug in some oMigen code:
It translates to this Verilog:
Given that (n)Migen signals can be negated only with
~
and booleans can be negated only withnot
, this seems to be a potential source of serious bugs. Unfortunately I'm not sure what can be done to fix it (since by the time the value is coerced to an nMigen constant, its boolean-ness is long lost), and nMigen is indeed still susceptible to this issue:The text was updated successfully, but these errors were encountered: