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

Fix setting bits of parameters in setundef pass #4733

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion passes/cmds/setundef.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ struct SetundefPass : public Pass {
{
for (auto *cell : module->selected_cells()) {
for (auto &parameter : cell->parameters) {
for (auto bit : parameter.second) {
for (auto &bit : parameter.second.bits()) {
if (bit > RTLIL::State::S1)
bit = worker.next_bit();
}
Expand Down
10 changes: 10 additions & 0 deletions tests/various/setundef.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module foo #(parameter [1:0] a) (output [1:0] o);
assign o = a;
endmodule

module top(output [1:0] o);
foo #(2'b0x) foo(o);
always_comb begin
assert(o == 2'b00);
end
endmodule
8 changes: 8 additions & 0 deletions tests/various/setundef.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
read_verilog -sv setundef.sv
setundef -zero -params
hierarchy -top top
flatten
proc
async2sync
write_json
sat -seq 5 -prove-asserts
Loading