aboutsummaryrefslogtreecommitdiffstats
path: root/passes/memory
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-07-02 13:27:37 +0100
committerDavid Shah <dave@ds0.me>2019-07-02 13:35:50 +0100
commitd45936fe5f2c6fd1e6f371b2fc3d6d820868ef72 (patch)
tree8ff666a0cf8df461c4c228417c908d23ce4ecc91 /passes/memory
parentd206eca03b8aa7bb982fb2486c02c90a61354066 (diff)
downloadyosys-d45936fe5f2c6fd1e6f371b2fc3d6d820868ef72.tar.gz
yosys-d45936fe5f2c6fd1e6f371b2fc3d6d820868ef72.tar.bz2
yosys-d45936fe5f2c6fd1e6f371b2fc3d6d820868ef72.zip
memory_dff: Fix checking of feedback mux input when more than one mux
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'passes/memory')
-rw-r--r--passes/memory/memory_dff.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/passes/memory/memory_dff.cc b/passes/memory/memory_dff.cc
index 5215cce44..32b97f27a 100644
--- a/passes/memory/memory_dff.cc
+++ b/passes/memory/memory_dff.cc
@@ -17,6 +17,7 @@
*
*/
+#include <algorithm>
#include "kernel/yosys.h"
#include "kernel/sigtools.h"
@@ -183,12 +184,12 @@ struct MemoryDffWorker
if (mux_cells_a.count(sig_data) || mux_cells_b.count(sig_data))
{
RTLIL::SigSpec en;
- RTLIL::SigSpec check_q;
+ std::vector<RTLIL::SigSpec> check_q;
do {
bool enable_invert = mux_cells_a.count(sig_data) != 0;
Cell *mux = enable_invert ? mux_cells_a.at(sig_data) : mux_cells_b.at(sig_data);
- check_q = sigmap(mux->getPort(enable_invert ? "\\B" : "\\A"));
+ check_q.push_back(sigmap(mux->getPort(enable_invert ? "\\B" : "\\A")));
sig_data = sigmap(mux->getPort("\\Y"));
en.append(enable_invert ? module->LogicNot(NEW_ID, mux->getPort("\\S")) : mux->getPort("\\S"));
} while (mux_cells_a.count(sig_data) || mux_cells_b.count(sig_data));
@@ -197,7 +198,8 @@ struct MemoryDffWorker
if (sigbit_users_count[bit] > 1)
goto skip_ff_after_read_merging;
- if (find_sig_before_dff(sig_data, clk_data, clk_polarity, true) && clk_data != RTLIL::SigSpec(RTLIL::State::Sx) && sig_data == check_q)
+ if (find_sig_before_dff(sig_data, clk_data, clk_polarity, true) && clk_data != RTLIL::SigSpec(RTLIL::State::Sx) &&
+ std::all_of(check_q.begin(), check_q.end(), [&](const SigSpec &cq) {return cq == sig_data; }))
{
disconnect_dff(sig_data);
cell->setPort("\\CLK", clk_data);