diff options
author | gatecat <gatecat@ds0.me> | 2021-06-11 11:11:12 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-06-11 12:06:35 +0100 |
commit | 6a6d049f1cb6a96eb2af83441a0fb156efbd9cc3 (patch) | |
tree | 807d14f47b6507aac995adea8b63045f8fb18832 /passes/opt/opt_muxtree.cc | |
parent | 1667ad658b3aefd3b5418dace6403d3990029fb9 (diff) | |
download | yosys-6a6d049f1cb6a96eb2af83441a0fb156efbd9cc3.tar.gz yosys-6a6d049f1cb6a96eb2af83441a0fb156efbd9cc3.tar.bz2 yosys-6a6d049f1cb6a96eb2af83441a0fb156efbd9cc3.zip |
opt_muxtree: Update port_off and port_idx even for constant bits
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'passes/opt/opt_muxtree.cc')
-rw-r--r-- | passes/opt/opt_muxtree.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/passes/opt/opt_muxtree.cc b/passes/opt/opt_muxtree.cc index 8ef54cdda..100b1b495 100644 --- a/passes/opt/opt_muxtree.cc +++ b/passes/opt/opt_muxtree.cc @@ -372,29 +372,28 @@ struct OptMuxtreeWorker int port_idx = 0, port_off = 0; vector<int> bits = sig2bits(sig, false); for (int i = 0; i < GetSize(bits); i++) { - if (bits[i] < 0) - continue; - if (knowledge.known_inactive.at(bits[i])) { - sig[i] = State::S0; - did_something = true; - } else - if (knowledge.known_active.at(bits[i])) { - sig[i] = State::S1; - did_something = true; - } - if (width) { - if (ctrl_bits.count(bits[i])) { - sig[i] = ctrl_bits.at(bits[i]) == port_idx ? State::S1 : State::S0; + if (bits[i] >= 0) { + if (knowledge.known_inactive.at(bits[i])) { + sig[i] = State::S0; + did_something = true; + } else + if (knowledge.known_active.at(bits[i])) { + sig[i] = State::S1; did_something = true; } - if (++port_off == width) - port_idx++, port_off=0; - } else { if (ctrl_bits.count(bits[i])) { - sig[i] = State::S0; + if (width) { + sig[i] = ctrl_bits.at(bits[i]) == port_idx ? State::S1 : State::S0; + } else { + sig[i] = State::S0; + } did_something = true; } } + if (width) { + if (++port_off == width) + port_idx++, port_off=0; + } } if (did_something) { |