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

opt: no "-purge" option but public names removed #4357

Open
YikeZhou opened this issue Apr 25, 2024 · 2 comments
Open

opt: no "-purge" option but public names removed #4357

YikeZhou opened this issue Apr 25, 2024 · 2 comments
Labels

Comments

@YikeZhou
Copy link

Version

Yosys 0.40+25 (git sha1 171577f, clang++ 14.0.6 -fPIC -Os)

On which OS did this happen?

Linux

Reproduction Steps

Before opening this issue, I found some really useful information in #2165.
Though, it was 4 years ago.
Therefore, I'm not sure if the following behavior of Yosys is expected but undocumented, or a bug.

Please consider this simple example:

module top(input clk, input signed [10:0] i);
  reg [2:0] r;
  always @(posedge clk)
    r <= i;
endmodule

Command:

yosys -p "read_verilog input.v; proc; opt; write_rtlil"

Expected Behavior

Having read the sections for opt and opt_clean in Yosys manual, I expected r to be remained after opt was called.

Actual Behavior

When running the command above, I noticed that:

3.7. Executing OPT_CLEAN pass (remove unused cells and wires).
Finding unused cells or wires in module \top..
Removed 1 unused cells and 2 unused wires.
<suppressed ~3 debug messages>

It seems that opt_clean removed r and it is missing in the RTLIL output.

# Generated by Yosys 0.40+25 (git sha1 171577f90, clang++ 14.0.6 -fPIC -Os)
autoidx 3
attribute \cells_not_processed 1
attribute \src "input.v:1.1-5.10"
module \top
  attribute \src "input.v:1.18-1.21"
  wire input 1 \clk
  attribute \src "input.v:1.43-1.44"
  wire width 11 input 2 signed \i
end
@YikeZhou YikeZhou added the pending-verification This issue is pending verification and/or reproduction label Apr 25, 2024
@whitequark whitequark added bug and removed pending-verification This issue is pending verification and/or reproduction labels Apr 25, 2024
@whitequark
Copy link
Member

Keeping these kinds of unused registers is something that's potentially important for Amaranth and CXXRTL simulations, so I think we need at least a clear way to disable the behavior.

@nakengelhardt
Copy link
Member

Keeping these kinds of unused registers is something that's potentially important for Amaranth and CXXRTL simulations, so I think we need at least a clear way to disable the behavior.

This was discussed in the context of sby a few years ago and setattr -set keep 1 w:\* is currently the way to disable that behavior...

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