diff options
author | Marcelina KoĆcielnicka <mwk@0x04.net> | 2020-07-19 02:19:38 +0200 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2020-07-24 11:22:31 +0200 |
commit | 31d61075219902b878ad1ff2e2d247dc33c91e60 (patch) | |
tree | 1bd1b91356d5c9390aeced0a1dd4e3439a33db04 | |
parent | 4d9105ccb0c6d50820a32969e2f3dfa2c210cc18 (diff) | |
download | yosys-31d61075219902b878ad1ff2e2d247dc33c91e60.tar.gz yosys-31d61075219902b878ad1ff2e2d247dc33c91e60.tar.bz2 yosys-31d61075219902b878ad1ff2e2d247dc33c91e60.zip |
pmux2shift: Refactor to use FfInitVals.
-rw-r--r-- | passes/opt/pmux2shiftx.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/passes/opt/pmux2shiftx.cc b/passes/opt/pmux2shiftx.cc index 9f226e12d..f3b1fd377 100644 --- a/passes/opt/pmux2shiftx.cc +++ b/passes/opt/pmux2shiftx.cc @@ -19,6 +19,7 @@ #include "kernel/yosys.h" #include "kernel/sigtools.h" +#include "kernel/ffinit.h" USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN @@ -30,7 +31,7 @@ struct OnehotDatabase bool verbose = false; bool initialized = false; - pool<SigBit> init_ones; + FfInitVals initvals; dict<SigSpec, pool<SigSpec>> sig_sources_db; dict<SigSpec, bool> sig_onehot_cache; pool<SigSpec> recursion_guard; @@ -44,19 +45,7 @@ struct OnehotDatabase log_assert(!initialized); initialized = true; - for (auto wire : module->wires()) - { - auto it = wire->attributes.find(ID::init); - if (it == wire->attributes.end()) - continue; - - auto &val = it->second; - int width = std::max(GetSize(wire), GetSize(val)); - - for (int i = 0; i < width; i++) - if (val[i] == State::S1) - init_ones.insert(sigmap(SigBit(wire, i))); - } + initvals.set(&sigmap, module); for (auto cell : module->cells()) { @@ -119,7 +108,7 @@ struct OnehotDatabase bool found_init_ones = false; for (auto bit : sig) { - if (init_ones.count(bit)) { + if (initvals(bit) == State::S1) { if (found_init_ones) { if (verbose) log("%*s - non-onehot init value\n", indent, ""); |