mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
opt_lut: use a worklist, and revisit cells affected by elimination.
This commit is contained in:
parent
f7363ac508
commit
06143ab33f
|
@ -189,7 +189,8 @@ struct OptLutWorker
|
||||||
|
|
||||||
log("\n");
|
log("\n");
|
||||||
log("Eliminating LUTs.\n");
|
log("Eliminating LUTs.\n");
|
||||||
for (auto lut : luts)
|
pool<RTLIL::Cell*> worklist = luts;
|
||||||
|
while (worklist.size())
|
||||||
{
|
{
|
||||||
if (limit == 0)
|
if (limit == 0)
|
||||||
{
|
{
|
||||||
|
@ -197,6 +198,7 @@ struct OptLutWorker
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto lut = worklist.pop();
|
||||||
SigSpec lut_input = sigmap(lut->getPort("\\A"));
|
SigSpec lut_input = sigmap(lut->getPort("\\A"));
|
||||||
pool<int> &lut_dlogic_inputs = luts_dlogic_inputs[lut];
|
pool<int> &lut_dlogic_inputs = luts_dlogic_inputs[lut];
|
||||||
|
|
||||||
|
@ -262,8 +264,13 @@ struct OptLutWorker
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SigSpec lut_output = lut->getPort("\\Y");
|
SigSpec lut_output = lut->getPort("\\Y");
|
||||||
module->connect(lut_output, value);
|
for (auto &port : index.query_ports(lut_output))
|
||||||
|
{
|
||||||
|
if (port.cell != lut && luts.count(port.cell))
|
||||||
|
worklist.insert(port.cell);
|
||||||
|
}
|
||||||
|
|
||||||
|
module->connect(lut_output, value);
|
||||||
module->remove(lut);
|
module->remove(lut);
|
||||||
luts.erase(lut);
|
luts.erase(lut);
|
||||||
luts_arity.erase(lut);
|
luts_arity.erase(lut);
|
||||||
|
@ -280,7 +287,7 @@ struct OptLutWorker
|
||||||
|
|
||||||
log("\n");
|
log("\n");
|
||||||
log("Combining LUTs.\n");
|
log("Combining LUTs.\n");
|
||||||
pool<RTLIL::Cell*> worklist = luts;
|
worklist = luts;
|
||||||
while (worklist.size())
|
while (worklist.size())
|
||||||
{
|
{
|
||||||
if (limit == 0)
|
if (limit == 0)
|
||||||
|
|
Loading…
Reference in a new issue