aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs
diff options
context:
space:
mode:
authorRobert Ou <rqou@robertou.com>2017-08-29 14:55:45 -0700
committerAndrew Zonenberg <azonenberg@drawersteak.com>2017-09-01 07:21:31 -0700
commitac84f4782964e36d064e0a517ed041cdaf8cd1a4 (patch)
tree3b3c9660b961a61921e113181df476ede0f6db91 /techlibs
parent18609f3df82a3403c41d552908183f7e49ff5678 (diff)
downloadyosys-ac84f4782964e36d064e0a517ed041cdaf8cd1a4.tar.gz
yosys-ac84f4782964e36d064e0a517ed041cdaf8cd1a4.tar.bz2
yosys-ac84f4782964e36d064e0a517ed041cdaf8cd1a4.zip
coolrunner2: Combine some for loops together
Diffstat (limited to 'techlibs')
-rw-r--r--techlibs/coolrunner2/coolrunner2_sop.cc30
1 files changed, 14 insertions, 16 deletions
diff --git a/techlibs/coolrunner2/coolrunner2_sop.cc b/techlibs/coolrunner2/coolrunner2_sop.cc
index eb8754de7..2d3961ee5 100644
--- a/techlibs/coolrunner2/coolrunner2_sop.cc
+++ b/techlibs/coolrunner2/coolrunner2_sop.cc
@@ -38,26 +38,24 @@ struct Coolrunner2SopPass : public Pass {
log_header(design, "Executing COOLRUNNER2_SOP pass (break $sop cells into ANDTERM/ORTERM cells).\n");
extra_args(args, 1, design);
- // Find all the $_NOT_ cells
- dict<SigBit, tuple<SigBit, Cell*>> not_cells;
for (auto module : design->selected_modules())
{
+ pool<Cell*> cells_to_remove;
SigMap sigmap(module);
+
+ // Find all the $_NOT_ cells
+ dict<SigBit, tuple<SigBit, Cell*>> not_cells;
for (auto cell : module->selected_cells())
{
if (cell->type == "$_NOT_")
{
- auto not_input = cell->getPort("\\A")[0];
- auto not_output = cell->getPort("\\Y")[0];
+ auto not_input = sigmap(cell->getPort("\\A")[0]);
+ auto not_output = sigmap(cell->getPort("\\Y")[0]);
not_cells[not_input] = tuple<SigBit, Cell*>(not_output, cell);
}
}
- }
- pool<tuple<Module*, Cell*>> cells_to_remove;
- for (auto module : design->selected_modules())
- {
- SigMap sigmap(module);
+ // Process $sop cells
for (auto cell : module->selected_cells())
{
if (cell->type == "$sop")
@@ -79,7 +77,7 @@ struct Coolrunner2SopPass : public Pass {
sop_output = std::get<0>(not_cell);
// remove the $_NOT_ cell because it gets folded into the xor
- cells_to_remove.insert(tuple<Module*, Cell*>(module, std::get<1>(not_cell)));
+ cells_to_remove.insert(std::get<1>(not_cell));
}
// Construct AND cells
@@ -140,15 +138,15 @@ struct Coolrunner2SopPass : public Pass {
}
// Finally, remove the $sop cell
- cells_to_remove.insert(tuple<Module*, Cell*>(module, cell));
+ cells_to_remove.insert(cell);
}
}
- }
- // Actually do the removal now that we aren't iterating
- for (auto mod_and_cell : cells_to_remove)
- {
- std::get<0>(mod_and_cell)->remove(std::get<1>(mod_and_cell));
+ // Actually do the removal now that we aren't iterating
+ for (auto cell : cells_to_remove)
+ {
+ module->remove(cell);
+ }
}
}
} Coolrunner2SopPass;