diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index d27eabc25..baf938660 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1346,8 +1346,10 @@ void RTLIL::Design::add(RTLIL::Binding *binding) RTLIL::Module *RTLIL::Design::addModule(RTLIL::IdString name) { - if (modules_.count(name) != 0) - log_error("Attempted to add new module named '%s', but a module by that name already exists\n", name); + if (modules_.count(name) != 0) { + log_warning("Attempted to add new module named '%s', but a module by that name already exists\n", name); + return modules_.at(name); + } log_assert(refcount_modules_ == 0); RTLIL::Module *module = new RTLIL::Module;