-
Notifications
You must be signed in to change notification settings - Fork 908
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
Frontend/AST: signed assign to indexed part-select #4064
Comments
#4065 does not seem to fix this, it still produces: assign _01_ = { 29'h00000000, offset_i } + 32'd0;
assign _05_ = $signed({ 1'h0, _01_ }) - $signed(32'd0);
assign _03_ = - $signed(_05_);
assign data_o = $signed(_03_) < 0 ? 1'h1 << - _03_ : 1'h1 >> _03_; note the last line where it is still |
Here is the output which could have been generated if only a few PRs were to be merged 😉
|
Now that does look correct, thanks!
Personally I would consider this to be high-priority since its in the frontend and therefore likely influences absolutely every project (most likely even LEC). |
|
@nakengelhardt Can you please merge #4065 and and #4066? |
Corrects sign extension of the right hand side, and hopefully makes the code simpler to understand. Fixes YosysHQ#4064
@phsauter FYI if you need sign extension working before all this hopefully gets merged, you can add |
Corrects sign extension of the right hand side, and hopefully makes the code simpler to understand. Fixes YosysHQ#4064
Version
Yosys 0.36+13 (git sha1 2858c33, clang 10.0.0-4ubuntu1 -fPIC -Os)
On which OS did this happen?
Linux
Reproduction Steps
The zip contains the source RTL, yosys output and a testbench.
sign_part_assign.zip
Execute the commands:
Compare the output
data_o
using the testbench or compare by inspection (its only a few lines to think through).From inspecting the debug output from
read_verilog -debug
I expect the problem to be in the AST simplification step.Expected Behavior
Source RTL:
The RHS of the second expression should be sign extended to match LHS width as per Sec 5.5.3 of IEEE Std 1364-2005 (Verilog 2005).
Actual Behavior
The LHS extension to match RHS is done without considering the sign bit. So it produces essentially:
The text was updated successfully, but these errors were encountered: