3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-15 22:21:30 +00:00

Fixed SAT and ConstEval undef handling for $pmux and $safe_pmux

This commit is contained in:
Clifford Wolf 2014-01-03 17:30:50 +01:00
parent 8a8d444648
commit 7354a1718e
2 changed files with 43 additions and 10 deletions

View file

@ -110,6 +110,7 @@ struct ConstEval
if (cell->type == "$mux" || cell->type == "$pmux" || cell->type == "$safe_pmux" || cell->type == "$_MUX_")
{
std::vector<RTLIL::SigSpec> y_candidates;
int count_maybe_set_s_bits = 0;
int count_set_s_bits = 0;
for (int i = 0; i < sig_s.width; i++)
@ -120,16 +121,17 @@ struct ConstEval
if (s_bit == RTLIL::State::Sx || s_bit == RTLIL::State::S1)
y_candidates.push_back(b_slice);
if (s_bit == RTLIL::State::S1 || s_bit == RTLIL::State::Sx)
count_maybe_set_s_bits++;
if (s_bit == RTLIL::State::S1)
count_set_s_bits++;
}
if (cell->type == "$safe_pmux" && count_set_s_bits > 1) {
if (cell->type == "$safe_pmux" && count_set_s_bits > 1)
y_candidates.clear();
count_set_s_bits = 0;
}
if (count_set_s_bits == 0)
if ((cell->type == "$safe_pmux" && count_maybe_set_s_bits > 1) || count_set_s_bits == 0)
y_candidates.push_back(sig_a);
std::vector<RTLIL::Const> y_values;