diff options
-rw-r--r-- | kernel/rtlil.cc | 7 | ||||
-rw-r--r-- | kernel/rtlil.h | 1 | ||||
-rw-r--r-- | passes/cmds/rename.cc | 4 | ||||
-rw-r--r-- | passes/cmds/setattr.cc | 11 |
4 files changed, 14 insertions, 9 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 7cd2dd4bb..cc7b1a7b8 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -444,6 +444,13 @@ void RTLIL::Design::remove(RTLIL::Module *module) delete module; } +void RTLIL::Design::rename(RTLIL::Module *module, RTLIL::IdString new_name) +{ + modules_.erase(module->name); + module->name = new_name; + add(module); +} + void RTLIL::Design::sort() { scratchpad.sort(); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index b6248c4c0..854ec1303 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -809,6 +809,7 @@ struct RTLIL::Design void add(RTLIL::Module *module); RTLIL::Module *addModule(RTLIL::IdString name); void remove(RTLIL::Module *module); + void rename(RTLIL::Module *module, RTLIL::IdString new_name); void scratchpad_unset(std::string varname); diff --git a/passes/cmds/rename.cc b/passes/cmds/rename.cc index d16713175..81e532590 100644 --- a/passes/cmds/rename.cc +++ b/passes/cmds/rename.cc @@ -193,9 +193,7 @@ struct RenamePass : public Pass { log_cmd_error("No top module found!\n"); log("Renaming module %s to %s.\n", log_id(module), log_id(new_name)); - design->modules_.erase(module->name); - module->name = new_name; - design->modules_[module->name] = module; + design->rename(module, new_name); } else { diff --git a/passes/cmds/setattr.cc b/passes/cmds/setattr.cc index a82625696..58fcf028f 100644 --- a/passes/cmds/setattr.cc +++ b/passes/cmds/setattr.cc @@ -45,7 +45,7 @@ struct setunset_t } }; -static void do_setunset(dict<RTLIL::IdString, RTLIL::Const> &attrs, std::vector<setunset_t> &list) +static void do_setunset(dict<RTLIL::IdString, RTLIL::Const> &attrs, const std::vector<setunset_t> &list) { for (auto &item : list) if (item.unset) @@ -217,6 +217,8 @@ struct ChparamPass : public Pass { } extra_args(args, argidx, design); + do_setunset(new_parameters, setunset_list); + if (list_mode) { if (!new_parameters.empty()) log_cmd_error("The options -set and -list cannot be used together.\n"); @@ -229,11 +231,8 @@ struct ChparamPass : public Pass { } pool<IdString> modnames, old_modnames; - for (auto module : design->selected_modules()) { - if (design->selected_whole_module(module)) - modnames.insert(module->name); - else - log_warning("Ignoring partially selected module %s.\n", log_id(module)); + for (auto module : design->selected_whole_modules_warn()) { + modnames.insert(module->name); old_modnames.insert(module->name); } modnames.sort(); |