From caa274ada6f2f35119cff943d0e9ed05dfaaeec7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 30 Jun 2015 01:37:59 +0200 Subject: Added design->rename(module, new_name) --- kernel/rtlil.cc | 7 +++++++ kernel/rtlil.h | 1 + 2 files changed, 8 insertions(+) (limited to 'kernel') diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 7cd2dd4b..cc7b1a7b 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 b6248c4c..854ec130 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); -- cgit v1.2.3