mirror of
https://github.com/YosysHQ/yosys
synced 2025-05-06 15:25:47 +00:00
Remove iterator based Module::remove as per @cliffordwolf
This commit is contained in:
parent
6a4025b5ee
commit
7324a4c2cd
3 changed files with 9 additions and 18 deletions
|
@ -1565,21 +1565,14 @@ void RTLIL::Module::remove(const pool<RTLIL::Wire*> &wires)
|
|||
|
||||
void RTLIL::Module::remove(RTLIL::Cell *cell)
|
||||
{
|
||||
auto it = cells_.find(cell->name);
|
||||
log_assert(it != cells_.end());
|
||||
remove(it);
|
||||
}
|
||||
|
||||
dict<RTLIL::IdString, RTLIL::Cell*>::iterator RTLIL::Module::remove(dict<RTLIL::IdString, RTLIL::Cell*>::iterator it)
|
||||
{
|
||||
RTLIL::Cell *cell = it->second;
|
||||
while (!cell->connections_.empty())
|
||||
cell->unsetPort(cell->connections_.begin()->first);
|
||||
|
||||
auto it = cells_.find(cell->name);
|
||||
log_assert(it != cells_.end());
|
||||
log_assert(refcount_cells_ == 0);
|
||||
it = cells_.erase(it);
|
||||
cells_.erase(it);
|
||||
delete cell;
|
||||
return it;
|
||||
}
|
||||
|
||||
void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue