diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-10-27 19:15:35 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-10-27 19:15:35 +0100 |
commit | 0c202a254963846626eef492059723bc2aa70dd0 (patch) | |
tree | 7dba89bbe3bf54d470e731ae72f8768baf2ec93a /passes | |
parent | f3db70d2f3d9e9c313df8d1e1880c170d3343ca8 (diff) | |
download | yosys-0c202a254963846626eef492059723bc2aa70dd0.tar.gz yosys-0c202a254963846626eef492059723bc2aa70dd0.tar.bz2 yosys-0c202a254963846626eef492059723bc2aa70dd0.zip |
Use mfp<> in equiv_mark
Diffstat (limited to 'passes')
-rw-r--r-- | passes/equiv/equiv_mark.cc | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/passes/equiv/equiv_mark.cc b/passes/equiv/equiv_mark.cc index da61678df..3e9819d1a 100644 --- a/passes/equiv/equiv_mark.cc +++ b/passes/equiv/equiv_mark.cc @@ -42,31 +42,7 @@ struct EquivMarkWorker int next_region; // merge-find - dict<int, int> region_mf; - - int region_find(int r) - { - vector<int> backlog; - - while (region_mf.count(r)) { - backlog.push_back(r); - r = region_mf.at(r); - } - - for (int q : backlog) - region_mf[q] = r; - - return r; - } - - void region_merge(int r, int q) - { - r = region_find(r); - q = region_find(q); - - if (r != q) - region_mf[r] = q; - } + mfp<int> region_mf; EquivMarkWorker(Module *module) : module(module), sigmap(module) { @@ -116,7 +92,7 @@ struct EquivMarkWorker if (cell_regions.count(cell)) { if (cell_regions.at(cell) != 0) - region_merge(cell_regions.at(cell), next_region); + region_mf.merge(cell_regions.at(cell), next_region); continue; } @@ -190,7 +166,7 @@ struct EquivMarkWorker dict<int, int> region_wire_count; for (int i = 0; i < next_region; i++) { - int r = region_find(i); + int r = region_mf.find(i); if (final_region_map.count(r) == 0) final_region_map[r] = next_final_region++; final_region_map[i] = final_region_map[r]; @@ -211,7 +187,7 @@ struct EquivMarkWorker pool<int> regions; for (auto bit : sigmap(wire)) if (bit_regions.count(bit)) - regions.insert(region_find(bit_regions.at(bit))); + regions.insert(region_mf.find(bit_regions.at(bit))); if (GetSize(regions) == 1) { int r = final_region_map.at(*regions.begin()); |