diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-06-21 08:56:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 08:56:56 -0700 |
commit | 6d74cf0d2b903eae16372f58dc15e4bc67666a2b (patch) | |
tree | 4e80fd5c7fc8870739c1d4419b27d3800ae8ddfd /passes/techmap | |
parent | 918460ddd312d25b8a3a889393b88025261a4b4b (diff) | |
parent | e63324f5ef2ebb14fa0cc88544f577406f95b223 (diff) | |
download | yosys-6d74cf0d2b903eae16372f58dc15e4bc67666a2b.tar.gz yosys-6d74cf0d2b903eae16372f58dc15e4bc67666a2b.tar.bz2 yosys-6d74cf0d2b903eae16372f58dc15e4bc67666a2b.zip |
Merge pull request #1085 from YosysHQ/eddie/shregmap_improve
Improve shregmap to handle case where first flop is common to two chains
Diffstat (limited to 'passes/techmap')
-rw-r--r-- | passes/techmap/shregmap.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/passes/techmap/shregmap.cc b/passes/techmap/shregmap.cc index 18e60fa6b..004ab1eb9 100644 --- a/passes/techmap/shregmap.cc +++ b/passes/techmap/shregmap.cc @@ -293,10 +293,22 @@ struct ShregmapWorker if (opts.init || sigbit_init.count(q_bit) == 0) { - if (sigbit_chain_next.count(d_bit)) { + auto r = sigbit_chain_next.insert(std::make_pair(d_bit, cell)); + if (!r.second) { + // Insertion not successful means that d_bit is already + // connected to another register, thus mark it as a + // non chain user ... sigbit_with_non_chain_users.insert(d_bit); - } else - sigbit_chain_next[d_bit] = cell; + // ... and clone d_bit into another wire, and use that + // wire as a different key in the d_bit-to-cell dictionary + // so that it can be identified as another chain + // (omitting this common flop) + // Link: https://github.com/YosysHQ/yosys/pull/1085 + Wire *wire = module->addWire(NEW_ID); + module->connect(wire, d_bit); + sigmap.add(wire, d_bit); + sigbit_chain_next.insert(std::make_pair(wire, cell)); + } sigbit_chain_prev[q_bit] = cell; continue; |