diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-06-25 17:34:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-25 17:34:44 +0200 |
commit | add2d415fcab64eae8819021ad1b8dd1b56e6bf2 (patch) | |
tree | 4eac0980c022262f37133350ccbe1b630d00b3e1 /passes | |
parent | 58629dc2ce5ebd24bf37ab429c2723db75a772de (diff) | |
parent | 42720ef6fefdf7645db47b97cd914008d68b00a9 (diff) | |
download | yosys-add2d415fcab64eae8819021ad1b8dd1b56e6bf2.tar.gz yosys-add2d415fcab64eae8819021ad1b8dd1b56e6bf2.tar.bz2 yosys-add2d415fcab64eae8819021ad1b8dd1b56e6bf2.zip |
Merge pull request #1130 from YosysHQ/eddie/fix710
memory_dff: walk through more than one mux for computing read enable
Diffstat (limited to 'passes')
-rw-r--r-- | passes/memory/memory_dff.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/passes/memory/memory_dff.cc b/passes/memory/memory_dff.cc index 220d29295..5215cce44 100644 --- a/passes/memory/memory_dff.cc +++ b/passes/memory/memory_dff.cc @@ -182,11 +182,17 @@ struct MemoryDffWorker if (mux_cells_a.count(sig_data) || mux_cells_b.count(sig_data)) { - 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); - SigSpec check_q = sigmap(mux->getPort(enable_invert ? "\\B" : "\\A")); + RTLIL::SigSpec en; + 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")); + 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)); - sig_data = sigmap(mux->getPort("\\Y")); for (auto bit : sig_data) if (sigbit_users_count[bit] > 1) goto skip_ff_after_read_merging; @@ -195,7 +201,7 @@ struct MemoryDffWorker { disconnect_dff(sig_data); cell->setPort("\\CLK", clk_data); - cell->setPort("\\EN", enable_invert ? module->LogicNot(NEW_ID, mux->getPort("\\S")) : mux->getPort("\\S")); + cell->setPort("\\EN", en.size() > 1 ? module->ReduceAnd(NEW_ID, en) : en); cell->setPort("\\DATA", sig_data); cell->parameters["\\CLK_ENABLE"] = RTLIL::Const(1); cell->parameters["\\CLK_POLARITY"] = RTLIL::Const(clk_polarity); |