231 log(
"Finding identical cells in module `%s'.\n", module->
name.
c_str());
235 for (
auto &it : module->
wires_)
236 if (it.second->attributes.count(
"\\init") != 0)
240 while (did_something)
242 #ifdef USE_CELL_HASH_CACHE
245 std::vector<RTLIL::Cell*> cells;
246 cells.reserve(module->
cells_.size());
247 for (
auto &it : module->
cells_) {
249 cells.push_back(it.second);
252 did_something =
false;
253 std::map<RTLIL::Cell*, RTLIL::Cell*, CompareCells> sharemap(CompareCells(
this));
254 for (
auto cell : cells)
256 if (sharemap.count(cell) > 0) {
257 did_something =
true;
258 log(
" Cell `%s' is identical to cell `%s'.\n", cell->name.c_str(), sharemap[cell]->name.c_str());
259 for (
auto &it : cell->connections()) {
262 log(
" Redirecting output %s: %s = %s\n", it.first.c_str(),
268 log(
" Removing %s cell `%s' from module `%s'.\n", cell->type.c_str(), cell->name.c_str(), module->
name.
c_str());
272 sharemap[cell] = cell;
const char * c_str() const
bool selected(T1 *module) const
void setup_internals_mem()
std::map< RTLIL::IdString, RTLIL::Wire * > wires_
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool did_something
std::map< RTLIL::IdString, CellType > cell_types
void set(RTLIL::Module *module)
bool cell_known(RTLIL::IdString type)
void connect(const RTLIL::SigSig &conn)
bool cell_output(RTLIL::IdString type, RTLIL::IdString port)
std::map< RTLIL::IdString, RTLIL::Cell * > cells_
void remove(const std::set< RTLIL::Wire * > &wires)
void log(const char *format,...)
void setup_stdcells_mem()
void add(RTLIL::SigSpec from, RTLIL::SigSpec to)
std::map< const RTLIL::Cell *, std::string > cell_hash_cache
std::pair< SigSpec, SigSpec > SigSig