mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
flatten: Keep sigmap around between flatten_cell invocations.
Fixes #3064.
This commit is contained in:
parent
9cb5092ad1
commit
f346868ccc
|
@ -77,7 +77,7 @@ struct FlattenWorker
|
||||||
{
|
{
|
||||||
bool ignore_wb = false;
|
bool ignore_wb = false;
|
||||||
|
|
||||||
void flatten_cell(RTLIL::Design *design, RTLIL::Module *module, RTLIL::Cell *cell, RTLIL::Module *tpl, std::vector<RTLIL::Cell*> &new_cells)
|
void flatten_cell(RTLIL::Design *design, RTLIL::Module *module, RTLIL::Cell *cell, RTLIL::Module *tpl, SigMap &sigmap, std::vector<RTLIL::Cell*> &new_cells)
|
||||||
{
|
{
|
||||||
// Copy the contents of the flattened cell
|
// Copy the contents of the flattened cell
|
||||||
|
|
||||||
|
@ -165,7 +165,6 @@ struct FlattenWorker
|
||||||
for (auto bit : tpl_conn.first)
|
for (auto bit : tpl_conn.first)
|
||||||
tpl_driven.insert(bit);
|
tpl_driven.insert(bit);
|
||||||
|
|
||||||
SigMap sigmap(module);
|
|
||||||
for (auto &port_it : cell->connections())
|
for (auto &port_it : cell->connections())
|
||||||
{
|
{
|
||||||
IdString port_name = port_it.first;
|
IdString port_name = port_it.first;
|
||||||
|
@ -218,6 +217,7 @@ struct FlattenWorker
|
||||||
log_id(module), log_id(cell), log_id(port_it.first), log_signal(new_conn.first), log_signal(new_conn.second));
|
log_id(module), log_id(cell), log_id(port_it.first), log_signal(new_conn.first), log_signal(new_conn.second));
|
||||||
|
|
||||||
module->connect(new_conn);
|
module->connect(new_conn);
|
||||||
|
sigmap.add(new_conn.first, new_conn.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
module->remove(cell);
|
module->remove(cell);
|
||||||
|
@ -228,6 +228,7 @@ struct FlattenWorker
|
||||||
if (!design->selected(module) || module->get_blackbox_attribute(ignore_wb))
|
if (!design->selected(module) || module->get_blackbox_attribute(ignore_wb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SigMap sigmap(module);
|
||||||
std::vector<RTLIL::Cell*> worklist = module->selected_cells();
|
std::vector<RTLIL::Cell*> worklist = module->selected_cells();
|
||||||
while (!worklist.empty())
|
while (!worklist.empty())
|
||||||
{
|
{
|
||||||
|
@ -251,7 +252,7 @@ struct FlattenWorker
|
||||||
// If a design is fully selected and has a top module defined, topological sorting ensures that all cells
|
// If a design is fully selected and has a top module defined, topological sorting ensures that all cells
|
||||||
// added during flattening are black boxes, and flattening is finished in one pass. However, when flattening
|
// added during flattening are black boxes, and flattening is finished in one pass. However, when flattening
|
||||||
// individual modules, this isn't the case, and the newly added cells might have to be flattened further.
|
// individual modules, this isn't the case, and the newly added cells might have to be flattened further.
|
||||||
flatten_cell(design, module, cell, tpl, worklist);
|
flatten_cell(design, module, cell, tpl, sigmap, worklist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue