-
Notifications
You must be signed in to change notification settings - Fork 173
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
Integer parameters over 32 bits #388
Comments
Plain integers used as parameters in RTLIL are equivalent to 32-bit constants, so we can convert them on nMigen's side without loss of generality. |
I think it's even worse than this. Consider this RTLIL:
If you convert it to Verilog, Yosys outputs: module foo();
(* init = 32'd2147483648 *)
wire [63:0] \-2**31 ;
(* init = 32'd2147483649 *)
wire [63:0] \-2**31+1 ;
(* init = 32'd2147483647 *)
wire [63:0] \2**31-1 ;
endmodule So it's discarding the sign bit! And not only that but you can't even specify any values between |
Looking closer, it seems that negative numbers in RTLIL don't roundtrip:
|
Proposed upstream fix: YosysHQ/yosys#2066 |
6e29fbc breaks integer parameters greater than
2**32 -1
With Yosys HEAD, a large integer parameter results in the error
nmigen.back.verilog.YosysError: ERROR: Parser error in line 247: syntax error
, with older Yosys, the parameter is silently clipped to2**32-1
.I'm not sure what the best way to handle this is. It could be as simple as converting large integer parameters to ast.Const parameters. Even an assert to catch this early may be an option.
The text was updated successfully, but these errors were encountered: