mirror of https://github.com/YosysHQ/yosys.git
Added design->rename(module, new_name)
This commit is contained in:
parent
df0163cd2b
commit
caa274ada6
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue