diff options
author | Clifford Wolf <clifford@clifford.at> | 2016-01-08 09:39:27 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2016-01-08 09:57:28 +0100 |
commit | f5008f4f8a3338b56ba5952b050ca4d00ad18b59 (patch) | |
tree | ea0bd4a76b69a163353ee06873a0a517a06d076b | |
parent | d00c63c927c6b64f426640b0fb87c7bf9288ee51 (diff) | |
download | yosys-f5008f4f8a3338b56ba5952b050ca4d00ad18b59.tar.gz yosys-f5008f4f8a3338b56ba5952b050ca4d00ad18b59.tar.bz2 yosys-f5008f4f8a3338b56ba5952b050ca4d00ad18b59.zip |
Bugfixes in equiv_struct
-rw-r--r-- | passes/equiv/equiv_struct.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/passes/equiv/equiv_struct.cc b/passes/equiv/equiv_struct.cc index 283ccb094..714470ee5 100644 --- a/passes/equiv/equiv_struct.cc +++ b/passes/equiv/equiv_struct.cc @@ -143,6 +143,7 @@ struct EquivStructWorker SigBit sig_y = sigmap(cell->getPort("\\Y").as_bit()); if (sig_a == sig_b && equiv_inputs.count(sig_y)) { log(" Purging redundant $equiv cell %s.\n", log_id(cell)); + module->connect(sig_y, sig_a); module->remove(cell); merge_count++; } @@ -205,11 +206,13 @@ struct EquivStructWorker const char *strategy = nullptr; vector<Cell*> gold_cells, gate_cells, other_cells; vector<pair<Cell*, Cell*>> cell_pairs; + IdString cells_type; for (auto cell_name : merge_cache[key]) { Cell *c = module->cell(cell_name); if (c != nullptr) { string n = cell_name.str(); + cells_type = c->type; if (GetSize(n) > 5 && n.substr(GetSize(n)-5) == "_gold") gold_cells.push_back(c); else if (GetSize(n) > 5 && n.substr(GetSize(n)-5) == "_gate") @@ -219,6 +222,9 @@ struct EquivStructWorker } } + if (phase && cells_type == "$equiv") + continue; + if (GetSize(gold_cells) > 1 || GetSize(gate_cells) > 1 || GetSize(other_cells) > 1) { strategy = "deduplicate"; @@ -256,8 +262,9 @@ struct EquivStructWorker continue; run_strategy: - log(" %s merging %d cells (from group of %d) using strategy %s:\n", phase ? "Bwd" : "Fwd", - 2*GetSize(cell_pairs), GetSize(gold_cells) + GetSize(gate_cells) + GetSize(other_cells), strategy); + int total_group_size = GetSize(gold_cells) + GetSize(gate_cells) + GetSize(other_cells); + log(" %s merging %d %s cells (from group of %d) using strategy %s:\n", phase ? "Bwd" : "Fwd", + 2*GetSize(cell_pairs), log_id(cells_type), total_group_size, strategy); for (auto it : cell_pairs) { log(" Merging cells %s and %s.\n", log_id(it.first), log_id(it.second)); merge_cell_pair(it.first, it.second); |