diff options
author | Jannis Harder <me@jix.one> | 2022-10-24 16:25:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 16:25:33 +0200 |
commit | 408fc60c95f88671e0d6c5624a10e147334edb4e (patch) | |
tree | b07daa89e730a8d8b76152d1b3a6174229452257 /kernel/celltypes.h | |
parent | 3a37597e9f3cbcd69a28663933074c24d5c03feb (diff) | |
parent | c77b7343d0412a009436a57764d907e2ae332da2 (diff) | |
download | yosys-408fc60c95f88671e0d6c5624a10e147334edb4e.tar.gz yosys-408fc60c95f88671e0d6c5624a10e147334edb4e.tar.bz2 yosys-408fc60c95f88671e0d6c5624a10e147334edb4e.zip |
Merge pull request #3526 from jix/mux-simlib-eval
Consistent $mux undef handling
Diffstat (limited to 'kernel/celltypes.h')
-rw-r--r-- | kernel/celltypes.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/celltypes.h b/kernel/celltypes.h index d62ba1506..e617b4603 100644 --- a/kernel/celltypes.h +++ b/kernel/celltypes.h @@ -488,16 +488,10 @@ struct CellTypes static RTLIL::Const eval(RTLIL::Cell *cell, const RTLIL::Const &arg1, const RTLIL::Const &arg2, const RTLIL::Const &arg3, bool *errp = nullptr) { - if (cell->type.in(ID($mux), ID($pmux), ID($_MUX_))) { - RTLIL::Const ret = arg1; - for (size_t i = 0; i < arg3.bits.size(); i++) - if (arg3.bits[i] == RTLIL::State::S1) { - std::vector<RTLIL::State> bits(arg2.bits.begin() + i*arg1.bits.size(), arg2.bits.begin() + (i+1)*arg1.bits.size()); - ret = RTLIL::Const(bits); - } - return ret; - } - + if (cell->type.in(ID($mux), ID($_MUX_))) + return const_mux(arg1, arg2, arg3); + if (cell->type == ID($pmux)) + return const_pmux(arg1, arg2, arg3); if (cell->type == ID($_AOI3_)) return eval_not(const_or(const_and(arg1, arg2, false, false, 1), arg3, false, false, 1)); if (cell->type == ID($_OAI3_)) |