template<typename T1, typename T2> bool selected(T1 *module, T2 *member) {
return selected_member(module->name, member->name);
}
+ template<typename T1, typename T2> void select(T1 *module, T2 *member) {
+ if (selection_stack.size() > 0) {
+ RTLIL::Selection &sel = selection_stack.back();
+ if (!sel.full_selection && sel.selected_modules.count(module->name) == 0)
+ sel.selected_members[module->name].insert(member->name);
+ }
+ }
};
struct RTLIL::Module {
return true;
}
- void replace(RTLIL::Module *needle, RTLIL::Module *haystack, SubCircuit::Solver::Result &match)
+ RTLIL::Cell *replace(RTLIL::Module *needle, RTLIL::Module *haystack, SubCircuit::Solver::Result &match)
{
SigMap sigmap(needle);
SigSet<std::pair<std::string, int>> sig2port;
haystack->cells.erase(haystack_cell->name);
delete haystack_cell;
}
+
+ return cell;
}
}
log(" %s:%s", it2.first.c_str(), it2.second.c_str());
log("\n");
}
- replace(needle_map.at(result.needleGraphId), haystack_map.at(result.haystackGraphId), result);
+ RTLIL::Cell *new_cell = replace(needle_map.at(result.needleGraphId), haystack_map.at(result.haystackGraphId), result);
+ design->select(haystack_map.at(result.haystackGraphId), new_cell);
+ log(" new cell: %s\n", id2cstr(new_cell->name));
}
}
}