Merge branch 'koriakin/xc7nocarrymux' into xaig
[yosys.git] / kernel / rtlil.cc
index 95a24c93f90b4ffd46addbe4e4511ffdeefca1b8..502b45cfdb691dc88a887ecf39a53d15613c23bc 100644 (file)
@@ -1592,13 +1592,21 @@ 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);
 
-       log_assert(cells_.count(cell->name) != 0);
        log_assert(refcount_cells_ == 0);
-       cells_.erase(cell->name);
+       it = cells_.erase(it);
        delete cell;
+       return it;
 }
 
 void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
@@ -3437,7 +3445,7 @@ void RTLIL::SigSpec::extend_u0(int width, bool is_signed)
 
        if (width_ < width) {
                RTLIL::SigBit padding = width_ > 0 ? (*this)[width_ - 1] : RTLIL::State::Sx;
-               if (padding != RTLIL::State::Sx && !is_signed)
+               if (!is_signed)
                        padding = RTLIL::State::S0;
                while (width_ < width)
                        append(padding);