Skip to content

Commit

Permalink
opt_reduce: keep at least one input to $reduce_or/and cells
Browse files Browse the repository at this point in the history
  • Loading branch information
georgerennie committed Sep 25, 2024
1 parent 8e1e2b9 commit 023f029
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions passes/opt/opt_reduce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ struct OptReduceWorker
RTLIL::SigSpec new_sig_a(new_sig_a_bits);
new_sig_a.sort_and_unify();

if (GetSize(new_sig_a) == 0)
new_sig_a = (cell->type == ID($reduce_or)) ? State::S0 : State::S1;

if (new_sig_a != sig_a || sig_a.size() != cell->getPort(ID::A).size()) {
log(" New input vector for %s cell %s: %s\n", cell->type.c_str(), cell->name.c_str(), log_signal(new_sig_a));
did_something = true;
Expand Down

0 comments on commit 023f029

Please sign in to comment.